@qonto/embed-sdk 0.35.0 → 0.37.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.
Files changed (53) hide show
  1. package/dist/auth-links/auth-links.api.d.ts +20 -0
  2. package/dist/auth-links/auth-links.api.d.ts.map +1 -0
  3. package/dist/auth-links/auth-links.d.ts +46 -0
  4. package/dist/auth-links/auth-links.d.ts.map +1 -0
  5. package/dist/auth-links/auth-links.public-api.d.ts +6 -0
  6. package/dist/auth-links/auth-links.public-api.d.ts.map +1 -0
  7. package/dist/auth-links/auth-links.test.d.ts +2 -0
  8. package/dist/auth-links/auth-links.test.d.ts.map +1 -0
  9. package/dist/auth-links/auth-links.types.d.ts +62 -0
  10. package/dist/auth-links/auth-links.types.d.ts.map +1 -0
  11. package/dist/auth-links/auth-links.validate.d.ts +6 -0
  12. package/dist/auth-links/auth-links.validate.d.ts.map +1 -0
  13. package/dist/auth-links/auth-links.validate.test.d.ts +2 -0
  14. package/dist/auth-links/auth-links.validate.test.d.ts.map +1 -0
  15. package/dist/auth-links/index.d.ts +24 -0
  16. package/dist/auth-links/index.d.ts.map +1 -0
  17. package/dist/common/constants.d.ts +9 -0
  18. package/dist/common/constants.d.ts.map +1 -1
  19. package/dist/index.d.ts +4 -3
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.umd.js +1 -1
  22. package/dist/mocks/handlers.d.ts +5 -0
  23. package/dist/mocks/handlers.d.ts.map +1 -1
  24. package/dist/sepa-transfers/index.d.ts +1 -0
  25. package/dist/sepa-transfers/index.d.ts.map +1 -1
  26. package/dist/sepa-transfers/sepa-transfers.d.ts +24 -1
  27. package/dist/sepa-transfers/sepa-transfers.d.ts.map +1 -1
  28. package/dist/sepa-transfers/sepa-transfers.public-api.d.ts +2 -1
  29. package/dist/sepa-transfers/sepa-transfers.public-api.d.ts.map +1 -1
  30. package/dist/sepa-transfers/sepa-transfers.types.d.ts +8 -0
  31. package/dist/sepa-transfers/sepa-transfers.types.d.ts.map +1 -1
  32. package/dist/sepa-transfers/sepa-transfers.utils.d.ts +2 -0
  33. package/dist/sepa-transfers/sepa-transfers.utils.d.ts.map +1 -1
  34. package/dist/sepa-transfers/sepa-transfers.validate.d.ts +2 -1
  35. package/dist/sepa-transfers/sepa-transfers.validate.d.ts.map +1 -1
  36. package/dist/src/auth-links/auth-links.api.js +1 -0
  37. package/dist/src/auth-links/auth-links.js +1 -0
  38. package/dist/src/auth-links/auth-links.public-api.js +1 -0
  39. package/dist/src/auth-links/auth-links.validate.js +1 -0
  40. package/dist/src/auth-links/index.js +1 -0
  41. package/dist/src/common/constants.js +1 -1
  42. package/dist/src/index.js +1 -1
  43. package/dist/src/sepa-transfers/sepa-transfers.js +1 -1
  44. package/dist/src/sepa-transfers/sepa-transfers.public-api.js +1 -1
  45. package/dist/src/sepa-transfers/sepa-transfers.utils.js +1 -1
  46. package/dist/src/sepa-transfers/sepa-transfers.validate.js +1 -1
  47. package/dist/types/index.d.ts +2 -2
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/dist/types/types.public-api.d.ts +2 -1
  50. package/dist/types/types.public-api.d.ts.map +1 -1
  51. package/dist/validation/operation-settings-validation.d.ts +7 -0
  52. package/dist/validation/operation-settings-validation.d.ts.map +1 -1
  53. package/package.json +5 -1
@@ -0,0 +1,20 @@
1
+ import type { OperationSettings } from '@validation/operation-settings-validation';
2
+ import type { NetworkCallDescriptor } from '@common/network/network';
3
+ import type { PostAuthAction, EmbedAuthLinkDataObject, AuthLinkRequestSettings } from './auth-links.types';
4
+ interface PrepareAuthLinkRequestParams {
5
+ accessToken?: string;
6
+ stagingToken?: string;
7
+ action: PostAuthAction;
8
+ callbackUrl?: string;
9
+ }
10
+ /**
11
+ * Prepares the network call descriptor for requesting an auth link
12
+ */
13
+ export declare function prepareAuthLinkRequest({ accessToken, stagingToken, action, callbackUrl, }: PrepareAuthLinkRequestParams): NetworkCallDescriptor;
14
+ export type RequestAuthLinkParams = AuthLinkRequestSettings & Pick<OperationSettings, 'accessToken' | 'stagingToken'>;
15
+ /**
16
+ * Makes the API call to request an auth link
17
+ */
18
+ export declare function requestAuthLink(requestAuthLinkParams: RequestAuthLinkParams): Promise<EmbedAuthLinkDataObject>;
19
+ export {};
20
+ //# sourceMappingURL=auth-links.api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-links.api.d.ts","sourceRoot":"","sources":["../../src/auth-links/auth-links.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,UAAU,4BAA4B;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,MAAM,EACN,WAAW,GACZ,EAAE,4BAA4B,GAAG,qBAAqB,CAsBtD;AAED,MAAM,MAAM,qBAAqB,GAAG,uBAAuB,GACzD,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,cAAc,CAAC,CAAC;AAE1D;;GAEG;AACH,wBAAsB,eAAe,CACnC,qBAAqB,EAAE,qBAAqB,GAC3C,OAAO,CAAC,uBAAuB,CAAC,CAmBlC"}
@@ -0,0 +1,46 @@
1
+ import type { AuthLinkRequestParams, AuthLinkRequestResult } from './auth-links.types';
2
+ /**
3
+ * Requests an authentication link for a specific action. Auth links allow
4
+ * loading embed features or performing Embed actions in a secure manner while
5
+ * still avoiding exposing the access token to the client side.
6
+ *
7
+ * @param requestAuthLinkParams - An object containing:
8
+ * - `requestSettings`: An object with the `action` and an optional `callbackUrl`
9
+ * properties (both string).
10
+ * - `operationSettings`: An object with operation-level settings such as
11
+ * `proxyRequestFunction` (preferred over using the access token flow),
12
+ * `accessToken`, `stagingToken`, and other optional parameters.
13
+ * See {@link AuthLinkRequestParams}.
14
+ * @returns Promise resolving to the auth link details, which includes the URL
15
+ * where the user should be redirected to perform the action, the requested action,
16
+ * the callback URL if it was provided, the expiration time of the link, and the
17
+ * time it was used.
18
+ * @throws `InvalidParametersError` - If the request settings are invalid.
19
+ * @throws `AuthenticationError` - If authentication fails (e.g., invalid or missing
20
+ * access token).
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * import { authLinks } from '@qonto/embed-sdk/auth-links';
25
+ * import { AUTH_LINK_ACTIONS } from '@qonto/embed-sdk/constants';
26
+ *
27
+ * // Request an auth link for displaying a card within an iframe injected to
28
+ * // your application.
29
+ * const result = await authLinks.request({
30
+ * requestSettings: {
31
+ * action: AUTH_LINK_ACTIONS.DISPLAY_CARD,
32
+ * },
33
+ * operationSettings: {
34
+ * proxyRequestFunction: async (encodedCall) => {
35
+ * // Implement your proxy logic here, e.g., make a fetch call to your backend
36
+ * // which will handle the request to Qonto's API.
37
+ * },
38
+ * }
39
+ * });
40
+ *
41
+ * console.log('Auth link URL:', result.url);
42
+ * // Use the URL to open an iframe in your website where the card will be displayed.
43
+ * ```
44
+ */
45
+ export declare function request({ requestSettings, operationSettings, }: AuthLinkRequestParams): Promise<AuthLinkRequestResult>;
46
+ //# sourceMappingURL=auth-links.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-links.d.ts","sourceRoot":"","sources":["../../src/auth-links/auth-links.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAiB5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,OAAO,CAAC,EAC5B,eAAe,EACf,iBAAiB,GAClB,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqCxD"}
@@ -0,0 +1,6 @@
1
+ import { request } from './auth-links';
2
+ declare const authLinks: {
3
+ request: typeof request;
4
+ };
5
+ export { authLinks };
6
+ //# sourceMappingURL=auth-links.public-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-links.public-api.d.ts","sourceRoot":"","sources":["../../src/auth-links/auth-links.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,QAAA,MAAM,SAAS;;CAEd,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=auth-links.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-links.test.d.ts","sourceRoot":"","sources":["../../src/auth-links/auth-links.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,62 @@
1
+ import type { OperationSettings } from '@validation/operation-settings-validation';
2
+ import { AUTH_LINK_ACTIONS } from '@common/constants';
3
+ /**
4
+ * Supported post-authentication actions that can be requested for auth links
5
+ */
6
+ export type PostAuthAction = (typeof AUTH_LINK_ACTIONS)[keyof typeof AUTH_LINK_ACTIONS];
7
+ /**
8
+ * Settings for requesting an auth link
9
+ */
10
+ export interface AuthLinkRequestSettings {
11
+ /**
12
+ * The action to perform after successful authentication
13
+ */
14
+ action: PostAuthAction;
15
+ /**
16
+ * Optional callback URL to redirect to after authentication
17
+ */
18
+ callbackUrl?: string;
19
+ }
20
+ /**
21
+ * Parameters for the auth link request function
22
+ */
23
+ export interface AuthLinkRequestParams {
24
+ requestSettings: AuthLinkRequestSettings;
25
+ operationSettings?: OperationSettings;
26
+ }
27
+ /**
28
+ * Response data object from auth link creation
29
+ */
30
+ export interface EmbedAuthLinkDataObject {
31
+ url: string;
32
+ post_authn_action: string;
33
+ callback_url?: string;
34
+ expired_at: string;
35
+ used_at?: string;
36
+ }
37
+ /**
38
+ * The result returned by the authLinks.request function
39
+ */
40
+ export interface AuthLinkRequestResult {
41
+ /**
42
+ * The authentication link URL
43
+ */
44
+ url: string;
45
+ /**
46
+ * The post-authentication action that will be performed
47
+ */
48
+ postAuthAction: string;
49
+ /**
50
+ * Optional callback URL
51
+ */
52
+ callbackUrl?: string;
53
+ /**
54
+ * Expiration date/time of the auth link
55
+ */
56
+ expiresAt: string;
57
+ /**
58
+ * Date/time when the auth link was used (if applicable)
59
+ */
60
+ usedAt?: string;
61
+ }
62
+ //# sourceMappingURL=auth-links.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-links.types.d.ts","sourceRoot":"","sources":["../../src/auth-links/auth-links.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,uBAAuB,CAAC;IACzC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,6 @@
1
+ import type { AuthLinkRequestSettings } from './auth-links.types';
2
+ /**
3
+ * Validates the auth link request settings
4
+ */
5
+ export declare function validateAuthLinkRequestSettings(requestSettings: AuthLinkRequestSettings): asserts requestSettings is AuthLinkRequestSettings;
6
+ //# sourceMappingURL=auth-links.validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-links.validate.d.ts","sourceRoot":"","sources":["../../src/auth-links/auth-links.validate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,eAAe,EAAE,uBAAuB,GACvC,OAAO,CAAC,eAAe,IAAI,uBAAuB,CA8BpD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=auth-links.validate.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-links.validate.test.d.ts","sourceRoot":"","sources":["../../src/auth-links/auth-links.validate.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The authLinks namespace contains all the functions related to authentication link operations.
3
+ * It can be accessed like this:
4
+ * ```ts
5
+ * import { authLinks } from '@qonto/embed-sdk/auth-links';
6
+ * ```
7
+ *
8
+ * Then, the authLinks object contains the functions to perform auth link operations:
9
+ * ```ts
10
+ * await authLinks.request({
11
+ * requestSettings: {
12
+ * action: 'display_card',
13
+ * callbackUrl: 'https://example.com/callback'
14
+ * },
15
+ * operationSettings: {
16
+ * accessToken: 'your-access-token'
17
+ * }
18
+ * });
19
+ * ```
20
+ */
21
+ export declare const authLinks: {
22
+ request: typeof import("./auth-links").request;
23
+ };
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth-links/index.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,SAAS;;CAA+B,CAAC"}
@@ -186,4 +186,13 @@ export declare const VOP_DECISIONS: {
186
186
  ACCEPT: string;
187
187
  REJECT: string;
188
188
  };
189
+ /**
190
+ * List of possible action we can request via the Embed Auth Links endpoint,
191
+ * which allows authenticating users without sharing access tokens in the client.
192
+ */
193
+ export declare const AUTH_LINK_ACTIONS: {
194
+ CARD_DISPLAY: string;
195
+ PAYMENT_LINK_CREATE: string;
196
+ SEPA_TRANSFER_CREATE: string;
197
+ };
189
198
  //# 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;;;;;;;;;;CAUnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;CAQpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;CAQ7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW;IACtB;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;;OAKG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;CAM7B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;CAGzB,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;;;;;;;;;;CAUnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;CAQpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;CAQ7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW;IACtB;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;;OAKG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;CAM7B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;CAGzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;CAI7B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -5,7 +5,8 @@ import { sepaTransfers } from '@sepa-transfers';
5
5
  import { paymentLinks } from '@payment-links';
6
6
  import { organizations } from '@organizations';
7
7
  import { transactions } from '@transactions';
8
- import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, Transaction, Item, CreatePaymentLinkSettings, PaymentLinkParams } from '@types';
9
- export { initialize, logout, cards, sepaTransfers, beneficiaries, constants, paymentLinks, organizations, transactions, };
10
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, Transaction, Item, CreatePaymentLinkSettings, PaymentLinkParams, };
8
+ import { authLinks } from '@auth-links';
9
+ import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, Transaction, Item, CreatePaymentLinkSettings, PaymentLinkParams, AuthLinkRequestParams, AuthLinkRequestResult, AuthLinkRequestSettings, PostAuthAction } from '@types';
10
+ export { initialize, logout, cards, sepaTransfers, beneficiaries, constants, paymentLinks, organizations, transactions, authLinks, };
11
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, Transaction, Item, CreatePaymentLinkSettings, PaymentLinkParams, AuthLinkRequestParams, AuthLinkRequestResult, AuthLinkRequestSettings, PostAuthAction, };
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,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,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,UAAU,EACV,MAAM,EACN,KAAK,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,EACb,YAAY,GACb,CAAC;AACF,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,GAClB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,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,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACf,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,UAAU,EACV,MAAM,EACN,KAAK,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,SAAS,GACV,CAAC;AACF,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,GACf,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,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 a extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class i extends a{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 i;return n.getAccessToken()}class s extends a{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")}`}}const o={READY:"qonto.ready"},c={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",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},u={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},m={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},l={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},f=3e4,g={ACCEPT:"ACCEPT",REJECT:"REJECT"};var p=Object.freeze({__proto__:null,ACTIONS:c,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"},AMOUNT_REQUIRING_ATTACHMENTS:f,BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:u,ENVIRONMENTS:d,IFRAME_EVENTS:o,LOCALES:m,MFA_METHODS:l,TRANSACTION_STATUSES:{PENDING:"pending",DECLINED:"declined",COMPLETED:"completed"},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"},TRANSFER_STATUSES:{PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled",FAILED:"failed",COMPLETED:"completed"},VOP_CHECK_RESULTS:{MATCH_RESULT_MATCH:"MATCH_RESULT_MATCH",MATCH_RESULT_NO_MATCH:"MATCH_RESULT_NO_MATCH",MATCH_RESULT_CLOSE_MATCH:"MATCH_RESULT_CLOSE_MATCH",MATCH_RESULT_NOT_POSSIBLE:"MATCH_RESULT_NOT_POSSIBLE",MATCH_RESULT_UNSPECIFIED:"MATCH_RESULT_UNSPECIFIED"},VOP_DECISIONS:g});class h{constructor(){this.mfaPreference=l.PASSKEY,this.debugMode=!1}static getInstance(){return h.instance||(h.instance=new h),h.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=l.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}}const T=h.getInstance(),y="https://embed.qonto.com",_="https://embed-js{branch}.staging.qonto.co",b="https://embed.dev.qonto.co",I={[d.PRODUCTION]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:b,IFRAME_URL:`${b}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class k{constructor(){this.environment=d.PRODUCTION,this.branch=u.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(d).includes(e)?e:d.PRODUCTION,this.branch=Object.values(u).includes(t)?t:u.SANDBOX}static getInstance(){return k.instance||(k.instance=new k),k.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===d.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=d.PRODUCTION,this.branch=u.MASTER}getEnvironmentUrls(){if(this.environment===d.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 w=k.getInstance(),E={requiresUI:!1};function A(e,{requiresUI:t}=E){const n=e?.uiParentElementId||T.getUIParentElementId();if(t&&!n)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 a=e?.mfaPreference||T.getMFAPreference();if(a){const e=(i=Object.values(l),w.isProductionEnvironment()?i.filter((e=>e!==l.MOCK)):i);if(!e.includes(a))throw new s(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(w.isProductionEnvironment()&&a===l.MOCK)throw new s("operationSettings.mfaPreference cannot be set to mock in production environment.")}var i;const r=e?.debugMode||T.getDebugMode();if(void 0!==r&&"boolean"!=typeof r)throw new s("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||T.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new s("operationSettings.proxyRequestFunction must be a function.");return{...e,uiParentElementId:n,mfaPreference:a,debugMode:r,proxyRequestFunction:o}}const S=Object.values(m);function R(e){if(!function(e){return S.includes(e)}(e))throw new s(`Unsupported locale: ${e}. The locale must be one of: ${S.join(", ")}.`);return e}function L(e){if(!e?.accessToken&&!e?.operationSettings?.proxyRequestFunction)throw new s("Either operationSettings.proxyRequestFunction or access token is required when calling initialize()");return e?.operationSettings&&A(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.locale&&R(e.locale),e}class v{constructor(){this.currentLocale="en"}static getInstance(){return v.instance||(v.instance=new v),v.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const P=v.getInstance();const D={initialize:function(e){const{accessToken:t,stagingToken:a,operationSettings:i,environment:r,branch:s,locale:o}=L(e);t&&n.setAccessToken(t),a&&n.setStagingToken(a),o&&P.setLocale(o),i&&T.setSettings(i),r&&(w.setEnvironment(r),s&&w.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),P.setDefaultLocale(),T.clearSettings()},constants:p},{initialize:O,logout:N,constants:C}=D;class U extends a{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 M(){return"undefined"!=typeof window&&"undefined"!=typeof document}function $(){return!M()}function q({accessToken:e,stagingToken:t,idempotencyKey:a,mfaPreference:i}){const r=new Headers;r.append("Authorization",`Bearer ${e}`);const s=t||n.getStagingToken();s&&r.append("X-Qonto-Staging-Token",s),a&&r.append("X-Qonto-Idempotency-Key",a);const o=i||T.getMFAPreference();return o&&r.append("X-Qonto-2fa-Preference",o),r.append("Content-Type","application/json"),r.append("Accept-Language",P.getLocale()),r}async function F({path:e,options:t}){const n=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(n,{...t,headers:q(t.headers),body:JSON.stringify(t.body)}),i=await a.json();if(!a.ok)throw i.errors?new U(i.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${i.code}: ${i.detail}`);return i}function B(e){const t={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},n=JSON.stringify(t);return a=n,$()?Buffer.from(a).toString("base64"):btoa(a);var a}function G(e){return JSON.parse((t=e,$()?Buffer.from(t,"base64").toString("utf-8"):atob(t)));var t}function H({membershipId:e,accessToken:t,stagingToken:n}){return{path:e?`/v2/cards?holder_ids[]=${e}`:"/v2/cards",options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function K({cardId:e,accessToken:t,stagingToken:n}){return{path:`/v2/cards?ids[]=${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}var x;!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"}(x||(x={}));const j={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 Y,z;function V(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 W(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function J(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function X(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"}(Y||(Y={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(z||(z={}));const Q=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],Z=[...Q,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function ee(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return V(e,Q),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:m,cardLevel:l}=e,f=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(l),g=W({membershipId:t,organizationId:n,bankAccountId:a}),p=J({hasDailyLimit:i,hasTransactionLimit:r}),h=X({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),T=te(u),y=ne(m),_=[...f,...g,...p,...h,...T,...y];if(_.length>0)throw new s(_)}(e),e}(e):function(e){V(e,Z),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:m,cardLevel:l,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,shipToBusiness:h,hasAtmOption:T,hasAtmDailyLimit:y,atmDailyLimit:_,atmMonthlyLimit:b,address:I,cardDesign:k,typeOfPrint:w}=e,E=function(e){return Object.values(z).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(l),A=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),S=W({membershipId:t,organizationId:n,bankAccountId:a}),R=J({hasDailyLimit:i,hasTransactionLimit:r,hasAtmOption:T,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,hasAtmDailyLimit:y,shipToBusiness:h}),L=X({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:_,atmMonthlyLimit:b}),v=te(u),P=ne(m),D=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(k),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"]}(I,h),N=[...E,...S,...R,...L,...v,...P,...A,...D,...O];if(N.length>0)throw new s(N)}(e)}(e)}function te(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 ne(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 ae extends a{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const ie=[];for(let e=0;e<256;++e)ie.push((e+256).toString(16).slice(1));let re;const se=new Uint8Array(16);var oe={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ce(e,t,n){if(oe.randomUUID&&!e)return oe.randomUUID();const a=(e=e||{}).random??e.rng?.()??function(){if(!re){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");re=crypto.getRandomValues.bind(crypto)}return re(se)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=15&a[6]|64,a[8]=63&a[8]|128,function(e,t=0){return(ie[e[t+0]]+ie[e[t+1]]+ie[e[t+2]]+ie[e[t+3]]+"-"+ie[e[t+4]]+ie[e[t+5]]+"-"+ie[e[t+6]]+ie[e[t+7]]+"-"+ie[e[t+8]]+ie[e[t+9]]+"-"+ie[e[t+10]]+ie[e[t+11]]+ie[e[t+12]]+ie[e[t+13]]+ie[e[t+14]]+ie[e[t+15]]).toLowerCase()}(a)}function de({actionId:e,actionData:t}){const n=T.getMFAPreference();return{actionId:e,actionData:{...t,scaPreference:t.scaPreference||n,idempotencyKey:t.idempotencyKey||ce()}}}class ue{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 ae(`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,a=setTimeout((()=>{window.removeEventListener("message",i),t(new ae(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),i=t=>{t.data.eventId===o.READY&&(clearTimeout(a),window.removeEventListener("message",i),e(this))};window.addEventListener("message",i),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){if(!this.iframe||!this.iframe.contentWindow)return Promise.reject(new ae("Attempted to perform an Embed operation without having the authentication UI initialized."));const t=de(e);return new Promise(((e,n)=>{const a=i=>{if(i.data?.actionId===t.actionId){if("error"===i.data.status)return this.removeMessageListener(t.actionId,a),n(new ae(`An error occurred when performing the action ${t.actionId}.\n${JSON.stringify(i.data.payload)}`));this.removeMessageListener(t.actionId,a),e(i.data.payload)}};this.addMessageListener(t.actionId,a),this.iframe?.contentWindow?.postMessage(t,this.targetOrigin)}))}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 me({accessToken:e,stagingToken:t,locale:n,debugMode:a}){const i=a||!1,r=n||P.getLocale(),s=w.getEnvironmentUrls().IFRAME_URL,o=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${i}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function le({parentElementId:e,iframeUrl:t}){return new ue({parentElementId:e,iframeUrl:t}).initialize()}function fe(e){return"virtual"===e.cardLevel?function(e){const t=pe(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ce(),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=pe(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ce(),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 ge(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 pe(e){const t=Object.values(j);return(e||[]).filter((e=>t.includes(e)))}const he="--qonto-embed";function Te(e){return!e.href||e.href.startsWith(window.location.origin)}function ye(e){return"CSSStyleRule"===e.constructor.name}function _e(e=he){return M()?function(e,t){return[...e].filter(Te).reduce(((e,n)=>[...n.cssRules].filter(ye).reduce(((e,n)=>{if("style"in n){const a=[...n.style].map((e=>[e.trim(),n.style.getPropertyValue(e).trim()])).filter((([e])=>e.startsWith(t))).reduce(((e,[n,a])=>({...e,[n.replace(`${t}-`,"")]:a})),{});return{...e,...a}}return e}),e)),{})}(document.styleSheets,e):{}}const be={getCards:async function(e){try{const t=e?.cardSettings?.membershipId;if(t&&"string"!=typeof t)throw new s("membershipId must be a string");const{proxyRequestFunction:n,stagingToken:a}=A(e?.operationSettings||{});if(n){const e=B(H({membershipId:t,stagingToken:a})),i=await n(e);return G(i).body.cards.map((e=>ge(e)))}{const n=e?.operationSettings?.accessToken||r(),i=await async function({membershipId:e,accessToken:t,stagingToken:n}){const a=H({membershipId:e,accessToken:t,stagingToken:n}),{cards:i}=await F(a);return i}({membershipId:t,accessToken:n,stagingToken:a});return i.map((e=>ge(e)))}}catch(e){return Promise.reject(e)}},getCard:async function({cardSettings:e,operationSettings:t}){try{!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId parameter is required for the called function");const t=W({cardId:e.cardId});if(t.length>0)throw new s(t)}(e);const n=e.cardId,{proxyRequestFunction:a,stagingToken:i}=A(t||{});if(a){const e=B(K({cardId:n,stagingToken:i})),t=await a(e),r=G(t).body.cards;if(Array.isArray(r)&&r.length>0)return ge(r[0]);throw new s("Unable to retrieve card data")}{const e=t?.accessToken||r(),a=await async function({cardId:e,accessToken:t,stagingToken:n}){const a=K({cardId:e,accessToken:t,stagingToken:n}),{cards:i}=await F(a);return i[0]}({cardId:n,accessToken:e,stagingToken:i});return ge(a)}}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=A(e.operationSettings,{requiresUI:!0});ee(e.cardSettings);const s=me({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),o=await le({iframeUrl:s,parentElementId:a}),c=fe(e.cardSettings),d=await o.postMessage(c);return o.destroy(),ge(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=A(e.operationSettings,{requiresUI:!0});!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=W({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=me({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),d=await le({iframeUrl:o,parentElementId:a}),u=function(e){return{actionId:c.CARD_UNLOCK,actionData:{body:{cardId:e.cardSettings.cardId}}}}(e),m=await d.postMessage(u);return d.destroy(),ge(m)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:t,accessToken:n,stagingToken:a,debugMode:i,mfaPreference:o}=A(e.operationSettings,{requiresUI:!0}),c=n||r();!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=W({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 a=J(n);if(a.length>0)throw new s(a)}(e.cardSettings);const d=await async function(e){const{accessToken:t,stagingToken:n,mfaPreference:a}=e,i={method:"GET",headers:q({accessToken:t,stagingToken:n,mfaPreference:a})},r=w.getEnvironmentUrls().THIRD_PARTY_API_URL,s=await fetch(`${r}/v2/cards/${e.cardId}/data_view`,i),o=await s.json();if(!s.ok)throw o.errors?new U(o.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${o.code}: ${o.detail}`);return o.iframe_url}({...e.cardSettings,accessToken:c,stagingToken:a,mfaPreference:o}),{allowPinReveal:u,allowBlocking:m}=e.cardSettings,l=function(e,t){const n=new URL(e);"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal.toString()),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking.toString()),!0===t.debugMode&&n.searchParams.set("debug",t.debugMode.toString());const a=_e(he);return Object.keys(a).length>0&&n.searchParams.set("customization",JSON.stringify(a)),n.toString()}(d,{allowPinReveal:u,allowBlocking:m,debugMode:i}),f=await le({iframeUrl:l,parentElementId:t});return{destroyEmbedUI:()=>{f.destroy()}}}catch(e){return Promise.reject(e)}}},Ie=be;function ke(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 we({endpointUrl:e,paginationSettings:t}){return function({url:e,searchParams:t}){const n=new URL(e.toString());for(const[e,a]of t.entries())n.searchParams.append(e,a);return n}({url:new URL(e),searchParams:ke(t)})}function Ee(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 Se(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 Re="/v2/sepa/beneficiaries";function Le({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},i=ke(e),r=i.size?`?${i.toString()}`:"";return{path:`${Re}${r}`,options:a}}function ve({beneficiaryId:e,accessToken:t,stagingToken:n}){return{path:`${Re}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}async function Pe({accessToken:e,stagingToken:t,beneficiaryId:n}){const a=ve({beneficiaryId:n,accessToken:e,stagingToken:t}),{beneficiary:i}=await F(a);return i}function De({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=ce()}){return{path:Re,options:{method:"POST",headers:{accessToken:t,stagingToken:n,idempotencyKey:a},body:{beneficiary:Se(e)}}}}function Oe({beneficiaryIds:e,accessToken:t,stagingToken:n}){return{path:`${Re}/untrust`,options:{method:"PATCH",headers:{accessToken:t,stagingToken:n},body:{ids:e}}}}function Ne({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}){const{name:r,email:s,activityTag:o}=e,c={method:"PATCH",headers:{accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i},body:{beneficiary:{name:r,email:s,activity_tag:o}}};return{path:`${Re}/${e.id}`,options:c}}const Ce=[{name:"name"},{name:"iban"}];const Ue={getBeneficiaries:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=A(e?.operationSettings||{});if(n){const e=B(Le({paginationSettings:i})),t=G(await n(e)),a=t.body.beneficiaries.map((e=>Ae(e))),r=Ee(t.body.meta);return{beneficiaries:a,...r?{meta:r}:{}}}{const e=a||r(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const a=Le({paginationSettings:e,accessToken:t,stagingToken:n}),{beneficiaries:i,meta:r}=await F(a);return{beneficiaries:i,meta:r}}({accessToken:e,stagingToken:t,paginationSettings:i}),s=n.beneficiaries.map((e=>Ae(e))),o=Ee(n.meta);return{beneficiaries:s,...o?{meta:o}:{}}}},getBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=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");return e}(e?.beneficiaryId),{proxyRequestFunction:a,accessToken:i,stagingToken:o}=A(t||{});if(a){const e=B(ve({beneficiaryId:n}));return Ae(G(await a(e)).body.beneficiary)}{const e=i||r();return Ae(await Pe({beneficiaryId:n,accessToken:e,stagingToken:o}))}},addBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=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");V(e,Ce);const t=W({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new s(t);return e}(e),{proxyRequestFunction:a,accessToken:i,stagingToken:o,idempotencyKey:c}=A(t||{});if(a){const e=B(De({beneficiary:n,idempotencyKey:c}));return Ae(G(await a(e)).body.beneficiary)}{const e=i||r(),t=await async function({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=ce()}){const i=De({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a}),{beneficiary:r}=await F(i);return r}({beneficiary:n,accessToken:e,stagingToken:o,idempotencyKey:c});return Ae(t)}},updateBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){const{id:t,name:n,email:a,activityTag:i}=e||{};if(!t)throw new s("Invalid parameters were passed to the function:\nA beneficiary ID is required for the called function");if(!n&&!a&&!i)throw new s("Invalid parameters were passed to the function:\nAt least one of the following properties must be provided: name, email, activityTag");const r=W({name:n,email:a,activityTag:i});if(r.length>0)throw new s(r);return{id:t,name:n,email:a,activityTag:i}}(e),{stagingToken:a,idempotencyKey:i,mfaPreference:o,proxyRequestFunction:c}=A(t),d={beneficiaryParamsBeingEdited:n,idempotencyKey:i,mfaPreference:o};if(c){const e=B(Ne(d));return Ae(G(await c(e)).body.beneficiary)}{const e=t?.accessToken||r(),n=await async function({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}){const r=Ne({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}),{beneficiary:s}=await F(r);return s}({...d,accessToken:e,stagingToken:a});return Ae(n)}},untrustBeneficiaries:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiaryIds parameter is required for the called function");if(!Array.isArray(e)||!e.every((e=>"string"==typeof e)))throw new s("beneficiaryIds must be an array of strings");return e}(e?.beneficiaryIds),{proxyRequestFunction:a,accessToken:i,stagingToken:o}=A(t||{});if(a){const e=B(Oe({beneficiaryIds:n}));return G(await a(e)).body.beneficiaries.map(Ae)}{const e=i||r(),t=await async function({beneficiaryIds:e,accessToken:t,stagingToken:n}){const a=Oe({beneficiaryIds:e,accessToken:t,stagingToken:n}),{beneficiaries:i}=await F(a);return i}({beneficiaryIds:n,accessToken:e,stagingToken:o});return t.map(Ae)}}},Me=Ue;function $e(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}function qe(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}function Fe(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}}function Be(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}function Ge(e){return{name:e.name,iban:e.iban}}const He="/v2/sepa",Ke=`${He}/transfers`;function xe({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},i=ke(e),r=i.size?`?${i.toString()}`:"";return{path:`${Ke}${r}`,options:a}}async function je({sepaPayee:e,accessToken:t,stagingToken:n}){const a=function({sepaPayee:e,accessToken:t,stagingToken:n}){return{path:`${He}/verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:t,stagingToken:n});return await F(a)}const Ye="/v2/sepa/bulk_transfers";async function ze({sepaPayees:e,accessToken:t,stagingToken:n}){const a=function({sepaPayees:e,accessToken:t,stagingToken:n}){return{path:`${He}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{requests:e.map(Ge)}}}}({sepaPayees:e,accessToken:t,stagingToken:n});return await F(a)}function Ve(e){if(!e)throw new s("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new s("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new s("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new s("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,t)=>{!function(e,t){if(!e)throw new s(`Invalid bulkTransfer at index ${t}: bulkTransfer object is required`);if(!e.beneficiary)throw new s(`Invalid bulkTransfer at index ${t}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new s(`Invalid bulkTransfer at index ${t}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new s(`Invalid bulkTransfer at index ${t}: Beneficiary name is required as part of the beneficiary details`);const n=W({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=X({amount:e.amount}),i=[...n,...a].flat();if(i.length>0)throw new s(i);if(e.amount>f&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new s(`Invalid bulkTransfer at index ${t}: Attachments are required for transfers over €30000`)}(e,t)})),e}const We="browser",Je="server";class Xe extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case We:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case Je:this.message="This code is running in a server environment, but it is expected to run in a browser environment.";break;default:this.message="This code is not expected to run in this environment. Check if the function was server-only or browser-only."}}}const Qe=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];const Ze={getSepaTransfers:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=A(e?.operationSettings||{});if(n){const e=B(xe({paginationSettings:i})),t=G(await n(e)),a=t.body.transfers.map(Fe),r=Ee(t.body.meta);return{transfers:a,...r?{meta:r}:{}}}{const e=a||r(),n=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a=xe({paginationSettings:n,accessToken:e,stagingToken:t}),{transfers:i,meta:r}=await F(a);return{transfers:i,meta:r}}({accessToken:e,stagingToken:t,paginationSettings:i}),s=n.transfers.map(Fe),o=Ee(n.meta);return{transfers:s,...o?{meta:o}:{}}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=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");return e}(e?.sepaTransferId);return Fe(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const a={method:"GET",headers:q({accessToken:e,stagingToken:t})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ke}/${n}`,r=await fetch(i,a),s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.transfer}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken}))},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),o=t?.idempotencyKey||ce();let d;!function(e){if(!e)throw new s("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new s("sepaTransferSettings must be an object");if(V(e,Qe),!e.beneficiaryId&&!e.beneficiary)throw new s("Either beneficiaryId or beneficiary must be provided");const t=[...W({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...X({amount:e.amount})].flat();if(t.length>0)throw new s(t);if(e.amount>f&&(!e.attachmentIds||0===e.attachmentIds.length))throw new s("Attachments are required for transfers over €30,000")}(e);const u=await async function({sepaTransferSettings:e,operationSettings:t}){return e?.beneficiary?e.beneficiary:Ae(await Pe({beneficiaryId:e?.beneficiaryId,accessToken:t?.accessToken,stagingToken:t?.stagingToken}))}({sepaTransferSettings:e,operationSettings:{accessToken:a,stagingToken:i||void 0}}),m={name:u.name,iban:u.iban},l=await je({sepaPayee:m,accessToken:a,stagingToken:i||void 0});var p;if((yield(p=l,{matchResult:p.match_result,matchedName:p.matched_name}))===g.REJECT)return;const h={...e,beneficiary:u};if(h.beneficiary?.trusted)d=await async function({transfer:e,vopProofToken:t,accessToken:n,stagingToken:a,idempotencyKey:i}){const r=Be(e),s={method:"POST",headers:q({accessToken:n,stagingToken:a,idempotencyKey:i}),body:JSON.stringify({transfer:r,vop_proof_token:t})},o=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ke}`,c=await fetch(o,s),d=await c.json();if(d.errors)throw new U(d.errors.map((e=>`${e.code}: ${e.detail}`)));return d.transfer}({transfer:h,vopProofToken:l.proof_token.token,accessToken:a,stagingToken:i||void 0,idempotencyKey:o});else{if(!M())throw new Xe(We);const{uiParentElementId:e,debugMode:n}=A(t,{requiresUI:!0});let r;try{const t=me({accessToken:a,stagingToken:i||void 0,debugMode:n});r=await le({iframeUrl:t,parentElementId:e});const s=Be(h);d=await r.postMessage(de({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}}))}finally{r?.destroy()}}return Fe(d)},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);await async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const a={method:"POST",headers:q({accessToken:t,stagingToken:n})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ke}/${e}/cancel`,r=await fetch(i,a);if(204!==r.status){const e=await r.json();if(e.errors)throw new U(e.errors.map((e=>`${e.code}: ${e.detail}`)))}}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken})},bulkTransfers:{getBulkTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||r(),{stagingToken:a,paginationSettings:i}=A(t||{}),s=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a={method:"GET",headers:q({accessToken:e,stagingToken:t})},i=we({endpointUrl:new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ye}`),paginationSettings:n}),r=await fetch(i,a);if(!r.ok)throw new U("Failed to fetch SEPA bulk transfers");const s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{bulkTransfers:s.bulk_transfers,meta:s.meta}}({accessToken:n,stagingToken:a,paginationSettings:i}),o=s.bulkTransfers?.map($e),c=Ee(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),{stagingToken:a}=A(t||{}),i=function(e){if(!e)throw new s("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new s("bulkTransferId must be a string.");return e}(e?.bulkTransferId);return $e(await async function({accessToken:e,stagingToken:t,bulkTransferId:n}){const a={method:"GET",headers:q({accessToken:e,stagingToken:t})},i=new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ye}/${n}`),r=await fetch(i,a),s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.bulk_transfer}({accessToken:n,stagingToken:a,bulkTransferId:i}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),s=t?.idempotencyKey||ce();Ve(e);const{uiParentElementId:o,debugMode:d}=A(t,{requiresUI:!0});if(!M())throw new Xe(We);const u=new Map;for(const t of e.bulkTransfers){const e=t.beneficiary.iban;e&&!u.has(e)&&u.set(e,{name:t.beneficiary.name,iban:e})}const m=Array.from(u.values()),l=await ze({sepaPayees:m,accessToken:a,stagingToken:i||void 0});if((yield l.requests.map(qe))===g.REJECT)return;let f,p;try{const t=me({accessToken:a,stagingToken:i||void 0,debugMode:d});p=await le({iframeUrl:t,parentElementId:o});const n={bankAccountId:e.bankAccountId,bulkTransfers:e.bulkTransfers.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))};f=await p.postMessage(de({actionId:c.TRANSFER_BULK_CREATE,actionData:{body:n,idempotencyKey:s}}))}finally{p?.destroy()}return $e(f)}}},et={GOOD:"good",SERVICE:"service"},tt={AED:"AED",AUD:"AUD",BGN:"BGN",CAD:"CAD",CHF:"CHF",CNY:"CNY",CZK:"CZK",DKK:"DKK",EUR:"EUR",GBP:"GBP",GHS:"GHS",HKD:"HKD",HUF:"HUF",ILS:"ILS",INR:"INR",MXN:"MXN",NOK:"NOK",NZD:"NZD",PEN:"PEN",PLN:"PLN",RON:"RON",RSD:"RSD",SAR:"SAR",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",ZAR:"ZAR",ZMW:"ZMW"},nt=e=>{if(!(e=>Object.values(tt).includes(e))(e))throw new s(`currency ${e} is not valid, valid currencies are ${Object.values(tt).join(", ")}`)},at={UNIT:"unit",HOUR:"hour",DAY:"day",MONTH:"month",GRAM:"gram",KILOGRAM:"kilogram",LITER:"liter",METER:"meter",SQUARE_METER:"square_meter",CUBIC_METER:"cubic_meter",AMPERE:"ampere",NUMBER_OF_ARTICLES:"number_of_articles",CENTIMETER:"centimeter",CUBIC_METER_PER_HOUR:"cubic_meter_per_hour",GIGAJOULE:"gigajoule",GIGAWATT:"gigawatt",GIGAWATT_HOUR:"gigawatt_hour",HALF_YEAR:"half_year",JOULE:"joule",KILOJOULE:"kilojoule",KILOVAR:"kilovar",KILOWATT:"kilowatt",KILOWATT_HOUR:"kilowatt_hour",MEGAJOULE:"megajoule",MEGAWATT:"megawatt",MEGAWATT_HOUR:"megawatt_hour",MILLIGRAM:"milligram",MILLILITER:"milliliter",MILLIMETER:"millimeter",MINUTE:"minute",PAIR:"pair",QUARTER:"quarter",SECOND:"second",SET:"set",TON:"ton",TWO_WEEK:"two_week",WATT_HOUR:"watt_hour",WEEK:"week",YEAR:"year"},it=e=>{if(!(e=>Object.values(at).includes(e))(e))throw new s(`unit ${e} is not valid, valid units are ${Object.values(at).join(", ")}`)},rt=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],st=[{name:"currency"},{name:"value"}];const ot=e=>{if(!Object.values(et).includes(e))throw new s(`type ${e} is not valid, valid types are ${Object.values(et).join(", ")}`)},ct={getPaymentLinkCreationFlowUrl:({paymentLinkSettings:e})=>{const{items:t,authUrl:n}=e;!function(e){if(!e)throw new s("authUrl is required for the called function");const t=W({authUrl:e});if(t.length>0)throw new s(t);try{new URL(e)}catch{throw new s("authUrl is not a valid URL")}}(n),function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{V(e,rt),V(e.unitPrice,st);const t=[...W({id:e.id,title:e.title,vatRate:e.vatRate,currency:e.unitPrice.currency,measureUnit:e.measureUnit,unitPrice:e.unitPrice.value,...e.description?{description:e.description}:{}}),...X({quantity:e.quantity})].flat();if(t.length>0)throw new s(t);ot(e.type),nt(e.unitPrice.currency),it(e.measureUnit)}))}(t);const a=new URLSearchParams({...t?{items:JSON.stringify(t)}:{}});return a.toString()?`${n}?${a.toString()}`:n}},dt=({accessToken:e,stagingToken:t})=>({path:"/v2/organizations/",options:{method:"GET",headers:{accessToken:e,stagingToken:t}}}),ut=e=>({slug:e.slug,iban:e.iban,bic:e.bic,currency:e.currency,balance:e.balance,balanceCents:e.balance_cents,authorizedBalance:e.authorized_balance,authorizedBalanceCents:e.authorized_balance_cents,name:e.name,updatedAt:new Date(e.updated_at),status:e.status,main:e.main}),mt={getBankAccounts:async e=>{const{stagingToken:t,proxyRequestFunction:n}=A(e);if(n){const e=dt({stagingToken:t}),a=await n(B(e)),{body:i}=G(a);return i.bank_accounts.map(ut)}{const n=e.accessToken||r(),a=await(async({accessToken:e,stagingToken:t})=>{const n=dt({accessToken:e,stagingToken:t});return await F(n)})({accessToken:n,stagingToken:t});return a.bank_accounts.map(ut)}}},lt="/v2/transactions";function ft({bankAccountId:e,iban:t,status:n,updatedAtFrom:a,updatedAtTo:i,emittedAtFrom:r,emittedAtTo:s,settledAtFrom:o,settledAtTo:c,side:d,operationType:u,withAttachments:m,paginationSettings:l,accessToken:f,stagingToken:g}){const p={method:"GET",headers:{accessToken:f,stagingToken:g}},h=new URLSearchParams;e&&h.append("bank_account_id",e),t&&h.append("iban",t),n&&h.append("status",n),a&&h.append("updated_at_from",a),i&&h.append("updated_at_to",i),r&&h.append("emitted_at_from",r),s&&h.append("emitted_at_to",s),o&&h.append("settled_at_from",o),c&&h.append("settled_at_to",c),d&&h.append("side",d),u&&h.append("operation_type",u),void 0!==m&&h.append("with_attachments",String(m));const T=ke(l);for(const[e,t]of T)h.append(e,t);const y=h.toString();return{path:`${lt}${y?`?${y}`:""}`,options:p}}function gt({transactionId:e,accessToken:t,stagingToken:n}){return{path:`${lt}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function pt(e){return{transactionId:e.transaction_id,amount:e.amount,amountCents:e.amount_cents,settledBalance:e.settled_balance,settledBalanceCents:e.settled_balance_cents,attachmentIds:e.attachment_ids,localAmount:e.local_amount,localAmountCents:e.local_amount_cents,side:e.side,operationType:e.operation_type,currency:e.currency,localCurrency:e.local_currency,label:e.label,settledAt:new Date(e.settled_at),emittedAt:new Date(e.emitted_at),updatedAt:new Date(e.updated_at),status:e.status,note:e.note,reference:e.reference,vatAmount:e.vat_amount,vatAmountCents:e.vat_amount_cents,vatRate:e.vat_rate,initiatorId:e.initiator_id,labelIds:e.label_ids,attachmentLost:e.attachment_lost,attachmentRequired:e.attachment_required,cardLastDigits:e.card_last_digits,category:e.category,cashflowCategory:{name:e.cashflow_category?.name||""},cashflowSubcategory:{name:e.cashflow_subcategory?.name||""},id:e.id,subjectType:e.subject_type,...e.transfer?{transfer:{counterpartyAccountNumber:e.transfer.counterparty_account_number,counterpartyName:e.transfer.counterparty_name,counterpartyBic:e.transfer.counterparty_bic,counterpartyIban:e.transfer.counterparty_iban}}:{}}}const ht={getTransactions:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=A(e?.operationSettings||{}),s={...e?.transactionSettings||{},paginationSettings:i};if(n){const e=B(ft(s)),t=G(await n(e));return{transactions:t.body.transactions.map(pt),meta:t.body.meta}}{const e=a||r(),n=await async function(e){const t=ft(e),{transactions:n,meta:a}=await F(t);return{transactions:n,meta:a}}({...s,accessToken:e,stagingToken:t});return{transactions:n.transactions.map(pt),meta:n.meta}}},getTransaction:async function({transactionSettings:e,operationSettings:t}){const{proxyRequestFunction:n,accessToken:a,stagingToken:i}=A(t||{}),{transactionId:o}=function(e){if(!e)throw new s("transactionSettings parameter is required for the called function");if(!e.transactionId)throw new s("transactionSettings.transactionId parameter is required for the called function");if(e.transactionId&&"string"!=typeof e.transactionId)throw new s("transactionSettings.transactionId must be a string.");return e}(e);if(n){const e=B(gt({transactionId:o}));return pt(G(await n(e)).body.transaction)}{const e=a||r();return pt(await async function(e){const t=gt(e),{transaction:n}=await F(t);return n}({transactionId:o,accessToken:e,stagingToken:i}))}}},Tt=ht;e.beneficiaries=Me,e.cards=Ie,e.constants=C,e.initialize=O,e.logout=N,e.organizations=mt,e.paymentLinks=ct,e.sepaTransfers=Ze,e.transactions=Tt}));
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 a extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class i extends a{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 i;return n.getAccessToken()}class s extends a{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")}`}}const o={READY:"qonto.ready"},c={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",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},u={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},l={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},m={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},f=3e4,g={ACCEPT:"ACCEPT",REJECT:"REJECT"},p={CARD_DISPLAY:"display_card",PAYMENT_LINK_CREATE:"create_payment_link",SEPA_TRANSFER_CREATE:"create_sepa_transfer"};var T=Object.freeze({__proto__:null,ACTIONS:c,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"},AMOUNT_REQUIRING_ATTACHMENTS:f,AUTH_LINK_ACTIONS:p,BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:u,ENVIRONMENTS:d,IFRAME_EVENTS:o,LOCALES:l,MFA_METHODS:m,TRANSACTION_STATUSES:{PENDING:"pending",DECLINED:"declined",COMPLETED:"completed"},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"},TRANSFER_STATUSES:{PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled",FAILED:"failed",COMPLETED:"completed"},VOP_CHECK_RESULTS:{MATCH_RESULT_MATCH:"MATCH_RESULT_MATCH",MATCH_RESULT_NO_MATCH:"MATCH_RESULT_NO_MATCH",MATCH_RESULT_CLOSE_MATCH:"MATCH_RESULT_CLOSE_MATCH",MATCH_RESULT_NOT_POSSIBLE:"MATCH_RESULT_NOT_POSSIBLE",MATCH_RESULT_UNSPECIFIED:"MATCH_RESULT_UNSPECIFIED"},VOP_DECISIONS:g});class h{constructor(){this.mfaPreference=m.PASSKEY,this.debugMode=!1}static getInstance(){return h.instance||(h.instance=new h),h.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=m.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}}const y=h.getInstance(),_="https://embed.qonto.com",b="https://embed-js{branch}.staging.qonto.co",k="https://embed.dev.qonto.co",I={[d.PRODUCTION]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:b,IFRAME_URL:`${b}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:k,IFRAME_URL:`${k}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class w{constructor(){this.environment=d.PRODUCTION,this.branch=u.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(d).includes(e)?e:d.PRODUCTION,this.branch=Object.values(u).includes(t)?t:u.SANDBOX}static getInstance(){return w.instance||(w.instance=new w),w.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===d.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=d.PRODUCTION,this.branch=u.MASTER}getEnvironmentUrls(){if(this.environment===d.PRODUCTION)return I.production;{const e=I[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const E=w.getInstance(),A={requiresUI:!1};function S(e,{requiresUI:t}=A){const n=e?.uiParentElementId||y.getUIParentElementId();if(t&&!n)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 a=e?.mfaPreference||y.getMFAPreference();if(a){const e=(i=Object.values(m),E.isProductionEnvironment()?i.filter((e=>e!==m.MOCK)):i);if(!e.includes(a))throw new s(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(E.isProductionEnvironment()&&a===m.MOCK)throw new s("operationSettings.mfaPreference cannot be set to mock in production environment.")}var i;const r=e?.debugMode||y.getDebugMode();if(void 0!==r&&"boolean"!=typeof r)throw new s("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||y.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new s("operationSettings.proxyRequestFunction must be a function.");return{...e,uiParentElementId:n,mfaPreference:a,debugMode:r,proxyRequestFunction:o}}const R=Object.values(l);function L(e){if(!function(e){return R.includes(e)}(e))throw new s(`Unsupported locale: ${e}. The locale must be one of: ${R.join(", ")}.`);return e}function v(e){if(!e?.accessToken&&!e?.operationSettings?.proxyRequestFunction)throw new s("Either operationSettings.proxyRequestFunction or access token is required when calling initialize()");return e?.operationSettings&&S(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.locale&&L(e.locale),e}class P{constructor(){this.currentLocale="en"}static getInstance(){return P.instance||(P.instance=new P),P.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const D=P.getInstance();const O={initialize:function(e){const{accessToken:t,stagingToken:a,operationSettings:i,environment:r,branch:s,locale:o}=v(e);t&&n.setAccessToken(t),a&&n.setStagingToken(a),o&&D.setLocale(o),i&&y.setSettings(i),r&&(E.setEnvironment(r),s&&E.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),D.setDefaultLocale(),y.clearSettings()},constants:T},{initialize:N,logout:U,constants:C}=O;class M extends a{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 $(){return"undefined"!=typeof window&&"undefined"!=typeof document}function q(){return!$()}function F({accessToken:e,stagingToken:t,idempotencyKey:a,mfaPreference:i}){const r=new Headers;r.append("Authorization",`Bearer ${e}`);const s=t||n.getStagingToken();s&&r.append("X-Qonto-Staging-Token",s),a&&r.append("X-Qonto-Idempotency-Key",a);const o=i||y.getMFAPreference();return o&&r.append("X-Qonto-2fa-Preference",o),r.append("Content-Type","application/json"),r.append("Accept-Language",D.getLocale()),r}async function B({path:e,options:t}){const n=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(n,{...t,headers:F(t.headers),body:JSON.stringify(t.body)}),i=await a.json();if(!a.ok)throw i.errors?new M(i.errors.map((e=>`${e.code}: ${e.detail}`))):new M(`${i.code}: ${i.detail}`);return i}function x(e){const t={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},n=JSON.stringify(t);return a=n,q()?Buffer.from(a).toString("base64"):btoa(a);var a}function G(e){return JSON.parse((t=e,q()?Buffer.from(t,"base64").toString("utf-8"):atob(t)));var t}function K({membershipId:e,accessToken:t,stagingToken:n}){return{path:e?`/v2/cards?holder_ids[]=${e}`:"/v2/cards",options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function H({cardId:e,accessToken:t,stagingToken:n}){return{path:`/v2/cards?ids[]=${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}var j;!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"}(j||(j={}));const Y={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 z,V;function W(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 J(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function X(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function Q(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"}(z||(z={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(V||(V={}));const Z=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],ee=[...Z,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function te(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return W(e,Z),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:l,cardLevel:m}=e,f=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(m),g=J({membershipId:t,organizationId:n,bankAccountId:a}),p=X({hasDailyLimit:i,hasTransactionLimit:r}),T=Q({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),h=ne(u),y=ae(l),_=[...f,...g,...p,...T,...h,...y];if(_.length>0)throw new s(_)}(e),e}(e):function(e){W(e,ee),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:l,cardLevel:m,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,shipToBusiness:T,hasAtmOption:h,hasAtmDailyLimit:y,atmDailyLimit:_,atmMonthlyLimit:b,address:k,cardDesign:I,typeOfPrint:w}=e,E=function(e){return Object.values(V).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(m),A=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),S=J({membershipId:t,organizationId:n,bankAccountId:a}),R=X({hasDailyLimit:i,hasTransactionLimit:r,hasAtmOption:h,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,hasAtmDailyLimit:y,shipToBusiness:T}),L=Q({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:_,atmMonthlyLimit:b}),v=ne(u),P=ae(l),D=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(I),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"]}(k,T),N=[...E,...S,...R,...L,...v,...P,...A,...D,...O];if(N.length>0)throw new s(N)}(e)}(e)}function ne(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 ae(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 ie extends a{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const re=[];for(let e=0;e<256;++e)re.push((e+256).toString(16).slice(1));let se;const oe=new Uint8Array(16);var ce={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function de(e,t,n){if(ce.randomUUID&&!e)return ce.randomUUID();const a=(e=e||{}).random??e.rng?.()??function(){if(!se){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");se=crypto.getRandomValues.bind(crypto)}return se(oe)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=15&a[6]|64,a[8]=63&a[8]|128,function(e,t=0){return(re[e[t+0]]+re[e[t+1]]+re[e[t+2]]+re[e[t+3]]+"-"+re[e[t+4]]+re[e[t+5]]+"-"+re[e[t+6]]+re[e[t+7]]+"-"+re[e[t+8]]+re[e[t+9]]+"-"+re[e[t+10]]+re[e[t+11]]+re[e[t+12]]+re[e[t+13]]+re[e[t+14]]+re[e[t+15]]).toLowerCase()}(a)}function ue({actionId:e,actionData:t}){const n=y.getMFAPreference();return{actionId:e,actionData:{...t,scaPreference:t.scaPreference||n,idempotencyKey:t.idempotencyKey||de()}}}class le{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 ie(`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,a=setTimeout((()=>{window.removeEventListener("message",i),t(new ie(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),i=t=>{t.data.eventId===o.READY&&(clearTimeout(a),window.removeEventListener("message",i),e(this))};window.addEventListener("message",i),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){if(!this.iframe||!this.iframe.contentWindow)return Promise.reject(new ie("Attempted to perform an Embed operation without having the authentication UI initialized."));const t=ue(e);return new Promise(((e,n)=>{const a=i=>{if(i.data?.actionId===t.actionId){if("error"===i.data.status)return this.removeMessageListener(t.actionId,a),n(new ie(`An error occurred when performing the action ${t.actionId}.\n${JSON.stringify(i.data.payload)}`));this.removeMessageListener(t.actionId,a),e(i.data.payload)}};this.addMessageListener(t.actionId,a),this.iframe?.contentWindow?.postMessage(t,this.targetOrigin)}))}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 me({accessToken:e,stagingToken:t,locale:n,debugMode:a}){const i=a||!1,r=n||D.getLocale(),s=E.getEnvironmentUrls().IFRAME_URL,o=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${i}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function fe({parentElementId:e,iframeUrl:t}){return new le({parentElementId:e,iframeUrl:t}).initialize()}function ge(e){return"virtual"===e.cardLevel?function(e){const t=Te(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:de(),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=Te(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:de(),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 pe(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 Te(e){const t=Object.values(Y);return(e||[]).filter((e=>t.includes(e)))}const he="--qonto-embed";function ye(e){return!e.href||e.href.startsWith(window.location.origin)}function _e(e){return"CSSStyleRule"===e.constructor.name}function be(e=he){return $()?function(e,t){return[...e].filter(ye).reduce(((e,n)=>[...n.cssRules].filter(_e).reduce(((e,n)=>{if("style"in n){const a=[...n.style].map((e=>[e.trim(),n.style.getPropertyValue(e).trim()])).filter((([e])=>e.startsWith(t))).reduce(((e,[n,a])=>({...e,[n.replace(`${t}-`,"")]:a})),{});return{...e,...a}}return e}),e)),{})}(document.styleSheets,e):{}}const ke={getCards:async function(e){try{const t=e?.cardSettings?.membershipId;if(t&&"string"!=typeof t)throw new s("membershipId must be a string");const{proxyRequestFunction:n,stagingToken:a}=S(e?.operationSettings||{});if(n){const e=x(K({membershipId:t,stagingToken:a})),i=await n(e);return G(i).body.cards.map((e=>pe(e)))}{const n=e?.operationSettings?.accessToken||r(),i=await async function({membershipId:e,accessToken:t,stagingToken:n}){const a=K({membershipId:e,accessToken:t,stagingToken:n}),{cards:i}=await B(a);return i}({membershipId:t,accessToken:n,stagingToken:a});return i.map((e=>pe(e)))}}catch(e){return Promise.reject(e)}},getCard:async function({cardSettings:e,operationSettings:t}){try{!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId parameter is required for the called function");const t=J({cardId:e.cardId});if(t.length>0)throw new s(t)}(e);const n=e.cardId,{proxyRequestFunction:a,stagingToken:i}=S(t||{});if(a){const e=x(H({cardId:n,stagingToken:i})),t=await a(e),r=G(t).body.cards;if(Array.isArray(r)&&r.length>0)return pe(r[0]);throw new s("Unable to retrieve card data")}{const e=t?.accessToken||r(),a=await async function({cardId:e,accessToken:t,stagingToken:n}){const a=H({cardId:e,accessToken:t,stagingToken:n}),{cards:i}=await B(a);return i[0]}({cardId:n,accessToken:e,stagingToken:i});return pe(a)}}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=S(e.operationSettings,{requiresUI:!0});te(e.cardSettings);const s=me({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),o=await fe({iframeUrl:s,parentElementId:a}),c=ge(e.cardSettings),d=await o.postMessage(c);return o.destroy(),pe(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=S(e.operationSettings,{requiresUI:!0});!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=J({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=me({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),d=await fe({iframeUrl:o,parentElementId:a}),u=function(e){return{actionId:c.CARD_UNLOCK,actionData:{body:{cardId:e.cardSettings.cardId}}}}(e),l=await d.postMessage(u);return d.destroy(),pe(l)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:t,accessToken:n,stagingToken:a,debugMode:i,mfaPreference:o}=S(e.operationSettings,{requiresUI:!0}),c=n||r();!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=J({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 a=X(n);if(a.length>0)throw new s(a)}(e.cardSettings);const d=await async function(e){const{accessToken:t,stagingToken:n,mfaPreference:a}=e,i={method:"GET",headers:F({accessToken:t,stagingToken:n,mfaPreference:a})},r=E.getEnvironmentUrls().THIRD_PARTY_API_URL,s=await fetch(`${r}/v2/cards/${e.cardId}/data_view`,i),o=await s.json();if(!s.ok)throw o.errors?new M(o.errors.map((e=>`${e.code}: ${e.detail}`))):new M(`${o.code}: ${o.detail}`);return o.iframe_url}({...e.cardSettings,accessToken:c,stagingToken:a,mfaPreference:o}),{allowPinReveal:u,allowBlocking:l}=e.cardSettings,m=function(e,t){const n=new URL(e);"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal.toString()),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking.toString()),!0===t.debugMode&&n.searchParams.set("debug",t.debugMode.toString());const a=be(he);return Object.keys(a).length>0&&n.searchParams.set("customization",JSON.stringify(a)),n.toString()}(d,{allowPinReveal:u,allowBlocking:l,debugMode:i}),f=await fe({iframeUrl:m,parentElementId:t});return{destroyEmbedUI:()=>{f.destroy()}}}catch(e){return Promise.reject(e)}}},Ie=ke;function we(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 Ee({endpointUrl:e,paginationSettings:t}){return function({url:e,searchParams:t}){const n=new URL(e.toString());for(const[e,a]of t.entries())n.searchParams.append(e,a);return n}({url:new URL(e),searchParams:we(t)})}function Ae(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 Se(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 Le="/v2/sepa/beneficiaries";function ve({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},i=we(e),r=i.size?`?${i.toString()}`:"";return{path:`${Le}${r}`,options:a}}function Pe({beneficiaryId:e,accessToken:t,stagingToken:n}){return{path:`${Le}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}async function De({accessToken:e,stagingToken:t,beneficiaryId:n}){const a=Pe({beneficiaryId:n,accessToken:e,stagingToken:t}),{beneficiary:i}=await B(a);return i}function Oe({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=de()}){return{path:Le,options:{method:"POST",headers:{accessToken:t,stagingToken:n,idempotencyKey:a},body:{beneficiary:Re(e)}}}}function Ne({beneficiaryIds:e,accessToken:t,stagingToken:n}){return{path:`${Le}/untrust`,options:{method:"PATCH",headers:{accessToken:t,stagingToken:n},body:{ids:e}}}}function Ue({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}){const{name:r,email:s,activityTag:o}=e,c={method:"PATCH",headers:{accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i},body:{beneficiary:{name:r,email:s,activity_tag:o}}};return{path:`${Le}/${e.id}`,options:c}}const Ce=[{name:"name"},{name:"iban"}];const Me={getBeneficiaries:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=S(e?.operationSettings||{});if(n){const e=x(ve({paginationSettings:i})),t=G(await n(e)),a=t.body.beneficiaries.map((e=>Se(e))),r=Ae(t.body.meta);return{beneficiaries:a,...r?{meta:r}:{}}}{const e=a||r(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const a=ve({paginationSettings:e,accessToken:t,stagingToken:n}),{beneficiaries:i,meta:r}=await B(a);return{beneficiaries:i,meta:r}}({accessToken:e,stagingToken:t,paginationSettings:i}),s=n.beneficiaries.map((e=>Se(e))),o=Ae(n.meta);return{beneficiaries:s,...o?{meta:o}:{}}}},getBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=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");return e}(e?.beneficiaryId),{proxyRequestFunction:a,accessToken:i,stagingToken:o}=S(t||{});if(a){const e=x(Pe({beneficiaryId:n}));return Se(G(await a(e)).body.beneficiary)}{const e=i||r();return Se(await De({beneficiaryId:n,accessToken:e,stagingToken:o}))}},addBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=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");W(e,Ce);const t=J({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new s(t);return e}(e),{proxyRequestFunction:a,accessToken:i,stagingToken:o,idempotencyKey:c}=S(t||{});if(a){const e=x(Oe({beneficiary:n,idempotencyKey:c}));return Se(G(await a(e)).body.beneficiary)}{const e=i||r(),t=await async function({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=de()}){const i=Oe({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a}),{beneficiary:r}=await B(i);return r}({beneficiary:n,accessToken:e,stagingToken:o,idempotencyKey:c});return Se(t)}},updateBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){const{id:t,name:n,email:a,activityTag:i}=e||{};if(!t)throw new s("Invalid parameters were passed to the function:\nA beneficiary ID is required for the called function");if(!n&&!a&&!i)throw new s("Invalid parameters were passed to the function:\nAt least one of the following properties must be provided: name, email, activityTag");const r=J({name:n,email:a,activityTag:i});if(r.length>0)throw new s(r);return{id:t,name:n,email:a,activityTag:i}}(e),{stagingToken:a,idempotencyKey:i,mfaPreference:o,proxyRequestFunction:c}=S(t),d={beneficiaryParamsBeingEdited:n,idempotencyKey:i,mfaPreference:o};if(c){const e=x(Ue(d));return Se(G(await c(e)).body.beneficiary)}{const e=t?.accessToken||r(),n=await async function({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}){const r=Ue({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}),{beneficiary:s}=await B(r);return s}({...d,accessToken:e,stagingToken:a});return Se(n)}},untrustBeneficiaries:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiaryIds parameter is required for the called function");if(!Array.isArray(e)||!e.every((e=>"string"==typeof e)))throw new s("beneficiaryIds must be an array of strings");return e}(e?.beneficiaryIds),{proxyRequestFunction:a,accessToken:i,stagingToken:o}=S(t||{});if(a){const e=x(Ne({beneficiaryIds:n}));return G(await a(e)).body.beneficiaries.map(Se)}{const e=i||r(),t=await async function({beneficiaryIds:e,accessToken:t,stagingToken:n}){const a=Ne({beneficiaryIds:e,accessToken:t,stagingToken:n}),{beneficiaries:i}=await B(a);return i}({beneficiaryIds:n,accessToken:e,stagingToken:o});return t.map(Se)}}},$e=Me;function qe(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}function Fe(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}function Be(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}}function xe(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}function Ge(e){return{name:e.name,iban:e.iban}}const Ke="/v2/sepa",He=`${Ke}/transfers`;function je({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},i=we(e),r=i.size?`?${i.toString()}`:"";return{path:`${He}${r}`,options:a}}async function Ye({sepaPayee:e,accessToken:t,stagingToken:n}){const a=function({sepaPayee:e,accessToken:t,stagingToken:n}){return{path:`${Ke}/verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:t,stagingToken:n});return await B(a)}const ze="/v2/sepa/bulk_transfers";async function Ve({sepaPayees:e,accessToken:t,stagingToken:n}){const a=function({sepaPayees:e,accessToken:t,stagingToken:n}){return{path:`${Ke}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{requests:e.map(Ge)}}}}({sepaPayees:e,accessToken:t,stagingToken:n});return await B(a)}function We(e){if(!e)throw new s("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new s("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new s("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new s("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,t)=>{!function(e,t){if(!e)throw new s(`Invalid bulkTransfer at index ${t}: bulkTransfer object is required`);if(!e.beneficiary)throw new s(`Invalid bulkTransfer at index ${t}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new s(`Invalid bulkTransfer at index ${t}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new s(`Invalid bulkTransfer at index ${t}: Beneficiary name is required as part of the beneficiary details`);const n=J({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=Q({amount:e.amount}),i=[...n,...a].flat();if(i.length>0)throw new s(i);if(e.amount>f&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new s(`Invalid bulkTransfer at index ${t}: Attachments are required for transfers over €30000`)}(e,t)})),e}const Je="browser",Xe="server";class Qe extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case Je:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case Xe:this.message="This code is running in a server environment, but it is expected to run in a browser environment.";break;default:this.message="This code is not expected to run in this environment. Check if the function was server-only or browser-only."}}}const Ze=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];function et(e,t){if(t){const n=new URL(e);return n.searchParams.append("lang",t),n.toString()}return e}function tt({accessToken:e,stagingToken:t,action:n,callbackUrl:a}){const i={post_authn_action:n};return a&&(i.callback_url=a),{path:"/v1/embed_auth_links",options:{method:"POST",headers:{accessToken:e,stagingToken:t},body:{embed_auth_link:i}}}}function nt(e){return{url:e.url,postAuthAction:e.post_authn_action,callbackUrl:e.callback_url,expiresAt:e.expired_at,usedAt:e.used_at}}const at={request:async function({requestSettings:e,operationSettings:t}){!function(e){if(!e||"object"!=typeof e)throw new s("requestSettings must be an object");const t=e,{action:n,callbackUrl:a}=e;W(t,[{name:"action"}]);const i=J(t),r=Object.values(p);if(r.includes(n)||i.push(`action must be one of ${r.join(", ")}`),i.length>0)throw new s(i);if(void 0!==a&&""===a.trim())throw new s("callbackUrl cannot be empty")}(e);const{proxyRequestFunction:n,stagingToken:a}=S(t||{});if(n){const t=x(tt({stagingToken:a,action:e.action,callbackUrl:e.callbackUrl}));return nt(G(await n(t)).body)}{const n=t?.accessToken||r();return nt(await async function(e){const t=tt({accessToken:e.accessToken,stagingToken:e.stagingToken,action:e.action,callbackUrl:e.callbackUrl}),{embed_auth_link:n}=await B(t);return{url:n.url,post_authn_action:n.post_authn_action,callback_url:n.callback_url,expired_at:n.expired_at,used_at:n.used_at}}({accessToken:n,stagingToken:a,action:e.action,callbackUrl:e.callbackUrl}))}}};const it={getSepaTransfers:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=S(e?.operationSettings||{});if(n){const e=x(je({paginationSettings:i})),t=G(await n(e)),a=t.body.transfers.map(Be),r=Ae(t.body.meta);return{transfers:a,...r?{meta:r}:{}}}{const e=a||r(),n=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a=je({paginationSettings:n,accessToken:e,stagingToken:t}),{transfers:i,meta:r}=await B(a);return{transfers:i,meta:r}}({accessToken:e,stagingToken:t,paginationSettings:i}),s=n.transfers.map(Be),o=Ae(n.meta);return{transfers:s,...o?{meta:o}:{}}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=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");return e}(e?.sepaTransferId);return Be(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const a={method:"GET",headers:F({accessToken:e,stagingToken:t})},i=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${He}/${n}`,r=await fetch(i,a),s=await r.json();if(s.errors)throw new M(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.transfer}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken}))},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),o=t?.idempotencyKey||de();let d;!function(e){if(!e)throw new s("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new s("sepaTransferSettings must be an object");if(W(e,Ze),!e.beneficiaryId&&!e.beneficiary)throw new s("Either beneficiaryId or beneficiary must be provided");const t=[...J({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...Q({amount:e.amount})].flat();if(t.length>0)throw new s(t);if(e.amount>f&&(!e.attachmentIds||0===e.attachmentIds.length))throw new s("Attachments are required for transfers over €30,000")}(e);const u=await async function({sepaTransferSettings:e,operationSettings:t}){return e?.beneficiary?e.beneficiary:Se(await De({beneficiaryId:e?.beneficiaryId,accessToken:t?.accessToken,stagingToken:t?.stagingToken}))}({sepaTransferSettings:e,operationSettings:{accessToken:a,stagingToken:i||void 0}}),l={name:u.name,iban:u.iban},m=await Ye({sepaPayee:l,accessToken:a,stagingToken:i||void 0});var p;if((yield(p=m,{matchResult:p.match_result,matchedName:p.matched_name}))===g.REJECT)return;const T={...e,beneficiary:u};if(T.beneficiary?.trusted)d=await async function({transfer:e,vopProofToken:t,accessToken:n,stagingToken:a,idempotencyKey:i}){const r=xe(e),s={method:"POST",headers:F({accessToken:n,stagingToken:a,idempotencyKey:i}),body:JSON.stringify({transfer:r,vop_proof_token:t})},o=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${He}`,c=await fetch(o,s),d=await c.json();if(d.errors)throw new M(d.errors.map((e=>`${e.code}: ${e.detail}`)));return d.transfer}({transfer:T,vopProofToken:m.proof_token.token,accessToken:a,stagingToken:i||void 0,idempotencyKey:o});else{if(!$())throw new Qe(Je);const{uiParentElementId:e,debugMode:n}=S(t,{requiresUI:!0});let r;try{const t=me({accessToken:a,stagingToken:i||void 0,debugMode:n});r=await fe({iframeUrl:t,parentElementId:e});const s=xe(T);d=await r.postMessage(ue({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}}))}finally{r?.destroy()}}return Be(d)},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);await async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const a={method:"POST",headers:F({accessToken:t,stagingToken:n})},i=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${He}/${e}/cancel`,r=await fetch(i,a);if(204!==r.status){const e=await r.json();if(e.errors)throw new M(e.errors.map((e=>`${e.code}: ${e.detail}`)))}}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken})},getSepaTransferCreationFlowLink:async function({sepaTransferSettings:e,operationSettings:t}){const n=function(e){if(!e||!e.callbackUrl)throw new s("callbackUrl parameter is required for the getSepaTransferCreationFlowLink function");if("string"!=typeof e.callbackUrl)throw new s("callbackUrl must be a string");return e.callbackUrl}(e),{proxyRequestFunction:a,stagingToken:i,accessToken:o}=S(t||{}),c=a?{proxyRequestFunction:a}:{stagingToken:i,accessToken:o||r()},d=await at.request({requestSettings:{action:p.SEPA_TRANSFER_CREATE,callbackUrl:n},operationSettings:c}),u=t?.locale||D.getLocale();return{...d,url:et(d.url,u)}},bulkTransfers:{getBulkTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||r(),{stagingToken:a,paginationSettings:i}=S(t||{}),s=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a={method:"GET",headers:F({accessToken:e,stagingToken:t})},i=Ee({endpointUrl:new URL(`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${ze}`),paginationSettings:n}),r=await fetch(i,a);if(!r.ok)throw new M("Failed to fetch SEPA bulk transfers");const s=await r.json();if(s.errors)throw new M(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{bulkTransfers:s.bulk_transfers,meta:s.meta}}({accessToken:n,stagingToken:a,paginationSettings:i}),o=s.bulkTransfers?.map(qe),c=Ae(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),{stagingToken:a}=S(t||{}),i=function(e){if(!e)throw new s("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new s("bulkTransferId must be a string.");return e}(e?.bulkTransferId);return qe(await async function({accessToken:e,stagingToken:t,bulkTransferId:n}){const a={method:"GET",headers:F({accessToken:e,stagingToken:t})},i=new URL(`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${ze}/${n}`),r=await fetch(i,a),s=await r.json();if(s.errors)throw new M(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.bulk_transfer}({accessToken:n,stagingToken:a,bulkTransferId:i}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),s=t?.idempotencyKey||de();We(e);const{uiParentElementId:o,debugMode:d}=S(t,{requiresUI:!0});if(!$())throw new Qe(Je);const u=new Map;for(const t of e.bulkTransfers){const e=t.beneficiary.iban;e&&!u.has(e)&&u.set(e,{name:t.beneficiary.name,iban:e})}const l=Array.from(u.values()),m=await Ve({sepaPayees:l,accessToken:a,stagingToken:i||void 0});if((yield m.requests.map(Fe))===g.REJECT)return;let f,p;try{const t=me({accessToken:a,stagingToken:i||void 0,debugMode:d});p=await fe({iframeUrl:t,parentElementId:o});const n={bankAccountId:e.bankAccountId,bulkTransfers:e.bulkTransfers.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))};f=await p.postMessage(ue({actionId:c.TRANSFER_BULK_CREATE,actionData:{body:n,idempotencyKey:s}}))}finally{p?.destroy()}return qe(f)}}},rt={GOOD:"good",SERVICE:"service"},st={AED:"AED",AUD:"AUD",BGN:"BGN",CAD:"CAD",CHF:"CHF",CNY:"CNY",CZK:"CZK",DKK:"DKK",EUR:"EUR",GBP:"GBP",GHS:"GHS",HKD:"HKD",HUF:"HUF",ILS:"ILS",INR:"INR",MXN:"MXN",NOK:"NOK",NZD:"NZD",PEN:"PEN",PLN:"PLN",RON:"RON",RSD:"RSD",SAR:"SAR",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",ZAR:"ZAR",ZMW:"ZMW"},ot=e=>{if(!(e=>Object.values(st).includes(e))(e))throw new s(`currency ${e} is not valid, valid currencies are ${Object.values(st).join(", ")}`)},ct={UNIT:"unit",HOUR:"hour",DAY:"day",MONTH:"month",GRAM:"gram",KILOGRAM:"kilogram",LITER:"liter",METER:"meter",SQUARE_METER:"square_meter",CUBIC_METER:"cubic_meter",AMPERE:"ampere",NUMBER_OF_ARTICLES:"number_of_articles",CENTIMETER:"centimeter",CUBIC_METER_PER_HOUR:"cubic_meter_per_hour",GIGAJOULE:"gigajoule",GIGAWATT:"gigawatt",GIGAWATT_HOUR:"gigawatt_hour",HALF_YEAR:"half_year",JOULE:"joule",KILOJOULE:"kilojoule",KILOVAR:"kilovar",KILOWATT:"kilowatt",KILOWATT_HOUR:"kilowatt_hour",MEGAJOULE:"megajoule",MEGAWATT:"megawatt",MEGAWATT_HOUR:"megawatt_hour",MILLIGRAM:"milligram",MILLILITER:"milliliter",MILLIMETER:"millimeter",MINUTE:"minute",PAIR:"pair",QUARTER:"quarter",SECOND:"second",SET:"set",TON:"ton",TWO_WEEK:"two_week",WATT_HOUR:"watt_hour",WEEK:"week",YEAR:"year"},dt=e=>{if(!(e=>Object.values(ct).includes(e))(e))throw new s(`unit ${e} is not valid, valid units are ${Object.values(ct).join(", ")}`)},ut=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],lt=[{name:"currency"},{name:"value"}];const mt=e=>{if(!Object.values(rt).includes(e))throw new s(`type ${e} is not valid, valid types are ${Object.values(rt).join(", ")}`)},ft={getPaymentLinkCreationFlowUrl:({paymentLinkSettings:e})=>{const{items:t,authUrl:n}=e;!function(e){if(!e)throw new s("authUrl is required for the called function");const t=J({authUrl:e});if(t.length>0)throw new s(t);try{new URL(e)}catch{throw new s("authUrl is not a valid URL")}}(n),function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{W(e,ut),W(e.unitPrice,lt);const t=[...J({id:e.id,title:e.title,vatRate:e.vatRate,currency:e.unitPrice.currency,measureUnit:e.measureUnit,unitPrice:e.unitPrice.value,...e.description?{description:e.description}:{}}),...Q({quantity:e.quantity})].flat();if(t.length>0)throw new s(t);mt(e.type),ot(e.unitPrice.currency),dt(e.measureUnit)}))}(t);const a=new URLSearchParams({...t?{items:JSON.stringify(t)}:{}});return a.toString()?`${n}?${a.toString()}`:n}},gt=({accessToken:e,stagingToken:t})=>({path:"/v2/organizations/",options:{method:"GET",headers:{accessToken:e,stagingToken:t}}}),pt=e=>({slug:e.slug,iban:e.iban,bic:e.bic,currency:e.currency,balance:e.balance,balanceCents:e.balance_cents,authorizedBalance:e.authorized_balance,authorizedBalanceCents:e.authorized_balance_cents,name:e.name,updatedAt:new Date(e.updated_at),status:e.status,main:e.main}),Tt={getBankAccounts:async e=>{const{stagingToken:t,proxyRequestFunction:n}=S(e);if(n){const e=gt({stagingToken:t}),a=await n(x(e)),{body:i}=G(a);return i.bank_accounts.map(pt)}{const n=e.accessToken||r(),a=await(async({accessToken:e,stagingToken:t})=>{const n=gt({accessToken:e,stagingToken:t});return await B(n)})({accessToken:n,stagingToken:t});return a.bank_accounts.map(pt)}}},ht="/v2/transactions";function yt({bankAccountId:e,iban:t,status:n,updatedAtFrom:a,updatedAtTo:i,emittedAtFrom:r,emittedAtTo:s,settledAtFrom:o,settledAtTo:c,side:d,operationType:u,withAttachments:l,paginationSettings:m,accessToken:f,stagingToken:g}){const p={method:"GET",headers:{accessToken:f,stagingToken:g}},T=new URLSearchParams;e&&T.append("bank_account_id",e),t&&T.append("iban",t),n&&T.append("status",n),a&&T.append("updated_at_from",a),i&&T.append("updated_at_to",i),r&&T.append("emitted_at_from",r),s&&T.append("emitted_at_to",s),o&&T.append("settled_at_from",o),c&&T.append("settled_at_to",c),d&&T.append("side",d),u&&T.append("operation_type",u),void 0!==l&&T.append("with_attachments",String(l));const h=we(m);for(const[e,t]of h)T.append(e,t);const y=T.toString();return{path:`${ht}${y?`?${y}`:""}`,options:p}}function _t({transactionId:e,accessToken:t,stagingToken:n}){return{path:`${ht}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function bt(e){return{transactionId:e.transaction_id,amount:e.amount,amountCents:e.amount_cents,settledBalance:e.settled_balance,settledBalanceCents:e.settled_balance_cents,attachmentIds:e.attachment_ids,localAmount:e.local_amount,localAmountCents:e.local_amount_cents,side:e.side,operationType:e.operation_type,currency:e.currency,localCurrency:e.local_currency,label:e.label,settledAt:new Date(e.settled_at),emittedAt:new Date(e.emitted_at),updatedAt:new Date(e.updated_at),status:e.status,note:e.note,reference:e.reference,vatAmount:e.vat_amount,vatAmountCents:e.vat_amount_cents,vatRate:e.vat_rate,initiatorId:e.initiator_id,labelIds:e.label_ids,attachmentLost:e.attachment_lost,attachmentRequired:e.attachment_required,cardLastDigits:e.card_last_digits,category:e.category,cashflowCategory:{name:e.cashflow_category?.name||""},cashflowSubcategory:{name:e.cashflow_subcategory?.name||""},id:e.id,subjectType:e.subject_type,...e.transfer?{transfer:{counterpartyAccountNumber:e.transfer.counterparty_account_number,counterpartyName:e.transfer.counterparty_name,counterpartyBic:e.transfer.counterparty_bic,counterpartyIban:e.transfer.counterparty_iban}}:{}}}const kt={getTransactions:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=S(e?.operationSettings||{}),s={...e?.transactionSettings||{},paginationSettings:i};if(n){const e=x(yt(s)),t=G(await n(e));return{transactions:t.body.transactions.map(bt),meta:t.body.meta}}{const e=a||r(),n=await async function(e){const t=yt(e),{transactions:n,meta:a}=await B(t);return{transactions:n,meta:a}}({...s,accessToken:e,stagingToken:t});return{transactions:n.transactions.map(bt),meta:n.meta}}},getTransaction:async function({transactionSettings:e,operationSettings:t}){const{proxyRequestFunction:n,accessToken:a,stagingToken:i}=S(t||{}),{transactionId:o}=function(e){if(!e)throw new s("transactionSettings parameter is required for the called function");if(!e.transactionId)throw new s("transactionSettings.transactionId parameter is required for the called function");if(e.transactionId&&"string"!=typeof e.transactionId)throw new s("transactionSettings.transactionId must be a string.");return e}(e);if(n){const e=x(_t({transactionId:o}));return bt(G(await n(e)).body.transaction)}{const e=a||r();return bt(await async function(e){const t=_t(e),{transaction:n}=await B(t);return n}({transactionId:o,accessToken:e,stagingToken:i}))}}},It=kt;e.authLinks=at,e.beneficiaries=$e,e.cards=Ie,e.constants=C,e.initialize=N,e.logout=U,e.organizations=Tt,e.paymentLinks=ft,e.sepaTransfers=it,e.transactions=It}));
@@ -75,5 +75,10 @@ export declare const mockBulkTransferMixedResponse: {
75
75
  status: string;
76
76
  }[];
77
77
  };
78
+ export declare const mockedEmbedAuthLink: {
79
+ url: string;
80
+ expired_at: string;
81
+ used_at: null;
82
+ };
78
83
  export declare const mswHandlers: import("msw").HttpHandler[];
79
84
  //# 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,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;AAE9E,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,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,2BAA2B,EAAE,qBA2CzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA8EzD,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,8BAKnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC,eAAe,CAI7E,CAAC;AAEJ,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;CAiB1C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;CAiB7C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,WAAW,6BA2evB,CAAC"}
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;AAE9E,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,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,2BAA2B,EAAE,qBA2CzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA8EzD,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,8BAKnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC,eAAe,CAI7E,CAAC;AAEJ,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;CAiB1C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;CAiB7C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,WAAW,6BA2hBvB,CAAC"}
@@ -27,6 +27,7 @@ export declare const sepaTransfers: {
27
27
  getSepaTransfer: typeof import("./sepa-transfers").getSepaTransfer;
28
28
  createSepaTransfer: typeof import("./sepa-transfers").createSepaTransfer;
29
29
  cancelSepaTransfer: typeof import("./sepa-transfers").cancelSepaTransfer;
30
+ getSepaTransferCreationFlowLink: typeof import("./sepa-transfers").getSepaTransferCreationFlowLink;
30
31
  bulkTransfers: {
31
32
  getBulkTransfers: typeof import("./bulk-transfers/bulk-transfers").getBulkTransfers;
32
33
  getBulkTransfer: typeof import("./bulk-transfers/bulk-transfers").getBulkTransfer;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;CAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;CAAuC,CAAC"}
@@ -1,4 +1,5 @@
1
- import type { GetSepaTransfer, CancelSepaTransferParams, GetSepaTransfersResponse, NewSepaTransfer, SepaTransfer, SepaTransferParams, VopVerificationResult } from './sepa-transfers.types';
1
+ import type { CancelSepaTransferParams, GetSepaTransfer, GetSepaTransfersResponse, NewSepaTransfer, SepaTransfer, SepaTransferCreationFlowRequest, SepaTransferParams, VopVerificationResult } from './sepa-transfers.types';
2
+ import type { AuthLinkRequestResult } from '@auth-links/auth-links.types';
2
3
  /**
3
4
  * Fetches the list of SEPA transfers for the current user.
4
5
  * @param getSepaTransfersParams - An object containing:
@@ -94,4 +95,26 @@ export declare function createSepaTransfer({ sepaTransferSettings, operationSett
94
95
  * @throws `EmbedApiError` If the API request fails or returns an error.
95
96
  */
96
97
  export declare function cancelSepaTransfer({ sepaTransferSettings, operationSettings, }: SepaTransferParams<CancelSepaTransferParams>): Promise<void>;
98
+ /**
99
+ * Generates an authentication link to start the SEPA transfer creation flow as
100
+ * a hosted page. This flow will allow users to create a SEPA transfer from a
101
+ * Qonto hosted page, which will guide them through the necessary steps to
102
+ * complete the transfer, including the Verification of Payee check.
103
+ * @param getSepaTransferCreationFlowLinkParams - An object with the parameters
104
+ * to request the link where the process will start. This object is expected to
105
+ * contain only a property called `callbackUrl`, which will be used to return the
106
+ * user to the desired location in your website after the process is complete.
107
+ * If it was not provided when calling the SDK's `initialize` function, an
108
+ * `operationSettings` object has to be passed too with the `proxyRequestFunction`
109
+ * parameter (preferred over using an access token if using the SDK in browsers),
110
+ * or the `accessToken` and `stagingToken` values. It is also possible, and
111
+ * advisable, to pass a `locale` property within operationSettings to set the
112
+ * language in which the hosted page will be shown. If not provided, it will
113
+ * default to English.
114
+ * @returns A promise that resolves to an object representing the Embed Auth Link.
115
+ * This object contains a `url` property with the link to start the SEPA transfer.
116
+ * @throws `InvalidParametersError` If none of `proxyRequestFunction` or `accessToken`
117
+ * are provided, of if the callbackUrl is invalid or missing.
118
+ */
119
+ export declare function getSepaTransferCreationFlowLink({ sepaTransferSettings, operationSettings, }: SepaTransferParams<SepaTransferCreationFlowRequest>): Promise<AuthLinkRequestResult>;
97
120
  //# 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":"AAWA,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,YAAY,EAEZ,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AA2BhC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,wBAAwB,CAAC,CAsDnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAY7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAuB,kBAAkB,CAAC,EACxC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,cAAc,CACrD,qBAAqB,EACrB,YAAY,GAAG,SAAS,CACzB,CAiGA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAW9D"}
1
+ {"version":3,"file":"sepa-transfers.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,wBAAwB,EACxB,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,YAAY,EACZ,+BAA+B,EAE/B,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AA+BhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAG1E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,wBAAwB,CAAC,CAsDnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAY7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAuB,kBAAkB,CAAC,EACxC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,cAAc,CACrD,qBAAqB,EACrB,YAAY,GAAG,SAAS,CACzB,CAiGA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAW9D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,+BAA+B,CAAC,EACpD,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,+BAA+B,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA0BtF"}
@@ -1,5 +1,5 @@
1
1
  import { getBulkTransfers, getBulkTransfer, createBulkTransfer } from './bulk-transfers/bulk-transfers';
2
- import { getSepaTransfers, getSepaTransfer, createSepaTransfer, cancelSepaTransfer } from './sepa-transfers';
2
+ import { getSepaTransfers, getSepaTransfer, createSepaTransfer, cancelSepaTransfer, getSepaTransferCreationFlowLink } from './sepa-transfers';
3
3
  /**
4
4
  * The SEPA transfers namespace containing all transfer-related operations
5
5
  * including both single transfers and bulk transfers.
@@ -9,6 +9,7 @@ declare const sepaTransfers: {
9
9
  getSepaTransfer: typeof getSepaTransfer;
10
10
  createSepaTransfer: typeof createSepaTransfer;
11
11
  cancelSepaTransfer: typeof cancelSepaTransfer;
12
+ getSepaTransferCreationFlowLink: typeof getSepaTransferCreationFlowLink;
12
13
  bulkTransfers: {
13
14
  getBulkTransfers: typeof getBulkTransfers;
14
15
  getBulkTransfer: typeof getBulkTransfer;
@@ -1 +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,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,QAAA,MAAM,aAAa;;;;;;;;;;CAWlB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"sepa-transfers.public-api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,+BAA+B,EAChC,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,QAAA,MAAM,aAAa;;;;;;;;;;;CAYlB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -2,6 +2,7 @@ import type { PaginationSettings, PaginationState } from '@common/api-pagination
2
2
  import { TRANSFER_DECLINE_REASONS, TRANSFER_STATUSES, VOP_CHECK_RESULTS } from '@common/constants';
3
3
  import type { Beneficiary } from '@beneficiaries/beneficiaries.types';
4
4
  import type { OperationSettings } from '@validation/operation-settings-validation';
5
+ import type { AuthLinkRequestSettings } from '@auth-links/auth-links.types';
5
6
  /**
6
7
  * Represents the reasons why a SEPA transfer might be declined.
7
8
  */
@@ -230,5 +231,12 @@ export interface VopVerificationResult {
230
231
  matchedName?: string;
231
232
  }
232
233
  export type VopCheckResult = (typeof VOP_CHECK_RESULTS)[keyof typeof VOP_CHECK_RESULTS];
234
+ /**
235
+ * Parameters for the `getSepaTransferCreationFlowLink` function. It must be an
236
+ * object with a single property `callbackUrl`, which is a string representing
237
+ * the URL to which the user will be redirected after completing the SEPA transfer
238
+ * creation flow.
239
+ */
240
+ export type SepaTransferCreationFlowRequest = Omit<AuthLinkRequestSettings, 'action'>;
233
241
  export {};
234
242
  //# sourceMappingURL=sepa-transfers.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.types.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EAChB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF;;GAEG;AACH,KAAK,0BAA0B,GAC7B,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAC;AAE3E;;GAEG;AACH,KAAK,kBAAkB,GACrB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,MAAM,EAAE,kBAAkB,CAAC;IAC3B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,cAAc,EAAE,0BAA0B,CAAC;IAC3C;;OAEG;IACH,aAAa,EAAE,IAAI,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,WAAW,EAAE,IAAI,CAAC;IAClB;;OAEG;IACH,WAAW,EAAE,IAAI,CAAC;IAClB;;OAEG;IACH,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;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,CAAC,CAAC;IACzB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
1
+ {"version":3,"file":"sepa-transfers.types.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EAChB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAE5E;;GAEG;AACH,KAAK,0BAA0B,GAC7B,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAC;AAE3E;;GAEG;AACH,KAAK,kBAAkB,GACrB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,MAAM,EAAE,kBAAkB,CAAC;IAC3B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,cAAc,EAAE,0BAA0B,CAAC;IAC3C;;OAEG;IACH,aAAa,EAAE,IAAI,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,WAAW,EAAE,IAAI,CAAC;IAClB;;OAEG;IACH,WAAW,EAAE,IAAI,CAAC;IAClB;;OAEG;IACH,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;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,CAAC,CAAC;IACzB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAChD,uBAAuB,EACvB,QAAQ,CACT,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { NewSepaTransfer } from '@sepa-transfers/sepa-transfers.types';
2
2
  import type { SepaTransferParams } from '@sepa-transfers/sepa-transfers.types';
3
+ import type { Locale } from '@common/locale/locale.types';
3
4
  /**
4
5
  * Extracts a beneficiary object from the provided create new SEPA transfer
5
6
  * settings object if it contains it, and otherwise it calls the beneficiaries
@@ -9,4 +10,5 @@ import type { SepaTransferParams } from '@sepa-transfers/sepa-transfers.types';
9
10
  * @returns A promise that resolves to a serialized beneficiary object.
10
11
  */
11
12
  export declare function findBeneficiary({ sepaTransferSettings, operationSettings, }: SepaTransferParams<NewSepaTransfer>): Promise<import("..").Beneficiary>;
13
+ export declare function decorateUrlWithLocaleParam(url: string, language?: Locale): string;
12
14
  //# sourceMappingURL=sepa-transfers.utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.utils.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,qCAWrC"}
1
+ {"version":3,"file":"sepa-transfers.utils.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1D;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,qCAWrC;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,UAOxE"}
@@ -1,5 +1,6 @@
1
- import type { NewSepaTransfer } from '@sepa-transfers/sepa-transfers.types';
1
+ import type { NewSepaTransfer, SepaTransferCreationFlowRequest } from '@sepa-transfers/sepa-transfers.types';
2
2
  export declare function validateGetSepaTransferParams(sepaTransferId: string | undefined): string;
3
3
  export declare function validateCreateSepaTransferParams(sepaTransferSettings: NewSepaTransfer | undefined): NewSepaTransfer;
4
4
  export declare function validateCancelSepaTransferParams(sepaTransferId: string | undefined): string;
5
+ export declare function validateGetSepaTransferCreationFlowLinkParams(params?: SepaTransferCreationFlowRequest): string;
5
6
  //# sourceMappingURL=sepa-transfers.validate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.validate.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.validate.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAS5E,wBAAgB,6BAA6B,CAC3C,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,MAAM,CAUR;AAED,wBAAgB,gCAAgC,CAC9C,oBAAoB,EAAE,eAAe,GAAG,SAAS,mBAsDlD;AAED,wBAAgB,gCAAgC,CAC9C,cAAc,EAAE,MAAM,GAAG,SAAS,UAWnC"}
1
+ {"version":3,"file":"sepa-transfers.validate.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.validate.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,eAAe,EACf,+BAA+B,EAChC,MAAM,sCAAsC,CAAC;AAS9C,wBAAgB,6BAA6B,CAC3C,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,MAAM,CAUR;AAED,wBAAgB,gCAAgC,CAC9C,oBAAoB,EAAE,eAAe,GAAG,SAAS,mBAsDlD;AAED,wBAAgB,gCAAgC,CAC9C,cAAc,EAAE,MAAM,GAAG,SAAS,UAWnC;AAED,wBAAgB,6CAA6C,CAC3D,MAAM,CAAC,EAAE,+BAA+B,GACvC,MAAM,CAUR"}
@@ -0,0 +1 @@
1
+ import{makeNetworkCall as a}from"../common/network/network.js";function n({accessToken:a,stagingToken:n,action:t,callbackUrl:c}){const e={post_authn_action:t};return c&&(e.callback_url=c),{path:"/v1/embed_auth_links",options:{method:"POST",headers:{accessToken:a,stagingToken:n},body:{embed_auth_link:e}}}}async function t(t){const c=n({accessToken:t.accessToken,stagingToken:t.stagingToken,action:t.action,callbackUrl:t.callbackUrl}),{embed_auth_link:e}=await a(c);return{url:e.url,post_authn_action:e.post_authn_action,callback_url:e.callback_url,expired_at:e.expired_at,used_at:e.used_at}}export{n as prepareAuthLinkRequest,t as requestAuthLink};
@@ -0,0 +1 @@
1
+ import{validateOperationSettingsParams as t}from"../validation/operation-settings-validation.js";import"../common/auth/auth.js";import{validatePresenceOfAuthToken as a}from"../common/auth/auth.validate.js";import{validateAuthLinkRequestSettings as o}from"./auth-links.validate.js";import{prepareAuthLinkRequest as n,requestAuthLink as i}from"./auth-links.api.js";import{encodeNetworkCall as r,decodeNetworkResponse as c}from"../common/network/network.js";function e(t){return{url:t.url,postAuthAction:t.post_authn_action,callbackUrl:t.callback_url,expiresAt:t.expired_at,usedAt:t.used_at}}async function s({requestSettings:s,operationSettings:l}){o(s);const{proxyRequestFunction:u,stagingToken:m}=t(l||{});if(u){const t=n({stagingToken:m,action:s.action,callbackUrl:s.callbackUrl}),a=r(t),o=await u(a);return e(c(o).body)}{const t=l?.accessToken||a();return e(await i({accessToken:t,stagingToken:m,action:s.action,callbackUrl:s.callbackUrl}))}}export{s as request};
@@ -0,0 +1 @@
1
+ import{request as t}from"./auth-links.js";const o={request:t};export{o as authLinks};
@@ -0,0 +1 @@
1
+ import{validatePresenceOfRequiredParams as t,validateExpectedStringValues as o}from"../validation/input-param-validation.js";import{InvalidParametersError as n}from"../errors/InvalidParametersError.js";import{AUTH_LINK_ACTIONS as e}from"../common/constants.js";function r(r){if(!r||"object"!=typeof r)throw new n("requestSettings must be an object");const a=r,{action:i,callbackUrl:c}=r;t(a,[{name:"action"}]);const s=o(a),m=Object.values(e);if(m.includes(i)||s.push(`action must be one of ${m.join(", ")}`),s.length>0)throw new n(s);if(void 0!==c&&""===c.trim())throw new n("callbackUrl cannot be empty")}export{r as validateAuthLinkRequestSettings};
@@ -0,0 +1 @@
1
+ import{authLinks as i}from"./auth-links.public-api.js";const s=i;export{s as authLinks};
@@ -1 +1 @@
1
- const E={READY:"qonto.ready"},_={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",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},e={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},A={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},T={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"},N={PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},C={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},n={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",FAILED:"failed",COMPLETED:"completed"},R={PENDING:"pending",DECLINED:"declined",COMPLETED:"completed"},a={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},S=3e4,i={MATCH_RESULT_MATCH:"MATCH_RESULT_MATCH",MATCH_RESULT_NO_MATCH:"MATCH_RESULT_NO_MATCH",MATCH_RESULT_CLOSE_MATCH:"MATCH_RESULT_CLOSE_MATCH",MATCH_RESULT_NOT_POSSIBLE:"MATCH_RESULT_NOT_POSSIBLE",MATCH_RESULT_UNSPECIFIED:"MATCH_RESULT_UNSPECIFIED"},r={ACCEPT:"ACCEPT",REJECT:"REJECT"};export{_ as ACTIONS,T as ACTIVITY_TAGS,S as AMOUNT_REQUIRING_ATTACHMENTS,N as BENEFICIARY_STATUSES,A as BRANCHES,e as ENVIRONMENTS,E as IFRAME_EVENTS,C as LOCALES,a as MFA_METHODS,R as TRANSACTION_STATUSES,n as TRANSFER_DECLINE_REASONS,I as TRANSFER_STATUSES,i as VOP_CHECK_RESULTS,r as VOP_DECISIONS};
1
+ const E={READY:"qonto.ready"},_={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",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},e={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},A={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},T={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"},N={PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},C={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},n={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"},R={PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled",FAILED:"failed",COMPLETED:"completed"},a={PENDING:"pending",DECLINED:"declined",COMPLETED:"completed"},I={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},S=3e4,i={MATCH_RESULT_MATCH:"MATCH_RESULT_MATCH",MATCH_RESULT_NO_MATCH:"MATCH_RESULT_NO_MATCH",MATCH_RESULT_CLOSE_MATCH:"MATCH_RESULT_CLOSE_MATCH",MATCH_RESULT_NOT_POSSIBLE:"MATCH_RESULT_NOT_POSSIBLE",MATCH_RESULT_UNSPECIFIED:"MATCH_RESULT_UNSPECIFIED"},r={ACCEPT:"ACCEPT",REJECT:"REJECT"},t={CARD_DISPLAY:"display_card",PAYMENT_LINK_CREATE:"create_payment_link",SEPA_TRANSFER_CREATE:"create_sepa_transfer"};export{_ as ACTIONS,T as ACTIVITY_TAGS,S as AMOUNT_REQUIRING_ATTACHMENTS,t as AUTH_LINK_ACTIONS,N as BENEFICIARY_STATUSES,A as BRANCHES,e as ENVIRONMENTS,E as IFRAME_EVENTS,C as LOCALES,I as MFA_METHODS,a as TRANSACTION_STATUSES,n as TRANSFER_DECLINE_REASONS,R as TRANSFER_STATUSES,i as VOP_CHECK_RESULTS,r as VOP_DECISIONS};
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";export{sepaTransfers}from"./sepa-transfers/index.js";export{paymentLinks}from"./payment-links/index.js";export{organizations}from"./organizations/index.js";export{transactions}from"./transactions/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";export{paymentLinks}from"./payment-links/index.js";export{organizations}from"./organizations/index.js";export{transactions}from"./transactions/index.js";export{authLinks}from"./auth-links/index.js";
@@ -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{cancelSepaTransfer as t,verifySepaPayee as s,createSepaTransfer as o,getSepaTransfer as r,prepareGetSepaTransfersCall as i,getSepaTransfers as m}from"./sepa-transfers.api.js";import{serializeToVopVerificationResult as c,serializeToNewSepaTransferDataObject as p,serializeSepaTransfer as f}from"./sepa-transfers.serializer.js";import{validateCancelSepaTransferParams as g,validateCreateSepaTransferParams as T,validateGetSepaTransferParams as d}from"./sepa-transfers.validate.js";import{validateOperationSettingsParams as u}from"../validation/operation-settings-validation.js";import{buildIframeUrl as k,createIframe as l}from"../iframe/iframe-manager.js";import{buildIframeMessage as y}from"../iframe/iframe-message-builder.js";import{VOP_DECISIONS as S,ACTIONS as j}from"../common/constants.js";import{findBeneficiary as w}from"./sepa-transfers.utils.js";import{isRunningInBrowser as v}from"../common/runtime/runtime.validation.js";import{InvalidRuntimeError as b,RUNTIME_ENVIRONMENT as E}from"../errors/InvalidRuntimeError.js";import{encodeNetworkCall as I,decodeNetworkResponse as R}from"../common/network/network.js";import h from"../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";async function _(e){const{stagingToken:t,proxyRequestFunction:s,accessToken:o,paginationSettings:r}=u(e?.operationSettings||{});if(s){const e=i({paginationSettings:r}),n=I(e),t=await s(n),o=R(t),m=o.body.transfers.map(f),c=a(o.body.meta);return{transfers:m,...c?{meta:c}:{}}}{const e=o||n(),s=await m({accessToken:e,stagingToken:t,paginationSettings:r}),i=s.transfers.map(f),c=a(s.meta);return{transfers:i,...c?{meta:c}:{}}}}async function K({sepaTransferSettings:e,operationSettings:a}){const t=a?.accessToken||n(),s=d(e?.sepaTransferId),o=await r({sepaTransferId:s,accessToken:t,stagingToken:a?.stagingToken});return f(o)}async function*M({sepaTransferSettings:a,operationSettings:t}){const r=t?.accessToken||n(),i=t?.stagingToken||e.getStagingToken(),m=t?.idempotencyKey||h();let g;T(a);const d=await w({sepaTransferSettings:a,operationSettings:{accessToken:r,stagingToken:i||void 0}}),I={name:d.name,iban:d.iban},R=await s({sepaPayee:I,accessToken:r,stagingToken:i||void 0});if((yield c(R))===S.REJECT)return;const _={...a,beneficiary:d};if(_.beneficiary?.trusted)g=await o({transfer:_,vopProofToken:R.proof_token.token,accessToken:r,stagingToken:i||void 0,idempotencyKey:m});else{if(!v())throw new b(E.BROWSER);const{uiParentElementId:e,debugMode:n}=u(t,{requiresUI:!0});let a;try{const t=k({accessToken:r,stagingToken:i||void 0,debugMode:n});a=await l({iframeUrl:t,parentElementId:e});const s=p(_);g=await a.postMessage(y({actionId:j.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:m}}))}finally{a?.destroy()}}return f(g)}async function P({sepaTransferSettings:e,operationSettings:a}){const s=a?.accessToken||n(),o=g(e?.sepaTransferId);await t({sepaTransferId:o,accessToken:s,stagingToken:a?.stagingToken})}export{P as cancelSepaTransfer,M as createSepaTransfer,K as getSepaTransfer,_ as getSepaTransfers};
1
+ import{authManager as e}from"../common/auth/auth.js";import{validatePresenceOfAuthToken as n}from"../common/auth/auth.validate.js";import{serializePaginationResponse as t}from"../common/api-pagination/api-pagination.js";import{cancelSepaTransfer as a,verifySepaPayee as s,createSepaTransfer as o,getSepaTransfer as r,prepareGetSepaTransfersCall as i,getSepaTransfers as c}from"./sepa-transfers.api.js";import{serializeToVopVerificationResult as m,serializeToNewSepaTransferDataObject as p,serializeSepaTransfer as g}from"./sepa-transfers.serializer.js";import{validateGetSepaTransferCreationFlowLinkParams as f,validateCancelSepaTransferParams as T,validateCreateSepaTransferParams as u,validateGetSepaTransferParams as d}from"./sepa-transfers.validate.js";import{validateOperationSettingsParams as k}from"../validation/operation-settings-validation.js";import{buildIframeUrl as l,createIframe as S}from"../iframe/iframe-manager.js";import{buildIframeMessage as y}from"../iframe/iframe-message-builder.js";import{AUTH_LINK_ACTIONS as j,VOP_DECISIONS as w,ACTIONS as E}from"../common/constants.js";import{decorateUrlWithLocaleParam as R,findBeneficiary as b}from"./sepa-transfers.utils.js";import{isRunningInBrowser as v}from"../common/runtime/runtime.validation.js";import{InvalidRuntimeError as I,RUNTIME_ENVIRONMENT as _}from"../errors/InvalidRuntimeError.js";import{encodeNetworkCall as h,decodeNetworkResponse as q}from"../common/network/network.js";import{authLinks as x}from"../auth-links/index.js";import{localeManager as A}from"../common/locale/locale-manager.js";import F from"../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";async function P(e){const{stagingToken:a,proxyRequestFunction:s,accessToken:o,paginationSettings:r}=k(e?.operationSettings||{});if(s){const e=i({paginationSettings:r}),n=h(e),a=await s(n),o=q(a),c=o.body.transfers.map(g),m=t(o.body.meta);return{transfers:c,...m?{meta:m}:{}}}{const e=o||n(),s=await c({accessToken:e,stagingToken:a,paginationSettings:r}),i=s.transfers.map(g),m=t(s.meta);return{transfers:i,...m?{meta:m}:{}}}}async function C({sepaTransferSettings:e,operationSettings:t}){const a=t?.accessToken||n(),s=d(e?.sepaTransferId),o=await r({sepaTransferId:s,accessToken:a,stagingToken:t?.stagingToken});return g(o)}async function*K({sepaTransferSettings:t,operationSettings:a}){const r=a?.accessToken||n(),i=a?.stagingToken||e.getStagingToken(),c=a?.idempotencyKey||F();let f;u(t);const T=await b({sepaTransferSettings:t,operationSettings:{accessToken:r,stagingToken:i||void 0}}),d={name:T.name,iban:T.iban},j=await s({sepaPayee:d,accessToken:r,stagingToken:i||void 0});if((yield m(j))===w.REJECT)return;const R={...t,beneficiary:T};if(R.beneficiary?.trusted)f=await o({transfer:R,vopProofToken:j.proof_token.token,accessToken:r,stagingToken:i||void 0,idempotencyKey:c});else{if(!v())throw new I(_.BROWSER);const{uiParentElementId:e,debugMode:n}=k(a,{requiresUI:!0});let t;try{const a=l({accessToken:r,stagingToken:i||void 0,debugMode:n});t=await S({iframeUrl:a,parentElementId:e});const s=p(R);f=await t.postMessage(y({actionId:E.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:c}}))}finally{t?.destroy()}}return g(f)}async function M({sepaTransferSettings:e,operationSettings:t}){const s=t?.accessToken||n(),o=T(e?.sepaTransferId);await a({sepaTransferId:o,accessToken:s,stagingToken:t?.stagingToken})}async function N({sepaTransferSettings:e,operationSettings:t}){const a=f(e),{proxyRequestFunction:s,stagingToken:o,accessToken:r}=k(t||{}),i=s?{proxyRequestFunction:s}:{stagingToken:o,accessToken:r||n()},c=await x.request({requestSettings:{action:j.SEPA_TRANSFER_CREATE,callbackUrl:a},operationSettings:i}),m=t?.locale||A.getLocale();return{...c,url:R(c.url,m)}}export{M as cancelSepaTransfer,K as createSepaTransfer,C as getSepaTransfer,N as getSepaTransferCreationFlowLink,P as getSepaTransfers};
@@ -1 +1 @@
1
- import{createBulkTransfer as r,getBulkTransfer as e,getBulkTransfers as s}from"./bulk-transfers/bulk-transfers.js";import{cancelSepaTransfer as a,createSepaTransfer as f,getSepaTransfer as n,getSepaTransfers as t}from"./sepa-transfers.js";const p={getSepaTransfers:t,getSepaTransfer:n,createSepaTransfer:f,cancelSepaTransfer:a,bulkTransfers:{getBulkTransfers:s,getBulkTransfer:e,createBulkTransfer:r}};export{p as sepaTransfers};
1
+ import{createBulkTransfer as r,getBulkTransfer as e,getBulkTransfers as a}from"./bulk-transfers/bulk-transfers.js";import{getSepaTransferCreationFlowLink as s,cancelSepaTransfer as n,createSepaTransfer as t,getSepaTransfer as f,getSepaTransfers as p}from"./sepa-transfers.js";const T={getSepaTransfers:p,getSepaTransfer:f,createSepaTransfer:t,cancelSepaTransfer:n,getSepaTransferCreationFlowLink:s,bulkTransfers:{getBulkTransfers:a,getBulkTransfer:e,createBulkTransfer:r}};export{T as sepaTransfers};
@@ -1 +1 @@
1
- import{getBeneficiary as e}from"../beneficiaries/beneficiaries.api.js";import{serializeBeneficiary as i}from"../beneficiaries/beneficiaries.serializer.js";async function n({sepaTransferSettings:n,operationSettings:r}){if(n?.beneficiary)return n.beneficiary;{const a=await e({beneficiaryId:n?.beneficiaryId,accessToken:r?.accessToken,stagingToken:r?.stagingToken});return i(a)}}export{n as findBeneficiary};
1
+ import{getBeneficiary as e}from"../beneficiaries/beneficiaries.api.js";import{serializeBeneficiary as i}from"../beneficiaries/beneficiaries.serializer.js";async function n({sepaTransferSettings:n,operationSettings:r}){if(n?.beneficiary)return n.beneficiary;{const a=await e({beneficiaryId:n?.beneficiaryId,accessToken:r?.accessToken,stagingToken:r?.stagingToken});return i(a)}}function r(e,i){if(i){const n=new URL(e);return n.searchParams.append("lang",i),n.toString()}return e}export{r as decorateUrlWithLocaleParam,n as findBeneficiary};
@@ -1 +1 @@
1
- import{InvalidParametersError as e}from"../errors/InvalidParametersError.js";import{validatePresenceOfRequiredParams as r,validateExpectedStringValues as n,validateExpectedNumericValues as t}from"../validation/input-param-validation.js";import{AMOUNT_REQUIRING_ATTACHMENTS as a}from"../common/constants.js";const o=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];function i(r){if(!r)throw new e("sepaTransferId parameter is required for the called function");if(r&&"string"!=typeof r)throw new e("sepaTransferId must be a string");return r}function f(i){if(!i)throw new e("sepaTransferSettings parameter is required for the called function");if("object"!=typeof i)throw new e("sepaTransferSettings must be an object");if(r(i,o),!i.beneficiaryId&&!i.beneficiary)throw new e("Either beneficiaryId or beneficiary must be provided");const f=[...n({beneficiaryId:i.beneficiaryId,bankAccountId:i.bankAccountId,note:i.note,reference:i.reference}),...t({amount:i.amount})].flat();if(f.length>0)throw new e(f);if(i.amount>a&&(!i.attachmentIds||0===i.attachmentIds.length))throw new e("Attachments are required for transfers over €30,000");return i}function s(r){if(!r)throw new e("sepaTransferId parameter is required for the called function");if("string"!=typeof r)throw new e("sepaTransferId must be a string");return r}export{s as validateCancelSepaTransferParams,f as validateCreateSepaTransferParams,i as validateGetSepaTransferParams};
1
+ import{InvalidParametersError as e}from"../errors/InvalidParametersError.js";import{validatePresenceOfRequiredParams as r,validateExpectedStringValues as t,validateExpectedNumericValues as n}from"../validation/input-param-validation.js";import{AMOUNT_REQUIRING_ATTACHMENTS as a}from"../common/constants.js";const i=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];function o(r){if(!r)throw new e("sepaTransferId parameter is required for the called function");if(r&&"string"!=typeof r)throw new e("sepaTransferId must be a string");return r}function f(o){if(!o)throw new e("sepaTransferSettings parameter is required for the called function");if("object"!=typeof o)throw new e("sepaTransferSettings must be an object");if(r(o,i),!o.beneficiaryId&&!o.beneficiary)throw new e("Either beneficiaryId or beneficiary must be provided");const f=[...t({beneficiaryId:o.beneficiaryId,bankAccountId:o.bankAccountId,note:o.note,reference:o.reference}),...n({amount:o.amount})].flat();if(f.length>0)throw new e(f);if(o.amount>a&&(!o.attachmentIds||0===o.attachmentIds.length))throw new e("Attachments are required for transfers over €30,000");return o}function c(r){if(!r)throw new e("sepaTransferId parameter is required for the called function");if("string"!=typeof r)throw new e("sepaTransferId must be a string");return r}function s(r){if(!r||!r.callbackUrl)throw new e("callbackUrl parameter is required for the getSepaTransferCreationFlowLink function");if("string"!=typeof r.callbackUrl)throw new e("callbackUrl must be a string");return r.callbackUrl}export{c as validateCancelSepaTransferParams,f as validateCreateSepaTransferParams,s as validateGetSepaTransferCreationFlowLinkParams,o as validateGetSepaTransferParams};
@@ -1,3 +1,3 @@
1
- import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, GetBeneficiariesResponse, Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, VopVerificationResult, VopCheckResult, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams } from './types.public-api';
2
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, VopVerificationResult, VopCheckResult, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams, };
1
+ import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, GetBeneficiariesResponse, Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, VopVerificationResult, VopCheckResult, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams, AuthLinkRequestParams, AuthLinkRequestResult, AuthLinkRequestSettings, PostAuthAction } from './types.public-api';
2
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, VopVerificationResult, VopCheckResult, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams, AuthLinkRequestParams, AuthLinkRequestResult, AuthLinkRequestSettings, PostAuthAction, };
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,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,MAAM,EACN,WAAW,EAEX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,GAClB,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,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACf,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,MAAM,EACN,WAAW,EAEX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,GACf,CAAC"}
@@ -6,5 +6,6 @@ import type { Locale } from '@common/locale/locale.types';
6
6
  import type { BankAccount, ACCOUNT_STATUS } from '@organizations/organizations.types';
7
7
  import type { CreatePaymentLinkSettings, Item, PaymentLinkParams } from '@payment-links/payment-links.types';
8
8
  import type { Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings } from '@transactions/transactions.types';
9
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, VopVerificationResult, VopCheckResult, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams, };
9
+ import type { AuthLinkRequestParams, AuthLinkRequestResult, AuthLinkRequestSettings, PostAuthAction } from '@auth-links/auth-links.types';
10
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, VopVerificationResult, VopCheckResult, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams, AuthLinkRequestParams, AuthLinkRequestResult, AuthLinkRequestSettings, PostAuthAction, };
10
11
  //# 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,EACV,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACf,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,yBAAyB,EACzB,IAAI,EACJ,iBAAiB,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,GAClB,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,eAAe,EACf,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACf,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,yBAAyB,EACzB,IAAI,EACJ,iBAAiB,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACf,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,GACf,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { MfaMethod } from '@common/operation-settings/operation-settings.types';
2
+ import type { Locale } from '@common/locale/locale.types';
2
3
  import type { PaginationSettings } from '@common/api-pagination/api-pagination.types';
3
4
  /**
4
5
  * Optional settings to configure the SDK's operations that will be performed
@@ -66,6 +67,12 @@ export interface OperationSettings {
66
67
  * [the Proxy Endpoint Implementation guide](https://docs.qonto.com/api-reference/embed-sdk-api/variables/overview-common).
67
68
  */
68
69
  proxyRequestFunction?: (operationPayload: string) => Promise<string>;
70
+ /**
71
+ * The locale to use for the SDK. This is optional, and if not provided, it will
72
+ * default to English. Setting the locale will make the SDK render its UI in the
73
+ * specified language.
74
+ */
75
+ locale?: Locale;
69
76
  }
70
77
  export interface OperationSettingsValidationConfiguration {
71
78
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"operation-settings-validation.d.ts","sourceRoot":"","sources":["../../src/validation/operation-settings-validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAGrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEtF;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IAEH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC;;;;;;;;;;;;;;;;;;OAkBG;IACH,oBAAoB,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,wCAAwC;IACvD;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAMD,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,iBAAiB,GAAG,SAAS,EACrC,EACE,UAAU,GACX,GAAE,wCAA0F,GAC5F,iBAAiB,CAsDnB"}
1
+ {"version":3,"file":"operation-settings-validation.d.ts","sourceRoot":"","sources":["../../src/validation/operation-settings-validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAErF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEtF;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IAEH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC;;;;;;;;;;;;;;;;;;OAkBG;IACH,oBAAoB,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrE;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wCAAwC;IACvD;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAMD,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,iBAAiB,GAAG,SAAS,EACrC,EACE,UAAU,GACX,GAAE,wCAA0F,GAC5F,iBAAiB,CAsDnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qonto/embed-sdk",
3
- "version": "0.35.0",
3
+ "version": "0.37.0",
4
4
  "description": "Library to embed Qonto features in your application",
5
5
  "type": "module",
6
6
  "exports": {
@@ -25,6 +25,10 @@
25
25
  "types": "./dist/transactions/index.d.ts",
26
26
  "import": "./dist/src/transactions/index.js"
27
27
  },
28
+ "./auth-links": {
29
+ "types": "./dist/auth-links/index.d.ts",
30
+ "import": "./dist/src/auth-links/index.js"
31
+ },
28
32
  "./common": {
29
33
  "types": "./dist/common/index.d.ts",
30
34
  "import": "./dist/src/common/index.js"