@modulrfinance/customer-verification-sdk 1.0.0-beta.1 → 2.0.0-beta.1
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/cdn/modulr-customer-verification-sdk.js +84 -28
- package/index.mjs +4982 -3923
- package/lib/browser-sdk-api.d.ts +1 -1
- package/lib/components/forms/forms.loader.d.ts +26 -0
- package/lib/config/sdk.config.d.ts +4 -1
- package/lib/sdk.d.ts +1 -1
- package/lib/sdk.handler.d.ts +10 -1
- package/lib/sdk.model.d.ts +49 -5
- package/package.json +34 -34
package/lib/browser-sdk-api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BrowserSdkApi } from './sdk.model';
|
|
2
|
-
export declare function createBrowserApi(version: string, init: BrowserSdkApi['init']): BrowserSdkApi;
|
|
2
|
+
export declare function createBrowserApi(version: string, init: BrowserSdkApi['init'], signedFetch: BrowserSdkApi['signedFetch'], getApiBaseUrl: BrowserSdkApi['getApiBaseUrl'], getExpApiBaseUrl: BrowserSdkApi['getExpApiBaseUrl'], notifyFormExit: BrowserSdkApi['notifyFormExit'], notifyBusinessTypeSelected: BrowserSdkApi['notifyBusinessTypeSelected']): BrowserSdkApi;
|
|
3
3
|
export declare function registerBrowserApi(api: BrowserSdkApi): void;
|
|
4
4
|
//# sourceMappingURL=browser-sdk-api.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CachedApplicationDetails, OnboardingQueryParams } from '../../sdk.model';
|
|
2
|
+
export declare const ONBOARDING_ELEMENT_TAG = "mod-cvsdk-onboarding";
|
|
3
|
+
/**
|
|
4
|
+
* Loads the prebuilt <mod-cvsdk-onboarding> Custom Element bundle (compiled by the isolated
|
|
5
|
+
* cvsdk-forms-element project). TEMPORARY: the bundle's source is inlined at build time via
|
|
6
|
+
* Vite `?raw` imports and injected via Blob URLs at runtime, so it ships inside this package's
|
|
7
|
+
* own bundle instead of being fetched from a separately hosted URL. This intentionally
|
|
8
|
+
* reintroduces Angular into dist/index.mjs and dist/cdn/*.js (scripts/check-agnostic.mjs will
|
|
9
|
+
* fail) as an accepted tradeoff to unblock testing before real asset hosting exists.
|
|
10
|
+
*
|
|
11
|
+
* See {@link FORMS_ASSET_BASE_URL_GLOBAL} for the dev-only escape hatch that loads the same
|
|
12
|
+
* bundle over HTTP instead, so its sourcemaps resolve.
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadFormsElement(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Local copy of the bridge shape cvsdk-forms-element's forms-element-bridge.ts exposes on
|
|
17
|
+
* `window.__cvsdkFormsElementBridge` — this project cannot import from that one's source
|
|
18
|
+
* directly, same build-order cycle as browser-sdk-api.ts's forward bridge. Feeds the id
|
|
19
|
+
* <mod-cvsdk-onboarding>'s wrapped ContinueApplicationComponent reads via ActivatedRoute (it has
|
|
20
|
+
* no `@Input()`s of its own), the isSourceSDK flag its host adapter's loadFormConfig gates
|
|
21
|
+
* its Experience API call on, and optional onboarding query parameters. Must be called before
|
|
22
|
+
* the element is appended to the document — that's when its component is created and reads
|
|
23
|
+
* both values synchronously.
|
|
24
|
+
*/
|
|
25
|
+
export declare function setFormsElementOnboardingRequest(applicationId: string, isSourceSDK: boolean, onboardingParams?: OnboardingQueryParams, applicationDetails?: CachedApplicationDetails): void;
|
|
26
|
+
//# sourceMappingURL=forms.loader.d.ts.map
|
|
@@ -3,9 +3,12 @@ export declare const API_BASE_URL_SANDBOX = "https://api-sandbox.modulrfinance.c
|
|
|
3
3
|
export declare const API_BASE_URL_DEV = "https://api-dev.aws.modulrfinance.io/api-dev";
|
|
4
4
|
export declare const SDK_CONFIG: {
|
|
5
5
|
baseUrl: string;
|
|
6
|
+
expApiBaseUrl?: string;
|
|
7
|
+
userId?: string;
|
|
6
8
|
};
|
|
9
|
+
export declare function isSdkRequestUrl(url: string): boolean;
|
|
7
10
|
export declare const SDK_HEADERS: {
|
|
8
|
-
readonly 'x-mod-version':
|
|
11
|
+
readonly 'x-mod-web-sdk-version': string;
|
|
9
12
|
};
|
|
10
13
|
export declare const STATUS_POLL_INTERVAL_MS = 5000;
|
|
11
14
|
export declare const STATUS_POLL_TIMEOUT_MS = 60000;
|
package/lib/sdk.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BrowserSdkApi, CustomerVerificationSdkConfig, CustomerVerificationSdkInstance } from './sdk.model';
|
|
2
|
-
export { ApplicationStatus, SdkEventType, SdkResultType } from './sdk.model';
|
|
2
|
+
export { ApplicationStatus, ApplicationType, SdkEventType, SdkResultType } from './sdk.model';
|
|
3
3
|
export type { BrowserSdkApi, CloseOptions, CloseSuccessResult, ComponentOverride, CustomerVerificationSdkConfig, CustomerVerificationSdkInstance, CustomStyle, CustomTheme, InitSuccessResult, OpenOptions, OpenSuccessResult, SdkErrorResult, SdkEvent } from './sdk.model';
|
|
4
4
|
export declare function init(config: CustomerVerificationSdkConfig): Promise<CustomerVerificationSdkInstance>;
|
|
5
5
|
export declare const ModulrCustomerVerificationSdk: BrowserSdkApi;
|
package/lib/sdk.handler.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CloseOptions, CustomerVerificationSdkInstance, OpenOptions, SdkErrorResult } from './sdk.model';
|
|
1
|
+
import { CachedApplicationDetails, CloseOptions, CustomerVerificationSdkInstance, OpenOptions, SdkErrorResult } from './sdk.model';
|
|
2
2
|
type ReadyOptions = {
|
|
3
3
|
onAlloyComplete?: (data: unknown) => void;
|
|
4
4
|
};
|
|
@@ -6,6 +6,7 @@ export declare class CustomerVerificationSdkController implements CustomerVerifi
|
|
|
6
6
|
private isReady;
|
|
7
7
|
private formMessage;
|
|
8
8
|
private activeDummyRoot;
|
|
9
|
+
private activeFormsRoot;
|
|
9
10
|
private activeSpinnerRoot;
|
|
10
11
|
private activeContainerId;
|
|
11
12
|
private activeOnClose;
|
|
@@ -14,8 +15,13 @@ export declare class CustomerVerificationSdkController implements CustomerVerifi
|
|
|
14
15
|
private activeCloseCleanup;
|
|
15
16
|
private onAlloyComplete;
|
|
16
17
|
private hasOpenedAlloy;
|
|
18
|
+
private isKybFlow;
|
|
19
|
+
private activeApplicationId;
|
|
20
|
+
private activeOnboardingParams;
|
|
21
|
+
private cachedApplicationDetails;
|
|
17
22
|
markReady(options?: ReadyOptions): void;
|
|
18
23
|
markReadyForForm(message: string): void;
|
|
24
|
+
markReadyForKyb(applicationId: string, applicationDetails?: CachedApplicationDetails): void;
|
|
19
25
|
setCloseCleanup(cleanup: () => void): void;
|
|
20
26
|
runAndClearOnComplete(data: unknown, onError?: (error: SdkErrorResult) => void): void;
|
|
21
27
|
private runAndClearCloseCleanup;
|
|
@@ -23,6 +29,9 @@ export declare class CustomerVerificationSdkController implements CustomerVerifi
|
|
|
23
29
|
private showSpinner;
|
|
24
30
|
private removeSpinner;
|
|
25
31
|
private removeDummyComponent;
|
|
32
|
+
private removeFormsComponent;
|
|
33
|
+
private mountFormsElement;
|
|
34
|
+
remountFormsElementWithCompanyType(companyType?: string): Promise<void>;
|
|
26
35
|
private showDummyComponent;
|
|
27
36
|
closeInternally(onError?: (error: SdkErrorResult) => void): void;
|
|
28
37
|
open(options?: OpenOptions): Promise<void>;
|
package/lib/sdk.model.d.ts
CHANGED
|
@@ -11,6 +11,23 @@ export declare enum ApplicationStatus {
|
|
|
11
11
|
DECLINED = "DECLINED",
|
|
12
12
|
MANUAL_REVIEW = "MANUAL_REVIEW"
|
|
13
13
|
}
|
|
14
|
+
export declare enum ApplicationType {
|
|
15
|
+
KYC = "KYC",
|
|
16
|
+
KYB = "KYB"
|
|
17
|
+
}
|
|
18
|
+
export declare enum JourneyType {
|
|
19
|
+
EXTERNAL_IDENTITY = "EXTERNAL_IDENTITY",
|
|
20
|
+
DIRECT_SME = "DIRECT_SME",
|
|
21
|
+
DELEGATE = "DELEGATE",
|
|
22
|
+
DIRECT_PARTNER = "DIRECT_PARTNER",
|
|
23
|
+
PARTNER_INVITE = "PARTNER_INVITE",
|
|
24
|
+
PARTNER_INTRODUCED = "PARTNER_INTRODUCED",
|
|
25
|
+
DELEGATE_INTRODUCED = "DELEGATE_INTRODUCED"
|
|
26
|
+
}
|
|
27
|
+
export declare enum LegalEntity {
|
|
28
|
+
MFSL = "MFSL",
|
|
29
|
+
MFBV = "MFBV"
|
|
30
|
+
}
|
|
14
31
|
export declare enum SdkEventType {
|
|
15
32
|
NEW = "NEW",
|
|
16
33
|
IN_PROGRESS = "IN_PROGRESS",
|
|
@@ -49,6 +66,7 @@ export type CloseSuccessResult = {
|
|
|
49
66
|
export type OpenOptions = {
|
|
50
67
|
containerId?: string;
|
|
51
68
|
loadingText?: string;
|
|
69
|
+
onboardingParams?: OnboardingQueryParams;
|
|
52
70
|
onSuccess?: (result: OpenSuccessResult) => void;
|
|
53
71
|
onComplete?: (data: unknown) => void;
|
|
54
72
|
onError?: (error: SdkErrorResult) => void;
|
|
@@ -58,9 +76,31 @@ export type CloseOptions = {
|
|
|
58
76
|
onSuccess?: (result: CloseSuccessResult) => void;
|
|
59
77
|
onError?: (error: SdkErrorResult) => void;
|
|
60
78
|
};
|
|
79
|
+
export type OnboardingQueryParams = {
|
|
80
|
+
journeyType?: string;
|
|
81
|
+
companyType?: string;
|
|
82
|
+
verificationProvider?: string;
|
|
83
|
+
legalEntity?: string;
|
|
84
|
+
applicationCountryCode?: string;
|
|
85
|
+
clientInvited?: boolean | string;
|
|
86
|
+
};
|
|
87
|
+
export type CachedApplicationDetails = {
|
|
88
|
+
status: string;
|
|
89
|
+
journeyType: string;
|
|
90
|
+
legalEntity: string;
|
|
91
|
+
};
|
|
61
92
|
export interface BrowserSdkApi {
|
|
62
93
|
version: string;
|
|
63
94
|
init(config: CustomerVerificationSdkConfig): Promise<CustomerVerificationSdkInstance>;
|
|
95
|
+
signedFetch(url: string, init?: RequestInit): Promise<Response>;
|
|
96
|
+
getApiBaseUrl(): string;
|
|
97
|
+
getExpApiBaseUrl(): string;
|
|
98
|
+
notifyFormExit(intent: {
|
|
99
|
+
journeyType?: string;
|
|
100
|
+
reason?: string;
|
|
101
|
+
errorMessage?: string;
|
|
102
|
+
}): void;
|
|
103
|
+
notifyBusinessTypeSelected(applicationId: string, companyType?: string): void;
|
|
64
104
|
}
|
|
65
105
|
export interface CustomerVerificationSdkConfig {
|
|
66
106
|
applicationId: string;
|
|
@@ -72,10 +112,14 @@ export interface CustomerVerificationSdkConfig {
|
|
|
72
112
|
customStyle?: CustomStyle;
|
|
73
113
|
/** Override the SDK API base URL. Useful for proxying in local development (e.g. '/api-dev'). */
|
|
74
114
|
baseUrl?: string;
|
|
115
|
+
/** Override the base URL for the Experience API call only; other calls keep using baseUrl. */
|
|
116
|
+
expApiBaseUrl?: string;
|
|
75
117
|
/** Whether to use production API endpoints. Defaults to true. When false, uses sandbox URLs. */
|
|
76
118
|
production?: boolean;
|
|
77
119
|
/** When true, uses dev API endpoints regardless of the production flag. For internal development only. */
|
|
78
120
|
isDev?: boolean;
|
|
121
|
+
/** Optional userId to add to the x-mod-user-id header for all API requests. */
|
|
122
|
+
userId?: string;
|
|
79
123
|
}
|
|
80
124
|
export interface CustomerVerificationSdkInstance {
|
|
81
125
|
open(options?: OpenOptions): Promise<void>;
|
|
@@ -87,12 +131,12 @@ export declare const SDK_MESSAGES: {
|
|
|
87
131
|
readonly INIT_SUCCESS: "CustomerVerificationSDK initialized successfully";
|
|
88
132
|
readonly INIT_FAILED: "Failed to initialize SDK";
|
|
89
133
|
readonly OPEN_SUCCESS: "Opening Onboarding verification form";
|
|
90
|
-
readonly OPEN_FORM_SUCCESS: "
|
|
134
|
+
readonly OPEN_FORM_SUCCESS: "The application is ready. Please provide the requested details via API to proceed.";
|
|
91
135
|
readonly CLOSE_SUCCESS: "SDK closed successfully";
|
|
92
|
-
readonly FORM_NEW: "The application is ready. Please provide the requested details to proceed.";
|
|
93
|
-
readonly FORM_IN_PROGRESS: "The application is in progress. Please complete and submit the required details to continue.";
|
|
94
|
-
readonly EVENT_NEW: "The application is ready. Please provide the requested details to proceed.";
|
|
95
|
-
readonly EVENT_IN_PROGRESS: "The application is in progress. Please complete and submit the required details to continue.";
|
|
136
|
+
readonly FORM_NEW: "The application is ready. Please provide the requested details via API to proceed.";
|
|
137
|
+
readonly FORM_IN_PROGRESS: "The application is in progress. Please complete and submit the required details via API to continue.";
|
|
138
|
+
readonly EVENT_NEW: "The application is ready. Please provide the requested details via API to proceed.";
|
|
139
|
+
readonly EVENT_IN_PROGRESS: "The application is in progress. Please complete and submit the required details via API to continue.";
|
|
96
140
|
readonly EVENT_PENDING_STEP_UP: "Additional information is required to complete this application. Please provide the requested details to proceed.";
|
|
97
141
|
readonly EVENT_SUBMITTED: "The application has been submitted and is being processed. No further action is required unless notified. The Customer Verification SDK will now close.";
|
|
98
142
|
readonly EVENT_APPROVED: "The application has been approved. No further action is required. The Customer Verification SDK will now close.";
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@modulrfinance/customer-verification-sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Modulr customer verification browser SDK",
|
|
5
|
-
"license": "UNLICENSED",
|
|
6
|
-
"keywords": [
|
|
7
|
-
"modulr",
|
|
8
|
-
"customer-verification",
|
|
9
|
-
"modulrfinance",
|
|
10
|
-
"sdk",
|
|
11
|
-
"browser"
|
|
12
|
-
],
|
|
13
|
-
"files": [
|
|
14
|
-
"index.mjs",
|
|
15
|
-
"index.d.ts",
|
|
16
|
-
"lib/**/*.d.ts",
|
|
17
|
-
"cdn/modulr-customer-verification-sdk.js",
|
|
18
|
-
"README.md"
|
|
19
|
-
],
|
|
20
|
-
"publishConfig": {
|
|
21
|
-
"access": "public",
|
|
22
|
-
"registry": "https://registry.npmjs.org",
|
|
23
|
-
"tag": "beta"
|
|
24
|
-
},
|
|
25
|
-
"sideEffects": false,
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"import": "./index.mjs",
|
|
29
|
-
"types": "./index.d.ts"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"module": "./index.mjs",
|
|
33
|
-
"types": "./index.d.ts"
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@modulrfinance/customer-verification-sdk",
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
|
+
"description": "Modulr customer verification browser SDK",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"modulr",
|
|
8
|
+
"customer-verification",
|
|
9
|
+
"modulrfinance",
|
|
10
|
+
"sdk",
|
|
11
|
+
"browser"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
"index.mjs",
|
|
15
|
+
"index.d.ts",
|
|
16
|
+
"lib/**/*.d.ts",
|
|
17
|
+
"cdn/modulr-customer-verification-sdk.js",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public",
|
|
22
|
+
"registry": "https://registry.npmjs.org",
|
|
23
|
+
"tag": "beta"
|
|
24
|
+
},
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./index.mjs",
|
|
29
|
+
"types": "./index.d.ts"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"module": "./index.mjs",
|
|
33
|
+
"types": "./index.d.ts"
|
|
34
|
+
}
|