@modulrfinance/customer-verification-sdk 1.0.0-beta.2 → 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 +4977 -3918
- 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 +44 -0
- package/package.json +1 -1
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>;
|