@modulrfinance/customer-verification-sdk 1.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/README.md +9 -0
- package/cdn/modulr-customer-verification-sdk.js +127 -0
- package/index.d.ts +2 -0
- package/index.mjs +10200 -0
- package/lib/alloy.config.d.ts +3 -0
- package/lib/auth/sdk-auth.d.ts +17 -0
- package/lib/browser-sdk-api.d.ts +4 -0
- package/lib/components/register.d.ts +2 -0
- package/lib/components/spinner/spinner.element.d.ts +13 -0
- package/lib/config/sdk.config.d.ts +12 -0
- package/lib/default-custom-style.d.ts +3 -0
- package/lib/http/auth.interceptor.d.ts +3 -0
- package/lib/http/headers.interceptor.d.ts +3 -0
- package/lib/http/interceptor.d.ts +8 -0
- package/lib/http/response-error.interceptor.d.ts +3 -0
- package/lib/http/sdk-fetch.d.ts +2 -0
- package/lib/sdk.d.ts +6 -0
- package/lib/sdk.handler.d.ts +32 -0
- package/lib/sdk.model.d.ts +102 -0
- package/package.json +34 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface SdkAuthState {
|
|
2
|
+
applicationId: string;
|
|
3
|
+
token: string;
|
|
4
|
+
hmac: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function setSdkAuthState(state: SdkAuthState): void;
|
|
7
|
+
export declare function clearSdkAuthState(): void;
|
|
8
|
+
export declare function getSdkAuthState(): SdkAuthState | null;
|
|
9
|
+
export declare function generateGuid(): string;
|
|
10
|
+
export declare function getSessionId(): string;
|
|
11
|
+
export declare function getSignedHeaders(): Promise<{
|
|
12
|
+
'x-aux-date': string;
|
|
13
|
+
'x-mod-nonce': string;
|
|
14
|
+
Authorization: string;
|
|
15
|
+
}>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=sdk-auth.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const SPINNER_TAG = "mod-cvsdk-spinner";
|
|
2
|
+
export declare class SpinnerElement extends HTMLElement {
|
|
3
|
+
static readonly observedAttributes: string[];
|
|
4
|
+
private readonly shadow;
|
|
5
|
+
constructor();
|
|
6
|
+
connectedCallback(): void;
|
|
7
|
+
attributeChangedCallback(): void;
|
|
8
|
+
private get size();
|
|
9
|
+
private get strokeWidth();
|
|
10
|
+
private get text();
|
|
11
|
+
private render;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=spinner.element.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const API_BASE_URL_PROD = "https://api.modulrfinance.com/api";
|
|
2
|
+
export declare const API_BASE_URL_SANDBOX = "https://api-sandbox.modulrfinance.com/api-sandbox";
|
|
3
|
+
export declare const API_BASE_URL_DEV = "https://api-dev.aws.modulrfinance.io/api-dev";
|
|
4
|
+
export declare const SDK_CONFIG: {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const SDK_HEADERS: {
|
|
8
|
+
readonly 'x-mod-version': "1";
|
|
9
|
+
};
|
|
10
|
+
export declare const STATUS_POLL_INTERVAL_MS = 5000;
|
|
11
|
+
export declare const STATUS_POLL_TIMEOUT_MS = 60000;
|
|
12
|
+
//# sourceMappingURL=sdk.config.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SdkRequest {
|
|
2
|
+
url: string;
|
|
3
|
+
init: RequestInit;
|
|
4
|
+
}
|
|
5
|
+
export type NextFn = (req: SdkRequest) => Promise<Response>;
|
|
6
|
+
export type Interceptor = (req: SdkRequest, next: NextFn) => Promise<Response>;
|
|
7
|
+
export declare function composeFetch(interceptors: Interceptor[]): (url: string, init?: RequestInit) => Promise<Response>;
|
|
8
|
+
//# sourceMappingURL=interceptor.d.ts.map
|
package/lib/sdk.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BrowserSdkApi, CustomerVerificationSdkConfig, CustomerVerificationSdkInstance } from './sdk.model';
|
|
2
|
+
export { ApplicationStatus, SdkEventType, SdkResultType } from './sdk.model';
|
|
3
|
+
export type { BrowserSdkApi, CloseOptions, CloseSuccessResult, ComponentOverride, CustomerVerificationSdkConfig, CustomerVerificationSdkInstance, CustomStyle, CustomTheme, InitSuccessResult, OpenOptions, OpenSuccessResult, SdkErrorResult, SdkEvent } from './sdk.model';
|
|
4
|
+
export declare function init(config: CustomerVerificationSdkConfig): Promise<CustomerVerificationSdkInstance>;
|
|
5
|
+
export declare const ModulrCustomerVerificationSdk: BrowserSdkApi;
|
|
6
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CloseOptions, CustomerVerificationSdkInstance, OpenOptions, SdkErrorResult } from './sdk.model';
|
|
2
|
+
type ReadyOptions = {
|
|
3
|
+
onAlloyComplete?: (data: unknown) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare class CustomerVerificationSdkController implements CustomerVerificationSdkInstance {
|
|
6
|
+
private isReady;
|
|
7
|
+
private formMessage;
|
|
8
|
+
private activeDummyRoot;
|
|
9
|
+
private activeSpinnerRoot;
|
|
10
|
+
private activeContainerId;
|
|
11
|
+
private activeOnClose;
|
|
12
|
+
private activeOnError;
|
|
13
|
+
private activeOnComplete;
|
|
14
|
+
private activeCloseCleanup;
|
|
15
|
+
private onAlloyComplete;
|
|
16
|
+
private hasOpenedAlloy;
|
|
17
|
+
markReady(options?: ReadyOptions): void;
|
|
18
|
+
markReadyForForm(message: string): void;
|
|
19
|
+
setCloseCleanup(cleanup: () => void): void;
|
|
20
|
+
runAndClearOnComplete(data: unknown, onError?: (error: SdkErrorResult) => void): void;
|
|
21
|
+
private runAndClearCloseCleanup;
|
|
22
|
+
private runAndClearOnClose;
|
|
23
|
+
private showSpinner;
|
|
24
|
+
private removeSpinner;
|
|
25
|
+
private removeDummyComponent;
|
|
26
|
+
private showDummyComponent;
|
|
27
|
+
closeInternally(onError?: (error: SdkErrorResult) => void): void;
|
|
28
|
+
open(options?: OpenOptions): Promise<void>;
|
|
29
|
+
close(options?: CloseOptions): void;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=sdk.handler.d.ts.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Init } from '@alloyidentity/web-sdk';
|
|
2
|
+
export type CustomStyle = NonNullable<Init['customStyle']>;
|
|
3
|
+
export type CustomTheme = CustomStyle['theme'];
|
|
4
|
+
export type ComponentOverride = CustomStyle['componentOverride'];
|
|
5
|
+
export declare enum ApplicationStatus {
|
|
6
|
+
NEW = "NEW",
|
|
7
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
8
|
+
PENDING_STEP_UP = "PENDING_STEP_UP",
|
|
9
|
+
SUBMITTED = "SUBMITTED",
|
|
10
|
+
APPROVED = "APPROVED",
|
|
11
|
+
DECLINED = "DECLINED",
|
|
12
|
+
MANUAL_REVIEW = "MANUAL_REVIEW"
|
|
13
|
+
}
|
|
14
|
+
export declare enum SdkEventType {
|
|
15
|
+
NEW = "NEW",
|
|
16
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
17
|
+
PENDING_STEP_UP = "PENDING_STEP_UP",
|
|
18
|
+
SUBMITTED = "SUBMITTED",
|
|
19
|
+
APPROVED = "APPROVED",
|
|
20
|
+
DECLINED = "DECLINED",
|
|
21
|
+
MANUAL_REVIEW = "MANUAL_REVIEW"
|
|
22
|
+
}
|
|
23
|
+
export declare enum SdkResultType {
|
|
24
|
+
SUCCESS = "SUCCESS",
|
|
25
|
+
ERROR = "ERROR",
|
|
26
|
+
OPENED = "OPENED",
|
|
27
|
+
CLOSED = "CLOSED"
|
|
28
|
+
}
|
|
29
|
+
export type SdkEvent = {
|
|
30
|
+
type: SdkEventType;
|
|
31
|
+
message: string;
|
|
32
|
+
};
|
|
33
|
+
export type InitSuccessResult = {
|
|
34
|
+
type: SdkResultType.SUCCESS;
|
|
35
|
+
message: string;
|
|
36
|
+
};
|
|
37
|
+
export type SdkErrorResult = {
|
|
38
|
+
type: SdkResultType.ERROR;
|
|
39
|
+
message: string;
|
|
40
|
+
};
|
|
41
|
+
export type OpenSuccessResult = {
|
|
42
|
+
type: SdkResultType.OPENED;
|
|
43
|
+
message: string;
|
|
44
|
+
};
|
|
45
|
+
export type CloseSuccessResult = {
|
|
46
|
+
type: SdkResultType.CLOSED;
|
|
47
|
+
message: string;
|
|
48
|
+
};
|
|
49
|
+
export type OpenOptions = {
|
|
50
|
+
containerId?: string;
|
|
51
|
+
loadingText?: string;
|
|
52
|
+
onSuccess?: (result: OpenSuccessResult) => void;
|
|
53
|
+
onComplete?: (data: unknown) => void;
|
|
54
|
+
onError?: (error: SdkErrorResult) => void;
|
|
55
|
+
onClose?: () => void;
|
|
56
|
+
};
|
|
57
|
+
export type CloseOptions = {
|
|
58
|
+
onSuccess?: (result: CloseSuccessResult) => void;
|
|
59
|
+
onError?: (error: SdkErrorResult) => void;
|
|
60
|
+
};
|
|
61
|
+
export interface BrowserSdkApi {
|
|
62
|
+
version: string;
|
|
63
|
+
init(config: CustomerVerificationSdkConfig): Promise<CustomerVerificationSdkInstance>;
|
|
64
|
+
}
|
|
65
|
+
export interface CustomerVerificationSdkConfig {
|
|
66
|
+
applicationId: string;
|
|
67
|
+
token: string;
|
|
68
|
+
hmac: string;
|
|
69
|
+
onSuccess?: (result: InitSuccessResult) => void;
|
|
70
|
+
onEvent?: (event: SdkEvent) => void;
|
|
71
|
+
onError?: (error: SdkErrorResult) => void;
|
|
72
|
+
customStyle?: CustomStyle;
|
|
73
|
+
/** Override the SDK API base URL. Useful for proxying in local development (e.g. '/api-dev'). */
|
|
74
|
+
baseUrl?: string;
|
|
75
|
+
/** Whether to use production API endpoints. Defaults to true. When false, uses sandbox URLs. */
|
|
76
|
+
production?: boolean;
|
|
77
|
+
/** When true, uses dev API endpoints regardless of the production flag. For internal development only. */
|
|
78
|
+
isDev?: boolean;
|
|
79
|
+
}
|
|
80
|
+
export interface CustomerVerificationSdkInstance {
|
|
81
|
+
open(options?: OpenOptions): Promise<void>;
|
|
82
|
+
close(options?: CloseOptions): void;
|
|
83
|
+
}
|
|
84
|
+
export declare const VERSION = "0.0.1";
|
|
85
|
+
export declare const SDK_PREFIX = "CustomerVerificationSDK";
|
|
86
|
+
export declare const SDK_MESSAGES: {
|
|
87
|
+
readonly INIT_SUCCESS: "CustomerVerificationSDK initialized successfully";
|
|
88
|
+
readonly INIT_FAILED: "Failed to initialize SDK";
|
|
89
|
+
readonly OPEN_SUCCESS: "Opening Onboarding verification form";
|
|
90
|
+
readonly OPEN_FORM_SUCCESS: "Opening onboarding form";
|
|
91
|
+
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.";
|
|
96
|
+
readonly EVENT_PENDING_STEP_UP: "Additional information is required to complete this application. Please provide the requested details to proceed.";
|
|
97
|
+
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
|
+
readonly EVENT_APPROVED: "The application has been approved. No further action is required. The Customer Verification SDK will now close.";
|
|
99
|
+
readonly EVENT_DECLINED: "There has been a problem with this application, please reach out to your Modulr contact for details. No further action is required. The Customer Verification SDK will now close.";
|
|
100
|
+
readonly EVENT_MANUAL_REVIEW: "The application is under review. No further action is required unless notified. The Customer Verification SDK will now close.";
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=sdk.model.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@modulrfinance/customer-verification-sdk",
|
|
3
|
+
"version": "1.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
|
+
}
|