@qonto/embed-sdk 0.7.0 → 0.9.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/dist/beneficiaries/beneficiaries.api.d.ts +7 -4
- package/dist/beneficiaries/beneficiaries.api.d.ts.map +1 -1
- package/dist/beneficiaries/beneficiaries.d.ts +9 -3
- package/dist/beneficiaries/beneficiaries.d.ts.map +1 -1
- package/dist/beneficiaries/beneficiaries.types.d.ts +1 -1
- package/dist/beneficiaries/beneficiaries.types.d.ts.map +1 -1
- package/dist/cards/cards.api.d.ts +7 -5
- package/dist/cards/cards.api.d.ts.map +1 -1
- package/dist/cards/cards.d.ts +4 -2
- package/dist/cards/cards.d.ts.map +1 -1
- package/dist/common/api-pagination/api-pagination.d.ts +1 -1
- package/dist/common/api-pagination/api-pagination.d.ts.map +1 -1
- package/dist/common/auth/auth.d.ts +5 -0
- package/dist/common/auth/auth.d.ts.map +1 -1
- package/dist/common/constants.d.ts +16 -0
- package/dist/common/constants.d.ts.map +1 -1
- package/dist/common/initialize/initialize.d.ts.map +1 -1
- package/dist/common/initialize/initialize.types.d.ts +5 -0
- package/dist/common/initialize/initialize.types.d.ts.map +1 -1
- package/dist/common/network/network.d.ts +8 -0
- package/dist/common/network/network.d.ts.map +1 -0
- package/dist/common/network/network.test.d.ts +2 -0
- package/dist/common/network/network.test.d.ts.map +1 -0
- package/dist/common/network/network.types.d.ts +5 -0
- package/dist/common/network/network.types.d.ts.map +1 -0
- package/dist/iframe/iframe-manager.d.ts +2 -1
- package/dist/iframe/iframe-manager.d.ts.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/mocks/handlers.d.ts +2 -0
- package/dist/mocks/handlers.d.ts.map +1 -1
- package/dist/sepa-transfers/index.d.ts +18 -0
- package/dist/sepa-transfers/index.d.ts.map +1 -0
- package/dist/sepa-transfers/sepa-transfers.api.d.ts +21 -0
- package/dist/sepa-transfers/sepa-transfers.api.d.ts.map +1 -0
- package/dist/sepa-transfers/sepa-transfers.d.ts +41 -0
- package/dist/sepa-transfers/sepa-transfers.d.ts.map +1 -0
- package/dist/sepa-transfers/sepa-transfers.public-api.d.ts +7 -0
- package/dist/sepa-transfers/sepa-transfers.public-api.d.ts.map +1 -0
- package/dist/sepa-transfers/sepa-transfers.serializer.d.ts +3 -0
- package/dist/sepa-transfers/sepa-transfers.serializer.d.ts.map +1 -0
- package/dist/sepa-transfers/sepa-transfers.test.d.ts +2 -0
- package/dist/sepa-transfers/sepa-transfers.test.d.ts.map +1 -0
- package/dist/sepa-transfers/sepa-transfers.types.d.ts +70 -0
- package/dist/sepa-transfers/sepa-transfers.types.d.ts.map +1 -0
- package/dist/sepa-transfers/sepa-transfers.validate.d.ts +2 -0
- package/dist/sepa-transfers/sepa-transfers.validate.d.ts.map +1 -0
- package/dist/src/beneficiaries/beneficiaries.api.js +1 -1
- package/dist/src/beneficiaries/beneficiaries.js +1 -1
- package/dist/src/cards/cards.api.js +1 -1
- package/dist/src/cards/cards.js +1 -1
- package/dist/src/common/api-pagination/api-pagination.js +1 -1
- package/dist/src/common/auth/auth.js +1 -1
- package/dist/src/common/constants.js +1 -1
- package/dist/src/common/initialize/initialize.js +1 -1
- package/dist/src/common/network/network.js +1 -0
- package/dist/src/iframe/iframe-manager.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/sepa-transfers/index.js +1 -0
- package/dist/src/sepa-transfers/sepa-transfers.api.js +1 -0
- package/dist/src/sepa-transfers/sepa-transfers.js +1 -0
- package/dist/src/sepa-transfers/sepa-transfers.public-api.js +1 -0
- package/dist/src/sepa-transfers/sepa-transfers.serializer.js +1 -0
- package/dist/src/sepa-transfers/sepa-transfers.validate.js +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.public-api.d.ts +2 -1
- package/dist/types/types.public-api.d.ts.map +1 -1
- package/package.json +5 -1
|
@@ -2,22 +2,25 @@ import type { BeneficiaryDataObject, NewBeneficiary } from './beneficiaries.type
|
|
|
2
2
|
import type { PaginationResponseDataObject, PaginationSettings } from '@common/api-pagination/api-pagination.types';
|
|
3
3
|
interface GetBeneficiariesParams {
|
|
4
4
|
accessToken: string;
|
|
5
|
+
stagingToken?: string;
|
|
5
6
|
paginationSettings?: PaginationSettings;
|
|
6
7
|
}
|
|
7
8
|
interface GetBeneficiaryParams {
|
|
8
9
|
accessToken: string;
|
|
10
|
+
stagingToken?: string;
|
|
9
11
|
beneficiaryId: string;
|
|
10
12
|
}
|
|
11
13
|
interface AddBeneficiaryParams {
|
|
12
|
-
accessToken: string;
|
|
13
14
|
beneficiary: NewBeneficiary;
|
|
15
|
+
accessToken: string;
|
|
16
|
+
stagingToken?: string;
|
|
14
17
|
}
|
|
15
18
|
interface GetBeneficiariesApiResponse {
|
|
16
19
|
beneficiaries: BeneficiaryDataObject[];
|
|
17
20
|
meta: PaginationResponseDataObject;
|
|
18
21
|
}
|
|
19
|
-
export declare function getBeneficiaries({ paginationSettings, accessToken, }: GetBeneficiariesParams): Promise<GetBeneficiariesApiResponse>;
|
|
20
|
-
export declare function getBeneficiary({ accessToken, beneficiaryId, }: GetBeneficiaryParams): Promise<BeneficiaryDataObject>;
|
|
21
|
-
export declare function addBeneficiary({ accessToken,
|
|
22
|
+
export declare function getBeneficiaries({ paginationSettings, accessToken, stagingToken, }: GetBeneficiariesParams): Promise<GetBeneficiariesApiResponse>;
|
|
23
|
+
export declare function getBeneficiary({ accessToken, stagingToken, beneficiaryId, }: GetBeneficiaryParams): Promise<BeneficiaryDataObject>;
|
|
24
|
+
export declare function addBeneficiary({ beneficiary, accessToken, stagingToken, }: AddBeneficiaryParams): Promise<any>;
|
|
22
25
|
export {};
|
|
23
26
|
//# sourceMappingURL=beneficiaries.api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beneficiaries.api.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"beneficiaries.api.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAKrD,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,oBAAoB;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,oBAAoB;IAC5B,WAAW,EAAE,cAAc,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID,UAAU,2BAA2B;IACnC,aAAa,EAAE,qBAAqB,EAAE,CAAC;IACvC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,wBAAsB,gBAAgB,CAAC,EACrC,kBAAkB,EAClB,WAAW,EACX,YAAY,GACb,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CA+B/D;AAED,wBAAsB,cAAc,CAAC,EACnC,WAAW,EACX,YAAY,EACZ,aAAa,GACd,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqBvD;AAED,wBAAsB,cAAc,CAAC,EACnC,WAAW,EACX,WAAW,EACX,YAAY,GACb,EAAE,oBAAoB,gBAyBtB"}
|
|
@@ -12,24 +12,29 @@ import type { PaginationSettings } from '@common/api-pagination/api-pagination.t
|
|
|
12
12
|
* @throws \{AuthenticationError\} If the access token is invalid or missing.
|
|
13
13
|
* Ensure initialize has been called before using this function if you are not
|
|
14
14
|
* passing the access token.
|
|
15
|
+
* @throws \{EmbedApiError\} If the API request fails or returns an error.
|
|
15
16
|
*/
|
|
16
17
|
export declare function getBeneficiaries(getBeneficiariesParams?: {
|
|
17
18
|
accessToken?: string;
|
|
19
|
+
stagingToken?: string;
|
|
18
20
|
paginationSettings?: PaginationSettings;
|
|
19
21
|
}): Promise<GetBeneficiariesResponse>;
|
|
20
22
|
/**
|
|
21
23
|
* Fetches a single beneficiary of the current user by ID.
|
|
22
|
-
* @param Object - An object with the beneficiaryId and the accessToken
|
|
24
|
+
* @param Object - An object with the beneficiaryId and the optional accessToken
|
|
25
|
+
* and stagingToken properties.
|
|
23
26
|
* @returns A promise that resolves to a beneficiary.
|
|
24
27
|
* @throws \{AuthenticationError\} If the access token is invalid or missing.
|
|
25
28
|
* Ensure initialize has been called before using this function if you are not
|
|
26
29
|
* passing the access token.
|
|
27
30
|
* @throws \{InvalidParametersError\} If the `beneficiaryId` parameter is not a
|
|
28
31
|
* string or is missing.
|
|
32
|
+
* @throws \{EmbedApiError\} If the API request fails or returns an error.
|
|
29
33
|
*/
|
|
30
|
-
export declare function getBeneficiary({ beneficiaryId, accessToken, }: {
|
|
34
|
+
export declare function getBeneficiary({ beneficiaryId, accessToken, stagingToken, }: {
|
|
31
35
|
beneficiaryId: string;
|
|
32
36
|
accessToken?: string;
|
|
37
|
+
stagingToken?: string;
|
|
33
38
|
}): Promise<Beneficiary>;
|
|
34
39
|
/**
|
|
35
40
|
* Adds a new beneficiary in the current user's account.
|
|
@@ -42,8 +47,9 @@ export declare function getBeneficiary({ beneficiaryId, accessToken, }: {
|
|
|
42
47
|
* @throws \{InvalidParametersError\} If the `beneficiary` parameter is not an
|
|
43
48
|
* object or if it does not contain the required properties.
|
|
44
49
|
*/
|
|
45
|
-
export declare function addBeneficiary({ beneficiary, accessToken, }: {
|
|
50
|
+
export declare function addBeneficiary({ beneficiary, accessToken, stagingToken, }: {
|
|
46
51
|
beneficiary: NewBeneficiary;
|
|
47
52
|
accessToken?: string;
|
|
53
|
+
stagingToken?: string;
|
|
48
54
|
}): Promise<Beneficiary>;
|
|
49
55
|
//# sourceMappingURL=beneficiaries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beneficiaries.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACxB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAY/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEtF
|
|
1
|
+
{"version":3,"file":"beneficiaries.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACxB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAY/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEtF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CAAC,sBAAsB,CAAC,EAAE;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAqBpC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAAC,EACnC,aAAa,EACb,WAAW,EACX,YAAY,GACb,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,WAAW,CAAC,CASvB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,EACnC,WAAW,EACX,WAAW,EACX,YAAY,GACb,EAAE;IACD,WAAW,EAAE,cAAc,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,WAAW,CAAC,CASvB"}
|
|
@@ -57,6 +57,6 @@ export interface GetBeneficiariesResponse {
|
|
|
57
57
|
/**
|
|
58
58
|
* Metadata about the pagination state of the response, such as the current page and total pages.
|
|
59
59
|
*/
|
|
60
|
-
meta
|
|
60
|
+
meta?: PaginationState;
|
|
61
61
|
}
|
|
62
62
|
//# sourceMappingURL=beneficiaries.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beneficiaries.types.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAAG;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;CAClE,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,aAAa,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"beneficiaries.types.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAAG;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;CAClE,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,aAAa,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { CardDataObject, DisplayCardSettings } from './cards.types';
|
|
2
2
|
interface GetCardsParams {
|
|
3
|
-
accessToken: string;
|
|
4
3
|
membershipId?: string;
|
|
4
|
+
accessToken: string;
|
|
5
|
+
stagingToken?: string;
|
|
5
6
|
}
|
|
6
7
|
interface GetCardParams {
|
|
7
|
-
accessToken: string;
|
|
8
8
|
cardId: string;
|
|
9
|
+
accessToken: string;
|
|
10
|
+
stagingToken?: string;
|
|
9
11
|
}
|
|
10
|
-
export declare function getCards({ accessToken,
|
|
11
|
-
export declare function getCard({ accessToken,
|
|
12
|
-
export declare function getCardIframeURL(cardSettings: DisplayCardSettings, accessToken: string): Promise<string>;
|
|
12
|
+
export declare function getCards({ membershipId, accessToken, stagingToken, }: GetCardsParams): Promise<CardDataObject[]>;
|
|
13
|
+
export declare function getCard({ cardId, accessToken, stagingToken, }: GetCardParams): Promise<CardDataObject>;
|
|
14
|
+
export declare function getCardIframeURL(cardSettings: DisplayCardSettings, accessToken: string, stagingToken?: string): Promise<string>;
|
|
13
15
|
export {};
|
|
14
16
|
//# sourceMappingURL=cards.api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cards.api.d.ts","sourceRoot":"","sources":["../../src/cards/cards.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"cards.api.d.ts","sourceRoot":"","sources":["../../src/cards/cards.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAOzE,UAAU,cAAc;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,QAAQ,CAAC,EAC7B,YAAY,EACZ,WAAW,EACX,YAAY,GACb,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAoB5C;AAED,wBAAsB,OAAO,CAAC,EAC5B,MAAM,EACN,WAAW,EACX,YAAY,GACb,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAkBzC;AAED,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,mBAAmB,EACjC,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAsBjB"}
|
package/dist/cards/cards.d.ts
CHANGED
|
@@ -24,9 +24,10 @@ export interface CardParams<T> {
|
|
|
24
24
|
* Ensure initialize has been called before using this function if you are not
|
|
25
25
|
* passing the access token.
|
|
26
26
|
*/
|
|
27
|
-
export declare function getCards({ membershipId, accessToken, }: {
|
|
27
|
+
export declare function getCards({ membershipId, accessToken, stagingToken, }: {
|
|
28
28
|
membershipId?: string;
|
|
29
29
|
accessToken?: string;
|
|
30
|
+
stagingToken?: string;
|
|
30
31
|
}): Promise<Card[]>;
|
|
31
32
|
/**
|
|
32
33
|
* Fetches a card by its id.
|
|
@@ -36,9 +37,10 @@ export declare function getCards({ membershipId, accessToken, }: {
|
|
|
36
37
|
* Ensure initialize has been called before using this function if you are not
|
|
37
38
|
* passing the access token.
|
|
38
39
|
*/
|
|
39
|
-
export declare function getCard({ cardId, accessToken, }: {
|
|
40
|
+
export declare function getCard({ cardId, accessToken, stagingToken, }: {
|
|
40
41
|
cardId: string;
|
|
41
42
|
accessToken?: string;
|
|
43
|
+
stagingToken?: string;
|
|
42
44
|
}): Promise<Card>;
|
|
43
45
|
/**
|
|
44
46
|
* Requests the creation of a card by showing the user the UI to perform MFA in the calling page.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../src/cards/cards.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,IAAI,EAET,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AAYvB,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,2CAA2C,CAAC;AAGnD;;;;;;GAMG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC;IAChB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,EAC7B,YAAY,EACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../src/cards/cards.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,IAAI,EAET,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AAYvB,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,2CAA2C,CAAC;AAGnD;;;;;;GAMG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC;IAChB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,EAC7B,YAAY,EACZ,WAAW,EACX,YAAY,GACb,EAAE;IACD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAelB;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,EAC5B,MAAM,EACN,WAAW,EACX,YAAY,GACb,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,UAAU,CAAC,iBAAiB,CAAC,GACxC,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,UAAU,CAC9B,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,GACzC,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAC/B,UAAU,EAAE,UAAU,CAAC,mBAAmB,CAAC,GAC1C,OAAO,CAAC,uBAAuB,CAAC,CAsBlC"}
|
|
@@ -4,6 +4,6 @@ interface AddPaginationParamsToUrlArgs {
|
|
|
4
4
|
paginationSettings?: PaginationSettings;
|
|
5
5
|
}
|
|
6
6
|
export declare function addPaginationParamsToUrl({ endpointUrl, paginationSettings, }: AddPaginationParamsToUrlArgs): URL;
|
|
7
|
-
export declare function serializePaginationResponse(paginationResponse: PaginationResponseDataObject): PaginationState;
|
|
7
|
+
export declare function serializePaginationResponse(paginationResponse: PaginationResponseDataObject): PaginationState | undefined;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=api-pagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-pagination.d.ts","sourceRoot":"","sources":["../../../src/common/api-pagination/api-pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EAClB,eAAe,EAChB,MAAM,6CAA6C,CAAC;AAErD,UAAU,4BAA4B;IACpC,WAAW,EAAE,GAAG,CAAC;IACjB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EACX,kBAAkB,GACnB,EAAE,4BAA4B,GAAG,GAAG,CAYpC;AAED,wBAAgB,2BAA2B,CACzC,kBAAkB,EAAE,4BAA4B,GAC/C,eAAe,
|
|
1
|
+
{"version":3,"file":"api-pagination.d.ts","sourceRoot":"","sources":["../../../src/common/api-pagination/api-pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EAClB,eAAe,EAChB,MAAM,6CAA6C,CAAC;AAErD,UAAU,4BAA4B;IACpC,WAAW,EAAE,GAAG,CAAC;IACjB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EACX,kBAAkB,GACnB,EAAE,4BAA4B,GAAG,GAAG,CAYpC;AAED,wBAAgB,2BAA2B,CACzC,kBAAkB,EAAE,4BAA4B,GAC/C,eAAe,GAAG,SAAS,CAY7B"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
export declare class AuthManager {
|
|
5
5
|
private static instance;
|
|
6
6
|
private accessToken;
|
|
7
|
+
private stagingToken;
|
|
7
8
|
private constructor();
|
|
8
9
|
/**
|
|
9
10
|
* Gets the singleton instance of AuthManager
|
|
@@ -28,6 +29,10 @@ export declare class AuthManager {
|
|
|
28
29
|
* Clears the current access token
|
|
29
30
|
*/
|
|
30
31
|
clearAccessToken(): void;
|
|
32
|
+
setStagingToken(token: string): void;
|
|
33
|
+
getStagingToken(): string | null;
|
|
34
|
+
hasStagingToken(): boolean;
|
|
35
|
+
clearStagingToken(): void;
|
|
31
36
|
}
|
|
32
37
|
export declare const authManager: AuthManager;
|
|
33
38
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/common/auth/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO,CAAC,WAAW,CAAuB;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/common/auth/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,YAAY,CAAuB;IAE3C,OAAO;IAIP;;OAEG;WACW,WAAW,IAAI,WAAW;IAOxC;;;OAGG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1C;;;OAGG;IACI,cAAc,IAAI,MAAM,GAAG,IAAI;IAItC;;;OAGG;IACI,cAAc,IAAI,OAAO;IAIhC;;OAEG;IACI,gBAAgB,IAAI,IAAI;IAIxB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIpC,eAAe,IAAI,MAAM,GAAG,IAAI;IAIhC,eAAe,IAAI,OAAO;IAI1B,iBAAiB,IAAI,IAAI;CAGjC;AAGD,eAAO,MAAM,WAAW,aAA4B,CAAC"}
|
|
@@ -73,4 +73,20 @@ export declare const BENEFICIARY_STATUSES: {
|
|
|
73
73
|
VALIDATED: string;
|
|
74
74
|
DECLINED: string;
|
|
75
75
|
};
|
|
76
|
+
export declare const SEPA_TRANSFER_DECLINE_REASONS: {
|
|
77
|
+
BENEFICIARY_BIC_INVALID: string;
|
|
78
|
+
BENEFICIARY_IBAN_INVALID: string;
|
|
79
|
+
BENEFICIARY_STATUS: string;
|
|
80
|
+
BENEFICIARY_NETWORK_RULES_ERROR: string;
|
|
81
|
+
ORGANISATION_COMPLIANCE_REASONS: string;
|
|
82
|
+
DEBIT_ACCOUNT_INSUFFICIENT_FUNDS: string;
|
|
83
|
+
QONTO_PROCESSING_FAILED: string;
|
|
84
|
+
};
|
|
85
|
+
export declare const SEPA_TRANSFER_STATUSES: {
|
|
86
|
+
PENDING: string;
|
|
87
|
+
PROCESSING: string;
|
|
88
|
+
CANCELED: string;
|
|
89
|
+
DECLINED: string;
|
|
90
|
+
SETTLED: string;
|
|
91
|
+
};
|
|
76
92
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;CAQnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;CAQnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;CAQzC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;CAMlC,CAAC"}
|
|
@@ -1 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,QAiB5D;AAED;;;;GAIG;AACH,wBAAgB,MAAM,SAGrB"}
|
|
@@ -9,6 +9,11 @@ export interface InitializeParams {
|
|
|
9
9
|
* generated using the OAuth authentication flow.
|
|
10
10
|
*/
|
|
11
11
|
accessToken: string;
|
|
12
|
+
/**
|
|
13
|
+
* The staging token allows users outside Qonto to access the staging environment.
|
|
14
|
+
* This is helpful for testing purposes, and it is irrelevant in production.
|
|
15
|
+
*/
|
|
16
|
+
stagingToken?: string;
|
|
12
17
|
locale?: 'en' | 'fr' | 'es' | 'de' | 'it' | 'pt';
|
|
13
18
|
/**
|
|
14
19
|
* Optional parameter to set the SDK's environment. If not provided,
|
|
@@ -1 +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;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjD;;;;OAIG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;IACjD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC"}
|
|
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;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjD;;;;OAIG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;IACjD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface BuildRequestHeadersParams {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
stagingToken?: string;
|
|
4
|
+
idempotencyKey?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function buildRequestHeaders({ accessToken, stagingToken, idempotencyKey, }: BuildRequestHeadersParams): Headers;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../src/common/network/network.ts"],"names":[],"mappings":"AAEA,UAAU,yBAAyB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,yBAAyB,GAAG,OAAO,CAcrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.test.d.ts","sourceRoot":"","sources":["../../../src/common/network/network.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.types.d.ts","sourceRoot":"","sources":["../../../src/common/network/network.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EmbedIframe } from './embed-iframe';
|
|
2
2
|
interface BuildIframeUrlParams {
|
|
3
3
|
accessToken: string;
|
|
4
|
+
stagingToken?: string;
|
|
4
5
|
language?: string;
|
|
5
6
|
debugMode?: boolean;
|
|
6
7
|
}
|
|
@@ -8,7 +9,7 @@ interface CreateIframeParams {
|
|
|
8
9
|
parentElementId: string;
|
|
9
10
|
iframeUrl: string;
|
|
10
11
|
}
|
|
11
|
-
export declare function buildIframeUrl({ accessToken, language, debugMode, }: BuildIframeUrlParams): string;
|
|
12
|
+
export declare function buildIframeUrl({ accessToken, stagingToken, language, debugMode, }: BuildIframeUrlParams): string;
|
|
12
13
|
export declare function createIframe({ parentElementId, iframeUrl, }: CreateIframeParams): Promise<EmbedIframe>;
|
|
13
14
|
export {};
|
|
14
15
|
//# sourceMappingURL=iframe-manager.d.ts.map
|
|
@@ -1 +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,
|
|
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,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,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,YAAY,EACZ,QAAQ,EACR,SAAS,GACV,EAAE,oBAAoB,UAQtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,eAAe,EACf,SAAS,GACV,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAG3C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { initialize, logout, constants } from '@common';
|
|
2
2
|
import { cards } from '@cards';
|
|
3
3
|
import { beneficiaries } from '@beneficiaries';
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
export
|
|
4
|
+
import { sepaTransfers } from '@sepa-transfers';
|
|
5
|
+
import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer } from '@types';
|
|
6
|
+
export { initialize, logout, cards, sepaTransfers, beneficiaries, constants };
|
|
7
|
+
export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, };
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,
|
|
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;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;AAC9E,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,GACb,CAAC"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +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,this.debugMode=!1}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),e.debugMode&&(this.debugMode=e.debugMode)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}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.");const i=e?.debugMode||c.getDebugMode();if(void 0!==i&&"boolean"!=typeof i)throw new s("operationSettings.debugMode must be a boolean.");return{uiParentElementId:t,mfaPreference:n,debugMode:i}}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.branch))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"},p={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},h={MASTER:"master",SANDBOX:"sandbox",QA:"qa"};var f=Object.freeze({__proto__:null,ACTIONS:u,ACTIVITY_TAGS:{ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:h,ENVIRONMENTS:p,IFRAME_EVENTS:l});const _="https://embed.qonto.com",g="https://embed-js{branch}.staging.qonto.co",y="https://embed.dev.qonto.co",I={[p.PRODUCTION]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[p.STAGING]:{IFRAME_BASE_URL:g,IFRAME_URL:`${g}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[p.LOCAL]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class E{constructor(){this.environment=p.PRODUCTION,this.branch=h.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(p).includes(e)?e:p.PRODUCTION,this.branch=Object.values(h).includes(t)?t:h.SANDBOX}static getInstance(){return E.instance||(E.instance=new E),E.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=p.PRODUCTION,this.branch=h.MASTER}getEnvironmentUrls(){if(this.environment===p.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 A=E.getInstance();const b={initialize:function(e){const{accessToken:t,operationSettings:i,environment:a,branch:r}=m(e);n.setAccessToken(t),i&&c.setSettings(i),a&&(A.setEnvironment(a),r&&A.setBranch(r))},logout:function(){n.clearAccessToken()},constants:f},{initialize:w,logout:T,constants:L}=b;class R 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 v(e,t){const n={method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","Accept-Language":"en"}},i=A.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 R(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 D;!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"}(D||(D={}));const P={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 N(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:void 0===e[t.name])).map((e=>e.name));if(n.length>0)throw new s(n.map((e=>`Missing required parameter: ${e}`)))}function U(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function C(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function k(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 B(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return N(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,p=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(u),h=U({membershipId:t,organizationId:n,bankAccountId:i}),f=C({hasDailyLimit:a,hasTransactionLimit:r}),_=k({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),g=z(m),y=j(l),I=[...p,...h,...f,..._,...g,...y];if(I.length>0)throw new s(I)}(e),e}(e):function(e){N(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:p,hasForeignPaymentOption:h,hasOnlinePaymentOption:f,shipToBusiness:_,hasAtmOption:g,hasAtmDailyLimit:y,atmDailyLimit:I,atmMonthlyLimit:E,address:A,cardDesign:b,typeOfPrint:w}=e,T=function(e){return Object.values(S).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(u),L=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),R=U({membershipId:t,organizationId:n,bankAccountId:i}),v=C({hasDailyLimit:a,hasTransactionLimit:r,hasAtmOption:g,hasNfcOption:p,hasForeignPaymentOption:h,hasOnlinePaymentOption:f,hasAtmDailyLimit:y,shipToBusiness:_}),D=k({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:I,atmMonthlyLimit:E}),P=z(m),O=j(l),N=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(b),M=function(e,t){if(t)return[];return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(A,_),$=[...T,...R,...v,...D,...P,...O,...L,...N,...M];if($.length>0)throw new s($)}(e)}(e)}function z(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 j(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 F extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}class q{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 F(`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 F(`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 F(`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 F("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 G({accessToken:e,language:t,debugMode:n}){const i=n||!1,a=t||"en";return`${A.getEnvironmentUrls().IFRAME_URL}?debug=${i}&lang=${encodeURIComponent(a)}#access_token=${encodeURIComponent(e)}`}function x({parentElementId:e,iframeUrl:t}){return new q({parentElementId:e,iframeUrl:t}).initialize()}const Y=[];for(let e=0;e<256;++e)Y.push((e+256).toString(16).slice(1));let H;const V=new Uint8Array(16);var X={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function K(e,t,n){if(X.randomUUID&&!e)return X.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(Y[e[t+0]]+Y[e[t+1]]+Y[e[t+2]]+Y[e[t+3]]+"-"+Y[e[t+4]]+Y[e[t+5]]+"-"+Y[e[t+6]]+Y[e[t+7]]+"-"+Y[e[t+8]]+Y[e[t+9]]+"-"+Y[e[t+10]]+Y[e[t+11]]+Y[e[t+12]]+Y[e[t+13]]+Y[e[t+14]]+Y[e[t+15]]).toLowerCase()}(i)}function Q(e){return"virtual"===e.cardLevel?function(e){const t=J(e.categories);return{actionId:u.CARD_ORDER,actionData:{idempotencyKey:K(),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:K(),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 W(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(P);return(e||[]).filter((e=>t.includes(e)))}const Z={getCards:async function({membershipId:e,accessToken:t}){try{const n=t||r();if(e&&"string"!=typeof e)throw new s("membershipId must be a string");const i=await async function({accessToken:e,membershipId:t}){const n={method:"GET",headers:{Authorization:`Bearer ${e}`}},i=A.getEnvironmentUrls().THIRD_PARTY_API_URL,a=t?`${i}/v2/cards?holder_ids[]=${t}`:`${i}/v2/cards`,r=await fetch(a,n),s=await r.json();if(s.errors)throw new R(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.cards}({accessToken:n,membershipId:e});return i.map((e=>W(e)))}catch(e){return Promise.reject(e)}},getCard:async function({cardId:e,accessToken:t}){try{const n=t||r();if(e&&"string"!=typeof e)throw new s("cardId must be a string");const i=await async function({accessToken:e,cardId:t}){const n={method:"GET",headers:{Authorization:`Bearer ${e}`}},i=`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/cards?ids[]=${t}`,a=await fetch(i,n),r=await a.json();if(r.errors)throw new R(r.errors.map((e=>`${e.code}: ${e.detail}`)));return r.cards[0]}({accessToken:n,cardId:e});return W(i)}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:n,debugMode:i}=d(e.operationSettings);B(e.cardSettings);const a=G({accessToken:t,debugMode:i}),s=await x({iframeUrl:a,parentElementId:n}),o=Q(e.cardSettings),c=await s.postMessage(o);return s.destroy(),W(c)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:n,debugMode:i}=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=U({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const a=G({accessToken:t,debugMode:i}),o=await x({iframeUrl:a,parentElementId:n}),c=function(e){return{actionId:u.CARD_UNLOCK,actionData:{cardId:e.cardSettings.cardId}}}(e),m=await o.postMessage(c);return o.destroy(),W(m)}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=U({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=C(n);if(i.length>0)throw new s(i)}(e.cardSettings);const i=await v(e.cardSettings,t),a=await x({iframeUrl:i,parentElementId:n});return{destroyEmbedUI:()=>{a.destroy()}}}catch(e){return Promise.reject(e)}}},ee=Z;function te(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function ne(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const ie="/v2/sepa/beneficiaries";async function ae({paginationSettings:e,accessToken:t}){const n={method:"GET",headers:{Authorization:`Bearer ${t}`}},i=function({endpointUrl:e,paginationSettings:t}){const n=new URL(e);return t?.page&&n.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&n.searchParams.set("per_page",t.itemsPerPage.toString()),n}({endpointUrl:new URL(A.getEnvironmentUrls().THIRD_PARTY_API_URL+ie),paginationSettings:e}),a=await fetch(i,n),r=await a.json();if(r.errors)throw new R(r.errors.map((e=>`${e.code}: ${e.detail}`)));return{beneficiaries:r.beneficiaries,meta:r.meta}}const re=[{name:"name"},{name:"iban"}];const se={getBeneficiaries:async function(e){const t=e?.accessToken||r(),n=await ae({accessToken:t,paginationSettings:e?.paginationSettings});var i;return{beneficiaries:n.beneficiaries.map((e=>te(e))),meta:{totalItems:(i=n.meta).total_count,totalPages:i.total_pages,currentPage:i.current_page,itemsPerPage:i.per_page,previousPage:i.prev_page||null,nextPage:i.next_page||null}}},getBeneficiary:async function({beneficiaryId:e,accessToken:t}){const n=t||r();!function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string")}(e);return te(await async function({accessToken:e,beneficiaryId:t}){const n={method:"GET",headers:{Authorization:`Bearer ${e}`}},i=`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}${ie}/${t}`,a=await fetch(i,n),r=await a.json();if(r.errors)throw new R(r.errors.map((e=>`${e.code}: ${e.detail}`)));return r.beneficiary}({accessToken:n,beneficiaryId:e}))},addBeneficiary:async function({beneficiary:e,accessToken:t}){const n=t||r();!function(e){if(!e)throw new s("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new s("beneficiary must be an object");N(e,re);const t=U({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new s(t)}(e);return te(await async function({accessToken:e,beneficiary:t}){const n={method:"POST",headers:{Authorization:`Bearer ${e}`,"X-Qonto-Idempotency-Key":K(),"Content-Type":"application/json"},body:JSON.stringify({beneficiary:ne(t)})},i=`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}${ie}`,a=await fetch(i,n),r=await a.json();if(r.errors)throw new R(r.errors.map((e=>`${e.code}: ${e.detail}`)));return r.beneficiary}({accessToken:n,beneficiary:e}))}};e.beneficiaries=se,e.cards=ee,e.constants=L,e.initialize=w,e.logout=T}));
|
|
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,this.stagingToken=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}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=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,this.debugMode=!1}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),e.debugMode&&(this.debugMode=e.debugMode)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}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.");const i=e?.debugMode||c.getDebugMode();if(void 0!==i&&"boolean"!=typeof i)throw new s("operationSettings.debugMode must be a boolean.");return{uiParentElementId:t,mfaPreference:n,debugMode:i}}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.branch))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"},p={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},g={MASTER:"master",SANDBOX:"sandbox",QA:"qa"};var h=Object.freeze({__proto__:null,ACTIONS:u,ACTIVITY_TAGS:{ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:g,ENVIRONMENTS:p,IFRAME_EVENTS:l,SEPA_TRANSFER_DECLINE_REASONS:{BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},SEPA_TRANSFER_STATUSES:{PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled"}});const f="https://embed.qonto.com",_="https://embed-js{branch}.staging.qonto.co",y="https://embed.dev.qonto.co",T={[p.PRODUCTION]:{IFRAME_BASE_URL:f,IFRAME_URL:`${f}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[p.STAGING]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[p.LOCAL]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class I{constructor(){this.environment=p.PRODUCTION,this.branch=g.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(p).includes(e)?e:p.PRODUCTION,this.branch=Object.values(g).includes(t)?t:g.SANDBOX}static getInstance(){return I.instance||(I.instance=new I),I.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=p.PRODUCTION,this.branch=g.MASTER}getEnvironmentUrls(){if(this.environment===p.PRODUCTION)return T.production;{const e=T[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const E=I.getInstance();const A={initialize:function(e){const{accessToken:t,stagingToken:i,operationSettings:a,environment:r,branch:s}=m(e);n.setAccessToken(t),i&&n.setStagingToken(i),a&&c.setSettings(a),r&&(E.setEnvironment(r),s&&E.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken()},constants:h},{initialize:w,logout:b,constants:R}=A;class L 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}`}}function D({accessToken:e,stagingToken:t,idempotencyKey:i}){const a=new Headers;a.append("Authorization",`Bearer ${e}`);const r=t||n.getStagingToken();return r&&a.append("X-Qonto-Staging-Token",r),i&&a.append("X-Qonto-Idempotency-Key",i),a.append("Content-Type","application/json"),a.append("Accept-Language","en"),a}async function k(e,t,n){const i={method:"GET",headers:D({accessToken:t,stagingToken:n})},a=E.getEnvironmentUrls().THIRD_PARTY_API_URL,r=await fetch(`${a}/v2/cards/${e.cardId}/data_view`,i),s=await r.json();if(s.errors)throw new L(s.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()}(s.iframe_url,e)}var v;!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"}(v||(v={}));const S={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 P,N;function O(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:void 0===e[t.name])).map((e=>e.name));if(n.length>0)throw new s(n.map((e=>`Missing required parameter: ${e}`)))}function U(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function C(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function M(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"}(P||(P={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(N||(N={}));const $=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],B=[...$,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function F(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return O(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}=e,p=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(u),g=U({membershipId:t,organizationId:n,bankAccountId:i}),h=C({hasDailyLimit:a,hasTransactionLimit:r}),f=M({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),_=G(m),y=j(l),T=[...p,...g,...h,...f,..._,...y];if(T.length>0)throw new s(T)}(e),e}(e):function(e){O(e,B),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:p,hasForeignPaymentOption:g,hasOnlinePaymentOption:h,shipToBusiness:f,hasAtmOption:_,hasAtmDailyLimit:y,atmDailyLimit:T,atmMonthlyLimit:I,address:E,cardDesign:A,typeOfPrint:w}=e,b=function(e){return Object.values(N).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(u),R=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),L=U({membershipId:t,organizationId:n,bankAccountId:i}),D=C({hasDailyLimit:a,hasTransactionLimit:r,hasAtmOption:_,hasNfcOption:p,hasForeignPaymentOption:g,hasOnlinePaymentOption:h,hasAtmDailyLimit:y,shipToBusiness:f}),k=M({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:T,atmMonthlyLimit:I}),v=G(m),S=j(l),P=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(A),O=function(e,t){if(t)return[];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,f),$=[...b,...L,...D,...k,...v,...S,...R,...P,...O];if($.length>0)throw new s($)}(e)}(e)}function G(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 j(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 Y extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}class q{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 Y(`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 Y(`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 Y(`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 Y("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 x({accessToken:e,stagingToken:t,language:n,debugMode:i}){const a=i||!1,r=n||"en",s=E.getEnvironmentUrls().IFRAME_URL,o=t?`&staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${a}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function z({parentElementId:e,iframeUrl:t}){return new q({parentElementId:e,iframeUrl:t}).initialize()}const H=[];for(let e=0;e<256;++e)H.push((e+256).toString(16).slice(1));let V;const K=new Uint8Array(16);var X={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Q(e,t,n){if(X.randomUUID&&!e)return X.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!V){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");V=crypto.getRandomValues.bind(crypto)}return V(K)}();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(H[e[t+0]]+H[e[t+1]]+H[e[t+2]]+H[e[t+3]]+"-"+H[e[t+4]]+H[e[t+5]]+"-"+H[e[t+6]]+H[e[t+7]]+"-"+H[e[t+8]]+H[e[t+9]]+"-"+H[e[t+10]]+H[e[t+11]]+H[e[t+12]]+H[e[t+13]]+H[e[t+14]]+H[e[t+15]]).toLowerCase()}(i)}function W(e){return"virtual"===e.cardLevel?function(e){const t=Z(e.categories);return{actionId:u.CARD_ORDER,actionData:{idempotencyKey:Q(),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=Z(e.categories);return{actionId:u.CARD_ORDER,actionData:{idempotencyKey:Q(),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 J(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 Z(e){const t=Object.values(S);return(e||[]).filter((e=>t.includes(e)))}const ee={getCards:async function({membershipId:e,accessToken:t,stagingToken:n}){try{const i=t||r();if(e&&"string"!=typeof e)throw new s("membershipId must be a string");const a=await async function({membershipId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:D({accessToken:t,stagingToken:n})},a=E.getEnvironmentUrls().THIRD_PARTY_API_URL,r=e?`${a}/v2/cards?holder_ids[]=${e}`:`${a}/v2/cards`,s=await fetch(r,i),o=await s.json();if(o.errors)throw new L(o.errors.map((e=>`${e.code}: ${e.detail}`)));return o.cards}({membershipId:e,accessToken:i,stagingToken:n});return a.map((e=>J(e)))}catch(e){return Promise.reject(e)}},getCard:async function({cardId:e,accessToken:t,stagingToken:n}){try{const i=t||r();if(e&&"string"!=typeof e)throw new s("cardId must be a string");const a=await async function({cardId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:D({accessToken:t,stagingToken:n})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/cards?ids[]=${e}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.cards[0]}({cardId:e,accessToken:i,stagingToken:n});return J(a)}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:i,debugMode:a}=d(e.operationSettings);F(e.cardSettings);const s=x({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),o=await z({iframeUrl:s,parentElementId:i}),c=W(e.cardSettings),m=await o.postMessage(c);return o.destroy(),J(m)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:i,debugMode:a}=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=U({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=x({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),c=await z({iframeUrl:o,parentElementId:i}),m=function(e){return{actionId:u.CARD_UNLOCK,actionData:{cardId:e.cardSettings.cardId}}}(e),l=await c.postMessage(m);return c.destroy(),J(l)}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=U({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=C(n);if(i.length>0)throw new s(i)}(e.cardSettings);const i=await k(e.cardSettings,t),a=await z({iframeUrl:i,parentElementId:n});return{destroyEmbedUI:()=>{a.destroy()}}}catch(e){return Promise.reject(e)}}},te=ee;function ne({endpointUrl:e,paginationSettings:t}){const n=new URL(e);return t?.page&&n.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&n.searchParams.set("per_page",t.itemsPerPage.toString()),n}function ie(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}function ae(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function re(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const se="/v2/sepa/beneficiaries";const oe=[{name:"name"},{name:"iban"}];const ce={getBeneficiaries:async function(e){const t=e?.accessToken||r(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:D({accessToken:t,stagingToken:n})},a=ne({endpointUrl:new URL(E.getEnvironmentUrls().THIRD_PARTY_API_URL+se),paginationSettings:e}),r=await fetch(a,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{beneficiaries:s.beneficiaries,meta:s.meta}}({accessToken:t,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),i=n.beneficiaries.map((e=>ae(e))),a=ie(n.meta);return{beneficiaries:i,...a?{meta:a}:{}}},getBeneficiary:async function({beneficiaryId:e,accessToken:t,stagingToken:n}){const i=t||r();!function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string")}(e);return ae(await async function({accessToken:e,stagingToken:t,beneficiaryId:n}){const i={method:"GET",headers:D({accessToken:e,stagingToken:t})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${se}/${n}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiary}({beneficiaryId:e,accessToken:i,stagingToken:n}))},addBeneficiary:async function({beneficiary:e,accessToken:t,stagingToken:n}){const i=t||r();!function(e){if(!e)throw new s("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new s("beneficiary must be an object");O(e,oe);const t=U({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new s(t)}(e);return ae(await async function({beneficiary:e,accessToken:t,stagingToken:n}){const i={method:"POST",headers:D({accessToken:t,stagingToken:n,idempotencyKey:Q()}),body:JSON.stringify({beneficiary:re(e)})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${se}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiary}({beneficiary:e,accessToken:i,stagingToken:n}))}},de="/v2/sepa/transfers";function me(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}const le={getSepaTransfers:async function(e={}){const t=e?.accessToken||r(),n=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const i={method:"GET",headers:D({accessToken:e,stagingToken:t})},a=ne({endpointUrl:new URL(E.getEnvironmentUrls().THIRD_PARTY_API_URL+de),paginationSettings:n}),r=await fetch(a,i);if(!r.ok)throw new L("Failed to fetch SEPA transfers");const s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{transfers:s.transfers,meta:s.meta}}({accessToken:t,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),i=n.transfers.map((e=>me(e))),a=ie(n.meta);return{transfers:i,...a?{meta:a}:{}}},getSepaTransfer:async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const i=t||r();!function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("sepaTransferId must be a string")}(e);return me(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const i={method:"GET",headers:D({accessToken:e,stagingToken:t})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${de}/${n}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.external_transfer}({sepaTransferId:e,accessToken:i,stagingToken:n}))}};e.beneficiaries=ce,e.cards=te,e.constants=R,e.initialize=w,e.logout=b,e.sepaTransfers=le}));
|
package/dist/mocks/handlers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BeneficiaryDataObject } from '@beneficiaries/beneficiaries.types';
|
|
2
|
+
import type { SepaTransferDataObject } from '@sepa-transfers/sepa-transfers.types';
|
|
2
3
|
export declare const INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN";
|
|
3
4
|
export declare const singleBeneficiary: BeneficiaryDataObject;
|
|
4
5
|
export declare const newBeneficiaryDbFields: {
|
|
@@ -10,5 +11,6 @@ export declare const newBeneficiaryDbFields: {
|
|
|
10
11
|
trusted: boolean;
|
|
11
12
|
};
|
|
12
13
|
export declare const mockedBeneficiariesList: BeneficiaryDataObject[];
|
|
14
|
+
export declare const mockTransfer: SepaTransferDataObject;
|
|
13
15
|
export declare const mswHandlers: import("msw").HttpHandler[];
|
|
14
16
|
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAGnF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,sBAkB1B,CAAC;AAEF,eAAO,MAAM,WAAW,6BAkMvB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sepaTransfers namespace contains all the functions related to SEPA transfer operations.
|
|
3
|
+
* It can be accessed like this:
|
|
4
|
+
* ```ts
|
|
5
|
+
* import { sepaTransfers } from '@qonto/embed-sdk/sepa-transfers';
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Then, the sepaTransfers object contains the functions to perform SEPA transfer operations:
|
|
9
|
+
* ```ts
|
|
10
|
+
* await sepaTransfers.getSepaTransfers();
|
|
11
|
+
* await sepaTransfers.getSepaTransfer({ sepaTransferId: '...' });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const sepaTransfers: {
|
|
15
|
+
getSepaTransfers: typeof import("./sepa-transfers").getSepaTransfers;
|
|
16
|
+
getSepaTransfer: typeof import("./sepa-transfers").getSepaTransfer;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;;;CAAuC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PaginationResponseDataObject, PaginationSettings } from '@common/api-pagination/api-pagination.types';
|
|
2
|
+
import type { SepaTransferDataObject } from './sepa-transfers.types';
|
|
3
|
+
interface GetSepaTransfersParams {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
stagingToken?: string;
|
|
6
|
+
paginationSettings?: PaginationSettings;
|
|
7
|
+
}
|
|
8
|
+
interface GetSepaTransferParams {
|
|
9
|
+
accessToken: string;
|
|
10
|
+
stagingToken?: string;
|
|
11
|
+
sepaTransferId: string;
|
|
12
|
+
}
|
|
13
|
+
interface GetSepaTransfersApiResponse {
|
|
14
|
+
transfers: SepaTransferDataObject[];
|
|
15
|
+
meta: PaginationResponseDataObject;
|
|
16
|
+
}
|
|
17
|
+
export declare const SEPA_TRANSFERS_ENDPOINT = "/v2/sepa/transfers";
|
|
18
|
+
export declare function getSepaTransfers({ accessToken, stagingToken, paginationSettings, }: GetSepaTransfersParams): Promise<GetSepaTransfersApiResponse>;
|
|
19
|
+
export declare function getSepaTransfer({ accessToken, stagingToken, sepaTransferId, }: GetSepaTransferParams): Promise<SepaTransferDataObject>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=sepa-transfers.api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sepa-transfers.api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAMrE,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,2BAA2B;IACnC,SAAS,EAAE,sBAAsB,EAAE,CAAC;IACpC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAE5D,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAkC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqBzD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PaginationSettings } from '@common/api-pagination/api-pagination.types';
|
|
2
|
+
import type { GetSepaTransfersResponse, SepaTransfer } from './sepa-transfers.types';
|
|
3
|
+
interface GetSepaTransfersParams {
|
|
4
|
+
accessToken?: string;
|
|
5
|
+
stagingToken?: string;
|
|
6
|
+
paginationSettings?: PaginationSettings;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Fetches the list of SEPA transfers for the current user.
|
|
10
|
+
* @param getSepaTransfersParams - An optional object with the accessToken
|
|
11
|
+
* property. If not passed, the function only works if initialize has been
|
|
12
|
+
* previously called. Also, this function allows managing pagination by passing
|
|
13
|
+
* the paginationSettings property, which accepts an object with the page and
|
|
14
|
+
* itemsPerPage properties.
|
|
15
|
+
* @returns A promise that resolves to an object containing an array of SEPA
|
|
16
|
+
* transfers and a `meta` object containing pagination state.
|
|
17
|
+
* @throws \{AuthenticationError\} If the access token is invalid or missing.
|
|
18
|
+
* Ensure initialize has been called before using this function if you are not
|
|
19
|
+
* passing the access token.
|
|
20
|
+
* @throws \{EmbedApiError\} If the API request fails or returns an error.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSepaTransfers(getSepaTransfersParams?: GetSepaTransfersParams): Promise<GetSepaTransfersResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Fetches a single SEPA transfer of the current user by ID.
|
|
25
|
+
* @param Object - An object with the sepaTransferId and the optional accessToken
|
|
26
|
+
* and stagingToken properties.
|
|
27
|
+
* @returns A promise that resolves to a SEPA transfer.
|
|
28
|
+
* @throws \{AuthenticationError\} If the access token is invalid or missing.
|
|
29
|
+
* Ensure initialize has been called before using this function if you are not
|
|
30
|
+
* passing the access token.
|
|
31
|
+
* @throws \{InvalidParametersError\} If the `sepaTransferId` parameter is not a
|
|
32
|
+
* string or is missing.
|
|
33
|
+
* @throws \{EmbedApiError\} If the API request fails or returns an error.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getSepaTransfer({ sepaTransferId, accessToken, stagingToken, }: {
|
|
36
|
+
sepaTransferId: string;
|
|
37
|
+
accessToken?: string;
|
|
38
|
+
stagingToken?: string;
|
|
39
|
+
}): Promise<SepaTransfer>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=sepa-transfers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sepa-transfers.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAOtF,OAAO,KAAK,EACV,wBAAwB,EACxB,YAAY,EACb,MAAM,wBAAwB,CAAC;AAIhC,UAAU,sBAAsB;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,GAAE,sBAA2B,GAClD,OAAO,CAAC,wBAAwB,CAAC,CAqBnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,EACpC,cAAc,EACd,WAAW,EACX,YAAY,GACb,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,YAAY,CAAC,CASxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getSepaTransfers, getSepaTransfer } from './sepa-transfers';
|
|
2
|
+
declare const sepaTransfers: {
|
|
3
|
+
getSepaTransfers: typeof getSepaTransfers;
|
|
4
|
+
getSepaTransfer: typeof getSepaTransfer;
|
|
5
|
+
};
|
|
6
|
+
export { sepaTransfers };
|
|
7
|
+
//# sourceMappingURL=sepa-transfers.public-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sepa-transfers.public-api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAErE,QAAA,MAAM,aAAa;;;CAGlB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sepa-transfers.serializer.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,YAAY,CAoBd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sepa-transfers.test.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { PaginationState } from '@common/api-pagination/api-pagination.types';
|
|
2
|
+
import { SEPA_TRANSFER_DECLINE_REASONS, SEPA_TRANSFER_STATUSES } from '@common/constants';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the reasons why a SEPA transfer might be declined.
|
|
5
|
+
*/
|
|
6
|
+
type SepaTransferDeclinedReason = (typeof SEPA_TRANSFER_DECLINE_REASONS)[keyof typeof SEPA_TRANSFER_DECLINE_REASONS];
|
|
7
|
+
/**
|
|
8
|
+
* Represents the possible statuses of a SEPA transfer.
|
|
9
|
+
*/
|
|
10
|
+
type SepaTransferStatus = (typeof SEPA_TRANSFER_STATUSES)[keyof typeof SEPA_TRANSFER_STATUSES];
|
|
11
|
+
/**
|
|
12
|
+
* Represents a SEPA transfer in the system. This type includes all the fields
|
|
13
|
+
* necessary to describe a SEPA transfer and various timestamps related to the
|
|
14
|
+
* transfer's lifecycle.
|
|
15
|
+
*/
|
|
16
|
+
export interface SepaTransfer {
|
|
17
|
+
id: string;
|
|
18
|
+
initiatorId: string;
|
|
19
|
+
bankAccountId: string;
|
|
20
|
+
amount: number;
|
|
21
|
+
amountCents: number;
|
|
22
|
+
amountCurrency: string;
|
|
23
|
+
status: SepaTransferStatus;
|
|
24
|
+
beneficiaryId: string;
|
|
25
|
+
reference: string;
|
|
26
|
+
note: string;
|
|
27
|
+
declinedReason: SepaTransferDeclinedReason;
|
|
28
|
+
scheduledDate: Date;
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
updatedAt: Date;
|
|
31
|
+
processedAt: Date;
|
|
32
|
+
completedAt: Date;
|
|
33
|
+
transactionId: string;
|
|
34
|
+
}
|
|
35
|
+
export interface SepaTransferDataObject {
|
|
36
|
+
id: string;
|
|
37
|
+
initiator_id: string;
|
|
38
|
+
bank_account_id: string;
|
|
39
|
+
amount: string;
|
|
40
|
+
amount_cents: string;
|
|
41
|
+
amount_currency: string;
|
|
42
|
+
status: string;
|
|
43
|
+
beneficiary_id: string;
|
|
44
|
+
reference: string;
|
|
45
|
+
note: string;
|
|
46
|
+
declined_reason: string;
|
|
47
|
+
scheduled_date: string;
|
|
48
|
+
created_at: string;
|
|
49
|
+
updated_at: string;
|
|
50
|
+
processed_at: string;
|
|
51
|
+
completed_at: string;
|
|
52
|
+
transaction_id: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Represents the response structure for fetching a list of SEPA transfers.
|
|
56
|
+
*/
|
|
57
|
+
export interface GetSepaTransfersResponse {
|
|
58
|
+
/**
|
|
59
|
+
* An array of SepaTransfer objects, each containing details about a specific
|
|
60
|
+
* transfer.
|
|
61
|
+
*/
|
|
62
|
+
transfers: SepaTransfer[];
|
|
63
|
+
/**
|
|
64
|
+
* Metadata about the pagination state of the response, such as the current
|
|
65
|
+
* page and total pages.
|
|
66
|
+
*/
|
|
67
|
+
meta?: PaginationState;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=sepa-transfers.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sepa-transfers.types.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,KAAK,0BAA0B,GAC7B,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAC;AAErF;;GAEG;AACH,KAAK,kBAAkB,GACrB,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAEvE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,0BAA0B,CAAC;IAC3C,aAAa,EAAE,IAAI,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,IAAI,CAAC;IAClB,WAAW,EAAE,IAAI,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sepa-transfers.validate.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.validate.ts"],"names":[],"mappings":"AAEA,wBAAgB,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAU5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EmbedApiError as e}from"../errors/EmbedApiError.js";import{environmentManager as
|
|
1
|
+
import{EmbedApiError as e}from"../errors/EmbedApiError.js";import{environmentManager as n}from"../common/environment/environment-manager.js";import{addPaginationParamsToUrl as o}from"../common/api-pagination/api-pagination.js";import{serializeToNewBeneficiaryDataObject as i}from"./beneficiaries.serializer.js";import{buildRequestHeaders as r}from"../common/network/network.js";import t from"../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";const a="/v2/sepa/beneficiaries";async function s({paginationSettings:i,accessToken:t,stagingToken:s}){const c={method:"GET",headers:r({accessToken:t,stagingToken:s})},m=new URL(n.getEnvironmentUrls().THIRD_PARTY_API_URL+a),f=o({endpointUrl:m,paginationSettings:i}),d=await fetch(f,c),g=await d.json();if(g.errors)throw new e(g.errors.map((e=>`${e.code}: ${e.detail}`)));return{beneficiaries:g.beneficiaries,meta:g.meta}}async function c({accessToken:o,stagingToken:i,beneficiaryId:t}){const s={method:"GET",headers:r({accessToken:o,stagingToken:i})},c=`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${a}/${t}`,m=await fetch(c,s),f=await m.json();if(f.errors)throw new e(f.errors.map((e=>`${e.code}: ${e.detail}`)));return f.beneficiary}async function m({beneficiary:o,accessToken:s,stagingToken:c}){const m={method:"POST",headers:r({accessToken:s,stagingToken:c,idempotencyKey:t()}),body:JSON.stringify({beneficiary:i(o)})},f=`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${a}`,d=await fetch(f,m),g=await d.json();if(g.errors)throw new e(g.errors.map((e=>`${e.code}: ${e.detail}`)));return g.beneficiary}export{m as addBeneficiary,s as getBeneficiaries,c as getBeneficiary};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../common/auth/auth.js";import{validatePresenceOfAuthToken as i}from"../common/auth/auth.validate.js";import{addBeneficiary as e,getBeneficiary as a,getBeneficiaries as n}from"./beneficiaries.api.js";import{serializeBeneficiary as t}from"./beneficiaries.serializer.js";import{validateAddBeneficiaryParams as
|
|
1
|
+
import"../common/auth/auth.js";import{validatePresenceOfAuthToken as i}from"../common/auth/auth.validate.js";import{addBeneficiary as e,getBeneficiary as a,getBeneficiaries as n}from"./beneficiaries.api.js";import{serializeBeneficiary as t}from"./beneficiaries.serializer.js";import{validateAddBeneficiaryParams as s,validateGetBeneficiaryParams as o}from"./beneficiaries.validate.js";import{serializePaginationResponse as c}from"../common/api-pagination/api-pagination.js";async function r(e){const a=e?.accessToken||i(),s=await n({accessToken:a,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),o=s.beneficiaries.map((i=>t(i))),r=c(s.meta);return{beneficiaries:o,...r?{meta:r}:{}}}async function f({beneficiaryId:e,accessToken:n,stagingToken:s}){const c=n||i();o(e);const r=await a({beneficiaryId:e,accessToken:c,stagingToken:s});return t(r)}async function g({beneficiary:a,accessToken:n,stagingToken:o}){const c=n||i();s(a);const r=await e({beneficiary:a,accessToken:c,stagingToken:o});return t(r)}export{g as addBeneficiary,r as getBeneficiaries,f as getBeneficiary};
|
|
@@ -1 +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
|
|
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";import{buildRequestHeaders as n}from"../common/network/network.js";async function s({membershipId:e,accessToken:s,stagingToken:a}){const t={method:"GET",headers:n({accessToken:s,stagingToken:a})},c=o.getEnvironmentUrls().THIRD_PARTY_API_URL,i=e?`${c}/v2/cards?holder_ids[]=${e}`:`${c}/v2/cards`,d=await fetch(i,t),m=await d.json();if(m.errors)throw new r(m.errors.map((r=>`${r.code}: ${r.detail}`)));return m.cards}async function a({cardId:e,accessToken:s,stagingToken:a}){const t={method:"GET",headers:n({accessToken:s,stagingToken:a})},c=`${o.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/cards?ids[]=${e}`,i=await fetch(c,t),d=await i.json();if(d.errors)throw new r(d.errors.map((r=>`${r.code}: ${r.detail}`)));return d.cards[0]}async function t(s,a,t){const c={method:"GET",headers:n({accessToken:a,stagingToken:t})},i=o.getEnvironmentUrls().THIRD_PARTY_API_URL,d=await fetch(`${i}/v2/cards/${s.cardId}/data_view`,c),m=await d.json();if(m.errors)throw new r(m.errors.map((r=>`${r.code}: ${r.detail}`)));return e(m.iframe_url,s)}export{a as getCard,t as getCardIframeURL,s as getCards};
|
package/dist/src/cards/cards.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../common/auth/auth.js";import{validatePresenceOfAuthToken as
|
|
1
|
+
import{authManager as t}from"../common/auth/auth.js";import{validatePresenceOfAuthToken as e}from"../common/auth/auth.validate.js";import{getCardIframeURL as r,getCard as a,getCards as n}from"./cards.api.js";import"./cards.types.js";import{validateDisplayCardParams as s,validateUnlockCardParams as o,validateOrderCardParams as i}from"./cards.validate.js";import{createIframe as c,buildIframeUrl as m}from"../iframe/iframe-manager.js";import{serializeUnlockCardPayload as d,serializeCard as g,serializeOrderCardPayload as u}from"./cards.serializer.js";import{validateOperationSettingsParams as p}from"../validation/operation-settings-validation.js";import{InvalidParametersError as f}from"../errors/InvalidParametersError.js";async function y({membershipId:t,accessToken:r,stagingToken:a}){try{const s=r||e();if(t&&"string"!=typeof t)throw new f("membershipId must be a string");return(await n({membershipId:t,accessToken:s,stagingToken:a})).map((t=>g(t)))}catch(t){return Promise.reject(t)}}async function l({cardId:t,accessToken:r,stagingToken:n}){try{const s=r||e();if(t&&"string"!=typeof t)throw new f("cardId must be a string");const o=await a({cardId:t,accessToken:s,stagingToken:n});return g(o)}catch(t){return Promise.reject(t)}}async function h(r){try{const a=e(),{uiParentElementId:n,debugMode:s}=p(r.operationSettings);i(r.cardSettings);const o=m({accessToken:a,stagingToken:t.getStagingToken()||void 0,debugMode:s}),d=await c({iframeUrl:o,parentElementId:n}),f=u(r.cardSettings),y=await d.postMessage(f);return d.destroy(),g(y)}catch(t){return Promise.reject(t)}}async function j(r){try{const a=e(),{uiParentElementId:n,debugMode:s}=p(r.operationSettings);o(r.cardSettings);const i=m({accessToken:a,stagingToken:t.getStagingToken()||void 0,debugMode:s}),u=await c({iframeUrl:i,parentElementId:n}),f=d(r),y=await u.postMessage(f);return u.destroy(),g(y)}catch(t){return Promise.reject(t)}}async function k(t){try{const a=e(),{uiParentElementId:n}=p(t.operationSettings);s(t.cardSettings);const o=await r(t.cardSettings,a),i=await c({iframeUrl:o,parentElementId:n});return{destroyEmbedUI:()=>{i.destroy()}}}catch(t){return Promise.reject(t)}}export{k as displayCard,l as getCard,y as getCards,h as orderCard,j as unlockCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e({endpointUrl:e,paginationSettings:t}){const a=new URL(e);return t?.page&&a.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&a.searchParams.set("per_page",t.itemsPerPage.toString()),a}function t(e){return{totalItems:e
|
|
1
|
+
function e({endpointUrl:e,paginationSettings:t}){const a=new URL(e);return t?.page&&a.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&a.searchParams.set("per_page",t.itemsPerPage.toString()),a}function t(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}export{e as addPaginationParamsToUrl,t as serializePaginationResponse};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class
|
|
1
|
+
class n{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return n.instance||(n.instance=new n),n.instance}setAccessToken(n){this.accessToken=n}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(n){this.stagingToken=n}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const s=n.getInstance();export{n as AuthManager,s as authManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _={READY:"qonto.ready"},e={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"},E={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},n={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},N={ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},a={PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},A={BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},i={PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled"};export{e as ACTIONS,N as ACTIVITY_TAGS,a as BENEFICIARY_STATUSES,n as BRANCHES,E as ENVIRONMENTS,_ as IFRAME_EVENTS,A as SEPA_TRANSFER_DECLINE_REASONS,i as SEPA_TRANSFER_STATUSES};
|
|
@@ -1 +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,
|
|
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,stagingToken:r,operationSettings:a,environment:c,branch:m}=t(i);n.setAccessToken(s),r&&n.setStagingToken(r),a&&e.setSettings(a),c&&(o.setEnvironment(c),m&&o.setBranch(m))}function s(){n.clearAccessToken(),n.clearStagingToken()}export{i as initialize,s as logout};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{authManager as e}from"../auth/auth.js";function n({accessToken:n,stagingToken:t,idempotencyKey:o}){const a=new Headers;a.append("Authorization",`Bearer ${n}`);const p=t||e.getStagingToken();return p&&a.append("X-Qonto-Staging-Token",p),o&&a.append("X-Qonto-Idempotency-Key",o),a.append("Content-Type","application/json"),a.append("Accept-Language","en"),a}export{n as buildRequestHeaders};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EmbedIframe as e}from"./embed-iframe.js";import{environmentManager as n}from"../common/environment/environment-manager.js";function o({accessToken:e,
|
|
1
|
+
import{EmbedIframe as e}from"./embed-iframe.js";import{environmentManager as n}from"../common/environment/environment-manager.js";function o({accessToken:e,stagingToken:o,language:t,debugMode:r}){const m=r||!1,i=t||"en",a=n.getEnvironmentUrls().IFRAME_URL,c=o?`&staging_token=${encodeURIComponent(o)}`:"";return`${a}?debug=${m}&lang=${encodeURIComponent(i)}#access_token=${encodeURIComponent(e)}${c}`}function t({parentElementId:n,iframeUrl:o}){return new e({parentElementId:n,iframeUrl:o}).initialize()}export{o as buildIframeUrl,t as createIframe};
|
package/dist/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{constants,initialize,logout}from"./common/index.js";export{cards}from"./cards/index.js";export{beneficiaries}from"./beneficiaries/index.js";
|
|
1
|
+
export{constants,initialize,logout}from"./common/index.js";export{cards}from"./cards/index.js";export{beneficiaries}from"./beneficiaries/index.js";export{sepaTransfers}from"./sepa-transfers/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{sepaTransfers as s}from"./sepa-transfers.public-api.js";const r=s;export{r as sepaTransfers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{buildRequestHeaders as n}from"../common/network/network.js";import{environmentManager as e}from"../common/environment/environment-manager.js";import{addPaginationParamsToUrl as r}from"../common/api-pagination/api-pagination.js";import{EmbedApiError as o}from"../errors/EmbedApiError.js";const t="/v2/sepa/transfers";async function a({accessToken:a,stagingToken:s,paginationSettings:i}){const m={method:"GET",headers:n({accessToken:a,stagingToken:s})},c=new URL(e.getEnvironmentUrls().THIRD_PARTY_API_URL+t),f=r({endpointUrl:c,paginationSettings:i}),g=await fetch(f,m);if(!g.ok)throw new o("Failed to fetch SEPA transfers");const p=await g.json();if(p.errors)throw new o(p.errors.map((n=>`${n.code}: ${n.detail}`)));return{transfers:p.transfers,meta:p.meta}}async function s({accessToken:r,stagingToken:a,sepaTransferId:s}){const i={method:"GET",headers:n({accessToken:r,stagingToken:a})},m=`${e.getEnvironmentUrls().THIRD_PARTY_API_URL}${t}/${s}`,c=await fetch(m,i),f=await c.json();if(f.errors)throw new o(f.errors.map((n=>`${n.code}: ${n.detail}`)));return f.external_transfer}export{t as SEPA_TRANSFERS_ENDPOINT,s as getSepaTransfer,a as getSepaTransfers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../common/auth/auth.js";import{validatePresenceOfAuthToken as a}from"../common/auth/auth.validate.js";import{serializePaginationResponse as s}from"../common/api-pagination/api-pagination.js";import{getSepaTransfer as n,getSepaTransfers as t}from"./sepa-transfers.api.js";import{serializeSepaTransfer as e}from"./sepa-transfers.serializer.js";import{validateGetSepaTransferParams as r}from"./sepa-transfers.validate.js";async function o(n={}){const r=n?.accessToken||a(),o=await t({accessToken:r,stagingToken:n?.stagingToken,paginationSettings:n?.paginationSettings}),i=o.transfers.map((a=>e(a))),p=s(o.meta);return{transfers:i,...p?{meta:p}:{}}}async function i({sepaTransferId:s,accessToken:t,stagingToken:o}){const i=t||a();r(s);const p=await n({sepaTransferId:s,accessToken:i,stagingToken:o});return e(p)}export{i as getSepaTransfer,o as getSepaTransfers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getSepaTransfer as e,getSepaTransfers as r}from"./sepa-transfers.js";const s={getSepaTransfers:r,getSepaTransfer:e};export{s as sepaTransfers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}export{e as serializeSepaTransfer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{InvalidParametersError as r}from"../errors/InvalidParametersError.js";function e(e){if(!e)throw new r("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new r("sepaTransferId must be a string");return e}export{e as validateGetSepaTransferParams};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, PaginationState } from './types.public-api';
|
|
2
|
-
export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, PaginationState, };
|
|
1
|
+
import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, GetSepaTransfersResponse, GetBeneficiariesResponse, PaginationState } from './types.public-api';
|
|
2
|
+
export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, GetSepaTransfersResponse, PaginationState, };
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,eAAe,GAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,wBAAwB,EACxB,eAAe,GAChB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings } from '@cards/cards.types';
|
|
2
2
|
import type { Beneficiary, GetBeneficiariesResponse } from '@beneficiaries/beneficiaries.types';
|
|
3
|
+
import type { SepaTransfer, GetSepaTransfersResponse } from '@sepa-transfers/sepa-transfers.types';
|
|
3
4
|
import type { PaginationState } from '@common/api-pagination/api-pagination.types';
|
|
4
|
-
export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, PaginationState, };
|
|
5
|
+
export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, GetSepaTransfersResponse, PaginationState, };
|
|
5
6
|
//# sourceMappingURL=types.public-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.public-api.d.ts","sourceRoot":"","sources":["../../src/types/types.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,eAAe,GAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.public-api.d.ts","sourceRoot":"","sources":["../../src/types/types.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,YAAY,EACZ,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,wBAAwB,EACxB,eAAe,GAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qonto/embed-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Library to embed Qonto features in your application",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"types": "./dist/beneficiaries/index.d.ts",
|
|
18
18
|
"import": "./dist/src/beneficiaries/index.js"
|
|
19
19
|
},
|
|
20
|
+
"./sepa-transfers": {
|
|
21
|
+
"types": "./dist/sepa-transfers/index.d.ts",
|
|
22
|
+
"import": "./dist/src/sepa-transfers/index.js"
|
|
23
|
+
},
|
|
20
24
|
"./common": {
|
|
21
25
|
"types": "./dist/common/index.d.ts",
|
|
22
26
|
"import": "./dist/src/common/index.js"
|