@qonto/embed-sdk 0.49.0 → 0.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EACV,sBAAsB,EAGtB,eAAe,EACf,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,qDAAqD,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAK5C,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA+BzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,sBAchC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAqBrE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,sBAqBxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAoBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,iEAC2B,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,cAuD1B,CAAC;AAEF,eAAO,MAAM,2BA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;;;CAKlB,CAAC;AAEX,eAAO,MAAM,WAAW,6BAoqBvB,CAAC"}
@@ -4,10 +4,12 @@ import { type OperationSettings } from '@validation/operation-settings-validatio
4
4
  * Retrieves the organization information.
5
5
  *
6
6
  * @param operationSettings - An object with operation-level settings such as
7
- * `accessToken`, `stagingToken`, `proxyRequestFunction`, and other optional
8
- * parameters. See {@link OperationSettings} for more details.
9
- * @returns A promise that resolves to the organization the current user belongs
10
- * to.
7
+ * `proxyRequestFunction` (preferred over using the access token flow),
8
+ * `accessToken`, `stagingToken`, and other optional
9
+ * parameters. See {@link OperationSettings}.
10
+ * @returns A promise that resolves to the organization the current user belongs to.
11
+ * @throws `AuthenticationError` If both the `proxyRequestFunction` and
12
+ * `accessToken` are invalid or missing within `operationSettings`.
11
13
  * @throws `EmbedApiError` If the API request fails or returns an error.
12
14
  */
13
15
  export declare const getOrganization: (operationSettings: OperationSettings) => Promise<Organization>;
@@ -15,9 +17,12 @@ export declare const getOrganization: (operationSettings: OperationSettings) =>
15
17
  * Retrieves the bank accounts for the organization.
16
18
  *
17
19
  * @param operationSettings - An object with operation-level settings such as
18
- * `accessToken`, `stagingToken`, `proxyRequestFunction`, and other optional
19
- * parameters. See {@link OperationSettings} for more details.
20
+ * `proxyRequestFunction` (preferred over using the access token flow),
21
+ * `accessToken`, `stagingToken`, and other optional
22
+ * parameters. See {@link OperationSettings}.
20
23
  * @returns A promise that resolves to the bank accounts for the organization.
24
+ * @throws `AuthenticationError` If both the `proxyRequestFunction` and
25
+ * `accessToken` are invalid or missing within `operationSettings`.
21
26
  * @throws `EmbedApiError` If the API request fails or returns an error.
22
27
  */
23
28
  export declare const getBankAccounts: (operationSettings: OperationSettings) => Promise<BankAccount[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../src/organizations/organizations.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,2CAA2C,CAAC;AAMnD;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,CAC5B,iBAAiB,EAAE,iBAAiB,KACjC,OAAO,CAAC,YAAY,CAyBxB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,EAAE,CAC5B,iBAAiB,EAAE,iBAAiB,KACjC,OAAO,CAAC,WAAW,EAAE,CAuBzB,CAAC"}
1
+ {"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../src/organizations/organizations.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,2CAA2C,CAAC;AAMnD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,CAC5B,iBAAiB,EAAE,iBAAiB,KACjC,OAAO,CAAC,YAAY,CAyBxB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,CAC5B,iBAAiB,EAAE,iBAAiB,KACjC,OAAO,CAAC,WAAW,EAAE,CAuBzB,CAAC"}
@@ -6,7 +6,9 @@ interface AuthParams {
6
6
  accessToken: string;
7
7
  stagingToken?: string;
8
8
  }
9
- interface GetBulkTransfersParams extends AuthParams {
9
+ interface GetBulkTransfersParams {
10
+ accessToken?: string;
11
+ stagingToken?: string;
10
12
  paginationSettings?: PaginationSettings;
11
13
  }
12
14
  interface GetBulkTransfersApiResponse {
@@ -27,7 +29,13 @@ interface VerifySepaPayeesParams {
27
29
  stagingToken?: string;
28
30
  }
29
31
  export declare const BULK_TRANSFERS_ENDPOINT = "/v2/sepa/bulk_transfers";
32
+ export declare function prepareGetBulkTransfersCall({ paginationSettings, accessToken, stagingToken, }: GetBulkTransfersParams): NetworkCallDescriptor;
30
33
  export declare function getBulkTransfers({ accessToken, stagingToken, paginationSettings, }: GetBulkTransfersParams): Promise<GetBulkTransfersApiResponse>;
34
+ export declare function prepareGetBulkTransferCall({ bulkTransferId, accessToken, stagingToken, }: {
35
+ bulkTransferId: string;
36
+ accessToken?: string;
37
+ stagingToken?: string;
38
+ }): NetworkCallDescriptor;
31
39
  export declare function getBulkTransfer({ accessToken, stagingToken, bulkTransferId, }: GetBulkTransferParams): Promise<BulkTransferDataObject>;
32
40
  export declare function createBulkTransfer({ bulkTransfers, accessToken, stagingToken, bankAccountId, idempotencyKey, }: CreateBulkTransferParams): Promise<BulkTransferDataObject>;
33
41
  export declare function prepareVerifySepaPayeesCall({ sepaPayees, accessToken, stagingToken, }: VerifySepaPayeesParams): NetworkCallDescriptor;
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-transfers.api.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EACV,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EACf,8BAA8B,EAC/B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAGtE,UAAU,UAAU;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,sBAAuB,SAAQ,UAAU;IACjD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,2BAA2B;IACnC,aAAa,EAAE,sBAAsB,EAAE,CAAC;IACxC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,UAAU,qBAAsB,SAAQ,UAAU;IAChD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,wBAAyB,SAAQ,UAAU;IAC1D,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,sBAAsB;IAC9B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAEjE,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAiC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAuBzD;AAED,wBAAsB,kBAAkB,CAAC,EACvC,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,GACf,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAoC5D;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,UAAU,EACV,WAAW,EACX,YAAY,GACb,EAAE,sBAAsB,GAAG,qBAAqB,CAchD;AAED,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,WAAW,EACX,YAAY,GACb,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CASlE"}
1
+ {"version":3,"file":"bulk-transfers.api.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EACV,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EACf,8BAA8B,EAC/B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCA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BAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAUzD;AAED,wBAAsB,kBAAkB,CAAC,EACvC,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,GACf,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAoC5D;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,UAAU,EACV,WAAW,EACX,YAAY,GACb,EAAE,sBAAsB,GAAG,qBAAqB,CAchD;AAED,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,WAAW,EACX,YAAY,GACb,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CASlE"}
@@ -2,15 +2,16 @@ import type { BulkTransfer, BulkTransferParams, GetBulkTransfer, GetBulkTransfer
2
2
  import type { SepaTransferParams } from '@sepa-transfers/sepa-transfers.types';
3
3
  /**
4
4
  * Fetches the list of SEPA bulk transfers for the current user.
5
- * @param getBulkTransfersParams - An optional object containing `operationSettings`.
6
- * The `operationSettings` object can include:
7
- * - `accessToken`: If not provided, the function will use the token from initialize.
8
- * - `stagingToken`: Optional, required only for staging environments.
9
- * - `paginationSettings`: Optional object with `page` and `itemsPerPage` properties for pagination control.
10
- * @returns A promise that resolves to an object containing an array of bulk transfers and a `meta` object containing pagination state.
11
- * @throws `AuthenticationError` If the access token is invalid or missing.
12
- * @throws `ValidationError` If the provided parameters fail validation.
13
- * Ensure initialize has been called before using this function if you are not passing the access token.
5
+ * @param getBulkTransfersParams - An optional object containing:
6
+ * - `operationSettings`: An object with operation-level settings such as
7
+ * `proxyRequestFunction` (preferred over using the access token flow),
8
+ * `accessToken`, `stagingToken`, `paginationSettings`, and other optional
9
+ * parameters. See {@link BulkTransferParams}.
10
+ * @returns A promise that resolves to an object containing an array of bulk
11
+ * transfers and a `meta` object containing pagination state.
12
+ * @throws `InvalidParametersError` If any parameter validation fails.
13
+ * @throws `AuthenticationError` If both the `proxyRequestFunction` and
14
+ * `accessToken` are invalid or missing within `operationSettings`.
14
15
  * @throws `EmbedApiError` If the API request fails or returns an error.
15
16
  */
16
17
  export declare function getBulkTransfers(getBulkTransfersParams?: SepaTransferParams<never>): Promise<GetBulkTransfersResponse>;
@@ -20,12 +21,15 @@ export declare function getBulkTransfers(getBulkTransfersParams?: SepaTransferPa
20
21
  * - `sepaTransferSettings`: An object that contains the mandatory `bulkTransferId`
21
22
  * to identify the bulk transfer to retrieve.
22
23
  * - `operationSettings`: An object with operation-level settings such as
23
- * `accessToken`, `stagingToken`, and other optional parameters. See {@link SepaTransferParams}.
24
- * @returns A promise that resolves to a BulkTransfer object containing details of the requested bulk transfer.
25
- * @throws `AuthenticationError` If the access token is invalid or missing.
26
- * @throws `ValidationError` If the provided parameters fail validation.
27
- * Ensure initialize has been called before using this function if you are not passing the access token.
28
- * @throws `InvalidParametersError` If the `bulkTransferId` parameter is not a string or missing.
24
+ * `proxyRequestFunction` (preferred over using the access token flow),
25
+ * `accessToken`, `stagingToken`, and other optional
26
+ * parameters. See {@link BulkTransferParams}.
27
+ * @returns A promise that resolves to a BulkTransfer object containing details of
28
+ * the requested bulk transfer.
29
+ * @throws `InvalidParametersError` If the `bulkTransferId` parameter is not a string
30
+ * or missing, or if any parameter validation fails.
31
+ * @throws `AuthenticationError` If both the `proxyRequestFunction` and
32
+ * `accessToken` are invalid or missing within `operationSettings`.
29
33
  * @throws `EmbedApiError` If the API request fails or returns an error.
30
34
  */
31
35
  export declare function getBulkTransfer({ sepaTransferSettings, operationSettings, }: SepaTransferParams<GetBulkTransfer>): Promise<BulkTransfer>;
@@ -45,30 +49,19 @@ export declare function getBulkTransfer({ sepaTransferSettings, operationSetting
45
49
  * - `bulkTransferSettings`: An object that contains the mandatory `bankAccountId`
46
50
  * and an array of `bulkTransfers`.
47
51
  * - `operationSettings`: An object with operation-level settings such as
48
- * `accessToken`, `stagingToken`, and other optional parameters. See {@link BulkTransferParams}.
49
- * The `operationSettings` object must also include the `uiParentElementId` property.
50
- * This has to specify the ID of the DOM element where the UI for MFA will be
51
- * displayed. Note that this means that creating transfers
52
- * can only happen in the client side. The `createBulkTransfer` function
53
- * expects an `idempotencyKey` as well. If this property is not passed as part
54
- * of `operationSettings`, a new one will be generated automatically.
55
- * You can also specify an `mfaPreference` in the `operationSettings` to choose the
56
- * multi-factor authentication method to use for the SCA flow (e.g., 'passkey',
57
- * 'sms-otp', or 'paired-device'). If not provided, the default MFA method will be used.
52
+ * `accessToken`, `stagingToken`, `idempotencyKey`, `mfaPreference`, `uiParentElementId`,
53
+ * and other optional parameters. See {@link BulkTransferParams}.
58
54
  * @returns As a yielded value, a promise that resolves to VoP check results for
59
55
  * all unique beneficiaries.
60
56
  * @returns As the final return value, a promise that resolves to the created
61
57
  * bulk transfer.
62
- * @throws `AuthenticationError` If the access token is invalid or missing.
63
- * Ensure initialize has been called before using this function if you are not
64
- * passing the access token.
65
58
  * @throws `InvalidParametersError` If the `bulkTransferSettings` parameter is not an object
66
- * or is missing, or if the required properties of the bulk transfer object are
67
- * missing or invalid. Also thrown if `uiParentElementId` is not provided in the
68
- * `operationSettings`, which is required for the iframe flow.
59
+ * or is missing, or if the required properties are missing or invalid, or if
60
+ * `uiParentElementId` is not provided in `operationSettings`.
61
+ * @throws `AuthenticationError` If the `accessToken` is invalid or missing within
62
+ * `operationSettings`.
69
63
  * @throws `EmbedApiError` If the API request fails or returns an error.
70
64
  * @throws `InvalidRuntimeError` If the function is called in a non-browser environment.
71
- * This operation can only be performed from a browser since it requires an iframe.
72
65
  */
73
66
  export declare function createBulkTransfer({ bulkTransferSettings, operationSettings, }: BulkTransferParams<NewBulkTransferWithBeneficiary>): AsyncGenerator<SingleBulkVopVerificationResult[], BulkTransfer | undefined>;
74
67
  //# sourceMappingURL=bulk-transfers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-transfers.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,YAAY,EAEZ,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAEV,kBAAkB,EACnB,MAAM,sCAAsC,CAAC;AAqB9C;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,wBAAwB,CAAC,CA0BnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAgB7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAuB,kBAAkB,CAAC,EACxC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,8BAA8B,CAAC,GAAG,cAAc,CACpE,+BAA+B,EAAE,EACjC,YAAY,GAAG,SAAS,CACzB,CAyFA"}
1
+ {"version":3,"file":"bulk-transfers.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,YAAY,EAEZ,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAEV,kBAAkB,EACnB,MAAM,sCAAsC,CAAC;AA0B9C;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,wBAAwB,CAAC,CAsDnC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CA0B7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAuB,kBAAkB,CAAC,EACxC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,8BAA8B,CAAC,GAAG,cAAc,CACpE,+BAA+B,EAAE,EACjC,YAAY,GAAG,SAAS,CACzB,CAyFA"}
@@ -6,14 +6,11 @@ import '../ui/ui-elements/sca-passkey/qonto-sca-passkey-waiting.ts';
6
6
  * @param getSepaTransfersParams - An object containing:
7
7
  * - `operationSettings`: An object with operation-level settings such as
8
8
  * `proxyRequestFunction` (preferred over using the access token flow),
9
- * `accessToken`, `stagingToken`, `mfaPreference`, and other optional
10
- * parameters. This function also allows managing pagination by passing the
11
- * `paginationSettings` property under `operationSettings`, which accepts an
12
- * object with the page and itemsPerPage properties.
9
+ * `accessToken`, `stagingToken`, `paginationSettings`, and other optional
10
+ * parameters. See {@link SepaTransferParams}.
13
11
  * @returns A promise that resolves to an object containing an array of SEPA
14
12
  * transfers and a `meta` object containing pagination state.
15
- * @throws `InvalidParametersError` If any of the values provided under
16
- * operationSettings is invalid.
13
+ * @throws `InvalidParametersError` If any parameter validation fails.
17
14
  * @throws `AuthenticationError` If both the `proxyRequestFunction` and
18
15
  * `accessToken` are invalid or missing within `operationSettings`.
19
16
  * @throws `EmbedApiError` If the API request fails or returns an error.
@@ -24,13 +21,14 @@ export declare function getSepaTransfers(getSepaTransfersParams?: SepaTransferPa
24
21
  * @param getSepaTransferParams - An object containing:
25
22
  * - `sepaTransferSettings`: An object with the `sepaTransferId` property (string).
26
23
  * - `operationSettings`: An object with operation-level settings such as
27
- * `proxyRequestFunction` (preferred over using the access token flow),
28
- * `accessToken`, `stagingToken`, `mfaPreference`, and other optional parameters.
29
- * See {@link SepaTransferParams}.
24
+ * `proxyRequestFunction` (preferred over using the access token flow),
25
+ * `accessToken`, `stagingToken`, and other optional
26
+ * parameters. See {@link SepaTransferParams}.
30
27
  * @returns A promise that resolves to a SEPA transfer.
31
- * @throws `InvalidParametersError` If the `sepaTransferId` parameter is not a string or is missing.
32
- * @throws `AuthenticationError` If both the `proxyRequestFunction` and `accessToken` are invalid or missing within
33
- * `operationSettings`.
28
+ * @throws `InvalidParametersError` If the `sepaTransferId` parameter is not a string
29
+ * or missing, or if any parameter validation fails.
30
+ * @throws `AuthenticationError` If both the `proxyRequestFunction` and
31
+ * `accessToken` are invalid or missing within `operationSettings`.
34
32
  * @throws `EmbedApiError` If the API request fails or returns an error.
35
33
  */
36
34
  export declare function getSepaTransfer({ sepaTransferSettings, operationSettings, }: SepaTransferParams<GetSepaTransfer>): Promise<SepaTransfer>;
@@ -62,29 +60,16 @@ export declare function getSepaTransfer({ sepaTransferSettings, operationSetting
62
60
  * beginning. This allows the caller to get only beneficiary details to start
63
61
  * the process and require the user to give the transfer data after the VoP
64
62
  * result.
65
- * If it was not provided when calling the SDK's `initialize`
66
- * function, an `operationSettings` object has to be passed too with the
67
- * authentication information, which should ideally be the `proxyRequestFunction`,
68
- * or alternatively the `accessToken` (not recommended for security reasons). The
69
- * `operationSettings` object can have other data, like the `stagingToken`.
70
- * If the transfer needs to be created
71
- * for an untrusted beneficiary, the `operationSettings` object must also include
72
- * the `uiParentElementId` property. This has to specify the ID of the DOM element
73
- * where the UI for MFA will be displayed. Note that this means that creating
74
- * transfers for untrusted beneficiaries can only happen in the client side.
75
- * The `createSepaTransfer` function requires an `idempotencyKey` as well. If this
76
- * property is not passed as part of `operationSettings`, a new one will be
77
- * generated automatically.
78
- * You can also specify an `mfaPreference` in the `operationSettings` to choose the
79
- * multi-factor authentication method to use for the SCA flow (e.g., 'passkey',
80
- * 'sms-otp', or 'paired-device'). If not provided, the default MFA method will be used.
63
+ * - `operationSettings`: An object with operation-level settings such as
64
+ * `proxyRequestFunction` (preferred over using the access token flow),
65
+ * `accessToken`, `stagingToken`, `idempotencyKey`, `mfaPreference`,
66
+ * `uiParentElementId`, and other optional parameters. See {@link SepaTransferParams}.
81
67
  * @returns As the first yielded value, a promise that resolves to the VoP check
82
68
  * result.
83
69
  * @returns As the final return value, a promise that resolves to the created
84
70
  * SEPA transfer.
85
- * @throws `AuthenticationError` If the access token is invalid or missing.
86
- * Ensure initialize has been called before using this function if you are not
87
- * passing the access token.
71
+ * @throws `AuthenticationError` If both the `proxyRequestFunction` and
72
+ * `accessToken` are invalid or missing within `operationSettings`.
88
73
  * @throws `InvalidParametersError` If the `transfer` parameter is not an object
89
74
  * or is missing, or if the required properties of the transfer object are
90
75
  * missing or invalid.
@@ -147,16 +132,17 @@ export declare function getSepaTransfer({ sepaTransferSettings, operationSetting
147
132
  export declare function createSepaTransfer({ sepaTransferSettings, operationSettings, }: SepaTransferParams<NewSepaTransfer | BeneficiaryInformationForVop>): AsyncGenerator<VopVerificationResult, SepaTransfer | undefined>;
148
133
  /**
149
134
  * Cancels an existing SEPA transfer identified by the provided `sepaTransferId`.
150
- * @param cancelSepaTransferParams - An object with the parameters to cancel the
151
- * transfer. If it was not provided when calling the SDK's `initialize`
152
- * function, an `operationSettings` object has to be passed too with the
153
- * `proxyRequestFunction` (preferred over using the access token flow),
154
- * or the `accessToken` and `stagingToken` values.
135
+ * @param cancelSepaTransferParams - An object containing:
136
+ * - `sepaTransferSettings`: An object with the `sepaTransferId` property (string).
137
+ * - `operationSettings`: An object with operation-level settings such as
138
+ * `proxyRequestFunction` (preferred over using the access token flow),
139
+ * `accessToken`, `stagingToken`, and other optional
140
+ * parameters. See {@link SepaTransferParams}.
155
141
  * @returns A promise that resolves without return value.
142
+ * @throws `InvalidParametersError` If the `sepaTransferId` parameter is missing
143
+ * or not a string, or if any parameter validation fails.
156
144
  * @throws `AuthenticationError` If both the `proxyRequestFunction` and
157
145
  * `accessToken` are invalid or missing within `operationSettings`.
158
- * @throws `InvalidParametersError` If the `sepaTransferId` parameter is
159
- * missing, or if the provided value is not a string.
160
146
  * @throws `EmbedApiError` If the API request fails or returns an error.
161
147
  */
162
148
  export declare function cancelSepaTransfer({ sepaTransferSettings, operationSettings, }: SepaTransferParams<CancelSepaTransferParams>): Promise<void>;
@@ -165,21 +151,20 @@ export declare function cancelSepaTransfer({ sepaTransferSettings, operationSett
165
151
  * a hosted page. This flow will allow users to create a SEPA transfer from a
166
152
  * Qonto hosted page, which will guide them through the necessary steps to
167
153
  * complete the transfer, including the Verification of Payee check.
168
- * @param getSepaTransferCreationFlowLinkParams - An object with the parameters
169
- * to request the link where the process will start. This object is expected to
170
- * contain only a property called `callbackUrl`, which will be used to return the
171
- * user to the desired location in your website after the process is complete.
172
- * If it was not provided when calling the SDK's `initialize` function, an
173
- * `operationSettings` object has to be passed too with the `proxyRequestFunction`
174
- * parameter (preferred over using an access token if using the SDK in browsers),
175
- * or the `accessToken` and `stagingToken` values. It is also possible, and
176
- * advisable, to pass a `locale` property within operationSettings to set the
177
- * language in which the hosted page will be shown. If not provided, it will
178
- * default to English.
154
+ * @param getSepaTransferCreationFlowLinkParams - An object containing:
155
+ * - `sepaTransferSettings`: An object with the `callbackUrl` property, which
156
+ * will be used to return the user to the desired location after completion.
157
+ * - `operationSettings`: An object with operation-level settings such as
158
+ * `proxyRequestFunction` (preferred over using the access token flow),
159
+ * `accessToken`, `stagingToken`, `locale`, and other optional
160
+ * parameters. See {@link SepaTransferParams}.
179
161
  * @returns A promise that resolves to an object representing the Embed Auth Link.
180
162
  * This object contains a `url` property with the link to start the SEPA transfer.
181
- * @throws `InvalidParametersError` If none of `proxyRequestFunction` or `accessToken`
182
- * are provided, of if the callbackUrl is invalid or missing.
163
+ * @throws `InvalidParametersError` If the callbackUrl is invalid or missing, or
164
+ * if any parameter validation fails.
165
+ * @throws `AuthenticationError` If both the `proxyRequestFunction` and
166
+ * `accessToken` are invalid or missing within `operationSettings`.
167
+ * @throws `EmbedApiError` If the API request fails or returns an error.
183
168
  */
184
169
  export declare function getSepaTransferCreationFlowLink({ sepaTransferSettings, operationSettings, }: SepaTransferParams<SepaTransferCreationFlowRequest>): Promise<AuthLinkRequestResult>;
185
170
  //# sourceMappingURL=sepa-transfers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,eAAe,EACf,wBAAwB,EACxB,eAAe,EAEf,YAAY,EACZ,+BAA+B,EAE/B,kBAAkB,EAGlB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AA6BhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAQ1E,OAAO,4DAA4D,CAAC;AAKpE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,wBAAwB,CAAC,CAsDnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CA0B7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GG;AACH,wBAAuB,kBAAkB,CAAC,EACxC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CACnB,eAAe,GAAG,4BAA4B,CAC/C,GAAG,cAAc,CAAC,qBAAqB,EAAE,YAAY,GAAG,SAAS,CAAC,CAqIlE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB9D;AA+BD;;;;;;;;;;;;;;;;;;;;GAo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,CAAC,IAAI,CAAC,CAuB9D;AA+BD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,+BAA+B,CAAC,EACpD,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,+BAA+B,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAyBtF"}
@@ -1 +1 @@
1
- import{authManager as e}from"../common/auth/auth.js";import{validatePresenceOfAuthToken as t}from"../common/auth/auth.validate.js";import{encodeNetworkCall as r,decodeNetworkResponse as n}from"../common/network/network.js";import{prepareGetCardIframeUrl as a,getCardIframeURL as o,prepareGetCardCall as s,getCard as i,prepareGetCardsCall as c,getCards as d}from"./cards.api.js";import"./cards.types.js";import{validateDisplayCardParams as m,validateUnlockCardParams as g,validateOrderCardParams as u,validateGetCardParams as p}from"./cards.validate.js";import{buildIframeUrl as f,createIframe as k}from"../iframe/iframe-manager.js";import{serializeUnlockCardPayload as l,serializeCard as y,serializeOrderCardPayload as T}from"./cards.serializer.js";import{validateOperationSettingsParams as I}from"../validation/operation-settings-validation.js";import{InvalidParametersError as S}from"../errors/InvalidParametersError.js";import{createEmbedUI as h}from"./cards.helper.js";async function b(e){try{const a=e?.cardSettings?.membershipId;if(a&&"string"!=typeof a)throw new S("membershipId must be a string");const{proxyRequestFunction:o,stagingToken:s}=I(e?.operationSettings||{});if(o){const e=c({membershipId:a,stagingToken:s}),t=r(e),i=await o(t);return n(i).body.cards.map((e=>y(e)))}{const r=e?.operationSettings?.accessToken||t();return(await d({membershipId:a,accessToken:r,stagingToken:s})).map((e=>y(e)))}}catch(e){return Promise.reject(e)}}async function j({cardSettings:e,operationSettings:a}){try{p(e);const o=e.cardId,{proxyRequestFunction:c,stagingToken:d}=I(a||{});if(c){const e=s({cardId:o,stagingToken:d}),t=r(e),a=await c(t),i=n(a).body.cards;if(Array.isArray(i)&&i.length>0)return y(i[0]);throw new S("Unable to retrieve card data")}{const e=a?.accessToken||t(),r=await i({cardId:o,accessToken:e,stagingToken:d});return y(r)}}catch(e){return Promise.reject(e)}}async function w(r){try{const n=t(),{uiParentElementId:a,debugMode:o}=I(r.operationSettings,{requiresUI:!0});u(r.cardSettings);const s=f({accessToken:n,stagingToken:e.getStagingToken()||void 0,debugMode:o}),i=await k({iframeUrl:s,parentElementId:a}),c=T(r.cardSettings),d=await i.postMessage(c);return i.destroy(),y(d)}catch(e){return Promise.reject(e)}}async function P(r){try{const n=t(),{uiParentElementId:a,debugMode:o}=I(r.operationSettings,{requiresUI:!0});g(r.cardSettings);const s=f({accessToken:n,stagingToken:e.getStagingToken()||void 0,debugMode:o}),i=await k({iframeUrl:s,parentElementId:a}),c=l(r),d=await i.postMessage(c);return i.destroy(),y(d)}catch(e){return Promise.reject(e)}}async function M(e){try{const{uiParentElementId:s,accessToken:i,stagingToken:c,debugMode:d,mfaPreference:g,proxyRequestFunction:u}=I(e.operationSettings,{requiresUI:!0});if(m(e.cardSettings),u){const t=a({stagingToken:c}),o=r(t),i=await u(o),m=n(i).body;return h({decorationParams:e.cardSettings,operationSettings:{uiParentElementId:s,debugMode:d},cardIframeUrl:m.url})}{const r=i||t(),n=await o({...e.cardSettings,accessToken:r,stagingToken:c});return h({decorationParams:e.cardSettings,operationSettings:{uiParentElementId:s,debugMode:d,mfaPreference:g},cardIframeUrl:n.url})}}catch(e){return Promise.reject(e)}}export{M as displayCard,j as getCard,b as getCards,w as orderCard,P as unlockCard};
1
+ import{authManager as e}from"../common/auth/auth.js";import{validatePresenceOfAuthToken as t}from"../common/auth/auth.validate.js";import{encodeNetworkCall as r,decodeNetworkResponse as n}from"../common/network/network.js";import{prepareGetCardIframeUrl as a,getCardIframeURL as o,prepareGetCardCall as s,getCard as i,prepareGetCardsCall as c,getCards as d}from"./cards.api.js";import"./cards.types.js";import{validateDisplayCardParams as m,validateUnlockCardParams as g,validateOrderCardParams as u,validateGetCardParams as p}from"./cards.validate.js";import{buildIframeUrl as f,createIframe as k}from"../iframe/iframe-manager.js";import{serializeUnlockCardPayload as l,serializeCard as y,serializeOrderCardPayload as T}from"./cards.serializer.js";import{validateOperationSettingsParams as I}from"../validation/operation-settings-validation.js";import{InvalidParametersError as S}from"../errors/InvalidParametersError.js";import{createEmbedUI as h}from"./cards.helper.js";async function b(e){try{const a=e?.cardSettings?.membershipId;if(a&&"string"!=typeof a)throw new S("membershipId must be a string");const{proxyRequestFunction:o,stagingToken:s}=I(e?.operationSettings||{});if(o){const e=c({membershipId:a,stagingToken:s}),t=r(e),i=await o(t);return n(i).body.cards.map((e=>y(e)))}{const r=e?.operationSettings?.accessToken||t();return(await d({membershipId:a,accessToken:r,stagingToken:s})).map((e=>y(e)))}}catch(e){return Promise.reject(e)}}async function j({cardSettings:e,operationSettings:a}){try{p(e);const o=e.cardId,{proxyRequestFunction:c,stagingToken:d}=I(a||{});if(c){const e=s({cardId:o,stagingToken:d}),t=r(e),a=await c(t),i=n(a).body.cards;if(Array.isArray(i)&&i.length>0)return y(i[0]);throw new S("Unable to retrieve card data")}{const e=a?.accessToken||t(),r=await i({cardId:o,accessToken:e,stagingToken:d});return y(r)}}catch(e){return Promise.reject(e)}}async function w(r){try{const n=t(),{uiParentElementId:a,debugMode:o}=I(r.operationSettings,{requiresUI:!0});u(r.cardSettings);const s=f({accessToken:n,stagingToken:e.getStagingToken()||void 0,debugMode:o}),i=await k({iframeUrl:s,parentElementId:a}),c=T(r.cardSettings),d=await i.postMessage(c);return i.destroy(),y(d)}catch(e){return Promise.reject(e)}}async function P(r){try{const n=t(),{uiParentElementId:a,debugMode:o}=I(r.operationSettings,{requiresUI:!0});g(r.cardSettings);const s=f({accessToken:n,stagingToken:e.getStagingToken()||void 0,debugMode:o}),i=await k({iframeUrl:s,parentElementId:a}),c=l(r),d=await i.postMessage(c);return i.destroy(),y(d)}catch(e){return Promise.reject(e)}}async function M(e){try{const{uiParentElementId:s,accessToken:i,stagingToken:c,debugMode:d,mfaPreference:g,proxyRequestFunction:u}=I(e.operationSettings,{requiresUI:!0});if(m(e.cardSettings),u){const t=a({stagingToken:c}),o=r(t),i=await u(o),m=n(i).body.embed_auth_link;return h({decorationParams:e.cardSettings,operationSettings:{uiParentElementId:s,debugMode:d},cardIframeUrl:m.url})}{const r=i||t(),n=await o({...e.cardSettings,accessToken:r,stagingToken:c});return h({decorationParams:e.cardSettings,operationSettings:{uiParentElementId:s,debugMode:d,mfaPreference:g},cardIframeUrl:n.url})}}catch(e){return Promise.reject(e)}}export{M as displayCard,j as getCard,b as getCards,w as orderCard,P as unlockCard};
@@ -1 +1 @@
1
- function e(e){const t=new URLSearchParams;return e?.page&&t.append("page",e.page.toString()),e?.itemsPerPage&&t.append("per_page",e.itemsPerPage.toString()),t}function t({url:e,searchParams:t}){const a=new URL(e.toString());for(const[e,n]of t.entries())a.searchParams.append(e,n);return a}function a({endpointUrl:a,paginationSettings:n}){return t({url:new URL(a),searchParams:e(n)})}function n(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{a as addPaginationParamsToUrl,t as addSearchParamsToUrl,e as buildPaginationParams,n as serializePaginationResponse};
1
+ function e(e){const t=new URLSearchParams;return e?.page&&t.append("page",e.page.toString()),e?.itemsPerPage&&t.append("per_page",e.itemsPerPage.toString()),t}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 buildPaginationParams,t as serializePaginationResponse};
@@ -1 +1 @@
1
- import{QontoEmbedSdkError as e}from"./QontoEmbedSdkError.js";class t extends e{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}export{t as AuthenticationError};
1
+ import{QontoEmbedSdkError as e}from"./QontoEmbedSdkError.js";class t extends e{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid authentication method. Provide either a proxyRequestFunction (recommended) or accessToken, either as parameters or by calling the initialize function first."}}export{t as AuthenticationError};
@@ -1 +1 @@
1
- import{makeNetworkCall as e,buildRequestHeaders as n}from"../../common/network/network.js";import{environmentManager as s}from"../../common/environment/environment-manager.js";import{addPaginationParamsToUrl as a}from"../../common/api-pagination/api-pagination.js";import{EmbedApiError as o}from"../../errors/EmbedApiError.js";import{SEPA_ENDPOINT as r}from"../sepa-transfers.api.js";import{serializeToSepaPayeeDataObject as t}from"../sepa-transfers.serializer.js";const i="/v2/sepa/bulk_transfers";async function c({accessToken:e,stagingToken:r,paginationSettings:t}){const c={method:"GET",headers:n({accessToken:e,stagingToken:r})},m=new URL(`${s.getEnvironmentUrls().THIRD_PARTY_API_URL}${i}`),g=a({endpointUrl:m,paginationSettings:t}),p=await fetch(g,c);if(!p.ok)throw new o({message:"Failed to fetch SEPA bulk transfers"});const k=await p.json();if(k.errors)throw new o({message:k.errors.map((e=>`${e.code}: ${e.detail}`))});return{bulkTransfers:k.bulk_transfers,meta:k.meta}}async function m({accessToken:e,stagingToken:a,bulkTransferId:r}){const t={method:"GET",headers:n({accessToken:e,stagingToken:a})},c=new URL(`${s.getEnvironmentUrls().THIRD_PARTY_API_URL}${i}/${r}`),m=await fetch(c,t),g=await m.json();if(g.errors)throw new o({message:g.errors.map((e=>`${e.code}: ${e.detail}`))});return g.bulk_transfer}function g({sepaPayees:e,accessToken:n,stagingToken:s}){return{path:`${r}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:s},body:{requests:e.map(t)}}}}async function p({sepaPayees:n,accessToken:s,stagingToken:a}){const o=g({sepaPayees:n,accessToken:s,stagingToken:a});return await e(o)}export{i as BULK_TRANSFERS_ENDPOINT,m as getBulkTransfer,c as getBulkTransfers,g as prepareVerifySepaPayeesCall,p as verifySepaPayees};
1
+ import{makeNetworkCall as n}from"../../common/network/network.js";import"../../common/environment/environment-manager.js";import{buildPaginationParams as e}from"../../common/api-pagination/api-pagination.js";import{SEPA_ENDPOINT as s}from"../sepa-transfers.api.js";import{serializeToSepaPayeeDataObject as a}from"../sepa-transfers.serializer.js";const t="/v2/sepa/bulk_transfers";function o({paginationSettings:n,accessToken:s,stagingToken:a}){const o={method:"GET",headers:{accessToken:s,stagingToken:a}},r=e(n),i=r.size?`?${r.toString()}`:"";return{path:`${t}${i}`,options:o}}async function r({accessToken:e,stagingToken:s,paginationSettings:a}){const t=o({paginationSettings:a,accessToken:e,stagingToken:s}),{bulk_transfers:r,meta:i}=await n(t);return{bulkTransfers:r,meta:i}}function i({bulkTransferId:n,accessToken:e,stagingToken:s}){return{path:`${t}/${n}`,options:{method:"GET",headers:{accessToken:e,stagingToken:s}}}}async function c({accessToken:e,stagingToken:s,bulkTransferId:a}){const t=i({bulkTransferId:a,accessToken:e,stagingToken:s}),{bulk_transfer:o}=await n(t);return o}function g({sepaPayees:n,accessToken:e,stagingToken:t}){return{path:`${s}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:e,stagingToken:t},body:{requests:n.map(a)}}}}async function k({sepaPayees:e,accessToken:s,stagingToken:a}){const t=g({sepaPayees:e,accessToken:s,stagingToken:a});return await n(t)}export{t as BULK_TRANSFERS_ENDPOINT,c as getBulkTransfer,r as getBulkTransfers,i as prepareGetBulkTransferCall,o as prepareGetBulkTransfersCall,g as prepareVerifySepaPayeesCall,k as verifySepaPayees};
@@ -1 +1 @@
1
- import{authManager as e}from"../../common/auth/auth.js";import{validatePresenceOfAuthToken as n}from"../../common/auth/auth.validate.js";import{serializePaginationResponse as a}from"../../common/api-pagination/api-pagination.js";import{verifySepaPayees as t,getBulkTransfer as o,getBulkTransfers as s}from"./bulk-transfers.api.js";import{serializeToBulkVopVerificationResult as r,serializeToNewBulkTransferDataObject as i,serializeBulkTransfer as m}from"./bulk-transfers.serializer.js";import{validateOperationSettingsParams as c}from"../../validation/operation-settings-validation.js";import{validateCreateBulkTransferParams as f,validateBulkTransferParams as u}from"./bulk-transfers.validate.js";import{isRunningInBrowser as p}from"../../common/runtime/runtime.validation.js";import{InvalidRuntimeError as g,RUNTIME_ENVIRONMENT as d}from"../../errors/InvalidRuntimeError.js";import{buildIframeUrl as l,createIframe as k}from"../../iframe/iframe-manager.js";import{buildIframeMessage as T}from"../../iframe/iframe-message-builder.js";import{VOP_DECISIONS as b,ACTIONS as y}from"../../common/constants.js";import j from"../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";async function v(e){const{operationSettings:t}=e||{},o=t?.accessToken||n(),{stagingToken:r,paginationSettings:i}=c(t||{}),f=await s({accessToken:o,stagingToken:r,paginationSettings:i}),u=f.bulkTransfers?.map(m),p=a(f.meta);return{bulkTransfers:u,...p?{meta:p}:{}}}async function S({sepaTransferSettings:e,operationSettings:a}){const t=a?.accessToken||n(),{stagingToken:s}=c(a||{}),r=u(e?.bulkTransferId),i=await o({accessToken:t,stagingToken:s,bulkTransferId:r});return m(i)}async function*w({bulkTransferSettings:a,operationSettings:o}){const s=o?.accessToken||n(),u=o?.stagingToken||e.getStagingToken(),v=o?.idempotencyKey||j();f(a);const{uiParentElementId:S,debugMode:w}=c(o,{requiresUI:!0});if(!p())throw new g(d.BROWSER);const E=new Map;for(const e of a.bulkTransfers){const n=e.beneficiary.iban;n&&!E.has(n)&&E.set(n,{name:e.beneficiary.name,iban:n})}const I=Array.from(E.values()),R=await t({sepaPayees:I,accessToken:s,stagingToken:u||void 0});if((yield R.requests.map(r))===b.REJECT)return;let h,A;try{const e=l({accessToken:s,stagingToken:u||void 0,debugMode:w});A=await k({iframeUrl:e,parentElementId:S});const n={bankAccountId:a.bankAccountId,bulkTransfers:a.bulkTransfers.map((e=>i(e)))};h=await A.postMessage(T({actionId:y.TRANSFER_BULK_CREATE,actionData:{body:n,idempotencyKey:v}}))}finally{A?.destroy()}return m(h)}export{w as createBulkTransfer,S as getBulkTransfer,v as getBulkTransfers};
1
+ import{authManager as n}from"../../common/auth/auth.js";import{validatePresenceOfAuthToken as e}from"../../common/auth/auth.validate.js";import{serializePaginationResponse as t}from"../../common/api-pagination/api-pagination.js";import{verifySepaPayees as a,prepareGetBulkTransferCall as o,getBulkTransfer as r,prepareGetBulkTransfersCall as s,getBulkTransfers as i}from"./bulk-transfers.api.js";import{serializeToBulkVopVerificationResult as m,serializeToNewBulkTransferDataObject as c,serializeBulkTransfer as u}from"./bulk-transfers.serializer.js";import{validateOperationSettingsParams as f}from"../../validation/operation-settings-validation.js";import{validateCreateBulkTransferParams as p,validateBulkTransferParams as g}from"./bulk-transfers.validate.js";import{isRunningInBrowser as d}from"../../common/runtime/runtime.validation.js";import{InvalidRuntimeError as k,RUNTIME_ENVIRONMENT as l}from"../../errors/InvalidRuntimeError.js";import{buildIframeUrl as T,createIframe as b}from"../../iframe/iframe-manager.js";import{buildIframeMessage as y}from"../../iframe/iframe-message-builder.js";import{VOP_DECISIONS as j,ACTIONS as w}from"../../common/constants.js";import{encodeNetworkCall as S,decodeNetworkResponse as v}from"../../common/network/network.js";import I from"../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";async function E(n){const{stagingToken:a,proxyRequestFunction:o,accessToken:r,paginationSettings:m}=f(n?.operationSettings||{});if(o){const n=s({paginationSettings:m}),e=S(n),a=await o(e),r=v(a),i=r.body.bulk_transfers.map(u),c=t(r.body.meta);return{bulkTransfers:i,...c?{meta:c}:{}}}{const n=r||e(),o=await i({accessToken:n,stagingToken:a,paginationSettings:m}),s=o.bulkTransfers?.map(u),c=t(o.meta);return{bulkTransfers:s,...c?{meta:c}:{}}}}async function R({sepaTransferSettings:n,operationSettings:t}){const a=g(n?.bulkTransferId),{proxyRequestFunction:s,accessToken:i,stagingToken:m}=f(t||{});if(s){const n=o({bulkTransferId:a}),e=S(n),t=await s(e),r=v(t);return u(r.body.bulk_transfer)}{const n=i||e(),t=await r({accessToken:n,stagingToken:m,bulkTransferId:a});return u(t)}}async function*h({bulkTransferSettings:t,operationSettings:o}){const r=o?.accessToken||e(),s=o?.stagingToken||n.getStagingToken(),i=o?.idempotencyKey||I();p(t);const{uiParentElementId:g,debugMode:S}=f(o,{requiresUI:!0});if(!d())throw new k(l.BROWSER);const v=new Map;for(const n of t.bulkTransfers){const e=n.beneficiary.iban;e&&!v.has(e)&&v.set(e,{name:n.beneficiary.name,iban:e})}const E=Array.from(v.values()),R=await a({sepaPayees:E,accessToken:r,stagingToken:s||void 0});if((yield R.requests.map(m))===j.REJECT)return;let h,_;try{const n=T({accessToken:r,stagingToken:s||void 0,debugMode:S});_=await b({iframeUrl:n,parentElementId:g});const e={bankAccountId:t.bankAccountId,bulkTransfers:t.bulkTransfers.map((n=>c(n)))};h=await _.postMessage(y({actionId:w.TRANSFER_BULK_CREATE,actionData:{body:e,idempotencyKey:i}}))}finally{_?.destroy()}return u(h)}export{h as createBulkTransfer,R as getBulkTransfer,E as getBulkTransfers};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qonto/embed-sdk",
3
- "version": "0.49.0",
3
+ "version": "0.49.1",
4
4
  "description": "Library to embed Qonto features in your application",
5
5
  "type": "module",
6
6
  "exports": {