@qonto/embed-sdk 0.1.0
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 +50 -0
- package/dist/cards/cards.api.d.ts +8 -0
- package/dist/cards/cards.api.d.ts.map +1 -0
- package/dist/cards/cards.d.ts +126 -0
- package/dist/cards/cards.d.ts.map +1 -0
- package/dist/cards/cards.helper.d.ts +3 -0
- package/dist/cards/cards.helper.d.ts.map +1 -0
- package/dist/cards/cards.public-api.d.ts +9 -0
- package/dist/cards/cards.public-api.d.ts.map +1 -0
- package/dist/cards/cards.serializer.d.ts +70 -0
- package/dist/cards/cards.serializer.d.ts.map +1 -0
- package/dist/cards/cards.test.d.ts +2 -0
- package/dist/cards/cards.test.d.ts.map +1 -0
- package/dist/cards/cards.types.d.ts +238 -0
- package/dist/cards/cards.types.d.ts.map +1 -0
- package/dist/cards/cards.validate.d.ts +5 -0
- package/dist/cards/cards.validate.d.ts.map +1 -0
- package/dist/cards/index.d.ts +7 -0
- package/dist/cards/index.d.ts.map +1 -0
- package/dist/common/auth/auth.d.ts +33 -0
- package/dist/common/auth/auth.d.ts.map +1 -0
- package/dist/common/auth/auth.test.d.ts +2 -0
- package/dist/common/auth/auth.test.d.ts.map +1 -0
- package/dist/common/auth/auth.validate.d.ts +2 -0
- package/dist/common/auth/auth.validate.d.ts.map +1 -0
- package/dist/common/auth/index.d.ts +3 -0
- package/dist/common/auth/index.d.ts.map +1 -0
- package/dist/common/common.public-api.d.ts +9 -0
- package/dist/common/common.public-api.d.ts.map +1 -0
- package/dist/common/constants.d.ts +23 -0
- package/dist/common/constants.d.ts.map +1 -0
- package/dist/common/environment/environment-manager.d.ts +53 -0
- package/dist/common/environment/environment-manager.d.ts.map +1 -0
- package/dist/common/environment/environment-manager.test.d.ts +2 -0
- package/dist/common/environment/environment-manager.test.d.ts.map +1 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/initialize/index.d.ts +2 -0
- package/dist/common/initialize/index.d.ts.map +1 -0
- package/dist/common/initialize/initialize.d.ts +40 -0
- package/dist/common/initialize/initialize.d.ts.map +1 -0
- package/dist/common/initialize/initialize.test.d.ts +2 -0
- package/dist/common/initialize/initialize.test.d.ts.map +1 -0
- package/dist/common/initialize/initialize.types.d.ts +9 -0
- package/dist/common/initialize/initialize.types.d.ts.map +1 -0
- package/dist/common/initialize/initialize.validate.d.ts +9 -0
- package/dist/common/initialize/initialize.validate.d.ts.map +1 -0
- package/dist/common/locale/index.d.ts +2 -0
- package/dist/common/locale/index.d.ts.map +1 -0
- package/dist/common/operation-settings/operation-settings.d.ts +35 -0
- package/dist/common/operation-settings/operation-settings.d.ts.map +1 -0
- package/dist/errors/AuthenticationError.d.ts +11 -0
- package/dist/errors/AuthenticationError.d.ts.map +1 -0
- package/dist/errors/EmbedApiError.d.ts +8 -0
- package/dist/errors/EmbedApiError.d.ts.map +1 -0
- package/dist/errors/EmbedOperationError.d.ts +11 -0
- package/dist/errors/EmbedOperationError.d.ts.map +1 -0
- package/dist/errors/InvalidParametersError.d.ts +14 -0
- package/dist/errors/InvalidParametersError.d.ts.map +1 -0
- package/dist/errors/QontoEmbedSdkError.d.ts +8 -0
- package/dist/errors/QontoEmbedSdkError.d.ts.map +1 -0
- package/dist/iframe/embed-iframe.d.ts +22 -0
- package/dist/iframe/embed-iframe.d.ts.map +1 -0
- package/dist/iframe/iframe-manager.d.ts +14 -0
- package/dist/iframe/iframe-manager.d.ts.map +1 -0
- package/dist/iframe/iframe-manager.test.d.ts +2 -0
- package/dist/iframe/iframe-manager.test.d.ts.map +1 -0
- package/dist/iframe/iframe.test.d.ts +2 -0
- package/dist/iframe/iframe.test.d.ts.map +1 -0
- package/dist/iframe/iframe.types.d.ts +6 -0
- package/dist/iframe/iframe.types.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.umd.js +1 -0
- package/dist/mocks/handlers.d.ts +3 -0
- package/dist/mocks/handlers.d.ts.map +1 -0
- package/dist/mocks/node.d.ts +2 -0
- package/dist/mocks/node.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.js +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/rng.js +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.js +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js +1 -0
- package/dist/public-api.test.d.ts +2 -0
- package/dist/public-api.test.d.ts.map +1 -0
- package/dist/setup-test.d.ts +2 -0
- package/dist/setup-test.d.ts.map +1 -0
- package/dist/src/cards/cards.api.js +1 -0
- package/dist/src/cards/cards.helper.js +1 -0
- package/dist/src/cards/cards.js +1 -0
- package/dist/src/cards/cards.public-api.js +1 -0
- package/dist/src/cards/cards.serializer.js +1 -0
- package/dist/src/cards/cards.types.js +1 -0
- package/dist/src/cards/cards.validate.js +1 -0
- package/dist/src/cards/index.js +1 -0
- package/dist/src/common/auth/auth.js +1 -0
- package/dist/src/common/auth/auth.validate.js +1 -0
- package/dist/src/common/common.public-api.js +1 -0
- package/dist/src/common/constants.js +1 -0
- package/dist/src/common/environment/environment-manager.js +1 -0
- package/dist/src/common/index.js +1 -0
- package/dist/src/common/initialize/initialize.js +1 -0
- package/dist/src/common/initialize/initialize.validate.js +1 -0
- package/dist/src/common/operation-settings/operation-settings.js +1 -0
- package/dist/src/errors/AuthenticationError.js +1 -0
- package/dist/src/errors/EmbedApiError.js +1 -0
- package/dist/src/errors/EmbedOperationError.js +1 -0
- package/dist/src/errors/InvalidParametersError.js +1 -0
- package/dist/src/errors/QontoEmbedSdkError.js +1 -0
- package/dist/src/iframe/embed-iframe.js +1 -0
- package/dist/src/iframe/iframe-manager.js +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/validation/input-param-validation.js +1 -0
- package/dist/src/validation/operation-settings-validation.js +1 -0
- package/dist/validation/index.d.ts +2 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/input-param-validation.d.ts +43 -0
- package/dist/validation/input-param-validation.d.ts.map +1 -0
- package/dist/validation/operation-settings-validation.d.ts +6 -0
- package/dist/validation/operation-settings-validation.d.ts.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const IFRAME_EVENTS: {
|
|
2
|
+
READY: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const ACTIONS: {
|
|
5
|
+
CARD_SEE: string;
|
|
6
|
+
CARD_SEE_DETAILS: string;
|
|
7
|
+
CARD_ORDER: string;
|
|
8
|
+
CARD_UNLOCK: string;
|
|
9
|
+
CARD_SHOW_PIN: string;
|
|
10
|
+
CARD_SET_PIN: string;
|
|
11
|
+
TRANSFERS_CREATE: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const ENVIRONMENTS: {
|
|
14
|
+
PRODUCTION: string;
|
|
15
|
+
STAGING: string;
|
|
16
|
+
LOCAL: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const BRANCHES: {
|
|
19
|
+
MASTER: string;
|
|
20
|
+
SANDBOX: string;
|
|
21
|
+
QA: string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;CAEzB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;CAQnB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { BRANCHES, ENVIRONMENTS } from '@common/constants';
|
|
2
|
+
type Environment = (typeof ENVIRONMENTS)[keyof typeof ENVIRONMENTS];
|
|
3
|
+
type Branch = (typeof BRANCHES)[keyof typeof BRANCHES];
|
|
4
|
+
interface EnvironmentUrls {
|
|
5
|
+
IFRAME_BASE_URL: string;
|
|
6
|
+
IFRAME_URL: string;
|
|
7
|
+
THIRD_PARTY_API_URL: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Class responsible for managing environment and branch settings
|
|
11
|
+
* throughout the application.
|
|
12
|
+
*/
|
|
13
|
+
export declare class EnvironmentManager {
|
|
14
|
+
private static instance;
|
|
15
|
+
private environment;
|
|
16
|
+
private branch;
|
|
17
|
+
private constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Returns the singleton instance of EnvironmentManager
|
|
20
|
+
*/
|
|
21
|
+
static getInstance(): EnvironmentManager;
|
|
22
|
+
/**
|
|
23
|
+
* Set the environment value
|
|
24
|
+
* @param environment - The environment to set
|
|
25
|
+
*/
|
|
26
|
+
setEnvironment(environment: Environment): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get the current environment value
|
|
29
|
+
* @returns The current environment or undefined if not set
|
|
30
|
+
*/
|
|
31
|
+
getEnvironment(): Environment | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Set the branch value
|
|
34
|
+
* @param branch - The branch to set
|
|
35
|
+
*/
|
|
36
|
+
setBranch(branch: Branch): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get the current branch value
|
|
39
|
+
* @returns The current branch or undefined if not set
|
|
40
|
+
*/
|
|
41
|
+
getBranch(): Branch | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Clear all environment settings
|
|
44
|
+
*/
|
|
45
|
+
clear(): void;
|
|
46
|
+
getEnvironmentUrls(): EnvironmentUrls;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Pre-instantiated singleton instance of EnvironmentManager for direct import
|
|
50
|
+
*/
|
|
51
|
+
export declare const environmentManager: EnvironmentManager;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=environment-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-manager.d.ts","sourceRoot":"","sources":["../../../src/common/environment/environment-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE3D,KAAK,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AACpE,KAAK,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AACvD,UAAU,eAAe;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAyBD;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAqB;IAG5C,OAAO,CAAC,WAAW,CAAwC;IAE3D,OAAO,CAAC,MAAM,CAA2B;IAEzC,OAAO;IAIP;;OAEG;WACW,WAAW,IAAI,kBAAkB;IAQ/C;;;OAGG;IACI,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAIrD;;;OAGG;IACI,cAAc,IAAI,WAAW,GAAG,SAAS;IAIhD;;;OAGG;IACI,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAItC;;;OAGG;IACI,SAAS,IAAI,MAAM,GAAG,SAAS;IAItC;;OAEG;IACI,KAAK,IAAI,IAAI;IAKb,kBAAkB,IAAI,eAAe;CAa7C;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,oBAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-manager.test.d.ts","sourceRoot":"","sources":["../../../src/common/environment/environment-manager.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAQ,UAAU,4CAAE,MAAM,wCAAE,SAAS,8BAAW,CAAC;AAMjD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/initialize/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { InitializeParams } from './initialize.types';
|
|
2
|
+
/**
|
|
3
|
+
* Initializes the SDK with the provided parameters. This function has to be called
|
|
4
|
+
* before using any other SDK functions, and as the bare minimum, it requires an
|
|
5
|
+
* access token.
|
|
6
|
+
* @param initializeParams - An object with the parameters to initialize the SDK.
|
|
7
|
+
* The only required parameter is the `accessToken`.
|
|
8
|
+
* - accessToken: The access token to authenticate the user. This has to be previously
|
|
9
|
+
* generated using the OAuth authentication flow.
|
|
10
|
+
* environment: Optional parameter to set the SDK's environment. If not provided,
|
|
11
|
+
* the SDK will default to 'production'. Use ENVIRONMENTS.STAGING to set the SDK to
|
|
12
|
+
* staging.
|
|
13
|
+
* branch: Optional parameter to set the SDK's branch. This is only relevant when the
|
|
14
|
+
* environment is set to 'staging'. The possible values are BRANCHES.MASTER,
|
|
15
|
+
* BRANCHES.SANDBOX and BRANCHES.QA. If not provided, the SDK will default to 'MASTER'.
|
|
16
|
+
* - operationSettings: Optional settings to configure the SDK's operations that will
|
|
17
|
+
* be performed after the initialization. This can be also provided when calling the
|
|
18
|
+
* operation functions themselves.
|
|
19
|
+
* - uiParentElementId: The id of the element where the SDK will be rendered.
|
|
20
|
+
* - mfaPreference: The MFA preference to use for the operations. This can be either
|
|
21
|
+
* MFA_METHODS.PASSKEY, MFA_METHODS.PAIRED_DEVICE or MFA_METHODS.SMS_OTP. If not
|
|
22
|
+
* provided, the SDK will default to 'PASSKEY'.
|
|
23
|
+
|
|
24
|
+
* @throws InvalidParametersError If the access token is not provided.
|
|
25
|
+
* @example
|
|
26
|
+
* ```
|
|
27
|
+
* const initializeParams = {
|
|
28
|
+
* accessToken: 'an-access-token',
|
|
29
|
+
* };
|
|
30
|
+
* initialize(initializeParams);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function initialize(initializeParams: InitializeParams): void;
|
|
34
|
+
/**
|
|
35
|
+
* Clears all the data that the SDK contains to identify a user session. This is normally useful after having called
|
|
36
|
+
* `initialize` with an access token and once the SDK is not needed anymore. If `logout` is called without having called
|
|
37
|
+
* `initialize`, it will do nothing.
|
|
38
|
+
*/
|
|
39
|
+
export declare function logout(): void;
|
|
40
|
+
//# sourceMappingURL=initialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../../src/common/initialize/initialize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAK3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,QAc5D;AAED;;;;GAIG;AACH,wBAAgB,MAAM,SAErB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.test.d.ts","sourceRoot":"","sources":["../../../src/common/initialize/initialize.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OperationSettings } from '@validation/operation-settings-validation';
|
|
2
|
+
export interface InitializeParams {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
locale?: 'en' | 'fr' | 'es' | 'de' | 'it' | 'pt';
|
|
5
|
+
environment?: 'production' | 'staging' | 'local';
|
|
6
|
+
branch?: 'master' | 'sandbox' | 'qa';
|
|
7
|
+
operationSettings?: OperationSettings;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=initialize.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.types.d.ts","sourceRoot":"","sources":["../../../src/common/initialize/initialize.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjD,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;IACjD,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InitializeParams } from './initialize.types';
|
|
2
|
+
/**
|
|
3
|
+
* Validates the parameters passed to the initialize function.
|
|
4
|
+
* @param params - The parameters to validate.
|
|
5
|
+
* @returns The validated parameters.
|
|
6
|
+
* @throws InvalidParametersError If the access token is not provided.
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateInitializeParams(params: InitializeParams): InitializeParams;
|
|
9
|
+
//# sourceMappingURL=initialize.validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.validate.d.ts","sourceRoot":"","sources":["../../../src/common/initialize/initialize.validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,gBAAgB,GACvB,gBAAgB,CAYlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/locale/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,SAExB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { OperationSettings } from '@validation/operation-settings-validation';
|
|
2
|
+
/**
|
|
3
|
+
* A singleton class to manage operation settings
|
|
4
|
+
*/
|
|
5
|
+
export declare class OperationSettingsManager {
|
|
6
|
+
private static instance;
|
|
7
|
+
private uiParentElementId;
|
|
8
|
+
private mfaPreference;
|
|
9
|
+
private constructor();
|
|
10
|
+
/**
|
|
11
|
+
* Gets the singleton instance of OperationSettingsManager
|
|
12
|
+
*/
|
|
13
|
+
static getInstance(): OperationSettingsManager;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the operation settings
|
|
16
|
+
* @param settings - The operation settings to store
|
|
17
|
+
*/
|
|
18
|
+
setSettings(settings: Partial<OperationSettings>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the UI parent element ID
|
|
21
|
+
* @returns The current UI parent element ID or null if not set
|
|
22
|
+
*/
|
|
23
|
+
getUIParentElementId(): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the MFA preference
|
|
26
|
+
* @returns The current MFA preference or null if not set
|
|
27
|
+
*/
|
|
28
|
+
getMFAPreference(): 'passkey' | 'paired-device' | 'sms-otp' | null;
|
|
29
|
+
/**
|
|
30
|
+
* Clears all operation settings
|
|
31
|
+
*/
|
|
32
|
+
clearSettings(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare const operationSettingsManager: OperationSettingsManager;
|
|
35
|
+
//# sourceMappingURL=operation-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-settings.d.ts","sourceRoot":"","sources":["../../../src/common/operation-settings/operation-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF;;GAEG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,aAAa,CAAwD;IAE7E,OAAO;IAIP;;OAEG;WACW,WAAW,IAAI,wBAAwB;IAOrD;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAS9D;;;OAGG;IACI,oBAAoB,IAAI,MAAM,GAAG,IAAI;IAI5C;;;OAGG;IACI,gBAAgB,IAAI,SAAS,GAAG,eAAe,GAAG,SAAS,GAAG,IAAI;IAIzE;;OAEG;IACI,aAAa,IAAI,IAAI;CAI7B;AAGD,eAAO,MAAM,wBAAwB,0BAAyC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { QontoEmbedSdkError } from './QontoEmbedSdkError';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when authentication fails due to missing or invalid tokens
|
|
4
|
+
*/
|
|
5
|
+
export declare class AuthenticationError extends QontoEmbedSdkError {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new AuthenticationError
|
|
8
|
+
*/
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=AuthenticationError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthenticationError.d.ts","sourceRoot":"","sources":["../../src/errors/AuthenticationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,kBAAkB;IACzD;;OAEG;;CAOJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { QontoEmbedSdkError } from './QontoEmbedSdkError';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when a call to the API returns 200 response but with an error
|
|
4
|
+
*/
|
|
5
|
+
export declare class EmbedApiError extends QontoEmbedSdkError {
|
|
6
|
+
constructor(message: string | string[]);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=EmbedApiError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbedApiError.d.ts","sourceRoot":"","sources":["../../src/errors/EmbedApiError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,qBAAa,aAAc,SAAQ,kBAAkB;gBACvC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;CAQvC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { QontoEmbedSdkError } from './QontoEmbedSdkError';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when an operation requested to the SDK fails
|
|
4
|
+
*/
|
|
5
|
+
export declare class EmbedOperationError extends QontoEmbedSdkError {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new EmbedOperationError
|
|
8
|
+
*/
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=EmbedOperationError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbedOperationError.d.ts","sourceRoot":"","sources":["../../src/errors/EmbedOperationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,kBAAkB;IACzD;;OAEG;gBACS,OAAO,EAAE,MAAM;CAK5B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { QontoEmbedSdkError } from './QontoEmbedSdkError';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when invalid parameters are passed to SDK methods
|
|
4
|
+
*/
|
|
5
|
+
export declare class InvalidParametersError extends QontoEmbedSdkError {
|
|
6
|
+
readonly invalidParameters: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new InvalidParametersError
|
|
9
|
+
*
|
|
10
|
+
* @param invalidParameterMessages - Messages about invalid parameters
|
|
11
|
+
*/
|
|
12
|
+
constructor(invalidParameterMessages: string | string[]);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=InvalidParametersError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidParametersError.d.ts","sourceRoot":"","sources":["../../src/errors/InvalidParametersError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,SAAgB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAE5C;;;;OAIG;gBACS,wBAAwB,EAAE,MAAM,GAAG,MAAM,EAAE;CASxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QontoEmbedSdkError.d.ts","sourceRoot":"","sources":["../../src/errors/QontoEmbedSdkError.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;;IAO3C;;OAEG;IACM,QAAQ,IAAI,MAAM;CAG5B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IframeMessage } from './iframe.types';
|
|
2
|
+
interface IframeOptions {
|
|
3
|
+
parentElementId: string;
|
|
4
|
+
iframeUrl: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class EmbedIframe {
|
|
8
|
+
private options;
|
|
9
|
+
private iframe;
|
|
10
|
+
private parentElement;
|
|
11
|
+
private messageListeners;
|
|
12
|
+
private readonly defaultTimeout;
|
|
13
|
+
private targetOrigin;
|
|
14
|
+
constructor(options: IframeOptions);
|
|
15
|
+
initialize(): Promise<EmbedIframe>;
|
|
16
|
+
postMessage(payload: IframeMessage): Promise<unknown>;
|
|
17
|
+
private addMessageListener;
|
|
18
|
+
private removeMessageListener;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=embed-iframe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-iframe.d.ts","sourceRoot":"","sources":["../../src/iframe/embed-iframe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD,UAAU,aAAa;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,WAAW;IAQV,OAAO,CAAC,OAAO;IAP3B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,gBAAgB,CACZ;IACZ,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,YAAY,CAAS;gBAET,OAAO,EAAE,aAAa;IAKpC,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC;IA0CxC,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IA8BrD,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,qBAAqB;IAc7B,OAAO,IAAI,IAAI;CAehB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EmbedIframe } from './embed-iframe';
|
|
2
|
+
interface BuildIframeUrlParams {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
debugMode?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface CreateIframeParams {
|
|
8
|
+
parentElementId: string;
|
|
9
|
+
iframeUrl: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildIframeUrl({ accessToken, language, debugMode, }: BuildIframeUrlParams): string;
|
|
12
|
+
export declare function createIframe({ parentElementId, iframeUrl, }: CreateIframeParams): Promise<EmbedIframe>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=iframe-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iframe-manager.d.ts","sourceRoot":"","sources":["../../src/iframe/iframe-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,UAAU,oBAAoB;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,kBAAkB;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,QAAQ,EACR,SAAS,GACV,EAAE,oBAAoB,UAKtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,eAAe,EACf,SAAS,GACV,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAG3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iframe-manager.test.d.ts","sourceRoot":"","sources":["../../src/iframe/iframe-manager.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iframe.test.d.ts","sourceRoot":"","sources":["../../src/iframe/iframe.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iframe.types.d.ts","sourceRoot":"","sources":["../../src/iframe/iframe.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;CAClD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}}const n=t.getInstance();class i extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class a extends i{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function r(){if(!n.hasAccessToken())throw new a;return n.getAccessToken()}class s extends i{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}class o{constructor(){this.uiParentElementId=null,this.mfaPreference=null}static getInstance(){return o.instance||(o.instance=new o),o.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}clearSettings(){this.uiParentElementId=null,this.mfaPreference=null}}const c=o.getInstance();function d(e){const t=e?.uiParentElementId||c.getUIParentElementId();if(!t)throw new s("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");const n=e?.mfaPreference||c.getMFAPreference();if(n&&!["passkey","paired-device","sms-otp"].includes(n))throw new s("operationSettings.mfaPreference must be one of passkey, paired-device or sms-otp.");return{uiParentElementId:t,mfaPreference:n}}function m(e){if(!e?.accessToken)throw new s("Access token is required when calling initialize()");return e?.operationSettings&&d(e.operationSettings),function(e){if(e.environment){if(!["production","staging","local"].includes(e.environment))throw new s('If provided, environment must be either "production" or "staging"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.environment.PRODUCTION" or "constants.environment.STAGING"');if(e.branch&&!["master","sandbox","qa"].includes(e.environment))throw new s('If provided, branch must be either "master", "sandbox" or "qa"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.branch.MASTER" or "constants.environment.SANDBOX" and so on')}}(e),e}const l={READY:"qonto.ready"},u={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFERS_CREATE:"transfers.create"},h={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},p={MASTER:"master",SANDBOX:"sandbox",QA:"qa"};var f=Object.freeze({__proto__:null,ACTIONS:u,BRANCHES:p,ENVIRONMENTS:h,IFRAME_EVENTS:l});const y="https://embed.qonto.com",_="https://embed-js{branch}.staging.qonto.co",g="https://embed.dev.qonto.co",I={[h.PRODUCTION]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[h.STAGING]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[h.LOCAL]:{IFRAME_BASE_URL:g,IFRAME_URL:`${g}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class L{constructor(){this.environment=h.PRODUCTION,this.branch=p.MASTER}static getInstance(){return L.instance||(L.instance=new L),L.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=h.PRODUCTION,this.branch=p.MASTER}getEnvironmentUrls(){if(this.environment===h.PRODUCTION)return I.production;{const e=I[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const E=L.getInstance();const A={initialize:function(e){const{accessToken:t,operationSettings:i,environment:a,branch:r}=m(e);n.setAccessToken(t),i&&c.setSettings(i),a&&(E.setEnvironment(a),r&&E.setBranch(r))},logout:function(){n.clearAccessToken()},constants:f},{initialize:w,logout:v,constants:D}=A;class b extends i{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}async function T(e,t){const n={method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","Accept-Language":"en"}},i=E.getEnvironmentUrls().THIRD_PARTY_API_URL,a=await fetch(`${i}/v2/cards/${e.cardId}/data_view`,n),r=await a.json();if(r.errors)throw new b(r.errors.map((e=>`${e.code}: ${e.detail}`)));return function(e,t){const n=new URL(e);return"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal?"true":"false"),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking?"true":"false"),n.toString()}(r.iframe_url,e)}var P;!function(e){e.PENDING="pending",e.ONHOLD="onhold",e.ORDER_CANCELED="order_canceled",e.LIVE="live",e.PAUSED="paused",e.STOLEN="stolen",e.LOST="lost",e.PIN_BLOCKED="pin_blocked",e.DELETED="deleted",e.PRE_EXPIRED="pre_expired",e.EXPIRED="expired",e.DISCARDED="discarded",e.SHIPPED_LOST="shipped_lost",e.ABUSIVE="abusive"}(P||(P={}));const R={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var O,S;function U(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:!e[t.name])).map((e=>e.name));if(n.length>0)throw new s(n.map((e=>`Missing required parameter: ${e}`)))}function k(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function N(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function C(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}(O||(O={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(S||(S={}));const M=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],$=[...M,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function z(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return U(e,M),function(e){const{membershipId:t,organizationId:n,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u}=e,h=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(u),p=k({membershipId:t,organizationId:n,bankAccountId:i}),f=N({hasDailyLimit:a,hasTransactionLimit:r}),y=C({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),_=B(m),g=q(l),I=[...h,...p,...f,...y,..._,...g];if(I.length>0)throw new s(I)}(e),e}(e):function(e){U(e,$),function(e){const{membershipId:t,organizationId:n,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u,hasNfcOption:h,hasForeignPaymentOption:p,hasOnlinePaymentOption:f,shipToBusiness:y,hasAtmOption:_,hasAtmDailyLimit:g,atmDailyLimit:I,atmMonthlyLimit:L,address:E,cardDesign:A,typeOfPrint:w}=e,v=function(e){return Object.values(S).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(u),D=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(w),b=k({membershipId:t,organizationId:n,bankAccountId:i}),T=N({hasDailyLimit:a,hasTransactionLimit:r,hasAtmOption:_,hasNfcOption:h,hasForeignPaymentOption:p,hasOnlinePaymentOption:f,hasAtmDailyLimit:g,shipToBusiness:y}),P=C({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:I,atmMonthlyLimit:L}),R=B(m),O=q(l),U=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(A),M=function(e){return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(E),$=[...v,...b,...T,...P,...R,...O,...D,...U,...M];if($.length>0)throw new s($)}(e)}(e)}function B(e){const t=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function q(e){const t=!Array.isArray(e)||e.some((e=>"string"!=typeof e));return void 0!==e&&t?["categories must be an array of strings"]:[]}class x extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}class j{constructor(e){this.options=e,this.iframe=null,this.parentElement=null,this.messageListeners=new Map,this.defaultTimeout=3e4;const t=new URL(e.iframeUrl);this.targetOrigin=`${t.protocol}//${t.host}`}async initialize(){if(this.iframe)return this;if(this.parentElement=document.getElementById(this.options.parentElementId),!this.parentElement)throw new x(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,i=setTimeout((()=>{window.removeEventListener("message",a),t(new x(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),a=t=>{t.data.eventId===l.READY&&(clearTimeout(i),window.removeEventListener("message",a),e(this))};window.addEventListener("message",a),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){return this.iframe&&this.iframe.contentWindow?new Promise(((t,n)=>{const i=a=>{if(a.data?.actionId===e.actionId){if("error"===a.data.status)return this.removeMessageListener(e.actionId,i),n(new x(`An error occurred when performing the action ${e.actionId}.\n${JSON.stringify(a.data.payload)}`));this.removeMessageListener(e.actionId,i),t(a.data.payload)}};this.addMessageListener(e.actionId,i),this.iframe?.contentWindow?.postMessage(e,this.targetOrigin)})):Promise.reject(new x("Attempted to perform an Embed operation without having the authentication UI initialized."))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function F({accessToken:e,language:t,debugMode:n}){const i=n||!1,a=t||"en";return`${E.getEnvironmentUrls().IFRAME_URL}?debug=${i}&lang=${encodeURIComponent(a)}#access_token=${encodeURIComponent(e)}`}function Y({parentElementId:e,iframeUrl:t}){return new j({parentElementId:e,iframeUrl:t}).initialize()}const G=[];for(let e=0;e<256;++e)G.push((e+256).toString(16).slice(1));let H;const V=new Uint8Array(16);var K={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function X(e,t,n){if(K.randomUUID&&!e)return K.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!H){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");H=crypto.getRandomValues.bind(crypto)}return H(V)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(G[e[t+0]]+G[e[t+1]]+G[e[t+2]]+G[e[t+3]]+"-"+G[e[t+4]]+G[e[t+5]]+"-"+G[e[t+6]]+G[e[t+7]]+"-"+G[e[t+8]]+G[e[t+9]]+"-"+G[e[t+10]]+G[e[t+11]]+G[e[t+12]]+G[e[t+13]]+G[e[t+14]]+G[e[t+15]]).toLowerCase()}(i)}function W(e){return"virtual"===e.cardLevel?function(e){const t=J(e.categories);return{actionId:u.CARD_ORDER,actionData:{idempotencyKey:X(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel}}}}}(e):function(e){const t=J(e.categories);return{actionId:u.CARD_ORDER,actionData:{idempotencyKey:X(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel,card_design:e.cardDesign,..."plus"===e.cardLevel&&{type_of_print:e.typeOfPrint},ship_to_business_address:e.shipToBusiness,atm_option:e.hasAtmOption,nfc_option:e.hasNfcOption,foreign_option:e.hasForeignPaymentOption,online_option:e.hasOnlinePaymentOption,atm_daily_limit:e.atmDailyLimit,atm_monthly_limit:e.atmMonthlyLimit,...!e.shipToBusiness&&{address:{contact_name:e.address?.contactName,first_line:e.address?.firstLine,second_line:e.address?.secondLine,third_line:e.address?.thirdLine,zipcode:e.address?.zipCode,city:e.address?.city,country:e.address?.country}}}}}}}(e)}function Q(e){return{id:e.id,nickname:e.nickname,embossedName:e.embossed_name,status:e.status,maskPan:e.mask_pan,expMonth:parseInt(e.exp_month,10),expYear:parseInt(e.exp_year,10),lastActivityAt:new Date(e.last_activity_at),lastDigits:e.last_digits,shipToBusiness:e.ship_to_business,atmOption:e.atm_option,atmDailyLimitOption:e.atm_daily_limit_option,nfcOption:e.nfc_option,onlineOption:e.online_option,foreignOption:e.foreign_option,atmMonthlyLimit:e.atm_monthly_limit,atmMonthlySpent:e.atm_monthly_spent,atmDailyLimit:e.atm_daily_limit,atmDailySpent:e.atm_daily_spent,paymentMonthlyLimit:e.payment_monthly_limit,paymentMonthlySpent:e.payment_monthly_spent,paymentDailyLimit:e.payment_daily_limit,paymentDailySpent:e.payment_daily_spent,paymentDailyLimitOption:e.payment_daily_limit_option,paymentTransactionLimit:e.payment_transaction_limit,paymentTransactionLimitOption:e.payment_transaction_limit_option,activeDays:e.active_days,holderId:e.holder_id,bankAccountId:e.bank_account_id,organizationId:e.organization_id,updatedAt:new Date(e.updated_at),createdAt:new Date(e.created_at),shippedAt:new Date(e.shipped_at),cardType:e.card_type,cardLevel:e.card_level,paymentLifespanLimit:e.payment_lifespan_limit,paymentLifespanSpent:e.payment_lifespan_spent,preExpiresAt:new Date(e.pre_expires_at),categories:e.categories,renewed:e.renewed,renewal:e.renewal,...e.parent_card_summary&&{parentCardSummary:{id:e.parent_card_summary.id,lastDigits:e.parent_card_summary.last_digits}},hadOperation:e.had_operation,hadPinOperation:e.had_pin_operation,cardDesign:e.card_design,typeOfPrint:e.type_of_print,upsold:e.upsold,upsell:e.upsell,discardOn:new Date(e.discard_on),reordered:e.reordered}}function J(e){const t=Object.values(R);return(e||[]).filter((e=>t.includes(e)))}const Z={getCards:async function(){try{const e=r();return(await async function({accessToken:e}){const t={method:"GET",headers:{Authorization:`Bearer ${e}`}},n=E.getEnvironmentUrls().THIRD_PARTY_API_URL,i=await fetch(`${n}/v2/cards`,t),a=await i.json();if(a.errors)throw new b(a.errors.map((e=>`${e.code}: ${e.detail}`)));return a.cards}({accessToken:e})).map((e=>Q(e)))}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:n}=d(e.operationSettings);z(e.cardSettings);const i=F({accessToken:t}),a=await Y({iframeUrl:i,parentElementId:n}),s=W(e.cardSettings),o=await a.postMessage(s);return a.destroy(),Q(o)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:n}=d(e.operationSettings);!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=k({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const i=F({accessToken:t}),a=await Y({iframeUrl:i,parentElementId:n}),o=function(e){return{actionId:u.CARD_UNLOCK,actionData:{cardId:e.cardSettings.cardId}}}(e),c=await a.postMessage(o);return a.destroy(),Q(c)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const t=r(),{uiParentElementId:n}=d(e.operationSettings);!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=k({cardId:e.cardId});if(t.length>0)throw new s(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const i=N(n);if(i.length>0)throw new s(i)}(e.cardSettings);const i=await T(e.cardSettings,t),a=await Y({iframeUrl:i,parentElementId:n});return{destroyEmbedUI:()=>{a.destroy()}}}catch(e){return Promise.reject(e)}}};e.cards=Z,e.constants=D,e.initialize=w,e.logout=v}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,WAAW,6BAuEvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/mocks/node.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,uCAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let t;const e=new Uint8Array(16);function o(){if(!t){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t=crypto.getRandomValues.bind(crypto)}return t(e)}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=[];for(let o=0;o<256;++o)t.push((o+256).toString(16).slice(1));function o(o,e=0){return(t[o[e+0]]+t[o[e+1]]+t[o[e+2]]+t[o[e+3]]+"-"+t[o[e+4]]+t[o[e+5]]+"-"+t[o[e+6]]+t[o[e+7]]+"-"+t[o[e+8]]+t[o[e+9]]+"-"+t[o[e+10]]+t[o[e+11]]+t[o[e+12]]+t[o[e+13]]+t[o[e+14]]+t[o[e+15]]).toLowerCase()}export{o as unsafeStringify};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./native.js";import n from"./rng.js";import{unsafeStringify as t}from"./stringify.js";function o(o,m,e){if(r.randomUUID&&!o)return r.randomUUID();const i=(o=o||{}).random??o.rng?.()??n();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,t(i)}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.test.d.ts","sourceRoot":"","sources":["../src/public-api.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-test.d.ts","sourceRoot":"","sources":["../src/setup-test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EmbedApiError as r}from"../errors/EmbedApiError.js";import{getPopulatedIframeURL as e}from"./cards.helper.js";import{environmentManager as o}from"../common/environment/environment-manager.js";async function n({accessToken:e}){const n={method:"GET",headers:{Authorization:`Bearer ${e}`}},t=o.getEnvironmentUrls().THIRD_PARTY_API_URL,a=await fetch(`${t}/v2/cards`,n),i=await a.json();if(i.errors)throw new r(i.errors.map((r=>`${r.code}: ${r.detail}`)));return i.cards}async function t(n,t){const a={method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","Accept-Language":"en"}},i=o.getEnvironmentUrls().THIRD_PARTY_API_URL,s=await fetch(`${i}/v2/cards/${n.cardId}/data_view`,a),c=await s.json();if(c.errors)throw new r(c.errors.map((r=>`${r.code}: ${r.detail}`)));return e(c.iframe_url,n)}export{t as getCardIframeURL,n as getCards};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,a){const l=new URL(e);return"boolean"==typeof a.allowPinReveal&&l.searchParams.set("canSeePin",a.allowPinReveal?"true":"false"),"boolean"==typeof a.allowBlocking&&l.searchParams.set("canBlock",a.allowBlocking?"true":"false"),l.toString()}export{e as getPopulatedIframeURL};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../common/auth/auth.js";import{validatePresenceOfAuthToken as t}from"../common/auth/auth.validate.js";import{getCardIframeURL as e,getCards as r}from"./cards.api.js";import"./cards.types.js";import{validateDisplayCardParams as a,validateUnlockCardParams as n,validateOrderCardParams as s}from"./cards.validate.js";import{createIframe as i,buildIframeUrl as o}from"../iframe/iframe-manager.js";import{serializeUnlockCardPayload as c,serializeCard as m,serializeOrderCardPayload as d}from"./cards.serializer.js";import{validateOperationSettingsParams as p}from"../validation/operation-settings-validation.js";async function u(){try{const e=t();return(await r({accessToken:e})).map((t=>m(t)))}catch(t){return Promise.reject(t)}}async function f(e){try{const r=t(),{uiParentElementId:a}=p(e.operationSettings);s(e.cardSettings);const n=o({accessToken:r}),c=await i({iframeUrl:n,parentElementId:a}),u=d(e.cardSettings),f=await c.postMessage(u);return c.destroy(),m(f)}catch(t){return Promise.reject(t)}}async function l(e){try{const r=t(),{uiParentElementId:a}=p(e.operationSettings);n(e.cardSettings);const s=o({accessToken:r}),d=await i({iframeUrl:s,parentElementId:a}),u=c(e),f=await d.postMessage(u);return d.destroy(),m(f)}catch(t){return Promise.reject(t)}}async function g(r){try{const n=t(),{uiParentElementId:s}=p(r.operationSettings);a(r.cardSettings);const o=await e(r.cardSettings,n),c=await i({iframeUrl:o,parentElementId:s});return{destroyEmbedUI:()=>{c.destroy()}}}catch(t){return Promise.reject(t)}}export{g as displayCard,u as getCards,f as orderCard,l as unlockCard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{displayCard as r,unlockCard as d,orderCard as a,getCards as o}from"./cards.js";const s={getCards:o,orderCard:a,unlockCard:d,displayCard:r};export{s as cards};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CardCategories as t}from"./cards.types.js";import{ACTIONS as i}from"../common/constants.js";import a from"../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";function n(t){return"virtual"===t.cardLevel?function(t){const n=o(t.categories);return{actionId:i.CARD_ORDER,actionData:{idempotencyKey:a(),body:{card:{payment_monthly_limit:t.monthlyLimit,payment_daily_limit:t.dailyLimit,payment_daily_limit_option:t.hasDailyLimit,payment_transaction_limit:t.transactionLimit,payment_transaction_limit_option:t.hasTransactionLimit,active_days:t.activeDays||[],holder_id:t.membershipId,organization_id:t.organizationId,bank_account_id:t.bankAccountId,categories:n,card_level:t.cardLevel}}}}}(t):function(t){const n=o(t.categories);return{actionId:i.CARD_ORDER,actionData:{idempotencyKey:a(),body:{card:{payment_monthly_limit:t.monthlyLimit,payment_daily_limit:t.dailyLimit,payment_daily_limit_option:t.hasDailyLimit,payment_transaction_limit:t.transactionLimit,payment_transaction_limit_option:t.hasTransactionLimit,active_days:t.activeDays||[],holder_id:t.membershipId,organization_id:t.organizationId,bank_account_id:t.bankAccountId,categories:n,card_level:t.cardLevel,card_design:t.cardDesign,..."plus"===t.cardLevel&&{type_of_print:t.typeOfPrint},ship_to_business_address:t.shipToBusiness,atm_option:t.hasAtmOption,nfc_option:t.hasNfcOption,foreign_option:t.hasForeignPaymentOption,online_option:t.hasOnlinePaymentOption,atm_daily_limit:t.atmDailyLimit,atm_monthly_limit:t.atmMonthlyLimit,...!t.shipToBusiness&&{address:{contact_name:t.address?.contactName,first_line:t.address?.firstLine,second_line:t.address?.secondLine,third_line:t.address?.thirdLine,zipcode:t.address?.zipCode,city:t.address?.city,country:t.address?.country}}}}}}}(t)}function e(t){return{id:t.id,nickname:t.nickname,embossedName:t.embossed_name,status:t.status,maskPan:t.mask_pan,expMonth:parseInt(t.exp_month,10),expYear:parseInt(t.exp_year,10),lastActivityAt:new Date(t.last_activity_at),lastDigits:t.last_digits,shipToBusiness:t.ship_to_business,atmOption:t.atm_option,atmDailyLimitOption:t.atm_daily_limit_option,nfcOption:t.nfc_option,onlineOption:t.online_option,foreignOption:t.foreign_option,atmMonthlyLimit:t.atm_monthly_limit,atmMonthlySpent:t.atm_monthly_spent,atmDailyLimit:t.atm_daily_limit,atmDailySpent:t.atm_daily_spent,paymentMonthlyLimit:t.payment_monthly_limit,paymentMonthlySpent:t.payment_monthly_spent,paymentDailyLimit:t.payment_daily_limit,paymentDailySpent:t.payment_daily_spent,paymentDailyLimitOption:t.payment_daily_limit_option,paymentTransactionLimit:t.payment_transaction_limit,paymentTransactionLimitOption:t.payment_transaction_limit_option,activeDays:t.active_days,holderId:t.holder_id,bankAccountId:t.bank_account_id,organizationId:t.organization_id,updatedAt:new Date(t.updated_at),createdAt:new Date(t.created_at),shippedAt:new Date(t.shipped_at),cardType:t.card_type,cardLevel:t.card_level,paymentLifespanLimit:t.payment_lifespan_limit,paymentLifespanSpent:t.payment_lifespan_spent,preExpiresAt:new Date(t.pre_expires_at),categories:t.categories,renewed:t.renewed,renewal:t.renewal,...t.parent_card_summary&&{parentCardSummary:{id:t.parent_card_summary.id,lastDigits:t.parent_card_summary.last_digits}},hadOperation:t.had_operation,hadPinOperation:t.had_pin_operation,cardDesign:t.card_design,typeOfPrint:t.type_of_print,upsold:t.upsold,upsell:t.upsell,discardOn:new Date(t.discard_on),reordered:t.reordered}}function o(i){const a=Object.values(t);return(i||[]).filter((t=>a.includes(t)))}function s(t){return{actionId:i.CARD_UNLOCK,actionData:{cardId:t.cardSettings.cardId}}}export{o as filterValidCategories,e as serializeCard,n as serializeOrderCardPayload,s as serializeUnlockCardPayload};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e;!function(e){e.PENDING="pending",e.ONHOLD="onhold",e.ORDER_CANCELED="order_canceled",e.LIVE="live",e.PAUSED="paused",e.STOLEN="stolen",e.LOST="lost",e.PIN_BLOCKED="pin_blocked",e.DELETED="deleted",e.PRE_EXPIRED="pre_expired",e.EXPIRED="expired",e.DISCARDED="discarded",e.SHIPPED_LOST="shipped_lost",e.ABUSIVE="abusive"}(e||(e={}));const E={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var _,n;!function(e){e.VIRTUAL="virtual"}(_||(_={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(n||(n={}));export{E as CardCategories,e as CardStatus,n as PhysicalCardLevel,_ as VirtualCardLevel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{PhysicalCardLevel as i}from"./cards.types.js";import{validateExpectedStringValues as t,validateExpectedBooleanValues as n,validatePresenceOfRequiredParams as e,validateExpectedNumericValues as a}from"../validation/input-param-validation.js";import{InvalidParametersError as r}from"../errors/InvalidParametersError.js";const o=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],s=[...o,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function m(m){if(!m)throw new r("cardSettings parameter is required for the called function");return"virtual"===m.cardLevel?function(i){return e(i,o),function(i){const{membershipId:e,organizationId:o,bankAccountId:s,hasDailyLimit:m,hasTransactionLimit:c,monthlyLimit:u,dailyLimit:h,transactionLimit:f,activeDays:y,categories:p,cardLevel:L}=i,g=function(i){return"virtual"!==i?['cardLevel must be "virtual"']:[]}(L),I=t({membershipId:e,organizationId:o,bankAccountId:s}),w=n({hasDailyLimit:m,hasTransactionLimit:c}),v=a({monthlyLimit:u,dailyLimit:h,transactionLimit:f}),b=d(y),A=l(p),D=[...g,...I,...w,...v,...b,...A];if(D.length>0)throw new r(D)}(i),i}(m):function(o){e(o,s),function(e){const{membershipId:o,organizationId:s,bankAccountId:m,hasDailyLimit:c,hasTransactionLimit:u,monthlyLimit:h,dailyLimit:f,transactionLimit:y,activeDays:p,categories:L,cardLevel:g,hasNfcOption:I,hasForeignPaymentOption:w,hasOnlinePaymentOption:v,shipToBusiness:b,hasAtmOption:A,hasAtmDailyLimit:D,atmDailyLimit:O,atmMonthlyLimit:P,address:k,cardDesign:q,typeOfPrint:z}=e,T=function(t){return Object.values(i).includes(t)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(g),B=function(i){const t=null!=i&&"string"!=typeof i,n=!["print","embossed",void 0,null].includes(i);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(z),N=t({membershipId:o,organizationId:s,bankAccountId:m}),j=n({hasDailyLimit:c,hasTransactionLimit:u,hasAtmOption:A,hasNfcOption:I,hasForeignPaymentOption:w,hasOnlinePaymentOption:v,hasAtmDailyLimit:D,shipToBusiness:b}),M=a({monthlyLimit:h,dailyLimit:f,transactionLimit:y,atmDailyLimit:O,atmMonthlyLimit:P}),R=d(p),S=l(L),C=function(i){return["undefined","string"].includes(typeof i)?[]:["cardDesign must be a string"]}(q),F=function(i){return!i||i.contactName&&i.firstLine&&i.zipCode&&i.city&&i.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(k),x=[...T,...N,...j,...M,...R,...S,...B,...C,...F];if(x.length>0)throw new r(x)}(o)}(m)}function c(i){if(!i)throw new r("cardSettings parameter is required for the called function");if(!i.cardId)throw new r("cardId is required for the called function");const n=t({cardId:i.cardId});if(n.length>0)throw new r(n)}function d(i){const t=!Array.isArray(i)||!i.every((i=>Number.isInteger(i)&&i>0&&i<8));return void 0!==i&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function l(i){const t=!Array.isArray(i)||i.some((i=>"string"!=typeof i));return void 0!==i&&t?["categories must be an array of strings"]:[]}function u(i){if(!i)throw new r("cardSettings parameter is required for the called function");if(!i.cardId)throw new r("cardId is required for the called function");const e=t({cardId:i.cardId});if(e.length>0)throw new r(e);let a={};void 0!==i.allowPinReveal&&(a={allowPinReveal:i.allowPinReveal}),void 0!==i.allowBlocking&&(a={...a,allowBlocking:i.allowBlocking});const o=n(a);if(o.length>0)throw new r(o);return i}export{u as validateDisplayCardParams,m as validateOrderCardParams,c as validateUnlockCardParams};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cards as r}from"./cards.public-api.js";const s=r;export{s as cards};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class s{constructor(){this.accessToken=null}static getInstance(){return s.instance||(s.instance=new s),s.instance}setAccessToken(s){this.accessToken=s}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}}const e=s.getInstance();export{s as AuthManager,e as authManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{authManager as r}from"./auth.js";import{AuthenticationError as o}from"../../errors/AuthenticationError.js";function t(){if(!r.hasAccessToken())throw new o;return r.getAccessToken()}export{t as validatePresenceOfAuthToken};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{initialize as i,logout as t}from"./initialize/initialize.js";import*as o from"./constants.js";const n={initialize:i,logout:t,constants:o};export{n as common};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a={READY:"qonto.ready"},r={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFERS_CREATE:"transfers.create"},A={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},R={MASTER:"master",SANDBOX:"sandbox",QA:"qa"};export{r as ACTIONS,R as BRANCHES,A as ENVIRONMENTS,a as IFRAME_EVENTS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ENVIRONMENTS as t,BRANCHES as n}from"../constants.js";const e="https://embed.qonto.com",r="https://embed-js{branch}.staging.qonto.co",c="https://embed.dev.qonto.co",o={[t.PRODUCTION]:{IFRAME_BASE_URL:e,IFRAME_URL:`${e}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[t.STAGING]:{IFRAME_BASE_URL:r,IFRAME_URL:`${r}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[t.LOCAL]:{IFRAME_BASE_URL:c,IFRAME_URL:`${c}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class s{constructor(){this.environment=t.PRODUCTION,this.branch=n.MASTER}static getInstance(){return s.instance||(s.instance=new s),s.instance}setEnvironment(t){this.environment=t}getEnvironment(){return this.environment}setBranch(t){this.branch=t}getBranch(){return this.branch}clear(){this.environment=t.PRODUCTION,this.branch=n.MASTER}getEnvironmentUrls(){if(this.environment===t.PRODUCTION)return o.production;{const t=o[this.environment];return Object.entries(t).reduce(((t,[n,e])=>({...t,[n]:e.replace("{branch}",`-${this.branch}`)})),{})}}}const i=s.getInstance();export{s as EnvironmentManager,i as environmentManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{common as o}from"./common.public-api.js";const{initialize:i,logout:t,constants:n}=o;export{n as constants,i as initialize,t as logout};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{authManager as n}from"../auth/auth.js";import{validateInitializeParams as t}from"./initialize.validate.js";import{operationSettingsManager as e}from"../operation-settings/operation-settings.js";import{environmentManager as o}from"../environment/environment-manager.js";function i(i){const{accessToken:s,operationSettings:r,environment:a,branch:m}=t(i);n.setAccessToken(s),r&&e.setSettings(r),a&&(o.setEnvironment(a),m&&o.setBranch(m))}function s(){n.clearAccessToken()}export{i as initialize,s as logout};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{InvalidParametersError as n}from"../../errors/InvalidParametersError.js";import{validateOperationSettingsParams as o}from"../../validation/operation-settings-validation.js";function t(t){if(!t?.accessToken)throw new n("Access token is required when calling initialize()");return t?.operationSettings&&o(t.operationSettings),function(o){if(o.environment){if(!["production","staging","local"].includes(o.environment))throw new n('If provided, environment must be either "production" or "staging"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.environment.PRODUCTION" or "constants.environment.STAGING"');if(o.branch&&!["master","sandbox","qa"].includes(o.environment))throw new n('If provided, branch must be either "master", "sandbox" or "qa"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.branch.MASTER" or "constants.environment.SANDBOX" and so on')}}(t),t}export{t as validateInitializeParams};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class e{constructor(){this.uiParentElementId=null,this.mfaPreference=null}static getInstance(){return e.instance||(e.instance=new e),e.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}clearSettings(){this.uiParentElementId=null,this.mfaPreference=null}}const t=e.getInstance();export{e as OperationSettingsManager,t as operationSettingsManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{QontoEmbedSdkError as e}from"./QontoEmbedSdkError.js";class t extends e{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}export{t as AuthenticationError};
|