@vpdev2/metakyc 1.0.55 → 1.0.57

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.
@@ -1,5 +1,4 @@
1
- export interface PreCreateApplicantParams {
2
- workflowKey: string;
1
+ export interface ApplicantPreFillParams {
3
2
  firstName?: string;
4
3
  lastName?: string;
5
4
  email?: string;
@@ -17,23 +16,31 @@ export interface CreateSessionTokenParams {
17
16
  /** String client ID (non-ABP projects). Provide this OR tenantId. */
18
17
  clientId?: string;
19
18
  /**
20
- * Optional external reference ID to bind the session token to a specific user.
21
- * When set, the server enforces that all API calls made with this token
22
- * can only create/access applicants matching this externalRefId.
19
+ * Your system's unique user identifier. The server automatically creates or
20
+ * finds an applicant matching this ID, so the response always includes `applicantId`.
21
+ */
22
+ externalRefId: string;
23
+ /**
24
+ * Workflow key for this session. Together with `externalRefId`, the server
25
+ * creates or retrieves the applicant assigned to this workflow.
26
+ */
27
+ workflowKey: string;
28
+ /**
29
+ * When true, the SDK shows the company applicant form instead of individual.
30
+ * Embedded in the token so the SDK auto-detects the form type.
23
31
  */
24
- externalRefId?: string;
32
+ isCompany?: boolean;
25
33
  /**
26
- * Optional: pre-create a skeleton applicant during token creation.
27
- * When provided, the response includes `applicantId` which can be passed
28
- * to the SDK so the CreateApplicantForm starts pre-filled.
34
+ * Optional pre-fill data for the applicant (email, name, etc.).
35
+ * The applicant is always created; this just seeds initial field values.
29
36
  */
30
- applicant?: PreCreateApplicantParams;
37
+ applicant?: ApplicantPreFillParams;
31
38
  }
32
39
  export interface SessionTokenResult {
33
40
  accessToken: string;
34
41
  expiresInSeconds: number;
35
- /** Present when an applicant was pre-created via the `applicant` parameter. */
36
- applicantId?: number;
42
+ /** The applicant ID created/found for this externalRefId + workflowKey combination. */
43
+ applicantId: number;
37
44
  }
38
45
  /**
39
46
  * Server-side utility to create a short-lived SDK session token.
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/client/session.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,wBAAwB,CAAC;CACtC;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,qBAAa,cAAc;WACZ,WAAW,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAkCxF"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/client/session.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,uFAAuF;IACvF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,qBAAa,cAAc;WACZ,WAAW,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA6CxF"}
@@ -0,0 +1,31 @@
1
+ import { default as React } from 'react';
2
+ import { WorkflowResultType } from '../types';
3
+ export interface MetaKYCProps {
4
+ /** Override company detection from the token. When true, shows the company form. */
5
+ isCompany?: boolean;
6
+ /** Called when the entire workflow completes */
7
+ onComplete?: (result: WorkflowResultType) => void;
8
+ /** Called when an error occurs */
9
+ onError?: (error: Error) => void;
10
+ /** Called after the applicant is created (before the workflow starts) */
11
+ onApplicantCreated?: (applicantId: number) => void;
12
+ className?: string;
13
+ }
14
+ /**
15
+ * Unified MetaKYC component.
16
+ *
17
+ * Automatically determines what to display based on the session token:
18
+ * - If no applicant exists for the token's ExternalRefId → shows the create form
19
+ * - If an applicant exists but has no progress (skeleton) → shows the create form (pre-filled)
20
+ * - If an applicant has active progress → shows the KYC workflow
21
+ * - If finished or on-hold → shows the status display (handled inside KycWorkflow)
22
+ *
23
+ * Usage:
24
+ * ```tsx
25
+ * <MetaKYCProvider config={{ baseUrl, getAccessToken: () => token }}>
26
+ * <MetaKYC onComplete={(result) => console.log(result)} />
27
+ * </MetaKYCProvider>
28
+ * ```
29
+ */
30
+ export declare const MetaKYC: React.FC<MetaKYCProps>;
31
+ //# sourceMappingURL=MetaKYC.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetaKYC.d.ts","sourceRoot":"","sources":["../../src/components/MetaKYC.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,WAAW,YAAY;IAC3B,oFAAoF;IACpF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gDAAgD;IAChD,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAClD,kCAAkC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAuH1C,CAAC"}
@@ -7,4 +7,5 @@ export * from './Header';
7
7
  export * from './CreateApplicantForm';
8
8
  export * from './CreateCompanyApplicantForm';
9
9
  export * from './KycWorkflow';
10
+ export * from './MetaKYC';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './useKycWorkflow';
2
+ export * from './useMetaKYCFlow';
2
3
  export * from './useQuestionnaire';
3
4
  export * from './useUploadDocument';
4
5
  export * from './useAppropriatenessTest';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { SdkPhase } from '../types';
2
+ export interface MetaKYCFlowState {
3
+ phase: SdkPhase | 'loading' | 'error';
4
+ applicantId?: number;
5
+ isCompany: boolean;
6
+ workflowKey?: string;
7
+ error?: Error;
8
+ isLoading: boolean;
9
+ /**
10
+ * Transition to the workflow phase after applicant creation.
11
+ * Call this from the form's onSuccess callback.
12
+ */
13
+ transitionToWorkflow: (applicantId: number) => void;
14
+ /** Re-fetch the SDK state from the backend */
15
+ refresh: () => Promise<void>;
16
+ }
17
+ export declare function useMetaKYCFlow(isCompanyOverride?: boolean): MetaKYCFlowState;
18
+ //# sourceMappingURL=useMetaKYCFlow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMetaKYCFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useMetaKYCFlow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,oBAAoB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,8CAA8C;IAC9C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,wBAAgB,cAAc,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAiD5E"}