@fileflow/sdk 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -280,6 +280,11 @@ declare interface ImportWizardProps {
280
280
 
281
281
  export declare function initializeClient(config: FileFlowClientConfig): FileFlowClient;
282
282
 
283
+ /**
284
+ * Injects the SDK styles into the document head if not already present
285
+ */
286
+ export declare function injectStyles(): void;
287
+
283
288
  declare interface KYCActions {
284
289
  setSessionId: (sessionId: string) => void;
285
290
  setRequiredDocuments: (documents: DocumentType_2[]) => void;
@@ -337,10 +342,38 @@ export { ProofOfAddressData }
337
342
 
338
343
  export { SchemaColumn }
339
344
 
345
+ /**
346
+ * StyleProvider component that:
347
+ * 1. Auto-injects SDK styles into the document
348
+ * 2. Provides style isolation from the host application
349
+ *
350
+ * This component wraps SDK components to ensure they are styled correctly
351
+ * regardless of the host application's styles.
352
+ */
353
+ export declare const StyleProvider: default_2.FC<StyleProviderProps>;
354
+
355
+ declare interface StyleProviderProps {
356
+ children: default_2.ReactNode;
357
+ /**
358
+ * Additional class names to apply to the container
359
+ */
360
+ className?: string;
361
+ /**
362
+ * Whether to apply style isolation (default: true)
363
+ */
364
+ isolate?: boolean;
365
+ }
366
+
340
367
  export { templateExists }
341
368
 
342
369
  export { TemplateId }
343
370
 
371
+ /**
372
+ * Hook to ensure styles are injected
373
+ * Can be used in components that don't use StyleProvider
374
+ */
375
+ export declare function useFileFlowStyles(): void;
376
+
344
377
  export declare const useImportStore: UseBoundStore<StoreApi<ImportState & ImportActions>>;
345
378
 
346
379
  export declare const useKYCStore: UseBoundStore<StoreApi<KYCState & KYCActions>>;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-VbMSbLb2.js"),t=require("./ImportWizard-CptGek_O.js"),a=require("./KYCWizard-B73SHhAI.js");exports.CANADIAN_PROVINCES=e.CANADIAN_PROVINCES;exports.DOCUMENT_TYPES=e.DOCUMENT_TYPES;exports.FileFlowClient=e.FileFlowClient;exports.FileFlowError=e.FileFlowError;exports.IMPORT_TEMPLATES=e.IMPORT_TEMPLATES;exports.VALID_TEMPLATE_IDS=e.VALID_TEMPLATE_IDS;exports.getAvailableTemplates=e.getAvailableTemplates;exports.getClient=e.getClient;exports.getTemplate=e.getTemplate;exports.getTemplateSchema=e.getTemplateSchema;exports.getTemplatesByCategory=e.getTemplatesByCategory;exports.initializeClient=e.initializeClient;exports.listTemplates=e.listTemplates;exports.templateExists=e.templateExists;exports.ColumnMapper=t.ColumnMapper;exports.DataTable=t.DataTable;exports.FileUploader=t.FileUploader;exports.ImportWizard=t.ImportWizard;exports.ValidationSummary=t.ValidationSummary;exports.useImportStore=t.useImportStore;exports.DocumentStatus=a.DocumentStatus;exports.DocumentUploader=a.DocumentUploader;exports.KYCWizard=a.KYCWizard;exports.useKYCStore=a.useKYCStore;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-A7EopL2N.js"),t=require("./ImportWizard-D5B5j2TQ.js"),l=require("./KYCWizard-C1PumBBm.js");exports.CANADIAN_PROVINCES=e.CANADIAN_PROVINCES;exports.DOCUMENT_TYPES=e.DOCUMENT_TYPES;exports.FileFlowClient=e.FileFlowClient;exports.FileFlowError=e.FileFlowError;exports.IMPORT_TEMPLATES=e.IMPORT_TEMPLATES;exports.StyleProvider=e.StyleProvider;exports.VALID_TEMPLATE_IDS=e.VALID_TEMPLATE_IDS;exports.getAvailableTemplates=e.getAvailableTemplates;exports.getClient=e.getClient;exports.getTemplate=e.getTemplate;exports.getTemplateSchema=e.getTemplateSchema;exports.getTemplatesByCategory=e.getTemplatesByCategory;exports.initializeClient=e.initializeClient;exports.injectStyles=e.injectStyles;exports.listTemplates=e.listTemplates;exports.templateExists=e.templateExists;exports.useFileFlowStyles=e.useFileFlowStyles;exports.ColumnMapper=t.ColumnMapper;exports.DataTable=t.DataTable;exports.FileUploader=t.FileUploader;exports.ImportWizard=t.ImportWizard;exports.ValidationSummary=t.ValidationSummary;exports.useImportStore=t.useImportStore;exports.DocumentStatus=l.DocumentStatus;exports.DocumentUploader=l.DocumentUploader;exports.KYCWizard=l.KYCWizard;exports.useKYCStore=l.useKYCStore;
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1,30 +1,33 @@
1
- import { C as s, D as t, F as l, a as o, I as r, V as i, d as m, g as p, b as T, c as C, e as D, i as u, l as E, t as I } from "./index-CEvc89fO.mjs";
2
- import { C as n, D as g, F as A, I as F, V as d, u as M } from "./ImportWizard-Bl9foTic.mjs";
3
- import { a as V, D as _, K as c, u as x } from "./KYCWizard-D4RKtikr.mjs";
1
+ import { C as s, D as t, F as l, b as o, I as r, S as i, V as m, e as p, g as S, c as T, d as C, f as u, a as D, i as n, l as E, t as F, u as I } from "./index-BIGw5rPX.mjs";
2
+ import { C as g, D as A, F as y, I as P, V as c, u as M } from "./ImportWizard-DrDHQwnE.mjs";
3
+ import { a as _, D as f, K as x, u as N } from "./KYCWizard-W1poXII_.mjs";
4
4
  export {
5
5
  s as CANADIAN_PROVINCES,
6
- n as ColumnMapper,
6
+ g as ColumnMapper,
7
7
  t as DOCUMENT_TYPES,
8
- g as DataTable,
9
- V as DocumentStatus,
10
- _ as DocumentUploader,
8
+ A as DataTable,
9
+ _ as DocumentStatus,
10
+ f as DocumentUploader,
11
11
  l as FileFlowClient,
12
12
  o as FileFlowError,
13
- A as FileUploader,
13
+ y as FileUploader,
14
14
  r as IMPORT_TEMPLATES,
15
- F as ImportWizard,
16
- c as KYCWizard,
17
- i as VALID_TEMPLATE_IDS,
18
- d as ValidationSummary,
19
- m as getAvailableTemplates,
20
- p as getClient,
15
+ P as ImportWizard,
16
+ x as KYCWizard,
17
+ i as StyleProvider,
18
+ m as VALID_TEMPLATE_IDS,
19
+ c as ValidationSummary,
20
+ p as getAvailableTemplates,
21
+ S as getClient,
21
22
  T as getTemplate,
22
23
  C as getTemplateSchema,
23
- D as getTemplatesByCategory,
24
- u as initializeClient,
24
+ u as getTemplatesByCategory,
25
+ D as initializeClient,
26
+ n as injectStyles,
25
27
  E as listTemplates,
26
- I as templateExists,
28
+ F as templateExists,
29
+ I as useFileFlowStyles,
27
30
  M as useImportStore,
28
- x as useKYCStore
31
+ N as useKYCStore
29
32
  };
30
33
  //# sourceMappingURL=index.mjs.map
package/dist/kyc.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./KYCWizard-B73SHhAI.js");exports.DocumentStatus=e.DocumentStatus;exports.DocumentUploader=e.DocumentUploader;exports.KYCWizard=e.KYCWizard;exports.useKYCStore=e.useKYCStore;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./KYCWizard-C1PumBBm.js");exports.DocumentStatus=e.DocumentStatus;exports.DocumentUploader=e.DocumentUploader;exports.KYCWizard=e.KYCWizard;exports.useKYCStore=e.useKYCStore;
2
2
  //# sourceMappingURL=kyc.js.map
package/dist/kyc.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as o, D as s, K as t, u as r } from "./KYCWizard-D4RKtikr.mjs";
1
+ import { a as o, D as s, K as t, u as r } from "./KYCWizard-W1poXII_.mjs";
2
2
  export {
3
3
  o as DocumentStatus,
4
4
  s as DocumentUploader,
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@fileflow/sdk",
3
- "version": "0.1.8",
4
- "description": "FileFlow SDK - Embeddable data import and KYC verification components",
3
+ "version": "0.1.9",
4
+ "description": "FileFlow SDK - Embeddable data import and KYC verification components with automatic style injection",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
8
+ "sideEffects": false,
8
9
  "exports": {
9
10
  ".": {
10
11
  "import": "./dist/index.mjs",
@@ -20,11 +21,6 @@
20
21
  "import": "./dist/kyc.mjs",
21
22
  "require": "./dist/kyc.js",
22
23
  "types": "./dist/kyc.d.ts"
23
- },
24
- "./style.css": {
25
- "import": "./dist/style.css",
26
- "require": "./dist/style.css",
27
- "default": "./dist/style.css"
28
24
  }
29
25
  },
30
26
  "files": [
@@ -1 +0,0 @@
1
- {"version":3,"file":"KYCWizard-B73SHhAI.js","sources":["../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/car.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/clock.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/file-text.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/home.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/image.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/shield-check.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/shield.js","../src/store/kyc-store.ts","../src/kyc/components/DocumentUploader.tsx","../src/kyc/components/DocumentStatus.tsx","../src/kyc/components/KYCWizard.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Car = createLucideIcon(\"Car\", [\n [\n \"path\",\n {\n d: \"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2\",\n key: \"5owen\"\n }\n ],\n [\"circle\", { cx: \"7\", cy: \"17\", r: \"2\", key: \"u2ysq9\" }],\n [\"path\", { d: \"M9 17h6\", key: \"r8uit2\" }],\n [\"circle\", { cx: \"17\", cy: \"17\", r: \"2\", key: \"axvx0g\" }]\n]);\n\nexport { Car as default };\n//# sourceMappingURL=car.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Clock = createLucideIcon(\"Clock\", [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"polyline\", { points: \"12 6 12 12 16 14\", key: \"68esgv\" }]\n]);\n\nexport { Clock as default };\n//# sourceMappingURL=clock.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst FileText = createLucideIcon(\"FileText\", [\n [\"path\", { d: \"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\", key: \"1rqfz7\" }],\n [\"path\", { d: \"M14 2v4a2 2 0 0 0 2 2h4\", key: \"tnqrlb\" }],\n [\"path\", { d: \"M10 9H8\", key: \"b1mrlr\" }],\n [\"path\", { d: \"M16 13H8\", key: \"t4e002\" }],\n [\"path\", { d: \"M16 17H8\", key: \"z1uh3a\" }]\n]);\n\nexport { FileText as default };\n//# sourceMappingURL=file-text.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Home = createLucideIcon(\"Home\", [\n [\"path\", { d: \"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\", key: \"y5dka4\" }],\n [\"polyline\", { points: \"9 22 9 12 15 12 15 22\", key: \"e2us08\" }]\n]);\n\nexport { Home as default };\n//# sourceMappingURL=home.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Image = createLucideIcon(\"Image\", [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", ry: \"2\", key: \"1m3agn\" }],\n [\"circle\", { cx: \"9\", cy: \"9\", r: \"2\", key: \"af1f0g\" }],\n [\"path\", { d: \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\", key: \"1xmnt7\" }]\n]);\n\nexport { Image as default };\n//# sourceMappingURL=image.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst ShieldCheck = createLucideIcon(\"ShieldCheck\", [\n [\"path\", { d: \"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10\", key: \"1irkt0\" }],\n [\"path\", { d: \"m9 12 2 2 4-4\", key: \"dzmm74\" }]\n]);\n\nexport { ShieldCheck as default };\n//# sourceMappingURL=shield-check.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Shield = createLucideIcon(\"Shield\", [\n [\"path\", { d: \"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10\", key: \"1irkt0\" }]\n]);\n\nexport { Shield as default };\n//# sourceMappingURL=shield.js.map\n","import { create } from 'zustand';\nimport type { \n DocumentType, \n KYCDocument, \n DocumentStatus,\n FraudFlag,\n ExtractedData,\n} from '@fileflow/shared';\n\nexport type KYCStep = 'select' | 'upload' | 'processing' | 'review' | 'complete';\n\nexport interface DocumentState {\n id: string | null;\n type: DocumentType;\n status: DocumentStatus;\n file: File | null;\n previewUrl: string | null;\n extractedData: ExtractedData | null;\n confidence: number;\n fraudFlags: FraudFlag[];\n error: string | null;\n}\n\nexport interface KYCState {\n // Session\n sessionId: string | null;\n status: string;\n step: KYCStep;\n \n // Required documents\n requiredDocuments: DocumentType[];\n currentDocumentType: DocumentType | null;\n \n // Document states\n documents: Map<DocumentType, DocumentState>;\n \n // Verification\n isVerified: boolean;\n verificationStatus: object | null;\n \n // UI state\n isLoading: boolean;\n error: string | null;\n}\n\nexport interface KYCActions {\n // Initialize\n setSessionId: (sessionId: string) => void;\n setRequiredDocuments: (documents: DocumentType[]) => void;\n \n // Document management\n setCurrentDocumentType: (type: DocumentType) => void;\n setDocumentFile: (type: DocumentType, file: File) => void;\n setDocumentStatus: (type: DocumentType, status: DocumentStatus) => void;\n setDocumentData: (type: DocumentType, data: Partial<DocumentState>) => void;\n clearDocumentPreview: (type: DocumentType) => void;\n \n // Navigation\n setStep: (step: KYCStep) => void;\n nextDocument: () => void;\n \n // Verification\n setVerificationStatus: (status: object) => void;\n setVerified: (verified: boolean) => void;\n \n // Status\n setStatus: (status: string) => void;\n setLoading: (loading: boolean) => void;\n setError: (error: string | null) => void;\n \n // Helpers\n getNextRequiredDocument: () => DocumentType | null;\n areAllDocumentsUploaded: () => boolean;\n areAllDocumentsProcessed: () => boolean;\n \n // Reset\n reset: () => void;\n}\n\nconst createEmptyDocumentState = (type: DocumentType): DocumentState => ({\n id: null,\n type,\n status: 'uploaded',\n file: null,\n previewUrl: null,\n extractedData: null,\n confidence: 0,\n fraudFlags: [],\n error: null,\n});\n\nconst initialState: KYCState = {\n sessionId: null,\n status: 'idle',\n step: 'select',\n requiredDocuments: [],\n currentDocumentType: null,\n documents: new Map(),\n isVerified: false,\n verificationStatus: null,\n isLoading: false,\n error: null,\n};\n\nexport const useKYCStore = create<KYCState & KYCActions>((set, get) => ({\n ...initialState,\n\n setSessionId: (sessionId) => set({ sessionId }),\n\n setRequiredDocuments: (documents) => {\n const docsMap = new Map<DocumentType, DocumentState>();\n for (const type of documents) {\n docsMap.set(type, createEmptyDocumentState(type));\n }\n set({ \n requiredDocuments: documents, \n documents: docsMap,\n currentDocumentType: documents[0] || null,\n });\n },\n\n setCurrentDocumentType: (type) => set({ currentDocumentType: type }),\n\n setDocumentFile: (type, file) => {\n const { documents } = get();\n const doc = documents.get(type) || createEmptyDocumentState(type);\n \n // Create preview URL\n const previewUrl = URL.createObjectURL(file);\n \n const updated = new Map(documents);\n updated.set(type, {\n ...doc,\n file,\n previewUrl,\n status: 'uploaded',\n error: null,\n });\n \n set({ documents: updated });\n },\n\n setDocumentStatus: (type, status) => {\n const { documents } = get();\n const doc = documents.get(type);\n if (doc) {\n const updated = new Map(documents);\n updated.set(type, { ...doc, status });\n set({ documents: updated });\n }\n },\n\n setDocumentData: (type, data) => {\n const { documents } = get();\n const doc = documents.get(type);\n if (doc) {\n const updated = new Map(documents);\n updated.set(type, { ...doc, ...data });\n set({ documents: updated });\n }\n },\n\n clearDocumentPreview: (type) => {\n const { documents } = get();\n const doc = documents.get(type);\n if (doc?.previewUrl) {\n URL.revokeObjectURL(doc.previewUrl);\n }\n },\n\n setStep: (step) => set({ step }),\n\n nextDocument: () => {\n const { requiredDocuments, currentDocumentType, documents } = get();\n const currentIndex = currentDocumentType \n ? requiredDocuments.indexOf(currentDocumentType) \n : -1;\n \n // Find next document that needs upload\n for (let i = currentIndex + 1; i < requiredDocuments.length; i++) {\n const type = requiredDocuments[i];\n const doc = documents.get(type);\n if (!doc?.file) {\n set({ currentDocumentType: type });\n return;\n }\n }\n \n // All documents uploaded, move to processing/review\n set({ \n currentDocumentType: null,\n step: 'processing',\n });\n },\n\n setVerificationStatus: (status) => set({ verificationStatus: status }),\n \n setVerified: (verified) => set({ isVerified: verified }),\n\n setStatus: (status) => set({ status }),\n \n setLoading: (isLoading) => set({ isLoading }),\n \n setError: (error) => set({ error }),\n\n getNextRequiredDocument: () => {\n const { requiredDocuments, documents } = get();\n for (const type of requiredDocuments) {\n const doc = documents.get(type);\n if (!doc?.file) {\n return type;\n }\n }\n return null;\n },\n\n areAllDocumentsUploaded: () => {\n const { requiredDocuments, documents } = get();\n return requiredDocuments.every((type) => {\n const doc = documents.get(type);\n return doc?.file !== null;\n });\n },\n\n areAllDocumentsProcessed: () => {\n const { requiredDocuments, documents } = get();\n return requiredDocuments.every((type) => {\n const doc = documents.get(type);\n return doc?.status === 'completed' || doc?.status === 'requires_review';\n });\n },\n\n reset: () => {\n // Clean up preview URLs\n const { documents } = get();\n for (const doc of documents.values()) {\n if (doc.previewUrl) {\n URL.revokeObjectURL(doc.previewUrl);\n }\n }\n set(initialState);\n },\n}));\n","import React, { useCallback } from 'react';\nimport { useDropzone } from 'react-dropzone';\nimport { Upload, FileText, Image, AlertCircle, X } from 'lucide-react';\nimport { clsx } from 'clsx';\nimport { useKYCStore } from '../../store/kyc-store';\nimport type { DocumentType } from '@fileflow/shared';\nimport { DOCUMENT_TYPES } from '@fileflow/shared';\n\ninterface DocumentUploaderProps {\n documentType: DocumentType;\n onFileSelect?: (file: File) => void;\n}\n\nexport const DocumentUploader: React.FC<DocumentUploaderProps> = ({\n documentType,\n onFileSelect,\n}) => {\n const { documents, setDocumentFile, isLoading } = useKYCStore();\n const documentState = documents.get(documentType);\n const documentInfo = DOCUMENT_TYPES[documentType];\n\n const onDrop = useCallback(\n (acceptedFiles: File[], rejectedFiles: unknown[]) => {\n if (rejectedFiles.length > 0) {\n return;\n }\n\n if (acceptedFiles.length > 0) {\n const file = acceptedFiles[0];\n setDocumentFile(documentType, file);\n onFileSelect?.(file);\n }\n },\n [documentType, onFileSelect, setDocumentFile]\n );\n\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n onDrop,\n accept: {\n 'application/pdf': ['.pdf'],\n 'image/jpeg': ['.jpg', '.jpeg'],\n 'image/png': ['.png'],\n },\n maxSize: documentInfo.maxFileSize,\n multiple: false,\n disabled: isLoading,\n });\n\n const formatFileSize = (bytes: number): string => {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n };\n\n const getFileIcon = () => {\n if (documentState?.file?.type === 'application/pdf') {\n return <FileText className=\"ff-w-6 ff-h-6\" />;\n }\n return <Image className=\"ff-w-6 ff-h-6\" />;\n };\n\n const clearFile = (e: React.MouseEvent) => {\n e.stopPropagation();\n useKYCStore.getState().clearDocumentPreview(documentType);\n setDocumentFile(documentType, null as unknown as File);\n };\n\n // Show preview if file is selected\n if (documentState?.file && documentState.previewUrl) {\n return (\n <div className=\"ff-space-y-4\">\n {/* Document Info */}\n <div className=\"ff-p-4 ff-rounded-xl\" style={{ backgroundColor: 'var(--ff-primary-20)', border: '1px solid var(--ff-primary-50)' }}>\n <div className=\"ff-flex ff-items-center ff-gap-3\">\n <div className=\"ff-p-2 ff-rounded-lg\" style={{ backgroundColor: 'var(--ff-primary-30)' }}>\n <span style={{ color: 'var(--ff-primary-90)' }}>{getFileIcon()}</span>\n </div>\n <div className=\"ff-flex-1 ff-min-w-0\">\n <p className=\"ff-font-medium ff-truncate\" style={{ color: 'var(--ff-primary-110)' }}>\n {documentState.file.name}\n </p>\n <p className=\"ff-text-sm\" style={{ color: 'var(--ff-primary-90)' }}>\n {formatFileSize(documentState.file.size)}\n </p>\n </div>\n <button\n onClick={clearFile}\n className=\"ff-p-1.5 ff-rounded-full ff-transition-colors\"\n style={{ color: 'var(--ff-primary-90)' }}\n aria-label=\"Remove file\"\n >\n <X className=\"ff-w-5 ff-h-5\" />\n </button>\n </div>\n </div>\n\n {/* Preview */}\n <div className=\"ff-document-preview ff-aspect-[3/4] ff-max-h-96\">\n {documentState.file.type === 'application/pdf' ? (\n <iframe\n src={documentState.previewUrl}\n className=\"ff-w-full ff-h-full ff-rounded-xl\"\n title=\"Document preview\"\n />\n ) : (\n <img\n src={documentState.previewUrl}\n alt=\"Document preview\"\n className=\"ff-w-full ff-h-full ff-object-contain ff-rounded-xl\"\n />\n )}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"ff-space-y-6\">\n {/* Document Type Info */}\n <div className=\"ff-text-center ff-mb-4\">\n <h3 className=\"ff-text-lg ff-font-semibold\" style={{ color: 'var(--ff-text-primary)' }}>{documentInfo.label}</h3>\n <p className=\"ff-text-sm ff-mt-1\" style={{ color: 'var(--ff-text-muted)' }}>{documentInfo.description}</p>\n </div>\n\n {/* Dropzone - Demo style */}\n <div\n {...getRootProps()}\n className={clsx(\n 'ff-dropzone',\n isDragActive && 'ff-dropzone-active',\n isLoading && 'ff-opacity-50 ff-cursor-not-allowed'\n )}\n >\n <input {...getInputProps()} />\n <div className=\"ff-dropzone-icon-wrapper\">\n <Upload className=\"ff-dropzone-icon\" />\n </div>\n <h3 className=\"ff-dropzone-text\">\n {isDragActive ? 'Drop your document here' : 'Upload your document'}\n </h3>\n <p className=\"ff-dropzone-hint\">Drag and drop or click to select</p>\n <label className=\"ff-inline-block\">\n <span className={clsx(\n 'ff-btn ff-btn-primary',\n isLoading && 'ff-opacity-50 ff-cursor-wait'\n )}>\n {isLoading ? 'Processing...' : 'Choose file'}\n </span>\n </label>\n <div className=\"ff-flex ff-flex-wrap ff-justify-center ff-gap-2 ff-mt-3\">\n {documentInfo.acceptedFormats.map((format) => (\n <span \n key={format} \n className=\"ff-px-2 ff-py-1 ff-rounded ff-text-xs\"\n style={{ backgroundColor: 'var(--ff-bg-tertiary)', color: 'var(--ff-text-muted)' }}\n >\n {format.toUpperCase()}\n </span>\n ))}\n <span className=\"ff-px-2 ff-py-1 ff-text-xs\" style={{ color: 'var(--ff-text-muted)' }}>\n Max {formatFileSize(documentInfo.maxFileSize)}\n </span>\n </div>\n </div>\n\n {/* Error */}\n {documentState?.error && (\n <div className=\"ff-flex ff-items-center ff-gap-2 ff-p-4 ff-rounded-lg ff-text-sm\" style={{ backgroundColor: 'var(--ff-error-light)', color: 'var(--ff-error)' }}>\n <AlertCircle className=\"ff-w-4 ff-h-4 ff-flex-shrink-0\" />\n <p>{documentState.error}</p>\n </div>\n )}\n\n {/* Tips */}\n <div className=\"ff-rounded-xl ff-p-4\" style={{ backgroundColor: 'var(--ff-bg-secondary)' }}>\n <h4 className=\"ff-text-sm ff-font-medium ff-mb-2\" style={{ color: 'var(--ff-text-secondary)' }}>Tips for best results:</h4>\n <ul className=\"ff-text-sm ff-space-y-1 ff-list-disc ff-list-inside\" style={{ color: 'var(--ff-text-muted)' }}>\n <li>Ensure all text is clearly visible and readable</li>\n <li>Avoid glare, shadows, or blurry images</li>\n <li>Include all four corners of the document</li>\n <li>Use good lighting when taking photos</li>\n </ul>\n </div>\n </div>\n );\n};\n","import React from 'react';\nimport { CheckCircle, XCircle, AlertTriangle, Loader2, Clock } from 'lucide-react';\nimport { clsx } from 'clsx';\nimport { useKYCStore } from '../../store/kyc-store';\nimport type { DocumentType, DocumentStatus as DocStatus } from '@fileflow/shared';\nimport { DOCUMENT_TYPES } from '@fileflow/shared';\n\ninterface DocumentStatusProps {\n documentType: DocumentType;\n showDetails?: boolean;\n}\n\nexport const DocumentStatus: React.FC<DocumentStatusProps> = ({\n documentType,\n showDetails = true,\n}) => {\n const { documents } = useKYCStore();\n const documentState = documents.get(documentType);\n const documentInfo = DOCUMENT_TYPES[documentType];\n\n const getStatusConfig = (status?: DocStatus) => {\n switch (status) {\n case 'completed':\n return {\n icon: CheckCircle,\n iconColor: 'var(--ff-success)',\n bgColor: 'var(--ff-success-light)',\n label: 'Verified',\n labelColor: 'var(--ff-success)',\n description: 'Document successfully processed',\n };\n case 'requires_review':\n return {\n icon: AlertTriangle,\n iconColor: 'var(--ff-warning)',\n bgColor: 'var(--ff-warning-light)',\n label: 'Review Required',\n labelColor: 'var(--ff-warning)',\n description: 'Manual verification may be needed',\n };\n case 'failed':\n return {\n icon: XCircle,\n iconColor: 'var(--ff-error)',\n bgColor: 'var(--ff-error-light)',\n label: 'Failed',\n labelColor: 'var(--ff-error)',\n description: 'Unable to process document',\n };\n case 'processing':\n return {\n icon: Loader2,\n iconColor: 'var(--ff-primary-90)',\n bgColor: 'var(--ff-primary-20)',\n label: 'Processing',\n labelColor: 'var(--ff-primary-90)',\n description: 'Analyzing document...',\n };\n case 'uploaded':\n return {\n icon: Clock,\n iconColor: 'var(--ff-text-secondary)',\n bgColor: 'var(--ff-bg-tertiary)',\n label: 'Pending',\n labelColor: 'var(--ff-text-secondary)',\n description: 'Waiting to be processed',\n };\n default:\n return {\n icon: Clock,\n iconColor: 'var(--ff-text-muted)',\n bgColor: 'var(--ff-bg-tertiary)',\n label: 'Not Uploaded',\n labelColor: 'var(--ff-text-muted)',\n description: 'Upload document to continue',\n };\n }\n };\n\n const statusConfig = getStatusConfig(documentState?.status);\n const Icon = statusConfig.icon;\n\n const getConfidenceColor = (confidence: number) => {\n if (confidence >= 0.8) return 'var(--ff-success)';\n if (confidence >= 0.6) return 'var(--ff-warning)';\n return 'var(--ff-error)';\n };\n\n return (\n <div className=\"ff-space-y-3\">\n {/* Status Header */}\n <div className=\"ff-flex ff-items-center ff-gap-3\">\n <div className=\"ff-p-2 ff-rounded-xl\" style={{ backgroundColor: statusConfig.bgColor }}>\n <Icon\n className={clsx(\n 'ff-w-5 ff-h-5',\n documentState?.status === 'processing' && 'ff-animate-spin'\n )}\n style={{ color: statusConfig.iconColor }}\n />\n </div>\n <div>\n <p className=\"ff-font-medium\" style={{ color: 'var(--ff-text-primary)' }}>{documentInfo.label}</p>\n <p className=\"ff-text-sm\" style={{ color: statusConfig.labelColor }}>{statusConfig.label}</p>\n </div>\n </div>\n\n {/* Confidence Score */}\n {documentState?.confidence !== undefined && documentState.confidence > 0 && (\n <div className=\"ff-space-y-1\">\n <div className=\"ff-flex ff-items-center ff-justify-between ff-text-sm\">\n <span style={{ color: 'var(--ff-text-secondary)' }}>Confidence</span>\n <span className=\"ff-font-medium\" style={{ color: getConfidenceColor(documentState.confidence) }}>\n {Math.round(documentState.confidence * 100)}%\n </span>\n </div>\n <div className=\"ff-progress\">\n <div\n className=\"ff-progress-bar\"\n style={{ \n width: `${documentState.confidence * 100}%`,\n backgroundColor: getConfidenceColor(documentState.confidence)\n }}\n />\n </div>\n </div>\n )}\n\n {/* Fraud Flags */}\n {showDetails && documentState?.fraudFlags && documentState.fraudFlags.length > 0 && (\n <div className=\"ff-space-y-2\">\n <p className=\"ff-text-sm ff-font-medium\" style={{ color: 'var(--ff-text-secondary)' }}>Issues Detected</p>\n <div className=\"ff-space-y-1\">\n {documentState.fraudFlags.map((flag, index) => (\n <div\n key={index}\n className=\"ff-flex ff-items-start ff-gap-2 ff-p-2 ff-rounded-lg ff-text-sm\"\n style={{\n backgroundColor: flag.severity === 'high' ? 'var(--ff-error-light)' : flag.severity === 'medium' ? 'var(--ff-warning-light)' : 'var(--ff-bg-tertiary)',\n color: flag.severity === 'high' ? 'var(--ff-error)' : flag.severity === 'medium' ? 'var(--ff-warning)' : 'var(--ff-text-secondary)',\n }}\n >\n {flag.severity === 'high' ? (\n <XCircle className=\"ff-w-4 ff-h-4 ff-flex-shrink-0 ff-mt-0.5\" />\n ) : (\n <AlertTriangle className=\"ff-w-4 ff-h-4 ff-flex-shrink-0 ff-mt-0.5\" />\n )}\n <span>{flag.message}</span>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {/* Extracted Data Preview */}\n {showDetails &&\n documentState?.extractedData &&\n documentState.status === 'completed' && (\n <div className=\"ff-rounded-xl ff-p-3\" style={{ backgroundColor: 'var(--ff-bg-tertiary)' }}>\n <p className=\"ff-text-sm ff-font-medium ff-mb-2\" style={{ color: 'var(--ff-text-secondary)' }}>\n Extracted Information\n </p>\n <dl className=\"ff-space-y-1 ff-text-sm\">\n {'fullName' in documentState.extractedData && (\n <div className=\"ff-flex ff-justify-between\">\n <dt style={{ color: 'var(--ff-text-muted)' }}>Name</dt>\n <dd className=\"ff-font-medium\" style={{ color: 'var(--ff-text-primary)' }}>\n {documentState.extractedData.fullName}\n </dd>\n </div>\n )}\n {'dateOfBirth' in documentState.extractedData && (\n <div className=\"ff-flex ff-justify-between\">\n <dt style={{ color: 'var(--ff-text-muted)' }}>Date of Birth</dt>\n <dd style={{ color: 'var(--ff-text-primary)' }}>{documentState.extractedData.dateOfBirth}</dd>\n </div>\n )}\n {documentState.extractedData.documentType === 'passport' &&\n 'passportNumber' in documentState.extractedData && (\n <div className=\"ff-flex ff-justify-between\">\n <dt style={{ color: 'var(--ff-text-muted)' }}>Passport #</dt>\n <dd className=\"ff-font-mono\" style={{ color: 'var(--ff-text-primary)' }}>\n {documentState.extractedData.passportNumber}\n </dd>\n </div>\n )}\n {documentState.extractedData.documentType === 'drivers_license' &&\n 'licenseNumber' in documentState.extractedData && (\n <div className=\"ff-flex ff-justify-between\">\n <dt style={{ color: 'var(--ff-text-muted)' }}>License #</dt>\n <dd className=\"ff-font-mono\" style={{ color: 'var(--ff-text-primary)' }}>\n {documentState.extractedData.licenseNumber}\n </dd>\n </div>\n )}\n {'address' in documentState.extractedData && documentState.extractedData.address && (\n <div className=\"ff-flex ff-justify-between\">\n <dt style={{ color: 'var(--ff-text-muted)' }}>Address</dt>\n <dd className=\"ff-text-right\" style={{ color: 'var(--ff-text-primary)' }}>\n {documentState.extractedData.address.city},{' '}\n {documentState.extractedData.address.province}\n </dd>\n </div>\n )}\n </dl>\n </div>\n )}\n </div>\n );\n};\n","import React, { useCallback, useEffect, useState } from 'react';\nimport {\n FileText,\n Car,\n Home,\n CheckCircle,\n X,\n Loader2,\n ChevronRight,\n ShieldCheck,\n Shield,\n} from 'lucide-react';\nimport { clsx } from 'clsx';\nimport { useKYCStore, type KYCStep } from '../../store/kyc-store';\nimport { getClient } from '../../api/client';\nimport { DocumentUploader } from './DocumentUploader';\nimport { DocumentStatus } from './DocumentStatus';\nimport type { DocumentType, KYCSession, KYCDocument } from '@fileflow/shared';\nimport { DOCUMENT_TYPES } from '@fileflow/shared';\n\n// KYC steps for the step indicator\nconst KYC_STEP_LABELS = ['select', 'upload', 'review', 'complete'] as const;\n\ninterface KYCWizardProps {\n requiredDocuments: DocumentType[];\n onComplete?: (session: KYCSession) => void;\n onCancel?: () => void;\n onError?: (error: Error) => void;\n}\n\nconst DOCUMENT_ICONS: Record<DocumentType, React.ElementType> = {\n passport: FileText,\n drivers_license: Car,\n proof_of_address: Home,\n};\n\nexport const KYCWizard: React.FC<KYCWizardProps> = ({\n requiredDocuments,\n onComplete,\n onCancel,\n onError,\n}) => {\n const {\n sessionId,\n step,\n currentDocumentType,\n documents,\n isVerified,\n verificationStatus,\n isLoading,\n error,\n setSessionId,\n setRequiredDocuments,\n setCurrentDocumentType,\n setDocumentStatus,\n setDocumentData,\n setStep,\n nextDocument,\n setVerificationStatus,\n setVerified,\n setLoading,\n setError,\n areAllDocumentsUploaded,\n areAllDocumentsProcessed,\n reset,\n } = useKYCStore();\n\n const [pollingDocument, setPollingDocument] = useState<string | null>(null);\n\n // Initialize\n useEffect(() => {\n setRequiredDocuments(requiredDocuments);\n initializeSession();\n\n return () => {\n // Cleanup polling on unmount\n setPollingDocument(null);\n };\n }, [requiredDocuments]);\n\n const initializeSession = async () => {\n try {\n setLoading(true);\n const client = getClient();\n const result = await client.createKYCSession(requiredDocuments);\n setSessionId(result.sessionId);\n setStep('upload');\n } catch (err) {\n const error = err as Error;\n setError(error.message);\n onError?.(error);\n } finally {\n setLoading(false);\n }\n };\n\n const handleFileSelect = useCallback(\n async (file: File) => {\n if (!sessionId || !currentDocumentType) return;\n\n try {\n setLoading(true);\n setError(null);\n\n const client = getClient();\n const result = await client.uploadKYCDocument(sessionId, currentDocumentType, file);\n\n setDocumentData(currentDocumentType, {\n id: result.documentId,\n status: 'processing',\n });\n\n // Start polling for document status\n setPollingDocument(result.documentId);\n pollDocumentStatus(result.documentId);\n } catch (err) {\n const error = err as Error;\n setDocumentData(currentDocumentType, {\n status: 'failed',\n error: error.message,\n });\n onError?.(error);\n } finally {\n setLoading(false);\n }\n },\n [sessionId, currentDocumentType]\n );\n\n const pollDocumentStatus = async (documentId: string) => {\n const maxAttempts = 30;\n const maxConsecutiveErrors = 3; // Stop after 3 consecutive errors\n let attempts = 0;\n let consecutiveErrors = 0;\n\n const poll = async () => {\n if (attempts >= maxAttempts) {\n setPollingDocument(null);\n if (currentDocumentType) {\n setDocumentData(currentDocumentType, {\n status: 'failed',\n error: 'Processing timed out. Please try again.',\n });\n }\n return;\n }\n\n // Stop polling if we've had too many consecutive errors\n if (consecutiveErrors >= maxConsecutiveErrors) {\n setPollingDocument(null);\n if (currentDocumentType) {\n setDocumentData(currentDocumentType, {\n status: 'failed',\n error: 'Failed to check document status. Please refresh and try again.',\n });\n }\n return;\n }\n\n try {\n const client = getClient();\n const result = await client.getKYCDocument(documentId);\n const doc = result.document as KYCDocument;\n\n // Reset consecutive errors on success\n consecutiveErrors = 0;\n\n const docType = doc.type as DocumentType;\n setDocumentData(docType, {\n id: doc.id,\n status: doc.status,\n extractedData: doc.extractedData,\n confidence: doc.confidence,\n fraudFlags: doc.fraudFlags,\n error: null, // Clear any previous errors\n });\n\n if (doc.status === 'completed' || doc.status === 'requires_review' || doc.status === 'failed') {\n setPollingDocument(null);\n\n // Check if all documents are processed\n if (areAllDocumentsUploaded()) {\n const allProcessed = areAllDocumentsProcessed();\n if (allProcessed) {\n setStep('review');\n }\n } else {\n // Move to next document\n nextDocument();\n }\n return;\n }\n\n // Continue polling\n attempts++;\n setTimeout(poll, 2000);\n } catch (err) {\n const error = err as Error & { status?: number };\n consecutiveErrors++;\n attempts++;\n \n // On 404, stop immediately - the document doesn't exist\n if (error.status === 404 || error.message?.includes('not found')) {\n setPollingDocument(null);\n if (currentDocumentType) {\n setDocumentData(currentDocumentType, {\n status: 'failed',\n error: 'Session not found or invalid state',\n });\n }\n return;\n }\n\n // On other errors, retry with backoff (up to maxConsecutiveErrors times)\n if (consecutiveErrors < maxConsecutiveErrors) {\n setTimeout(poll, 3000 * consecutiveErrors); // Exponential backoff\n } else {\n setPollingDocument(null);\n if (currentDocumentType) {\n setDocumentData(currentDocumentType, {\n status: 'failed',\n error: error.message || 'Failed to process document',\n });\n }\n }\n }\n };\n\n poll();\n };\n\n const handleVerify = async () => {\n if (!sessionId) return;\n\n try {\n setLoading(true);\n setError(null);\n\n const client = getClient();\n const result = await client.verifyKYCSession(sessionId, true);\n\n setVerificationStatus(result.verificationStatus);\n const status = result.verificationStatus as { isVerified: boolean };\n setVerified(status.isVerified);\n setStep('complete');\n\n onComplete?.(result as unknown as KYCSession);\n } catch (err) {\n const error = err as Error;\n setError(error.message);\n onError?.(error);\n } finally {\n setLoading(false);\n }\n };\n\n const handleCancel = () => {\n reset();\n onCancel?.();\n };\n\n const selectDocument = (type: DocumentType) => {\n setCurrentDocumentType(type);\n setStep('upload');\n };\n\n const isDocumentComplete = (type: DocumentType) => {\n const doc = documents.get(type);\n return doc?.status === 'completed' || doc?.status === 'requires_review';\n };\n\n // Get step index for the step indicator\n const getDisplayStepIndex = () => {\n const currentStep = step === 'processing' ? 'upload' : step;\n return KYC_STEP_LABELS.indexOf(currentStep as typeof KYC_STEP_LABELS[number]);\n };\n\n return (\n <div className=\"ff-container ff-modal\">\n {/* Modal Header - Demo style */}\n <div className=\"ff-modal-header\">\n <div className=\"ff-modal-header-left\">\n <div className=\"ff-flex ff-items-center ff-gap-3\">\n <div className=\"ff-modal-icon\">\n <Shield />\n </div>\n <h2 className=\"ff-modal-title\">Identity Verification</h2>\n </div>\n {/* Step Indicator - Demo style */}\n <div className=\"ff-steps ff-ml-4\">\n {KYC_STEP_LABELS.map((s, i) => (\n <React.Fragment key={s}>\n <div\n className={clsx(\n 'ff-step',\n getDisplayStepIndex() === i && 'ff-step-active',\n getDisplayStepIndex() > i && 'ff-step-complete',\n getDisplayStepIndex() < i && 'ff-step-pending'\n )}\n >\n {getDisplayStepIndex() > i ? '✓' : i + 1}\n </div>\n {i < KYC_STEP_LABELS.length - 1 && (\n <div className={clsx(\n 'ff-step-connector',\n getDisplayStepIndex() > i && 'ff-step-connector-complete'\n )} />\n )}\n </React.Fragment>\n ))}\n </div>\n </div>\n <button\n onClick={handleCancel}\n className=\"ff-modal-close\"\n >\n <X className=\"ff-w-5 ff-h-5\" />\n </button>\n </div>\n\n {/* Modal Body */}\n <div className=\"ff-modal-body\">\n {error && (\n <div className=\"ff-mb-4 ff-p-4 ff-rounded-lg ff-text-sm\" style={{ backgroundColor: 'var(--ff-error-light)', color: 'var(--ff-error)' }}>\n {error}\n </div>\n )}\n\n {/* Document Selection */}\n {step === 'select' && (\n <div className=\"ff-space-y-4\">\n <p className=\"ff-text-center ff-mb-6\" style={{ color: 'var(--ff-text-muted)' }}>\n Please upload the following documents to verify your identity\n </p>\n <div className=\"ff-grid ff-gap-3\">\n {requiredDocuments.map((type) => {\n const Icon = DOCUMENT_ICONS[type];\n const info = DOCUMENT_TYPES[type];\n const doc = documents.get(type);\n const isComplete = isDocumentComplete(type);\n\n return (\n <button\n key={type}\n onClick={() => selectDocument(type)}\n className={clsx(\n 'ff-flex ff-items-center ff-gap-4 ff-p-4 ff-rounded-xl ff-border-2 ff-text-left ff-transition-all ff-duration-150',\n isComplete\n ? 'ff-border-transparent'\n : 'ff-border-transparent hover:ff-border-transparent'\n )}\n style={{\n backgroundColor: isComplete ? 'var(--ff-success-light)' : 'var(--ff-bg-secondary)',\n borderColor: isComplete ? 'var(--ff-success)' : 'var(--ff-border-light)',\n }}\n >\n <div\n className=\"ff-p-3 ff-rounded-xl\"\n style={{\n backgroundColor: isComplete ? 'rgba(41, 142, 51, 0.15)' : 'var(--ff-bg-tertiary)',\n }}\n >\n {isComplete ? (\n <CheckCircle className=\"ff-w-6 ff-h-6\" style={{ color: 'var(--ff-success)' }} />\n ) : (\n <Icon className=\"ff-w-6 ff-h-6\" style={{ color: 'var(--ff-text-secondary)' }} />\n )}\n </div>\n <div className=\"ff-flex-1\">\n <p className=\"ff-font-medium\" style={{ color: 'var(--ff-text-primary)' }}>{info.label}</p>\n <p className=\"ff-text-sm\" style={{ color: 'var(--ff-text-muted)' }}>{info.description}</p>\n </div>\n <ChevronRight className=\"ff-w-5 ff-h-5\" style={{ color: 'var(--ff-text-muted)' }} />\n </button>\n );\n })}\n </div>\n </div>\n )}\n\n {/* Document Upload */}\n {step === 'upload' && currentDocumentType && (\n <div className=\"ff-py-4\">\n <div className=\"ff-max-w-lg ff-mx-auto\">\n <DocumentUploader documentType={currentDocumentType} onFileSelect={handleFileSelect} />\n </div>\n </div>\n )}\n\n {/* Processing */}\n {step === 'processing' && (\n <div className=\"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12\">\n <Loader2 className=\"ff-w-12 ff-h-12 ff-animate-spin ff-mb-4\" style={{ color: 'var(--ff-primary-90)' }} />\n <h3 className=\"ff-text-lg ff-font-semibold ff-mb-2\" style={{ color: 'var(--ff-text-primary)' }}>\n Processing Documents\n </h3>\n <p style={{ color: 'var(--ff-text-muted)' }} className=\"ff-text-center\">\n We're analyzing your documents. This may take a moment...\n </p>\n </div>\n )}\n\n {/* Review */}\n {step === 'review' && (\n <div className=\"ff-space-y-6\">\n <div className=\"ff-text-center ff-mb-6\">\n <h3 className=\"ff-text-lg ff-font-semibold\" style={{ color: 'var(--ff-text-primary)' }}>Review Your Documents</h3>\n <p style={{ color: 'var(--ff-text-muted)' }}>\n Please review the extracted information before completing verification\n </p>\n </div>\n\n <div className=\"ff-grid ff-gap-4\">\n {requiredDocuments.map((type) => (\n <div\n key={type}\n className=\"ff-rounded-xl ff-p-4\"\n style={{ backgroundColor: 'var(--ff-bg-secondary)', border: '1px solid var(--ff-border-light)' }}\n >\n <DocumentStatus documentType={type} showDetails={true} />\n </div>\n ))}\n </div>\n </div>\n )}\n\n {/* Complete */}\n {step === 'complete' && (\n <div className=\"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12\">\n <div\n className=\"ff-w-16 ff-h-16 ff-rounded-full ff-flex ff-items-center ff-justify-center ff-mb-4\"\n style={{ backgroundColor: isVerified ? 'var(--ff-success-light)' : 'var(--ff-warning-light)' }}\n >\n {isVerified ? (\n <CheckCircle className=\"ff-w-10 ff-h-10\" style={{ color: 'var(--ff-success)' }} />\n ) : (\n <ShieldCheck className=\"ff-w-10 ff-h-10\" style={{ color: 'var(--ff-warning)' }} />\n )}\n </div>\n <h3 className=\"ff-text-xl ff-font-semibold ff-mb-2\" style={{ color: 'var(--ff-text-primary)' }}>\n {isVerified ? 'Verification Complete!' : 'Review Required'}\n </h3>\n <p style={{ color: 'var(--ff-text-muted)' }} className=\"ff-text-center\">\n {isVerified\n ? 'Your identity has been successfully verified.'\n : 'Additional review may be required. We will contact you if needed.'}\n </p>\n </div>\n )}\n </div>\n\n {/* Modal Footer */}\n {step !== 'complete' && (\n <div className=\"ff-modal-footer\">\n <button\n onClick={() => {\n if (step === 'upload') {\n setStep('select');\n } else if (step === 'review') {\n setStep('select');\n }\n }}\n disabled={isLoading}\n className=\"ff-btn ff-btn-secondary\"\n >\n Back\n </button>\n\n {step === 'review' && (\n <button\n onClick={handleVerify}\n disabled={isLoading || !areAllDocumentsProcessed()}\n className=\"ff-btn ff-btn-primary\"\n >\n {isLoading ? (\n <>\n <Loader2 className=\"ff-w-4 ff-h-4 ff-animate-spin\" />\n Verifying...\n </>\n ) : (\n 'Complete Verification'\n )}\n </button>\n )}\n\n {step === 'select' && areAllDocumentsUploaded() && (\n <button\n onClick={() => setStep('review')}\n className=\"ff-btn ff-btn-primary\"\n >\n Review & Verify\n </button>\n )}\n </div>\n )}\n </div>\n );\n};\n"],"names":["Car","createLucideIcon","Clock","FileText","Home","Image","ShieldCheck","Shield","createEmptyDocumentState","type","initialState","useKYCStore","create","set","get","sessionId","documents","docsMap","file","doc","previewUrl","updated","status","data","step","requiredDocuments","currentDocumentType","currentIndex","i","verified","isLoading","error","DocumentUploader","documentType","onFileSelect","setDocumentFile","documentState","documentInfo","DOCUMENT_TYPES","onDrop","useCallback","acceptedFiles","rejectedFiles","getRootProps","getInputProps","isDragActive","useDropzone","formatFileSize","bytes","getFileIcon","_a","jsx","clearFile","e","jsxs","X","clsx","Upload","format","AlertCircle","DocumentStatus","showDetails","statusConfig","CheckCircle","AlertTriangle","XCircle","Loader2","Icon","getConfidenceColor","confidence","flag","index","KYC_STEP_LABELS","DOCUMENT_ICONS","KYCWizard","onComplete","onCancel","onError","isVerified","verificationStatus","setSessionId","setRequiredDocuments","setCurrentDocumentType","setDocumentStatus","setDocumentData","setStep","nextDocument","setVerificationStatus","setVerified","setLoading","setError","areAllDocumentsUploaded","areAllDocumentsProcessed","reset","pollingDocument","setPollingDocument","useState","useEffect","initializeSession","result","getClient","err","handleFileSelect","pollDocumentStatus","documentId","attempts","consecutiveErrors","poll","docType","handleVerify","handleCancel","selectDocument","isDocumentComplete","getDisplayStepIndex","currentStep","s","React","info","isComplete","ChevronRight","Fragment"],"mappings":"sGAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GASA,MAAMA,GAAMC,EAAAA,iBAAiB,MAAO,CAClC,CACE,OACA,CACE,EAAG,6KACH,IAAK,OACX,CACA,EACE,CAAC,SAAU,CAAE,GAAI,IAAK,GAAI,KAAM,EAAG,IAAK,IAAK,SAAU,EACvD,CAAC,OAAQ,CAAE,EAAG,UAAW,IAAK,QAAQ,CAAE,EACxC,CAAC,SAAU,CAAE,GAAI,KAAM,GAAI,KAAM,EAAG,IAAK,IAAK,QAAQ,CAAE,CAC1D,CAAC,ECpBD;AAAA;AAAA;AAAA;AAAA;AAAA,GASA,MAAMC,EAAQD,EAAAA,iBAAiB,QAAS,CACtC,CAAC,SAAU,CAAE,GAAI,KAAM,GAAI,KAAM,EAAG,KAAM,IAAK,SAAU,EACzD,CAAC,WAAY,CAAE,OAAQ,mBAAoB,IAAK,QAAQ,CAAE,CAC5D,CAAC,ECZD;AAAA;AAAA;AAAA;AAAA;AAAA,GASA,MAAME,EAAWF,EAAAA,iBAAiB,WAAY,CAC5C,CAAC,OAAQ,CAAE,EAAG,6DAA8D,IAAK,QAAQ,CAAE,EAC3F,CAAC,OAAQ,CAAE,EAAG,0BAA2B,IAAK,QAAQ,CAAE,EACxD,CAAC,OAAQ,CA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,SAAA2B,EACG,gDACA,mEAAA,CACN,CAAA,CAAA,CACF,CAAA,EAEJ,EAGCtD,IAAS,YACR8B,OAAC,MAAA,CAAI,UAAU,kBACb,SAAA,CAAAH,EAAAA,IAAC,SAAA,CACC,QAAS,IAAM,EACT3B,IAAS,UAEFA,IAAS,WAClB6D,EAAQ,QAAQ,CAEpB,EACA,SAAUvD,EACV,UAAU,0BACX,SAAA,MAAA,CAAA,EAIAN,IAAS,UACR2B,EAAAA,IAAC,SAAA,CACC,QAAS0D,EACT,SAAU/E,GAAa,CAAC8D,EAAA,EACxB,UAAU,wBAET,WACCtC,EAAAA,KAAAkE,EAAAA,SAAA,CACE,SAAA,CAAArE,EAAAA,IAACe,EAAAA,QAAA,CAAQ,UAAU,+BAAA,CAAgC,EAAE,cAAA,CAAA,CAEvD,EAEA,uBAAA,CAAA,EAKL1C,IAAS,UAAYmE,EAAA,GACpBxC,EAAAA,IAAC,SAAA,CACC,QAAS,IAAMkC,EAAQ,QAAQ,EAC/B,UAAU,wBACX,SAAA,iBAAA,CAAA,CAED,CAAA,CAEJ,CAAA,EAEJ,CAEJ","x_google_ignoreList":[0,1,2,3,4,5,6]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"KYCWizard-D4RKtikr.mjs","sources":["../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/car.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/clock.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/file-text.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/home.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/image.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/shield-check.js","../../../node_modules/.pnpm/lucide-react@0.321.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/shield.js","../src/store/kyc-store.ts","../src/kyc/components/DocumentUploader.tsx","../src/kyc/components/DocumentStatus.tsx","../src/kyc/components/KYCWizard.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Car = createLucideIcon(\"Car\", [\n [\n \"path\",\n {\n d: \"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2\",\n key: \"5owen\"\n }\n ],\n [\"circle\", { cx: \"7\", cy: \"17\", r: \"2\", key: \"u2ysq9\" }],\n [\"path\", { d: \"M9 17h6\", key: \"r8uit2\" }],\n [\"circle\", { cx: \"17\", cy: \"17\", r: \"2\", key: \"axvx0g\" }]\n]);\n\nexport { Car as default };\n//# sourceMappingURL=car.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Clock = createLucideIcon(\"Clock\", [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"polyline\", { points: \"12 6 12 12 16 14\", key: \"68esgv\" }]\n]);\n\nexport { Clock as default };\n//# sourceMappingURL=clock.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst FileText = createLucideIcon(\"FileText\", [\n [\"path\", { d: \"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\", key: \"1rqfz7\" }],\n [\"path\", { d: \"M14 2v4a2 2 0 0 0 2 2h4\", key: \"tnqrlb\" }],\n [\"path\", { d: \"M10 9H8\", key: \"b1mrlr\" }],\n [\"path\", { d: \"M16 13H8\", key: \"t4e002\" }],\n [\"path\", { d: \"M16 17H8\", key: \"z1uh3a\" }]\n]);\n\nexport { FileText as default };\n//# sourceMappingURL=file-text.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Home = createLucideIcon(\"Home\", [\n [\"path\", { d: \"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\", key: \"y5dka4\" }],\n [\"polyline\", { points: \"9 22 9 12 15 12 15 22\", key: \"e2us08\" }]\n]);\n\nexport { Home as default };\n//# sourceMappingURL=home.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Image = createLucideIcon(\"Image\", [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", ry: \"2\", key: \"1m3agn\" }],\n [\"circle\", { cx: \"9\", cy: \"9\", r: \"2\", key: \"af1f0g\" }],\n [\"path\", { d: \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\", key: \"1xmnt7\" }]\n]);\n\nexport { Image as default };\n//# sourceMappingURL=image.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst ShieldCheck = createLucideIcon(\"ShieldCheck\", [\n [\"path\", { d: \"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10\", key: \"1irkt0\" }],\n [\"path\", { d: \"m9 12 2 2 4-4\", key: \"dzmm74\" }]\n]);\n\nexport { ShieldCheck as default };\n//# sourceMappingURL=shield-check.js.map\n","/**\n * @license lucide-react v0.321.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Shield = createLucideIcon(\"Shield\", [\n [\"path\", { d: \"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10\", key: \"1irkt0\" }]\n]);\n\nexport { Shield as default };\n//# sourceMappingURL=shield.js.map\n","import { create } from 'zustand';\nimport type { \n DocumentType, \n KYCDocument, \n DocumentStatus,\n FraudFlag,\n ExtractedData,\n} from '@fileflow/shared';\n\nexport type KYCStep = 'select' | 'upload' | 'processing' | 'review' | 'complete';\n\nexport interface DocumentState {\n id: string | null;\n type: DocumentType;\n status: DocumentStatus;\n file: File | null;\n previewUrl: string | null;\n extractedData: ExtractedData | null;\n confidence: number;\n fraudFlags: FraudFlag[];\n error: string | null;\n}\n\nexport interface KYCState {\n // Session\n sessionId: string | null;\n status: string;\n step: KYCStep;\n \n // Required documents\n requiredDocuments: DocumentType[];\n currentDocumentType: DocumentType | null;\n \n // Document states\n documents: Map<DocumentType, DocumentState>;\n \n // Verification\n isVerified: boolean;\n verificationStatus: object | null;\n \n // UI state\n isLoading: boolean;\n error: string | null;\n}\n\nexport interface KYCActions {\n // Initialize\n setSessionId: (sessionId: string) => void;\n setRequiredDocuments: (documents: DocumentType[]) => void;\n \n // Document management\n setCurrentDocumentType: (type: DocumentType) => void;\n setDocumentFile: (type: DocumentType, file: File) => void;\n setDocumentStatus: (type: DocumentType, status: DocumentStatus) => void;\n setDocumentData: (type: DocumentType, data: Partial<DocumentState>) => void;\n clearDocumentPreview: (type: DocumentType) => void;\n \n // Navigation\n setStep: (step: KYCStep) => void;\n nextDocument: () => void;\n \n // Verification\n setVerificationStatus: (status: object) => void;\n setVerified: (verified: boolean) => void;\n \n // Status\n setStatus: (status: string) => void;\n setLoading: (loading: boolean) => void;\n setError: (error: string | null) => void;\n \n // Helpers\n getNextRequiredDocument: () => DocumentType | null;\n areAllDocumentsUploaded: () => boolean;\n areAllDocumentsProcessed: () => boolean;\n \n // Reset\n reset: () => void;\n}\n\nconst createEmptyDocumentState = (type: DocumentType): DocumentState => ({\n id: null,\n type,\n status: 'uploaded',\n file: null,\n previewUrl: null,\n extractedData: null,\n confidence: 0,\n fraudFlags: [],\n error: null,\n});\n\nconst initialState: KYCState = {\n sessionId: null,\n status: 'idle',\n step: 'select',\n requiredDocuments: [],\n currentDocumentType: null,\n documents: new Map(),\n isVerified: false,\n verificationStatus: null,\n isLoading: false,\n error: null,\n};\n\nexport const useKYCStore = create<KYCState & KYCActions>((set, get) => ({\n ...initialState,\n\n setSessionId: (sessionId) => set({ sessionId }),\n\n setRequiredDocuments: (documents) => {\n const docsMap = new Map<DocumentType, DocumentState>();\n for (const type of documents) {\n docsMap.set(type, createEmptyDocumentState(type));\n }\n set({ \n requiredDocuments: documents, \n documents: docsMap,\n currentDocumentType: documents[0] || null,\n });\n },\n\n setCurrentDocumentType: (type) => set({ currentDocumentType: type }),\n\n setDocumentFile: (type, file) => {\n const { documents } = get();\n const doc = documents.get(type) || createEmptyDocumentState(type);\n \n // Create preview URL\n const previewUrl = URL.createObjectURL(file);\n \n const updated = new Map(documents);\n updated.set(type, {\n ...doc,\n file,\n previewUrl,\n status: 'uploaded',\n error: null,\n });\n \n set({ documents: updated });\n },\n\n setDocumentStatus: (type, status) => {\n const { documents } = get();\n const doc = documents.get(type);\n if (doc) {\n const updated = new Map(documents);\n updated.set(type, { ...doc, status });\n set({ documents: updated });\n }\n },\n\n setDocumentData: (type, data) => {\n const { documents } = get();\n const doc = documents.get(type);\n if (doc) {\n const updated = new Map(documents);\n updated.set(type, { ...doc, ...data });\n set({ documents: updated });\n }\n },\n\n clearDocumentPreview: (type) => {\n const { documents } = get();\n const doc = documents.get(type);\n if (doc?.previewUrl) {\n URL.revokeObjectURL(doc.previewUrl);\n }\n },\n\n setStep: (step) => set({ step }),\n\n nextDocument: () => {\n const { requiredDocuments, currentDocumentType, documents } = get();\n const currentIndex = currentDocumentType \n ? requiredDocuments.indexOf(currentDocumentType) \n : -1;\n \n // Find next document that needs upload\n for (let i = currentIndex + 1; i < requiredDocuments.length; i++) {\n const type = requiredDocuments[i];\n const doc = documents.get(type);\n if (!doc?.file) {\n set({ currentDocumentType: type });\n return;\n }\n }\n \n // All documents uploaded, move to processing/review\n set({ \n currentDocumentType: null,\n step: 'processing',\n });\n },\n\n setVerificationStatus: (status) => set({ verificationStatus: status }),\n \n setVerified: (verified) => set({ isVerified: verified }),\n\n setStatus: (status) => set({ status }),\n \n setLoading: (isLoading) => set({ isLoading }),\n \n setError: (error) => set({ error }),\n\n getNextRequiredDocument: () => {\n const { requiredDocuments, documents } = get();\n for (const type of requiredDocuments) {\n const doc = documents.get(type);\n if (!doc?.file) {\n return type;\n }\n }\n return null;\n },\n\n areAllDocumentsUploaded: () => {\n const { requiredDocuments, documents } = get();\n return requiredDocuments.every((type) => {\n const doc = documents.get(type);\n return doc?.file !== null;\n });\n },\n\n areAllDocumentsProcessed: () => {\n const { requiredDocuments, documents } = get();\n return requiredDocuments.every((type) => {\n const doc = documents.get(type);\n return doc?.status === 'completed' || doc?.status === 'requires_review';\n });\n },\n\n reset: () => {\n // Clean up preview URLs\n const { documents } = get();\n for (const doc of documents.values()) {\n if (doc.previewUrl) {\n URL.revokeObjectURL(doc.previewUrl);\n }\n }\n set(initialState);\n },\n}));\n","import React, { useCallback } from 'react';\nimport { useDropzone } from 'react-dropzone';\nimport { Upload, FileText, Image, AlertCircle, X } from 'lucide-react';\nimport { clsx } from 'clsx';\nimport { useKYCStore } from '../../store/kyc-store';\nimport type { DocumentType } from '@fileflow/shared';\nimport { DOCUMENT_TYPES } from '@fileflow/shared';\n\ninterface DocumentUploaderProps {\n documentType: DocumentType;\n onFileSelect?: (file: File) => void;\n}\n\nexport const DocumentUploader: React.FC<DocumentUploaderProps> = ({\n documentType,\n onFileSelect,\n}) => {\n const { documents, setDocumentFile, isLoading } = useKYCStore();\n const documentState = documents.get(documentType);\n const documentInfo = DOCUMENT_TYPES[documentType];\n\n const onDrop = useCallback(\n (acceptedFiles: File[], rejectedFiles: unknown[]) => {\n if (rejectedFiles.length > 0) {\n return;\n }\n\n if (acceptedFiles.length > 0) {\n const file = acceptedFiles[0];\n setDocumentFile(documentType, file);\n onFileSelect?.(file);\n }\n },\n [documentType, onFileSelect, setDocumentFile]\n );\n\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n onDrop,\n accept: {\n 'application/pdf': ['.pdf'],\n 'image/jpeg': ['.jpg', '.jpeg'],\n 'image/png': ['.png'],\n },\n maxSize: documentInfo.maxFileSize,\n multiple: false,\n disabled: isLoading,\n });\n\n const formatFileSize = (bytes: number): string => {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n };\n\n const getFileIcon = () => {\n if (documentState?.file?.type === 'application/pdf') {\n return <FileText className=\"ff-w-6 ff-h-6\" />;\n }\n return <Image className=\"ff-w-6 ff-h-6\" />;\n };\n\n const clearFile = (e: React.MouseEvent) => {\n e.stopPropagation();\n useKYCStore.getState().clearDocumentPreview(documentType);\n setDocumentFile(documentType, null as unknown as File);\n };\n\n // Show preview if file is selected\n if (documentState?.file && documentState.previewUrl) {\n return (\n <div className=\"ff-space-y-4\">\n {/* Document Info */}\n <div className=\"ff-p-4 ff-rounded-xl\" style={{ backgroundColor: 'var(--ff-primary-20)', border: '1px solid var(--ff-primary-50)' }}>\n <div className=\"ff-flex ff-items-center ff-gap-3\">\n <div className=\"ff-p-2 ff-rounded-lg\" style={{ backgroundColor: 'var(--ff-primary-30)' }}>\n <span style={{ color: 'var(--ff-primary-90)' }}>{getFileIcon()}</span>\n </div>\n <div className=\"ff-flex-1 ff-min-w-0\">\n <p className=\"ff-font-medium ff-truncate\" style={{ color: 'var(--ff-primary-110)' }}>\n {documentState.file.name}\n </p>\n <p className=\"ff-text-sm\" style={{ color: 'var(--ff-primary-90)' }}>\n {formatFileSize(documentState.file.size)}\n </p>\n </div>\n <button\n onClick={clearFile}\n className=\"ff-p-1.5 ff-rounded-full ff-transition-colors\"\n style={{ color: 'var(--ff-primary-90)' }}\n aria-label=\"Remove file\"\n >\n <X className=\"ff-w-5 ff-h-5\" />\n </button>\n </div>\n </div>\n\n {/* Preview */}\n <div className=\"ff-document-preview ff-aspect-[3/4] ff-max-h-96\">\n {documentState.file.type === 'application/pdf' ? (\n <iframe\n src={documentState.previewUrl}\n className=\"ff-w-full ff-h-full ff-rounded-xl\"\n title=\"Document preview\"\n />\n ) : (\n <img\n src={documentState.previewUrl}\n alt=\"Document preview\"\n className=\"ff-w-full ff-h-full ff-object-contain ff-rounded-xl\"\n />\n )}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"ff-space-y-6\">\n {/* Document Type Info */}\n <div className=\"ff-text-center ff-mb-4\">\n <h3 className=\"ff-text-lg ff-font-semibold\" style={{ color: 'var(--ff-text-primary)' }}>{documentInfo.label}</h3>\n <p className=\"ff-text-sm ff-mt-1\" style={{ color: 'var(--ff-text-muted)' }}>{documentInfo.description}</p>\n </div>\n\n {/* Dropzone - Demo style */}\n <div\n {...getRootProps()}\n className={clsx(\n 'ff-dropzone',\n isDragActive && 'ff-dropzone-active',\n isLoading && 'ff-opacity-50 ff-cursor-not-allowed'\n )}\n >\n <input {...getInputProps()} />\n <div className=\"ff-dropzone-icon-wrapper\">\n <Upload className=\"ff-dropzone-icon\" />\n </div>\n <h3 className=\"ff-dropzone-text\">\n {isDragActive ? 'Drop your document here' : 'Upload your document'}\n </h3>\n <p className=\"ff-dropzone-hint\">Drag and drop or click to select</p>\n <label className=\"ff-inline-block\">\n <span className={clsx(\n 'ff-btn ff-btn-primary',\n isLoading && 'ff-opacity-50 ff-cursor-wait'\n )}>\n {isLoading ? 'Processing...' : 'Choose file'}\n </span>\n </label>\n <div className=\"ff-flex ff-flex-wrap ff-justify-center ff-gap-2 ff-mt-3\">\n {documentInfo.acceptedFormats.map((format) => (\n <span \n key={format} \n className=\"ff-px-2 ff-py-1 ff-rounded ff-text-xs\"\n style={{ backgroundColor: 'var(--ff-bg-tertiary)', color: 'var(--ff-text-muted)' }}\n >\n {format.toUpperCase()}\n </span>\n ))}\n <span className=\"ff-px-2 ff-py-1 ff-text-xs\" style={{ color: 'var(--ff-text-muted)' }}>\n Max {formatFileSize(documentInfo.maxFileSize)}\n </span>\n </div>\n </div>\n\n {/* Error */}\n {documentState?.error && (\n <div className=\"ff-flex ff-items-center ff-gap-2 ff-p-4 ff-rounded-lg ff-text-sm\" style={{ backgroundColor: 'var(--ff-error-light)', color: 'var(--ff-error)' }}>\n <AlertCircle className=\"ff-w-4 ff-h-4 ff-flex-shrink-0\" />\n <p>{documentState.error}</p>\n </div>\n )}\n\n {/* Tips */}\n <div className=\"ff-rounded-xl ff-p-4\" style={{ backgroundColor: 'var(--ff-bg-secondary)' }}>\n <h4 className=\"ff-text-sm ff-font-medium ff-mb-2\" style={{ color: 'var(--ff-text-secondary)' }}>Tips for best results:</h4>\n <ul className=\"ff-text-sm ff-space-y-1 ff-list-disc ff-list-inside\" style={{ color: 'var(--ff-text-muted)' }}>\n <li>Ensure all text is clearly visible and readable</li>\n <li>Avoid glare, shadows, or blurry images</li>\n <li>Include all four corners of the document</li>\n <li>Use good lighting when taking photos</li>\n </ul>\n </div>\n </div>\n );\n};\n","import React from 'react';\nimport { CheckCircle, XCircle, AlertTriangle, Loader2, Clock } from 'lucide-react';\nimport { clsx } from 'clsx';\nimport { useKYCStore } from '../../store/kyc-store';\nimport type { DocumentType, DocumentStatus as DocStatus } from '@fileflow/shared';\nimport { DOCUMENT_TYPES } from '@fileflow/shared';\n\ninterface DocumentStatusProps {\n documentType: DocumentType;\n showDetails?: boolean;\n}\n\nexport const DocumentStatus: React.FC<DocumentStatusProps> = ({\n documentType,\n showDetails = true,\n}) => {\n const { documents } = useKYCStore();\n const documentState = documents.get(documentType);\n const documentInfo = DOCUMENT_TYPES[documentType];\n\n const getStatusConfig = (status?: DocStatus) => {\n switch (status) {\n case 'completed':\n return {\n icon: CheckCircle,\n iconColor: 'var(--ff-success)',\n bgColor: 'var(--ff-success-light)',\n label: 'Verified',\n labelColor: 'var(--ff-success)',\n description: 'Document successfully processed',\n };\n case 'requires_review':\n return {\n icon: AlertTriangle,\n iconColor: 'var(--ff-warning)',\n bgColor: 'var(--ff-warning-light)',\n label: 'Review Required',\n labelColor: 'var(--ff-warning)',\n description: 'Manual verification may be needed',\n };\n case 'failed':\n return {\n icon: XCircle,\n iconColor: 'var(--ff-error)',\n bgColor: 'var(--ff-error-light)',\n label: 'Failed',\n labelColor: 'var(--ff-error)',\n description: 'Unable to process document',\n };\n case 'processing':\n return {\n icon: Loader2,\n iconColor: 'var(--ff-primary-90)',\n bgColor: 'var(--ff-primary-20)',\n label: 'Processing',\n labelColor: 'var(--ff-primary-90)',\n description: 'Analyzing document...',\n };\n case 'uploaded':\n return {\n icon: Clock,\n iconColor: 'var(--ff-text-secondary)',\n bgColor: 'var(--ff-bg-tertiary)',\n label: 'Pending',\n labelColor: 'var(--ff-text-secondary)',\n description: 'Waiting to be processed',\n };\n default:\n return {\n icon: Clock,\n iconColor: 'var(--ff-text-muted)',\n bgColor: 'var(--ff-bg-tertiary)',\n label: 'Not Uploaded',\n labelColor: 'var(--ff-text-muted)',\n description: 'Upload document to continue',\n };\n }\n };\n\n const statusConfig = getStatusConfig(documentState?.status);\n const Icon = statusConfig.icon;\n\n const getConfidenceColor = (confidence: number) => {\n if (confidence >= 0.8) return 'var(--ff-success)';\n if (confidence >= 0.6) return 'var(--ff-warning)';\n return 'var(--ff-error)';\n };\n\n return (\n <div className=\"ff-space-y-3\">\n {/* Status Header */}\n <div className=\"ff-flex ff-items-center ff-gap-3\">\n <div className=\"ff-p-2 ff-rounded-xl\" style={{ backgroundColor: statusConfig.bgColor }}>\n <Icon\n className={clsx(\n 'ff-w-5 ff-h-5',\n documentState?.status === 'processing' && 'ff-animate-spin'\n )}\n style={{ color: statusConfig.iconColor }}\n />\n </div>\n <div>\n <p className=\"ff-font-medium\" style={{ color: 'var(--ff-text-primary)' }}>{documentInfo.label}</p>\n <p className=\"ff-text-sm\" style={{ color: statusConfig.labelColor }}>{statusConfig.label}</p>\n </div>\n </div>\n\n {/* Confidence Score */}\n {documentState?.confidence !== undefined && documentState.confidence > 0 && (\n <div className=\"ff-space-y-1\">\n <div className=\"ff-flex ff-items-center ff-justify-between ff-text-sm\">\n <span style={{ color: 'var(--ff-text-secondary)' }}>Confidence</span>\n <span className=\"ff-font-medium\" style={{ color: getConfidenceColor(documentState.confidence) }}>\n {Math.round(documentState.confidence * 100)}%\n </span>\n </div>\n <div className=\"ff-progress\">\n <div\n className=\"ff-progress-bar\"\n style={{ \n width: `${documentState.confidence * 100}%`,\n backgroundColor: getConfidenceColor(documentState.confidence)\n }}\n />\n </div>\n </div>\n )}\n\n {/* Fraud Flags */}\n {showDetails && documentState?.fraudFlags && documentState.fraudFlags.length > 0 && (\n <div className=\"ff-space-y-2\">\n <p className=\"ff-text-sm ff-font-medium\" style={{ color: 'var(--ff-text-secondary)' }}>Issues Detected</p>\n <div className=\"ff-space-y-1\">\n {documentState.fraudFlags.map((flag, index) => (\n <div\n key={index}\n className=\"ff-flex ff-items-start ff-gap-2 ff-p-2 ff-rounded-lg ff-text-sm\"\n style={{\n backgroundColor: flag.severity === 'high' ? 'var(--ff-error-light)' : flag.severity === 'medium' ? 'var(--ff-warning-light)' : 'var(--ff-bg-tertiary)',\n color: flag.severity === 'high' ? 'var(--ff-error)' : flag.severity === 'medium' ? 'var(--ff-warning)' : 'var(--ff-text-secondary)',\n }}\n >\n {flag.severity === 'high' ? (\n <XCircle className=\"ff-w-4 ff-h-4 ff-flex-shrink-0 ff-mt-0.5\" />\n ) : (\n <AlertTriangle className=\"ff-w-4 ff-h-4 ff-flex-shrink-0 ff-mt-0.5\" />\n )}\n <span>{flag.message}</span>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {/* Extracted Data Preview */}\n {showDetails &&\n documentState?.extractedData &&\n documentState.status === 'completed' && (\n <div className=\"ff-rounded-xl ff-p-3\" style={{ backgroundColor: 'var(--ff-bg-tertiary)' }}>\n <p className=\"ff-text-sm ff-font-medium ff-mb-2\" style={{ color: 'var(--ff-text-secondary)' }}>\n Extracted Information\n </p>\n <dl className=\"ff-space-y-1 ff-text-sm\">\n {'fullName' in documentState.extractedData && (\n <div className=\"ff-flex ff-justify-between\">\n <dt style={{ color: 'var(--ff-text-muted)' }}>Name</dt>\n <dd className=\"ff-font-medium\" style={{ color: 'var(--ff-text-primary)' }}>\n {documentState.extractedData.fullName}\n </dd>\n </div>\n )}\n {'dateOfBirth' in documentState.extractedData && (\n <div className=\"ff-flex ff-justify-between\">\n <dt style={{ color: 'var(--ff-text-muted)' }}>Date of Birth</dt>\n <dd style={{ color: 'var(--ff-text-primary)' }}>{documentState.extractedData.dateOfBirth}</dd>\n </div>\n )}\n {documentState.extractedData.documentType === 'passport' &&\n 'passportNumber' in documentState.extractedData && (\n <div className=\"ff-flex ff-justify-between\">\n <dt style={{ color: 'var(--ff-text-muted)' }}>Passport #</dt>\n <dd className=\"ff-font-mono\" style={{ color: 'var(--ff-text-primary)' }}>\n {documentState.extractedData.passportNumber}\n </dd>\n </div>\n )}\n {documentState.extractedData.documentType === 'drivers_license' &&\n 'licenseNumber' in documentState.extractedData && (\n <div className=\"ff-flex ff-justify-between\">\n <dt style={{ color: 'var(--ff-text-muted)' }}>License #</dt>\n <dd className=\"ff-font-mono\" style={{ color: 'var(--ff-text-primary)' }}>\n {documentState.extractedData.licenseNumber}\n </dd>\n </div>\n )}\n {'address' in documentState.extractedData && documentState.extractedData.address && (\n <div className=\"ff-flex ff-justify-between\">\n <dt style={{ color: 'var(--ff-text-muted)' }}>Address</dt>\n <dd className=\"ff-text-right\" style={{ color: 'var(--ff-text-primary)' }}>\n {documentState.extractedData.address.city},{' '}\n {documentState.extractedData.address.province}\n </dd>\n </div>\n )}\n </dl>\n </div>\n )}\n </div>\n );\n};\n","import React, { useCallback, useEffect, useState } from 'react';\nimport {\n FileText,\n Car,\n Home,\n CheckCircle,\n X,\n Loader2,\n ChevronRight,\n ShieldCheck,\n Shield,\n} from 'lucide-react';\nimport { clsx } from 'clsx';\nimport { useKYCStore, type KYCStep } from '../../store/kyc-store';\nimport { getClient } from '../../api/client';\nimport { DocumentUploader } from './DocumentUploader';\nimport { DocumentStatus } from './DocumentStatus';\nimport type { DocumentType, KYCSession, KYCDocument } from '@fileflow/shared';\nimport { DOCUMENT_TYPES } from '@fileflow/shared';\n\n// KYC steps for the step indicator\nconst KYC_STEP_LABELS = ['select', 'upload', 'review', 'complete'] as const;\n\ninterface KYCWizardProps {\n requiredDocuments: DocumentType[];\n onComplete?: (session: KYCSession) => void;\n onCancel?: () => void;\n onError?: (error: Error) => void;\n}\n\nconst DOCUMENT_ICONS: Record<DocumentType, React.ElementType> = {\n passport: FileText,\n drivers_license: Car,\n proof_of_address: Home,\n};\n\nexport const KYCWizard: React.FC<KYCWizardProps> = ({\n requiredDocuments,\n onComplete,\n onCancel,\n onError,\n}) => {\n const {\n sessionId,\n step,\n currentDocumentType,\n documents,\n isVerified,\n verificationStatus,\n isLoading,\n error,\n setSessionId,\n setRequiredDocuments,\n setCurrentDocumentType,\n setDocumentStatus,\n setDocumentData,\n setStep,\n nextDocument,\n setVerificationStatus,\n setVerified,\n setLoading,\n setError,\n areAllDocumentsUploaded,\n areAllDocumentsProcessed,\n reset,\n } = useKYCStore();\n\n const [pollingDocument, setPollingDocument] = useState<string | null>(null);\n\n // Initialize\n useEffect(() => {\n setRequiredDocuments(requiredDocuments);\n initializeSession();\n\n return () => {\n // Cleanup polling on unmount\n setPollingDocument(null);\n };\n }, [requiredDocuments]);\n\n const initializeSession = async () => {\n try {\n setLoading(true);\n const client = getClient();\n const result = await client.createKYCSession(requiredDocuments);\n setSessionId(result.sessionId);\n setStep('upload');\n } catch (err) {\n const error = err as Error;\n setError(error.message);\n onError?.(error);\n } finally {\n setLoading(false);\n }\n };\n\n const handleFileSelect = useCallback(\n async (file: File) => {\n if (!sessionId || !currentDocumentType) return;\n\n try {\n setLoading(true);\n setError(null);\n\n const client = getClient();\n const result = await client.uploadKYCDocument(sessionId, currentDocumentType, file);\n\n setDocumentData(currentDocumentType, {\n id: result.documentId,\n status: 'processing',\n });\n\n // Start polling for document status\n setPollingDocument(result.documentId);\n pollDocumentStatus(result.documentId);\n } catch (err) {\n const error = err as Error;\n setDocumentData(currentDocumentType, {\n status: 'failed',\n error: error.message,\n });\n onError?.(error);\n } finally {\n setLoading(false);\n }\n },\n [sessionId, currentDocumentType]\n );\n\n const pollDocumentStatus = async (documentId: string) => {\n const maxAttempts = 30;\n const maxConsecutiveErrors = 3; // Stop after 3 consecutive errors\n let attempts = 0;\n let consecutiveErrors = 0;\n\n const poll = async () => {\n if (attempts >= maxAttempts) {\n setPollingDocument(null);\n if (currentDocumentType) {\n setDocumentData(currentDocumentType, {\n status: 'failed',\n error: 'Processing timed out. Please try again.',\n });\n }\n return;\n }\n\n // Stop polling if we've had too many consecutive errors\n if (consecutiveErrors >= maxConsecutiveErrors) {\n setPollingDocument(null);\n if (currentDocumentType) {\n setDocumentData(currentDocumentType, {\n status: 'failed',\n error: 'Failed to check document status. Please refresh and try again.',\n });\n }\n return;\n }\n\n try {\n const client = getClient();\n const result = await client.getKYCDocument(documentId);\n const doc = result.document as KYCDocument;\n\n // Reset consecutive errors on success\n consecutiveErrors = 0;\n\n const docType = doc.type as DocumentType;\n setDocumentData(docType, {\n id: doc.id,\n status: doc.status,\n extractedData: doc.extractedData,\n confidence: doc.confidence,\n fraudFlags: doc.fraudFlags,\n error: null, // Clear any previous errors\n });\n\n if (doc.status === 'completed' || doc.status === 'requires_review' || doc.status === 'failed') {\n setPollingDocument(null);\n\n // Check if all documents are processed\n if (areAllDocumentsUploaded()) {\n const allProcessed = areAllDocumentsProcessed();\n if (allProcessed) {\n setStep('review');\n }\n } else {\n // Move to next document\n nextDocument();\n }\n return;\n }\n\n // Continue polling\n attempts++;\n setTimeout(poll, 2000);\n } catch (err) {\n const error = err as Error & { status?: number };\n consecutiveErrors++;\n attempts++;\n \n // On 404, stop immediately - the document doesn't exist\n if (error.status === 404 || error.message?.includes('not found')) {\n setPollingDocument(null);\n if (currentDocumentType) {\n setDocumentData(currentDocumentType, {\n status: 'failed',\n error: 'Session not found or invalid state',\n });\n }\n return;\n }\n\n // On other errors, retry with backoff (up to maxConsecutiveErrors times)\n if (consecutiveErrors < maxConsecutiveErrors) {\n setTimeout(poll, 3000 * consecutiveErrors); // Exponential backoff\n } else {\n setPollingDocument(null);\n if (currentDocumentType) {\n setDocumentData(currentDocumentType, {\n status: 'failed',\n error: error.message || 'Failed to process document',\n });\n }\n }\n }\n };\n\n poll();\n };\n\n const handleVerify = async () => {\n if (!sessionId) return;\n\n try {\n setLoading(true);\n setError(null);\n\n const client = getClient();\n const result = await client.verifyKYCSession(sessionId, true);\n\n setVerificationStatus(result.verificationStatus);\n const status = result.verificationStatus as { isVerified: boolean };\n setVerified(status.isVerified);\n setStep('complete');\n\n onComplete?.(result as unknown as KYCSession);\n } catch (err) {\n const error = err as Error;\n setError(error.message);\n onError?.(error);\n } finally {\n setLoading(false);\n }\n };\n\n const handleCancel = () => {\n reset();\n onCancel?.();\n };\n\n const selectDocument = (type: DocumentType) => {\n setCurrentDocumentType(type);\n setStep('upload');\n };\n\n const isDocumentComplete = (type: DocumentType) => {\n const doc = documents.get(type);\n return doc?.status === 'completed' || doc?.status === 'requires_review';\n };\n\n // Get step index for the step indicator\n const getDisplayStepIndex = () => {\n const currentStep = step === 'processing' ? 'upload' : step;\n return KYC_STEP_LABELS.indexOf(currentStep as typeof KYC_STEP_LABELS[number]);\n };\n\n return (\n <div className=\"ff-container ff-modal\">\n {/* Modal Header - Demo style */}\n <div className=\"ff-modal-header\">\n <div className=\"ff-modal-header-left\">\n <div className=\"ff-flex ff-items-center ff-gap-3\">\n <div className=\"ff-modal-icon\">\n <Shield />\n </div>\n <h2 className=\"ff-modal-title\">Identity Verification</h2>\n </div>\n {/* Step Indicator - Demo style */}\n <div className=\"ff-steps ff-ml-4\">\n {KYC_STEP_LABELS.map((s, i) => (\n <React.Fragment key={s}>\n <div\n className={clsx(\n 'ff-step',\n getDisplayStepIndex() === i && 'ff-step-active',\n getDisplayStepIndex() > i && 'ff-step-complete',\n getDisplayStepIndex() < i && 'ff-step-pending'\n )}\n >\n {getDisplayStepIndex() > i ? '✓' : i + 1}\n </div>\n {i < KYC_STEP_LABELS.length - 1 && (\n <div className={clsx(\n 'ff-step-connector',\n getDisplayStepIndex() > i && 'ff-step-connector-complete'\n )} />\n )}\n </React.Fragment>\n ))}\n </div>\n </div>\n <button\n onClick={handleCancel}\n className=\"ff-modal-close\"\n >\n <X className=\"ff-w-5 ff-h-5\" />\n </button>\n </div>\n\n {/* Modal Body */}\n <div className=\"ff-modal-body\">\n {error && (\n <div className=\"ff-mb-4 ff-p-4 ff-rounded-lg ff-text-sm\" style={{ backgroundColor: 'var(--ff-error-light)', color: 'var(--ff-error)' }}>\n {error}\n </div>\n )}\n\n {/* Document Selection */}\n {step === 'select' && (\n <div className=\"ff-space-y-4\">\n <p className=\"ff-text-center ff-mb-6\" style={{ color: 'var(--ff-text-muted)' }}>\n Please upload the following documents to verify your identity\n </p>\n <div className=\"ff-grid ff-gap-3\">\n {requiredDocuments.map((type) => {\n const Icon = DOCUMENT_ICONS[type];\n const info = DOCUMENT_TYPES[type];\n const doc = documents.get(type);\n const isComplete = isDocumentComplete(type);\n\n return (\n <button\n key={type}\n onClick={() => selectDocument(type)}\n className={clsx(\n 'ff-flex ff-items-center ff-gap-4 ff-p-4 ff-rounded-xl ff-border-2 ff-text-left ff-transition-all ff-duration-150',\n isComplete\n ? 'ff-border-transparent'\n : 'ff-border-transparent hover:ff-border-transparent'\n )}\n style={{\n backgroundColor: isComplete ? 'var(--ff-success-light)' : 'var(--ff-bg-secondary)',\n borderColor: isComplete ? 'var(--ff-success)' : 'var(--ff-border-light)',\n }}\n >\n <div\n className=\"ff-p-3 ff-rounded-xl\"\n style={{\n backgroundColor: isComplete ? 'rgba(41, 142, 51, 0.15)' : 'var(--ff-bg-tertiary)',\n }}\n >\n {isComplete ? (\n <CheckCircle className=\"ff-w-6 ff-h-6\" style={{ color: 'var(--ff-success)' }} />\n ) : (\n <Icon className=\"ff-w-6 ff-h-6\" style={{ color: 'var(--ff-text-secondary)' }} />\n )}\n </div>\n <div className=\"ff-flex-1\">\n <p className=\"ff-font-medium\" style={{ color: 'var(--ff-text-primary)' }}>{info.label}</p>\n <p className=\"ff-text-sm\" style={{ color: 'var(--ff-text-muted)' }}>{info.description}</p>\n </div>\n <ChevronRight className=\"ff-w-5 ff-h-5\" style={{ color: 'var(--ff-text-muted)' }} />\n </button>\n );\n })}\n </div>\n </div>\n )}\n\n {/* Document Upload */}\n {step === 'upload' && currentDocumentType && (\n <div className=\"ff-py-4\">\n <div className=\"ff-max-w-lg ff-mx-auto\">\n <DocumentUploader documentType={currentDocumentType} onFileSelect={handleFileSelect} />\n </div>\n </div>\n )}\n\n {/* Processing */}\n {step === 'processing' && (\n <div className=\"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12\">\n <Loader2 className=\"ff-w-12 ff-h-12 ff-animate-spin ff-mb-4\" style={{ color: 'var(--ff-primary-90)' }} />\n <h3 className=\"ff-text-lg ff-font-semibold ff-mb-2\" style={{ color: 'var(--ff-text-primary)' }}>\n Processing Documents\n </h3>\n <p style={{ color: 'var(--ff-text-muted)' }} className=\"ff-text-center\">\n We're analyzing your documents. This may take a moment...\n </p>\n </div>\n )}\n\n {/* Review */}\n {step === 'review' && (\n <div className=\"ff-space-y-6\">\n <div className=\"ff-text-center ff-mb-6\">\n <h3 className=\"ff-text-lg ff-font-semibold\" style={{ color: 'var(--ff-text-primary)' }}>Review Your Documents</h3>\n <p style={{ color: 'var(--ff-text-muted)' }}>\n Please review the extracted information before completing verification\n </p>\n </div>\n\n <div className=\"ff-grid ff-gap-4\">\n {requiredDocuments.map((type) => (\n <div\n key={type}\n className=\"ff-rounded-xl ff-p-4\"\n style={{ backgroundColor: 'var(--ff-bg-secondary)', border: '1px solid var(--ff-border-light)' }}\n >\n <DocumentStatus documentType={type} showDetails={true} />\n </div>\n ))}\n </div>\n </div>\n )}\n\n {/* Complete */}\n {step === 'complete' && (\n <div className=\"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12\">\n <div\n className=\"ff-w-16 ff-h-16 ff-rounded-full ff-flex ff-items-center ff-justify-center ff-mb-4\"\n style={{ backgroundColor: isVerified ? 'var(--ff-success-light)' : 'var(--ff-warning-light)' }}\n >\n {isVerified ? (\n <CheckCircle className=\"ff-w-10 ff-h-10\" style={{ color: 'var(--ff-success)' }} />\n ) : (\n <ShieldCheck className=\"ff-w-10 ff-h-10\" style={{ color: 'var(--ff-warning)' }} />\n )}\n </div>\n <h3 className=\"ff-text-xl ff-font-semibold ff-mb-2\" style={{ color: 'var(--ff-text-primary)' }}>\n {isVerified ? 'Verification Complete!' : 'Review Required'}\n </h3>\n <p style={{ color: 'var(--ff-text-muted)' }} className=\"ff-text-center\">\n {isVerified\n ? 'Your identity has been successfully verified.'\n : 'Additional review may be required. We will contact you if needed.'}\n </p>\n </div>\n )}\n </div>\n\n {/* Modal Footer */}\n {step !== 'complete' && (\n <div className=\"ff-modal-footer\">\n <button\n onClick={() => {\n if (step === 'upload') {\n setStep('select');\n } else if (step === 'review') {\n setStep('select');\n }\n }}\n disabled={isLoading}\n className=\"ff-btn ff-btn-secondary\"\n >\n Back\n </button>\n\n {step === 'review' && (\n <button\n onClick={handleVerify}\n disabled={isLoading || !areAllDocumentsProcessed()}\n className=\"ff-btn ff-btn-primary\"\n >\n {isLoading ? (\n <>\n <Loader2 className=\"ff-w-4 ff-h-4 ff-animate-spin\" />\n Verifying...\n </>\n ) : (\n 'Complete Verification'\n )}\n </button>\n )}\n\n {step === 'select' && areAllDocumentsUploaded() && (\n <button\n onClick={() => setStep('review')}\n className=\"ff-btn ff-btn-primary\"\n >\n Review & Verify\n </button>\n )}\n </div>\n )}\n </div>\n );\n};\n"],"names":["Car","createLucideIcon","Clock","FileText","Home","Image","ShieldCheck","Shield","createEmptyDocumentState","type","initialState","useKYCStore","create","set","get","sessionId","documents","docsMap","file","doc","previewUrl","updated","status","data","step","requiredDocuments","currentDocumentType","currentIndex","i","verified","isLoading","error","DocumentUploader","documentType","onFileSelect","setDocumentFile","documentState","documentInfo","DOCUMENT_TYPES","onDrop","useCallback","acceptedFiles","rejectedFiles","getRootProps","getInputProps","isDragActive","useDropzone","formatFileSize","bytes","getFileIcon","_a","jsx","clearFile","e","jsxs","X","clsx","Upload","format","AlertCircle","DocumentStatus","showDetails","statusConfig","CheckCircle","AlertTriangle","XCircle","Loader2","Icon","getConfidenceColor","confidence","flag","index","KYC_STEP_LABELS","DOCUMENT_ICONS","KYCWizard","onComplete","onCancel","onError","isVerified","verificationStatus","setSessionId","setRequiredDocuments","setCurrentDocumentType","setDocumentStatus","setDocumentData","setStep","nextDocument","setVerificationStatus","setVerified","setLoading","setError","areAllDocumentsUploaded","areAllDocumentsProcessed","reset","pollingDocument","setPollingDocument","useState","useEffect","initializeSession","result","getClient","err","handleFileSelect","pollDocumentStatus","documentId","attempts","consecutiveErrors","poll","docType","handleVerify","handleCancel","selectDocument","isDocumentComplete","getDisplayStepIndex","currentStep","s","React","info","isComplete","ChevronRight","Fragment"],"mappings":";;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAMC,EAAiB,OAAO;AAAA,EAClC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,UAAU,EAAE,IAAI,KAAK,IAAI,MAAM,GAAG,KAAK,KAAK,UAAU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