diff --git a/packages/temp-trustvc-website/src/pages/ErrorPage.tsx b/packages/temp-trustvc-website/src/pages/ErrorPage.tsx
new file mode 100644
index 0000000..0e7a3c7
--- /dev/null
+++ b/packages/temp-trustvc-website/src/pages/ErrorPage.tsx
@@ -0,0 +1,39 @@
+import { Button } from "@/components/ui/button"
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
+import { useNavigate } from "react-router-dom"
+
+export default function ErrorPage() {
+ const navigate = useNavigate()
+
+ return (
+
+
+
+
+ Submission Failed
+
+
+ There was an error submitting your support request. Please try again.
+
+
+
+
+
+ Error
+
+ Something went wrong. Please try submitting your request again.
+
+
+
+ navigate("/support")}
+ className="w-full max-w-xs bg-gradient-trust hover:opacity-90"
+ >
+ Try Again
+
+
+
+
+
+ )
+}
diff --git a/packages/temp-trustvc-website/src/pages/SuccessPage.tsx b/packages/temp-trustvc-website/src/pages/SuccessPage.tsx
new file mode 100644
index 0000000..f4124ac
--- /dev/null
+++ b/packages/temp-trustvc-website/src/pages/SuccessPage.tsx
@@ -0,0 +1,52 @@
+import { Button } from "@/components/ui/button"
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
+import { useNavigate, useLocation } from "react-router-dom"
+
+export default function SuccessPage() {
+ const navigate = useNavigate()
+ const location = useLocation()
+ const { ticketId } = location.state || {}
+
+ return (
+
+
+
+
+ Thank You!
+
+
+ {ticketId
+ ? `Your support ticket ${ticketId} has been created successfully. We'll get back to you soon.`
+ : "Your support request has been submitted successfully. We'll get back to you soon."
+ }
+
+
+
+
+
+ Submission Successful
+
+ Thank you for reaching out to us.
+
+
+
+ {ticketId && (
+
+ Ticket ID: {ticketId}
+
+ )}
+
+ You will receive an email confirmation shortly.
+
+ navigate("/")}
+ className="w-full max-w-xs bg-gradient-trust hover:opacity-90"
+ >
+ Back to Home
+
+
+
+
+
+ )
+}
diff --git a/packages/temp-trustvc-website/src/pages/Support.tsx b/packages/temp-trustvc-website/src/pages/Support.tsx
index b698b47..57f72ad 100644
--- a/packages/temp-trustvc-website/src/pages/Support.tsx
+++ b/packages/temp-trustvc-website/src/pages/Support.tsx
@@ -1,183 +1,367 @@
-import { Book, Code, MessageCircle, FileText, ExternalLink, ChevronRight } from "lucide-react";
-import { Button } from "@/components/ui/button";
-import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { Checkbox } from "@/components/ui/checkbox"
+import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, } from "@/components/ui/form"
+import { Input } from "@/components/ui/input"
+import { Textarea } from "@/components/ui/textarea"
+import { Button } from "@/components/ui/button"
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
+import { useForm } from "react-hook-form"
+import { zodResolver } from "@hookform/resolvers/zod"
+import * as z from "zod"
+import { toast } from "@/components/ui/sonner"
+import { useRef } from "react"
+import { useNavigate } from "react-router-dom"
+import { useState } from "react"
+import { Trash2 } from "lucide-react"
-const documentationSections = [
- {
- title: "Getting Started",
- description: "Quick start guides and basic concepts",
- icon: Book,
- items: [
- "Installation & Setup",
- "Your First Document",
- "Basic Verification",
- "Configuration Guide"
- ]
- },
- {
- title: "API Reference",
- description: "Complete API documentation",
- icon: Code,
- items: [
- "Authentication",
- "Document Creation",
- "Verification Methods",
- "Webhook Events"
- ]
- },
- {
- title: "SDKs & Libraries",
- description: "Language-specific implementations",
- icon: FileText,
- items: [
- "JavaScript/TypeScript",
- "Python SDK",
- "Java Library",
- "REST API"
- ]
+const formSchema = z.object({
+ email: z.string().email({ message: "Please enter a valid email address." }).min(1, { message: "Email is required." }),
+ summary: z.string().min(1, { message: "Summary is required." }),
+ description: z.string().optional(),
+ whereEncountered: z.array(z.string()).optional(),
+})
+
+const whereOptions = [
+ "TradeTrust Reference Website",
+ "TradeTrust Documentation Website",
+ "TradeTrust Gallery",
+ "TradeTrust Library",
+ "TrustVC Website",
+ "OpenCerts Website",
+ "TrustVC SDK",
+ "Other"
+]
+
+export default function Support() {
+ const form = useForm
>({
+ resolver: zodResolver(formSchema),
+ defaultValues: {
+ email: "",
+ summary: "",
+ description: "",
+ whereEncountered: [],
+ },
+ })
+
+ const fileRef = useRef(null)
+ const navigate = useNavigate()
+ const [selectedFiles, setSelectedFiles] = useState([])
+
+ const handleFileChange = (event: React.ChangeEvent) => {
+ const files = event.target.files
+ if (files) {
+ const newFiles = Array.from(files)
+ // Append new files to existing ones instead of replacing
+ setSelectedFiles(prevFiles => [...prevFiles, ...newFiles])
+
+ // Clear the input so the same file can be selected again if needed
+ if (fileRef.current) {
+ fileRef.current.value = ''
+ }
+ }
}
-];
-const communityResources = [
- {
- title: "GitHub Repository",
- description: "Source code, issues, and contributions",
- icon: Code,
- link: "https://github.com/trustvc"
- },
- {
- title: "Community Forum",
- description: "Ask questions and get help from the community",
- icon: MessageCircle,
- link: "#"
- },
- {
- title: "Developer Blog",
- description: "Latest updates, tutorials, and best practices",
- icon: FileText,
- link: "#"
+ const removeFile = (index: number) => {
+ const newFiles = selectedFiles.filter((_, i) => i !== index)
+ setSelectedFiles(newFiles)
+
+ // Update the file input
+ if (fileRef.current) {
+ const dt = new DataTransfer()
+ newFiles.forEach(file => dt.items.add(file))
+ fileRef.current.files = dt.files
+ }
+ }
+
+ const onSubmit = async (values: z.infer) => {
+ const { email, summary, description, whereEncountered } = values;
+
+ // Use description as is
+ const fullDescription = description || '';
+
+ try {
+ // Create FormData for multipart/form-data request
+ const formData = new FormData();
+ formData.append('email', email);
+ formData.append('summary', summary);
+ formData.append('description', fullDescription);
+
+ // Convert whereEncountered to array of objects with value property
+ const platformData = (whereEncountered || []).map(item => ({ value: item }));
+ formData.append('platform', JSON.stringify(platformData));
+
+ // Add file attachments
+ if (selectedFiles && selectedFiles.length > 0) {
+ selectedFiles.forEach(file => {
+ formData.append('attachments', file);
+ });
+ }
+
+ // Show loading state
+ toast.success('Submitting your request...');
+
+ // Submit to AWS API endpoint
+ const response = await fetch('https://nrw2toa8ed.execute-api.ap-southeast-1.amazonaws.com/dev/service-request', {
+ method: 'POST',
+ body: formData,
+ });
+
+ const data = await response.json();
+
+ if (response.ok && data.success) {
+ const ticketId = data.data?.serviceRequest?.issueKey || 'Unknown';
+ const message = data.data?.message || 'Ticket created successfully!';
+ const attachmentCount = data.data?.attachmentsUploaded || 0;
+
+ toast.success(`${message}${attachmentCount > 0 ? ` (${attachmentCount} attachments uploaded)` : ''}`);
+ navigate("/support/success", { state: { ticketId, webUrl: data.data?.serviceRequest?.webUrl } });
+ } else {
+ // Handle the actual error response format
+ const errorMessage = data.error?.message || data.message || data.error || 'Failed to create ticket';
+ console.error('API Error:', data);
+ toast.error(errorMessage);
+ navigate("/support/error", { state: { error: data.error || data } });
+ }
+ } catch (error) {
+ console.error('Submission error:', error);
+ toast.error('Network error. Please try again.');
+ navigate("/support/error");
+ }
}
-];
-const Support = () => {
return (
- {/* Header */}
- TrustVC{" "}
+ Support{" "}
- Documentation
+ Request
- Everything you need to integrate TrustVC into your applications.
- Comprehensive guides, API references, and community resources.
+ Get help with TrustVC products and services.
+ We'll get back to you as soon.
-
-
- Documentation
- Tutorials
- Community
-
+
+