@qonto/embed-sdk 0.11.0 → 0.13.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 (55) hide show
  1. package/dist/common/constants.d.ts +8 -3
  2. package/dist/common/constants.d.ts.map +1 -1
  3. package/dist/common/network/network.d.ts +3 -1
  4. package/dist/common/network/network.d.ts.map +1 -1
  5. package/dist/common/operation-settings/operation-settings.d.ts +2 -1
  6. package/dist/common/operation-settings/operation-settings.d.ts.map +1 -1
  7. package/dist/common/operation-settings/operation-settings.types.d.ts +3 -0
  8. package/dist/common/operation-settings/operation-settings.types.d.ts.map +1 -0
  9. package/dist/common/runtime/runtime.validation.d.ts +3 -0
  10. package/dist/common/runtime/runtime.validation.d.ts.map +1 -0
  11. package/dist/common/runtime/runtime.validation.test.d.ts +2 -0
  12. package/dist/common/runtime/runtime.validation.test.d.ts.map +1 -0
  13. package/dist/errors/InvalidRuntimeError.d.ts +18 -0
  14. package/dist/errors/InvalidRuntimeError.d.ts.map +1 -0
  15. package/dist/index.umd.js +1 -1
  16. package/dist/mocks/handlers.d.ts +1 -1
  17. package/dist/mocks/handlers.d.ts.map +1 -1
  18. package/dist/sepa-transfers/index.d.ts +1 -0
  19. package/dist/sepa-transfers/index.d.ts.map +1 -1
  20. package/dist/sepa-transfers/sepa-transfers.api.d.ts +8 -1
  21. package/dist/sepa-transfers/sepa-transfers.api.d.ts.map +1 -1
  22. package/dist/sepa-transfers/sepa-transfers.d.ts +47 -1
  23. package/dist/sepa-transfers/sepa-transfers.d.ts.map +1 -1
  24. package/dist/sepa-transfers/sepa-transfers.public-api.d.ts +2 -1
  25. package/dist/sepa-transfers/sepa-transfers.public-api.d.ts.map +1 -1
  26. package/dist/sepa-transfers/sepa-transfers.serializer.d.ts +2 -1
  27. package/dist/sepa-transfers/sepa-transfers.serializer.d.ts.map +1 -1
  28. package/dist/sepa-transfers/sepa-transfers.types.d.ts +106 -3
  29. package/dist/sepa-transfers/sepa-transfers.types.d.ts.map +1 -1
  30. package/dist/sepa-transfers/sepa-transfers.utils.d.ts +12 -0
  31. package/dist/sepa-transfers/sepa-transfers.utils.d.ts.map +1 -0
  32. package/dist/sepa-transfers/sepa-transfers.utils.test.d.ts +2 -0
  33. package/dist/sepa-transfers/sepa-transfers.utils.test.d.ts.map +1 -0
  34. package/dist/sepa-transfers/sepa-transfers.validate.d.ts +2 -0
  35. package/dist/sepa-transfers/sepa-transfers.validate.d.ts.map +1 -1
  36. package/dist/src/common/constants.js +1 -1
  37. package/dist/src/common/network/network.js +1 -1
  38. package/dist/src/common/operation-settings/operation-settings.js +1 -1
  39. package/dist/src/common/runtime/runtime.validation.js +1 -0
  40. package/dist/src/errors/InvalidRuntimeError.js +1 -0
  41. package/dist/src/iframe/iframe-manager.js +1 -1
  42. package/dist/src/sepa-transfers/sepa-transfers.api.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.serializer.js +1 -1
  46. package/dist/src/sepa-transfers/sepa-transfers.utils.js +1 -0
  47. package/dist/src/sepa-transfers/sepa-transfers.validate.js +1 -1
  48. package/dist/src/validation/operation-settings-validation.js +1 -1
  49. package/dist/types/index.d.ts +2 -2
  50. package/dist/types/index.d.ts.map +1 -1
  51. package/dist/types/types.public-api.d.ts +2 -2
  52. package/dist/types/types.public-api.d.ts.map +1 -1
  53. package/dist/validation/operation-settings-validation.d.ts +19 -1
  54. package/dist/validation/operation-settings-validation.d.ts.map +1 -1
  55. package/package.json +1 -1
@@ -17,7 +17,7 @@ export declare const ACTIONS: {
17
17
  CARD_UNLOCK: string;
18
18
  CARD_SHOW_PIN: string;
19
19
  CARD_SET_PIN: string;
20
- TRANSFERS_CREATE: string;
20
+ TRANSFER_SINGLE_CREATE: string;
21
21
  };
22
22
  /**
23
23
  * List of possible environments the SDK can be used in.
@@ -81,7 +81,7 @@ export declare const LOCALES: {
81
81
  IT: string;
82
82
  PT: string;
83
83
  };
84
- export declare const SEPA_TRANSFER_DECLINE_REASONS: {
84
+ export declare const TRANSFER_DECLINE_REASONS: {
85
85
  BENEFICIARY_BIC_INVALID: string;
86
86
  BENEFICIARY_IBAN_INVALID: string;
87
87
  BENEFICIARY_STATUS: string;
@@ -90,11 +90,16 @@ export declare const SEPA_TRANSFER_DECLINE_REASONS: {
90
90
  DEBIT_ACCOUNT_INSUFFICIENT_FUNDS: string;
91
91
  QONTO_PROCESSING_FAILED: string;
92
92
  };
93
- export declare const SEPA_TRANSFER_STATUSES: {
93
+ export declare const TRANSFER_STATUSES: {
94
94
  PENDING: string;
95
95
  PROCESSING: string;
96
96
  CANCELED: string;
97
97
  DECLINED: string;
98
98
  SETTLED: string;
99
99
  };
100
+ export declare const MFA_METHODS: {
101
+ PASSKEY: string;
102
+ SMS_OTP: string;
103
+ PAIRED_DEVICE: string;
104
+ };
100
105
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;CAQnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;CAQzC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;CAMlC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;CAQnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;CAQpC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;CAM7B,CAAC;AAEF,eAAO,MAAM,WAAW;;;;CAIvB,CAAC"}
@@ -1,8 +1,10 @@
1
+ import type { MfaMethod } from '@common/operation-settings/operation-settings.types';
1
2
  interface BuildRequestHeadersParams {
2
3
  accessToken: string;
3
4
  stagingToken?: string;
4
5
  idempotencyKey?: string;
6
+ mfaPreference?: MfaMethod;
5
7
  }
6
- export declare function buildRequestHeaders({ accessToken, stagingToken, idempotencyKey, }: BuildRequestHeadersParams): Headers;
8
+ export declare function buildRequestHeaders({ accessToken, stagingToken, idempotencyKey, mfaPreference, }: BuildRequestHeadersParams): Headers;
7
9
  export {};
8
10
  //# sourceMappingURL=network.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../src/common/network/network.ts"],"names":[],"mappings":"AAGA,UAAU,yBAAyB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,yBAAyB,GAAG,OAAO,CAarC"}
1
+ {"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../src/common/network/network.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAGrF,UAAU,yBAAyB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,YAAY,EACZ,cAAc,EACd,aAAa,GACd,EAAE,yBAAyB,GAAG,OAAO,CAkBrC"}
@@ -1,4 +1,5 @@
1
1
  import type { OperationSettings } from '@validation/operation-settings-validation';
2
+ import type { MfaMethod } from '@common/operation-settings/operation-settings.types';
2
3
  /**
3
4
  * A singleton class to manage operation settings
4
5
  */
@@ -26,7 +27,7 @@ export declare class OperationSettingsManager {
26
27
  * Gets the MFA preference
27
28
  * @returns The current MFA preference or null if not set
28
29
  */
29
- getMFAPreference(): 'passkey' | 'paired-device' | 'sms-otp' | null;
30
+ getMFAPreference(): MfaMethod;
30
31
  /**
31
32
  * Gets the debug mode
32
33
  * @returns The current debug mode or false if not set
@@ -1 +1 @@
1
- {"version":3,"file":"operation-settings.d.ts","sourceRoot":"","sources":["../../../src/common/operation-settings/operation-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF;;GAEG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,aAAa,CAAwD;IAC7E,OAAO,CAAC,SAAS,CAAkB;IAEnC,OAAO;IAIP;;OAEG;WACW,WAAW,IAAI,wBAAwB;IAOrD;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAY9D;;;OAGG;IACI,oBAAoB,IAAI,MAAM,GAAG,IAAI;IAI5C;;;OAGG;IACI,gBAAgB,IAAI,SAAS,GAAG,eAAe,GAAG,SAAS,GAAG,IAAI;IAIzE;;;OAGG;IACI,YAAY,IAAI,OAAO;IAG9B;;OAEG;IACI,aAAa,IAAI,IAAI;CAI7B;AAGD,eAAO,MAAM,wBAAwB,0BAAyC,CAAC"}
1
+ {"version":3,"file":"operation-settings.d.ts","sourceRoot":"","sources":["../../../src/common/operation-settings/operation-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAGrF;;GAEG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,aAAa,CAAkC;IACvD,OAAO,CAAC,SAAS,CAAkB;IAEnC,OAAO;IAIP;;OAEG;WACW,WAAW,IAAI,wBAAwB;IAOrD;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAY9D;;;OAGG;IACI,oBAAoB,IAAI,MAAM,GAAG,IAAI;IAI5C;;;OAGG;IACI,gBAAgB,IAAI,SAAS;IAIpC;;;OAGG;IACI,YAAY,IAAI,OAAO;IAG9B;;OAEG;IACI,aAAa,IAAI,IAAI;CAI7B;AAGD,eAAO,MAAM,wBAAwB,0BAAyC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { MFA_METHODS } from '@common/constants';
2
+ export type MfaMethod = (typeof MFA_METHODS)[keyof typeof MFA_METHODS];
3
+ //# sourceMappingURL=operation-settings.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation-settings.types.d.ts","sourceRoot":"","sources":["../../../src/common/operation-settings/operation-settings.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function isRunningInBrowser(): boolean;
2
+ export declare function isRunningInServer(): boolean;
3
+ //# sourceMappingURL=runtime.validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.validation.d.ts","sourceRoot":"","sources":["../../../src/common/runtime/runtime.validation.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,YAEjC;AAED,wBAAgB,iBAAiB,YAEhC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runtime.validation.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.validation.test.d.ts","sourceRoot":"","sources":["../../../src/common/runtime/runtime.validation.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ export declare const RUNTIME_ENVIRONMENT: {
2
+ BROWSER: string;
3
+ SERVER: string;
4
+ };
5
+ type RuntimeEnvironment = (typeof RUNTIME_ENVIRONMENT)[keyof typeof RUNTIME_ENVIRONMENT];
6
+ /**
7
+ * Error thrown when the code is running in an unexpected runtime environment.
8
+ * This means that a server-only function is being called in a browser or that
9
+ * a browser-only function is being called in a server environment.
10
+ */
11
+ export declare class InvalidRuntimeError extends Error {
12
+ /**
13
+ * Creates a new InvalidRuntimeError
14
+ */
15
+ constructor(detectedEnvironment: RuntimeEnvironment);
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=InvalidRuntimeError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvalidRuntimeError.d.ts","sourceRoot":"","sources":["../../src/errors/InvalidRuntimeError.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC;AAEF,KAAK,kBAAkB,GACrB,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C;;OAEG;gBACS,mBAAmB,EAAE,kBAAkB;CAkBpD"}
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 i extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class a extends i{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function s(){if(!n.hasAccessToken())throw new a;return n.getAccessToken()}class r extends i{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}class o{constructor(){this.uiParentElementId=null,this.mfaPreference=null,this.debugMode=!1}static getInstance(){return o.instance||(o.instance=new o),o.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}clearSettings(){this.uiParentElementId=null,this.mfaPreference=null}}const c=o.getInstance();function d(e){const t=e?.uiParentElementId||c.getUIParentElementId();if(!t)throw new r("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");const n=e?.mfaPreference||c.getMFAPreference();if(n&&!["passkey","paired-device","sms-otp"].includes(n))throw new r("operationSettings.mfaPreference must be one of passkey, paired-device or sms-otp.");const i=e?.debugMode||c.getDebugMode();if(void 0!==i&&"boolean"!=typeof i)throw new r("operationSettings.debugMode must be a boolean.");return{uiParentElementId:t,mfaPreference:n,debugMode:i}}const m={READY:"qonto.ready"},l={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFERS_CREATE:"transfers.create"},u={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},p={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},g={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"};var h=Object.freeze({__proto__:null,ACTIONS:l,ACTIVITY_TAGS:{ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:p,ENVIRONMENTS:u,IFRAME_EVENTS:m,LOCALES:g,SEPA_TRANSFER_DECLINE_REASONS:{BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},SEPA_TRANSFER_STATUSES:{PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled"}});const f=Object.values(g);function _(e){if(!function(e){return f.includes(e)}(e))throw new r(`Unsupported locale: ${e}. The locale must be one of: ${f.join(", ")}.`);return e}function y(e){if(!e?.accessToken)throw new r("Access token is required when calling initialize()");return e?.operationSettings&&d(e.operationSettings),function(e){if(e.environment){if(!["production","staging","local"].includes(e.environment))throw new r('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 r('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&&_(e.locale),e}const T="https://embed.qonto.com",I="https://embed-js{branch}.staging.qonto.co",E="https://embed.dev.qonto.co",A={[u.PRODUCTION]:{IFRAME_BASE_URL:T,IFRAME_URL:`${T}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[u.STAGING]:{IFRAME_BASE_URL:I,IFRAME_URL:`${I}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[u.LOCAL]:{IFRAME_BASE_URL:E,IFRAME_URL:`${E}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class w{constructor(){this.environment=u.PRODUCTION,this.branch=p.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(u).includes(e)?e:u.PRODUCTION,this.branch=Object.values(p).includes(t)?t:p.SANDBOX}static getInstance(){return w.instance||(w.instance=new w),w.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=u.PRODUCTION,this.branch=p.MASTER}getEnvironmentUrls(){if(this.environment===u.PRODUCTION)return A.production;{const e=A[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const b=w.getInstance();class L{constructor(){this.currentLocale="en"}static getInstance(){return L.instance||(L.instance=new L),L.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const R=L.getInstance();const D={initialize:function(e){const{accessToken:t,stagingToken:i,operationSettings:a,environment:s,branch:r,locale:o}=y(e);n.setAccessToken(t),i&&n.setStagingToken(i),o&&R.setLocale(o),a&&c.setSettings(a),s&&(b.setEnvironment(s),r&&b.setBranch(r))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),R.setDefaultLocale()},constants:h},{initialize:S,logout:v,constants:k}=D;class P extends i{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function O({accessToken:e,stagingToken:t,idempotencyKey:i}){const a=new Headers;a.append("Authorization",`Bearer ${e}`);const s=t||n.getStagingToken();return s&&a.append("X-Qonto-Staging-Token",s),i&&a.append("X-Qonto-Idempotency-Key",i),a.append("Content-Type","application/json"),a.append("Accept-Language",R.getLocale()),a}async function N(e,t,n){const i={method:"GET",headers:O({accessToken:t,stagingToken:n})},a=b.getEnvironmentUrls().THIRD_PARTY_API_URL,s=await fetch(`${a}/v2/cards/${e.cardId}/data_view`,i),r=await s.json();if(r.errors)throw new P(r.errors.map((e=>`${e.code}: ${e.detail}`)));return function(e,t){const n=new URL(e);return"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal?"true":"false"),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking?"true":"false"),n.toString()}(r.iframe_url,e)}var U;!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"}(U||(U={}));const C={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 M,$;function B(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 r(n.map((e=>`Missing required parameter: ${e}`)))}function F(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 G(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"}(M||(M={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}($||($={}));const Y=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],q=[...Y,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function x(e){if(!e)throw new r("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return B(e,Y),function(e){const{membershipId:t,organizationId:n,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:s,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u}=e,p=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(u),g=F({membershipId:t,organizationId:n,bankAccountId:i}),h=j({hasDailyLimit:a,hasTransactionLimit:s}),f=G({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),_=z(m),y=H(l),T=[...p,...g,...h,...f,..._,...y];if(T.length>0)throw new r(T)}(e),e}(e):function(e){B(e,q),function(e){const{membershipId:t,organizationId:n,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:s,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u,hasNfcOption:p,hasForeignPaymentOption:g,hasOnlinePaymentOption:h,shipToBusiness:f,hasAtmOption:_,hasAtmDailyLimit:y,atmDailyLimit:T,atmMonthlyLimit:I,address:E,cardDesign:A,typeOfPrint:w}=e,b=function(e){return Object.values($).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(u),L=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(w),R=F({membershipId:t,organizationId:n,bankAccountId:i}),D=j({hasDailyLimit:a,hasTransactionLimit:s,hasAtmOption:_,hasNfcOption:p,hasForeignPaymentOption:g,hasOnlinePaymentOption:h,hasAtmDailyLimit:y,shipToBusiness:f}),S=G({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:T,atmMonthlyLimit:I}),v=z(m),k=H(l),P=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(A),O=function(e,t){if(t)return[];return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(E,f),N=[...b,...R,...D,...S,...v,...k,...L,...P,...O];if(N.length>0)throw new r(N)}(e)}(e)}function z(e){const t=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function H(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 V extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}class K{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 V(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,i=setTimeout((()=>{window.removeEventListener("message",a),t(new V(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),a=t=>{t.data.eventId===m.READY&&(clearTimeout(i),window.removeEventListener("message",a),e(this))};window.addEventListener("message",a),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){return this.iframe&&this.iframe.contentWindow?new Promise(((t,n)=>{const i=a=>{if(a.data?.actionId===e.actionId){if("error"===a.data.status)return this.removeMessageListener(e.actionId,i),n(new V(`An error occurred when performing the action ${e.actionId}.\n${JSON.stringify(a.data.payload)}`));this.removeMessageListener(e.actionId,i),t(a.data.payload)}};this.addMessageListener(e.actionId,i),this.iframe?.contentWindow?.postMessage(e,this.targetOrigin)})):Promise.reject(new V("Attempted to perform an Embed operation without having the authentication UI initialized."))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function X({accessToken:e,stagingToken:t,locale:n,debugMode:i}){const a=i||!1,s=n||R.getLocale(),r=b.getEnvironmentUrls().IFRAME_URL,o=t?`&staging_token=${encodeURIComponent(t)}`:"";return`${r}?debug=${a}&lang=${encodeURIComponent(s)}#access_token=${encodeURIComponent(e)}${o}`}function Q({parentElementId:e,iframeUrl:t}){return new K({parentElementId:e,iframeUrl:t}).initialize()}const W=[];for(let e=0;e<256;++e)W.push((e+256).toString(16).slice(1));let J;const Z=new Uint8Array(16);var ee={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function te(e,t,n){if(ee.randomUUID&&!e)return ee.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!J){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");J=crypto.getRandomValues.bind(crypto)}return J(Z)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(W[e[t+0]]+W[e[t+1]]+W[e[t+2]]+W[e[t+3]]+"-"+W[e[t+4]]+W[e[t+5]]+"-"+W[e[t+6]]+W[e[t+7]]+"-"+W[e[t+8]]+W[e[t+9]]+"-"+W[e[t+10]]+W[e[t+11]]+W[e[t+12]]+W[e[t+13]]+W[e[t+14]]+W[e[t+15]]).toLowerCase()}(i)}function ne(e){return"virtual"===e.cardLevel?function(e){const t=ae(e.categories);return{actionId:l.CARD_ORDER,actionData:{idempotencyKey:te(),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=ae(e.categories);return{actionId:l.CARD_ORDER,actionData:{idempotencyKey:te(),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 ie(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 ae(e){const t=Object.values(C);return(e||[]).filter((e=>t.includes(e)))}const se={getCards:async function({membershipId:e,accessToken:t,stagingToken:n}){try{const i=t||s();if(e&&"string"!=typeof e)throw new r("membershipId must be a string");const a=await async function({membershipId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:O({accessToken:t,stagingToken:n})},a=b.getEnvironmentUrls().THIRD_PARTY_API_URL,s=e?`${a}/v2/cards?holder_ids[]=${e}`:`${a}/v2/cards`,r=await fetch(s,i),o=await r.json();if(o.errors)throw new P(o.errors.map((e=>`${e.code}: ${e.detail}`)));return o.cards}({membershipId:e,accessToken:i,stagingToken:n});return a.map((e=>ie(e)))}catch(e){return Promise.reject(e)}},getCard:async function({cardId:e,accessToken:t,stagingToken:n}){try{const i=t||s();if(e&&"string"!=typeof e)throw new r("cardId must be a string");const a=await async function({cardId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:O({accessToken:t,stagingToken:n})},a=`${b.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/cards?ids[]=${e}`,s=await fetch(a,i),r=await s.json();if(r.errors)throw new P(r.errors.map((e=>`${e.code}: ${e.detail}`)));return r.cards[0]}({cardId:e,accessToken:i,stagingToken:n});return ie(a)}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=s(),{uiParentElementId:i,debugMode:a}=d(e.operationSettings);x(e.cardSettings);const r=X({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),o=await Q({iframeUrl:r,parentElementId:i}),c=ne(e.cardSettings),m=await o.postMessage(c);return o.destroy(),ie(m)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=s(),{uiParentElementId:i,debugMode:a}=d(e.operationSettings);!function(e){if(!e)throw new r("cardSettings parameter is required for the called function");if(!e.cardId)throw new r("cardId is required for the called function");const t=F({cardId:e.cardId});if(t.length>0)throw new r(t)}(e.cardSettings);const o=X({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),c=await Q({iframeUrl:o,parentElementId:i}),m=function(e){return{actionId:l.CARD_UNLOCK,actionData:{cardId:e.cardSettings.cardId}}}(e),u=await c.postMessage(m);return c.destroy(),ie(u)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const t=s(),{uiParentElementId:n}=d(e.operationSettings);!function(e){if(!e)throw new r("cardSettings parameter is required for the called function");if(!e.cardId)throw new r("cardId is required for the called function");const t=F({cardId:e.cardId});if(t.length>0)throw new r(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const i=j(n);if(i.length>0)throw new r(i)}(e.cardSettings);const i=await N(e.cardSettings,t),a=await Q({iframeUrl:i,parentElementId:n});return{destroyEmbedUI:()=>{a.destroy()}}}catch(e){return Promise.reject(e)}}},re=se;function oe({endpointUrl:e,paginationSettings:t}){const n=new URL(e);return t?.page&&n.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&n.searchParams.set("per_page",t.itemsPerPage.toString()),n}function ce(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 de(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 me(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";const ue=[{name:"name"},{name:"iban"}];const pe={getBeneficiaries:async function(e){const t=e?.accessToken||s(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:O({accessToken:t,stagingToken:n})},a=oe({endpointUrl:new URL(b.getEnvironmentUrls().THIRD_PARTY_API_URL+le),paginationSettings:e}),s=await fetch(a,i),r=await s.json();if(r.errors)throw new P(r.errors.map((e=>`${e.code}: ${e.detail}`)));return{beneficiaries:r.beneficiaries,meta:r.meta}}({accessToken:t,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),i=n.beneficiaries.map((e=>de(e))),a=ce(n.meta);return{beneficiaries:i,...a?{meta:a}:{}}},getBeneficiary:async function({beneficiaryId:e,accessToken:t,stagingToken:n}){const i=t||s();!function(e){if(!e)throw new r("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new r("beneficiaryId must be a string")}(e);return de(await async function({accessToken:e,stagingToken:t,beneficiaryId:n}){const i={method:"GET",headers:O({accessToken:e,stagingToken:t})},a=`${b.getEnvironmentUrls().THIRD_PARTY_API_URL}${le}/${n}`,s=await fetch(a,i),r=await s.json();if(r.errors)throw new P(r.errors.map((e=>`${e.code}: ${e.detail}`)));return r.beneficiary}({beneficiaryId:e,accessToken:i,stagingToken:n}))},addBeneficiary:async function({beneficiary:e,accessToken:t,stagingToken:n}){const i=t||s();!function(e){if(!e)throw new r("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new r("beneficiary must be an object");B(e,ue);const t=F({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new r(t)}(e);return de(await async function({beneficiary:e,accessToken:t,stagingToken:n}){const i={method:"POST",headers:O({accessToken:t,stagingToken:n,idempotencyKey:te()}),body:JSON.stringify({beneficiary:me(e)})},a=`${b.getEnvironmentUrls().THIRD_PARTY_API_URL}${le}`,s=await fetch(a,i),r=await s.json();if(r.errors)throw new P(r.errors.map((e=>`${e.code}: ${e.detail}`)));return r.beneficiary}({beneficiary:e,accessToken:i,stagingToken:n}))}},ge="/v2/sepa/transfers";function he(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}const fe={getSepaTransfers:async function(e={}){const t=e?.accessToken||s(),n=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const i={method:"GET",headers:O({accessToken:e,stagingToken:t})},a=oe({endpointUrl:new URL(b.getEnvironmentUrls().THIRD_PARTY_API_URL+ge),paginationSettings:n}),s=await fetch(a,i);if(!s.ok)throw new P("Failed to fetch SEPA transfers");const r=await s.json();if(r.errors)throw new P(r.errors.map((e=>`${e.code}: ${e.detail}`)));return{transfers:r.transfers,meta:r.meta}}({accessToken:t,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),i=n.transfers.map((e=>he(e))),a=ce(n.meta);return{transfers:i,...a?{meta:a}:{}}},getSepaTransfer:async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const i=t||s();!function(e){if(!e)throw new r("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new r("sepaTransferId must be a string")}(e);return he(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const i={method:"GET",headers:O({accessToken:e,stagingToken:t})},a=`${b.getEnvironmentUrls().THIRD_PARTY_API_URL}${ge}/${n}`,s=await fetch(a,i),r=await s.json();if(r.errors)throw new P(r.errors.map((e=>`${e.code}: ${e.detail}`)));return r.external_transfer}({sepaTransferId:e,accessToken:i,stagingToken:n}))}};e.beneficiaries=pe,e.cards=re,e.constants=k,e.initialize=S,e.logout=v,e.sepaTransfers=fe}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const n=t.getInstance();class i extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class a extends i{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function r(){if(!n.hasAccessToken())throw new a;return n.getAccessToken()}class s extends i{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}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"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},m={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},l={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},u={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device"};var g=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"},BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:m,ENVIRONMENTS:d,IFRAME_EVENTS:o,LOCALES:l,MFA_METHODS:u,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"}});class f{constructor(){this.uiParentElementId=null,this.mfaPreference=u.PASSKEY,this.debugMode=!1}static getInstance(){return f.instance||(f.instance=new f),f.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}clearSettings(){this.uiParentElementId=null,this.mfaPreference=u.PASSKEY}}const p=f.getInstance();function h(e){const t=e?.uiParentElementId||p.getUIParentElementId();if(!t)throw new s("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");const n=e?.mfaPreference||p.getMFAPreference();if(n&&!Object.values(u).includes(n))throw new s("operationSettings.mfaPreference must be one of passkey, paired-device or sms-otp.");const i=e?.debugMode||p.getDebugMode();if(void 0!==i&&"boolean"!=typeof i)throw new s("operationSettings.debugMode must be a boolean.");return{uiParentElementId:t,mfaPreference:n,debugMode:i}}const _=Object.values(l);function y(e){if(!function(e){return _.includes(e)}(e))throw new s(`Unsupported locale: ${e}. The locale must be one of: ${_.join(", ")}.`);return e}function T(e){if(!e?.accessToken)throw new s("Access token is required when calling initialize()");return e?.operationSettings&&h(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&&y(e.locale),e}const I="https://embed.qonto.com",E="https://embed-js{branch}.staging.qonto.co",A="https://embed.dev.qonto.co",b={[d.PRODUCTION]:{IFRAME_BASE_URL:I,IFRAME_URL:`${I}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:E,IFRAME_URL:`${E}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:A,IFRAME_URL:`${A}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class w{constructor(){this.environment=d.PRODUCTION,this.branch=m.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(m).includes(t)?t:m.SANDBOX}static getInstance(){return w.instance||(w.instance=new w),w.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=d.PRODUCTION,this.branch=m.MASTER}getEnvironmentUrls(){if(this.environment===d.PRODUCTION)return b.production;{const e=b[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const L=w.getInstance();class R{constructor(){this.currentLocale="en"}static getInstance(){return R.instance||(R.instance=new R),R.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const S=R.getInstance();const k={initialize:function(e){const{accessToken:t,stagingToken:i,operationSettings:a,environment:r,branch:s,locale:o}=T(e);n.setAccessToken(t),i&&n.setStagingToken(i),o&&S.setLocale(o),a&&p.setSettings(a),r&&(L.setEnvironment(r),s&&L.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),S.setDefaultLocale()},constants:g},{initialize:v,logout:D,constants:P}=k;class O extends i{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function N({accessToken:e,stagingToken:t,idempotencyKey:i,mfaPreference:a}){const r=new Headers;r.append("Authorization",`Bearer ${e}`);const s=t||n.getStagingToken();s&&r.append("X-Qonto-Staging-Token",s),i&&r.append("X-Qonto-Idempotency-Key",i);const o=a||p.getMFAPreference();return o&&r.append("X-Qonto-2fa-Preference",o),r.append("Content-Type","application/json"),r.append("Accept-Language",S.getLocale()),r}async function U(e,t,n){const i={method:"GET",headers:N({accessToken:t,stagingToken:n})},a=L.getEnvironmentUrls().THIRD_PARTY_API_URL,r=await fetch(`${a}/v2/cards/${e.cardId}/data_view`,i),s=await r.json();if(s.errors)throw new O(s.errors.map((e=>`${e.code}: ${e.detail}`)));return function(e,t){const n=new URL(e);return"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal?"true":"false"),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking?"true":"false"),n.toString()}(s.iframe_url,e)}var C;!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"}(C||(C={}));const M={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 $,B;function F(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 G(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function Y(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"}($||($={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(B||(B={}));const q=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],x=[...q,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function z(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return F(e,q),function(e){const{membershipId:t,organizationId:n,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u}=e,g=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(u),f=j({membershipId:t,organizationId:n,bankAccountId:i}),p=G({hasDailyLimit:a,hasTransactionLimit:r}),h=Y({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),_=H(m),y=K(l),T=[...g,...f,...p,...h,..._,...y];if(T.length>0)throw new s(T)}(e),e}(e):function(e){F(e,x),function(e){const{membershipId:t,organizationId:n,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u,hasNfcOption:g,hasForeignPaymentOption:f,hasOnlinePaymentOption:p,shipToBusiness:h,hasAtmOption:_,hasAtmDailyLimit:y,atmDailyLimit:T,atmMonthlyLimit:I,address:E,cardDesign:A,typeOfPrint:b}=e,w=function(e){return Object.values(B).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(u),L=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(b),R=j({membershipId:t,organizationId:n,bankAccountId:i}),S=G({hasDailyLimit:a,hasTransactionLimit:r,hasAtmOption:_,hasNfcOption:g,hasForeignPaymentOption:f,hasOnlinePaymentOption:p,hasAtmDailyLimit:y,shipToBusiness:h}),k=Y({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:T,atmMonthlyLimit:I}),v=H(m),D=K(l),P=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(A),O=function(e,t){if(t)return[];return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(E,h),N=[...w,...R,...S,...k,...v,...D,...L,...P,...O];if(N.length>0)throw new s(N)}(e)}(e)}function H(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 K(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 V extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}class X{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 V(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,i=setTimeout((()=>{window.removeEventListener("message",a),t(new V(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),a=t=>{t.data.eventId===o.READY&&(clearTimeout(i),window.removeEventListener("message",a),e(this))};window.addEventListener("message",a),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){return this.iframe&&this.iframe.contentWindow?new Promise(((t,n)=>{const i=a=>{if(a.data?.actionId===e.actionId){if("error"===a.data.status)return this.removeMessageListener(e.actionId,i),n(new V(`An error occurred when performing the action ${e.actionId}.\n${JSON.stringify(a.data.payload)}`));this.removeMessageListener(e.actionId,i),t(a.data.payload)}};this.addMessageListener(e.actionId,i),this.iframe?.contentWindow?.postMessage(e,this.targetOrigin)})):Promise.reject(new V("Attempted to perform an Embed operation without having the authentication UI initialized."))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function Q({accessToken:e,stagingToken:t,locale:n,debugMode:i}){const a=i||!1,r=n||S.getLocale(),s=L.getEnvironmentUrls().IFRAME_URL,o=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${a}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function W({parentElementId:e,iframeUrl:t}){return new X({parentElementId:e,iframeUrl:t}).initialize()}const J=[];for(let e=0;e<256;++e)J.push((e+256).toString(16).slice(1));let Z;const ee=new Uint8Array(16);var te={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ne(e,t,n){if(te.randomUUID&&!e)return te.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!Z){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Z=crypto.getRandomValues.bind(crypto)}return Z(ee)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(J[e[t+0]]+J[e[t+1]]+J[e[t+2]]+J[e[t+3]]+"-"+J[e[t+4]]+J[e[t+5]]+"-"+J[e[t+6]]+J[e[t+7]]+"-"+J[e[t+8]]+J[e[t+9]]+"-"+J[e[t+10]]+J[e[t+11]]+J[e[t+12]]+J[e[t+13]]+J[e[t+14]]+J[e[t+15]]).toLowerCase()}(i)}function ie(e){return"virtual"===e.cardLevel?function(e){const t=re(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ne(),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=re(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ne(),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 ae(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 re(e){const t=Object.values(M);return(e||[]).filter((e=>t.includes(e)))}const se={getCards:async function({membershipId:e,accessToken:t,stagingToken:n}){try{const i=t||r();if(e&&"string"!=typeof e)throw new s("membershipId must be a string");const a=await async function({membershipId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:N({accessToken:t,stagingToken:n})},a=L.getEnvironmentUrls().THIRD_PARTY_API_URL,r=e?`${a}/v2/cards?holder_ids[]=${e}`:`${a}/v2/cards`,s=await fetch(r,i),o=await s.json();if(o.errors)throw new O(o.errors.map((e=>`${e.code}: ${e.detail}`)));return o.cards}({membershipId:e,accessToken:i,stagingToken:n});return a.map((e=>ae(e)))}catch(e){return Promise.reject(e)}},getCard:async function({cardId:e,accessToken:t,stagingToken:n}){try{const i=t||r();if(e&&"string"!=typeof e)throw new s("cardId must be a string");const a=await async function({cardId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:N({accessToken:t,stagingToken:n})},a=`${L.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/cards?ids[]=${e}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new O(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.cards[0]}({cardId:e,accessToken:i,stagingToken:n});return ae(a)}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:i,debugMode:a}=h(e.operationSettings);z(e.cardSettings);const s=Q({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),o=await W({iframeUrl:s,parentElementId:i}),c=ie(e.cardSettings),d=await o.postMessage(c);return o.destroy(),ae(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:i,debugMode:a}=h(e.operationSettings);!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=j({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=Q({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),d=await W({iframeUrl:o,parentElementId:i}),m=function(e){return{actionId:c.CARD_UNLOCK,actionData:{cardId:e.cardSettings.cardId}}}(e),l=await d.postMessage(m);return d.destroy(),ae(l)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const t=r(),{uiParentElementId:n}=h(e.operationSettings);!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=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 i=G(n);if(i.length>0)throw new s(i)}(e.cardSettings);const i=await U(e.cardSettings,t),a=await W({iframeUrl:i,parentElementId:n});return{destroyEmbedUI:()=>{a.destroy()}}}catch(e){return Promise.reject(e)}}},oe=se;function ce({endpointUrl:e,paginationSettings:t}){const n=new URL(e);return t?.page&&n.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&n.searchParams.set("per_page",t.itemsPerPage.toString()),n}function de(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 me(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 le(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 ue="/v2/sepa/beneficiaries";async function ge({accessToken:e,stagingToken:t,beneficiaryId:n}){const i={method:"GET",headers:N({accessToken:e,stagingToken:t})},a=`${L.getEnvironmentUrls().THIRD_PARTY_API_URL}${ue}/${n}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new O(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiary}const fe=[{name:"name"},{name:"iban"}];const pe={getBeneficiaries:async function(e){const t=e?.accessToken||r(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:N({accessToken:t,stagingToken:n})},a=ce({endpointUrl:new URL(L.getEnvironmentUrls().THIRD_PARTY_API_URL+ue),paginationSettings:e}),r=await fetch(a,i),s=await r.json();if(s.errors)throw new O(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{beneficiaries:s.beneficiaries,meta:s.meta}}({accessToken:t,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),i=n.beneficiaries.map((e=>me(e))),a=de(n.meta);return{beneficiaries:i,...a?{meta:a}:{}}},getBeneficiary:async function({beneficiaryId:e,accessToken:t,stagingToken:n}){const i=t||r();return function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string")}(e),me(await ge({beneficiaryId:e,accessToken:i,stagingToken:n}))},addBeneficiary:async function({beneficiary:e,accessToken:t,stagingToken:n}){const i=t||r();!function(e){if(!e)throw new s("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new s("beneficiary must be an object");F(e,fe);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)}(e);return me(await async function({beneficiary:e,accessToken:t,stagingToken:n}){const i={method:"POST",headers:N({accessToken:t,stagingToken:n,idempotencyKey:ne()}),body:JSON.stringify({beneficiary:le(e)})},a=`${L.getEnvironmentUrls().THIRD_PARTY_API_URL}${ue}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new O(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiary}({beneficiary:e,accessToken:i,stagingToken:n}))}};function he(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 _e(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.attachments?{attachments:e.attachments}:{}}}const ye="/v2/sepa/transfers";const Te=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];async function Ie({sepaTransferSettings:e,operationSettings:t}){if(e.beneficiary)return e.beneficiary;return me(await ge({beneficiaryId:e.beneficiaryId,accessToken:t?.accessToken,stagingToken:t?.stagingToken}))}const Ee="browser",Ae="server";class be extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case Ee:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case Ae: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 we={getSepaTransfers:async function(e={}){const t=e?.accessToken||r(),n=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const i={method:"GET",headers:N({accessToken:e,stagingToken:t})},a=ce({endpointUrl:new URL(L.getEnvironmentUrls().THIRD_PARTY_API_URL+ye),paginationSettings:n}),r=await fetch(a,i);if(!r.ok)throw new O("Failed to fetch SEPA transfers");const s=await r.json();if(s.errors)throw new O(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{transfers:s.transfers,meta:s.meta}}({accessToken:t,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),i=n.transfers.map((e=>he(e))),a=de(n.meta);return{transfers:i,...a?{meta:a}:{}}},getSepaTransfer:async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const i=t||r();!function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("sepaTransferId must be a string")}(e);return he(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const i={method:"GET",headers:N({accessToken:e,stagingToken:t})},a=`${L.getEnvironmentUrls().THIRD_PARTY_API_URL}${ye}/${n}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new O(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.external_transfer}({sepaTransferId:e,accessToken:i,stagingToken:n}))},createSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const i=t?.accessToken||r(),a=t?.stagingToken||n.getStagingToken(),o=t?.idempotencyKey||ne();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(F(e,Te),!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}),...Y({amount:e.amount})].flat();if(t.length>0)throw new s(t);if(e.amount>3e4&&(!e.attachments||0===e.attachments.length))throw new s("Attachments are required for transfers over €30,000")}(e);const m={...e,beneficiary:await Ie({sepaTransferSettings:e,operationSettings:{accessToken:i,stagingToken:a||void 0}})};if(m.beneficiary.trusted)d=await async function({transfer:e,accessToken:t,stagingToken:n,idempotencyKey:i}){const a=_e(e),r={method:"POST",headers:N({accessToken:t,stagingToken:n,idempotencyKey:i}),body:JSON.stringify({transfer:a})},s=`${L.getEnvironmentUrls().THIRD_PARTY_API_URL}${ye}`,o=await fetch(s,r),c=await o.json();if(c.errors)throw new O(c.errors.map((e=>`${e.code}: ${e.detail}`)));return c.transfer}({transfer:m,accessToken:i,stagingToken:a||void 0,idempotencyKey:o});else{if("undefined"==typeof window||"undefined"==typeof document)throw new be(Ee);const{uiParentElementId:e,debugMode:n}=h(t);let r;try{const t=Q({accessToken:i,stagingToken:a||void 0,debugMode:n});r=await W({iframeUrl:t,parentElementId:e});const s=_e(m);d=await r.postMessage({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}})}finally{r?.destroy()}}return he(d)}};e.beneficiaries=pe,e.cards=oe,e.constants=P,e.initialize=v,e.logout=D,e.sepaTransfers=we}));
@@ -11,6 +11,6 @@ export declare const newBeneficiaryDbFields: {
11
11
  trusted: boolean;
12
12
  };
13
13
  export declare const mockedBeneficiariesList: BeneficiaryDataObject[];
14
- export declare const mockTransfer: SepaTransferDataObject;
14
+ export declare const mockTransferDataObject: SepaTransferDataObject;
15
15
  export declare const mswHandlers: import("msw").HttpHandler[];
16
16
  //# sourceMappingURL=handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAGnF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,sBAkB1B,CAAC;AAEF,eAAO,MAAM,WAAW,6BAkMvB,CAAC"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAG9C,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,WAAW,6BA0NvB,CAAC"}
@@ -14,5 +14,6 @@
14
14
  export declare const sepaTransfers: {
15
15
  getSepaTransfers: typeof import("./sepa-transfers").getSepaTransfers;
16
16
  getSepaTransfer: typeof import("./sepa-transfers").getSepaTransfer;
17
+ createSepaTransfer: typeof import("./sepa-transfers").createSepaTransfer;
17
18
  };
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;;;CAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;;;;CAAuC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { PaginationResponseDataObject, PaginationSettings } from '@common/api-pagination/api-pagination.types';
2
- import type { SepaTransferDataObject } from './sepa-transfers.types';
2
+ import type { NewSepaTransfer, SepaTransferDataObject } from './sepa-transfers.types';
3
3
  interface GetSepaTransfersParams {
4
4
  accessToken: string;
5
5
  stagingToken?: string;
@@ -14,8 +14,15 @@ interface GetSepaTransfersApiResponse {
14
14
  transfers: SepaTransferDataObject[];
15
15
  meta: PaginationResponseDataObject;
16
16
  }
17
+ export interface CreateSepaTransferParams {
18
+ transfer: NewSepaTransfer;
19
+ accessToken: string;
20
+ stagingToken?: string;
21
+ idempotencyKey: string;
22
+ }
17
23
  export declare const SEPA_TRANSFERS_ENDPOINT = "/v2/sepa/transfers";
18
24
  export declare function getSepaTransfers({ accessToken, stagingToken, paginationSettings, }: GetSepaTransfersParams): Promise<GetSepaTransfersApiResponse>;
19
25
  export declare function getSepaTransfer({ accessToken, stagingToken, sepaTransferId, }: GetSepaTransferParams): Promise<SepaTransferDataObject>;
26
+ export declare function createSepaTransfer({ transfer, accessToken, stagingToken, idempotencyKey, }: CreateSepaTransferParams): Promise<SepaTransferDataObject>;
20
27
  export {};
21
28
  //# sourceMappingURL=sepa-transfers.api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAMrE,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,2BAA2B;IACnC,SAAS,EAAE,sBAAsB,EAAE,CAAC;IACpC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAE5D,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAkC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqBzD"}
1
+ {"version":3,"file":"sepa-transfers.api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAEV,eAAe,EACf,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAOhC,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,2BAA2B;IACnC,SAAS,EAAE,sBAAsB,EAAE,CAAC;IACpC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAE5D,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAkC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqBzD;AAED,wBAAsB,kBAAkB,CAAC,EACvC,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAyB5D"}
@@ -1,10 +1,27 @@
1
1
  import type { PaginationSettings } from '@common/api-pagination/api-pagination.types';
2
- import type { GetSepaTransfersResponse, SepaTransfer } from './sepa-transfers.types';
2
+ import type { GetSepaTransfersResponse, NewSepaTransfer, SepaTransfer } from './sepa-transfers.types';
3
+ import { type OperationSettings } from '@validation/operation-settings-validation';
3
4
  interface GetSepaTransfersParams {
4
5
  accessToken?: string;
5
6
  stagingToken?: string;
6
7
  paginationSettings?: PaginationSettings;
7
8
  }
9
+ /**
10
+ * This is the common parameter format expected by the SEPA transfers functions.
11
+ * It consists of a `sepaTransferSettings` object and an optional
12
+ * `operationSettings` object. The `sepaTransferSettings` object's properties
13
+ * will be different depending on the function being called. Read the docs of
14
+ * each transfer related function to see the expected properties of the
15
+ * `sepaTransferSettings` object.
16
+ */
17
+ export interface SepaTransferParams<T> {
18
+ /**
19
+ * An object with the parameters relevant to different card operations. Read the
20
+ * documentation of each function to see the expected properties of this object.
21
+ */
22
+ sepaTransferSettings: T;
23
+ operationSettings?: OperationSettings;
24
+ }
8
25
  /**
9
26
  * Fetches the list of SEPA transfers for the current user.
10
27
  * @param getSepaTransfersParams - An optional object with the accessToken
@@ -37,5 +54,34 @@ export declare function getSepaTransfer({ sepaTransferId, accessToken, stagingTo
37
54
  accessToken?: string;
38
55
  stagingToken?: string;
39
56
  }): Promise<SepaTransfer>;
57
+ /**
58
+ * Creates a new SEPA transfer from the current user to a given beneficiary.
59
+ * Depending on the beneficiary's trust status, this function will either
60
+ * create the transfer directly via API or open the UI to complete the SCA
61
+ * process.
62
+ * @param createTransferParams - An object with the parameters to create the
63
+ * transfer. If it was not provided when calling the SDK's `initialize`
64
+ * function, an `operationSettings` object has to be passed too with the
65
+ * `accessToken` and `stagingToken` values. If the transfer needs to be created
66
+ * for an untrusted beneficiary, the `operationSettings` object must also include
67
+ * the `uiParentElementId` property. This has to specify the ID of the DOM element
68
+ * where the UI for MFA will be displayed. Note that this means that creating
69
+ * transfers for untrusted beneficiaries can only happen in the client side.
70
+ * The `createSepaTransfer` function requires an `idempotencyKey` as well. If this
71
+ * property is not passed as part of `operationSettings`, a new one will be
72
+ * generated automatically.
73
+ * @returns A promise that resolves to the created SEPA transfer.
74
+ * @throws \{AuthenticationError\} If the access token is invalid or missing.
75
+ * Ensure initialize has been called before using this function if you are not
76
+ * passing the access token.
77
+ * @throws \{InvalidParametersError\} If the `transfer` parameter is not an object
78
+ * or is missing, or if the required properties of the transfer object are
79
+ * missing or invalid.
80
+ * @throws \{EmbedApiError\} If the API request fails or returns an error.
81
+ * @throws \{InvalidRuntimeError\} If a transfer for an untrusted beneficiary is
82
+ * attempted to be created in the server. This scenario requires to be performed
83
+ * from a browser.
84
+ */
85
+ export declare function createSepaTransfer({ sepaTransferSettings, operationSettings, }: SepaTransferParams<NewSepaTransfer>): Promise<SepaTransfer>;
40
86
  export {};
41
87
  //# 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":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAOtF,OAAO,KAAK,EACV,wBAAwB,EACxB,YAAY,EACb,MAAM,wBAAwB,CAAC;AAIhC,UAAU,sBAAsB;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,GAAE,sBAA2B,GAClD,OAAO,CAAC,wBAAwB,CAAC,CAqBnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,EACpC,cAAc,EACd,WAAW,EACX,YAAY,GACb,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,YAAY,CAAC,CASxB"}
1
+ {"version":3,"file":"sepa-transfers.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAQtF,OAAO,KAAK,EACV,wBAAwB,EACxB,eAAe,EACf,YAAY,EAEb,MAAM,wBAAwB,CAAC;AAShC,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,2CAA2C,CAAC;AAUnD,UAAU,sBAAsB;IAC9B,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;;;OAGG;IACH,oBAAoB,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,GAAE,sBAA2B,GAClD,OAAO,CAAC,wBAAwB,CAAC,CAqBnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,EACpC,cAAc,EACd,WAAW,EACX,YAAY,GACb,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,YAAY,CAAC,CASxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAwE7D"}
@@ -1,7 +1,8 @@
1
- import { getSepaTransfers, getSepaTransfer } from './sepa-transfers';
1
+ import { getSepaTransfers, getSepaTransfer, createSepaTransfer } from './sepa-transfers';
2
2
  declare const sepaTransfers: {
3
3
  getSepaTransfers: typeof getSepaTransfers;
4
4
  getSepaTransfer: typeof getSepaTransfer;
5
+ createSepaTransfer: typeof createSepaTransfer;
5
6
  };
6
7
  export { sepaTransfers };
7
8
  //# sourceMappingURL=sepa-transfers.public-api.d.ts.map
@@ -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,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAErE,QAAA,MAAM,aAAa;;;CAGlB,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,kBAAkB,CAAC;AAE1B,QAAA,MAAM,aAAa;;;;CAIlB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
- import type { SepaTransfer, SepaTransferDataObject } from './sepa-transfers.types';
1
+ import type { SepaTransfer, SepaTransferDataObject, NewSepaTransfer, NewSepaTransferDataObject } from './sepa-transfers.types';
2
2
  export declare function serializeSepaTransfer(data: SepaTransferDataObject): SepaTransfer;
3
+ export declare function serializeToNewSepaTransferDataObject(transfer: NewSepaTransfer): NewSepaTransferDataObject;
3
4
  //# sourceMappingURL=sepa-transfers.serializer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.serializer.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,YAAY,CAoBd"}
1
+ {"version":3,"file":"sepa-transfers.serializer.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,YAAY,CAoBd;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,eAAe,GACxB,yBAAyB,CAc3B"}
@@ -1,13 +1,14 @@
1
1
  import type { PaginationState } from '@common/api-pagination/api-pagination.types';
2
- import { SEPA_TRANSFER_DECLINE_REASONS, SEPA_TRANSFER_STATUSES } from '@common/constants';
2
+ import { TRANSFER_DECLINE_REASONS, TRANSFER_STATUSES } from '@common/constants';
3
+ import type { Beneficiary } from '@beneficiaries/beneficiaries.types';
3
4
  /**
4
5
  * Represents the reasons why a SEPA transfer might be declined.
5
6
  */
6
- type SepaTransferDeclinedReason = (typeof SEPA_TRANSFER_DECLINE_REASONS)[keyof typeof SEPA_TRANSFER_DECLINE_REASONS];
7
+ type SepaTransferDeclinedReason = (typeof TRANSFER_DECLINE_REASONS)[keyof typeof TRANSFER_DECLINE_REASONS];
7
8
  /**
8
9
  * Represents the possible statuses of a SEPA transfer.
9
10
  */
10
- type SepaTransferStatus = (typeof SEPA_TRANSFER_STATUSES)[keyof typeof SEPA_TRANSFER_STATUSES];
11
+ type SepaTransferStatus = (typeof TRANSFER_STATUSES)[keyof typeof TRANSFER_STATUSES];
11
12
  /**
12
13
  * Represents a SEPA transfer in the system. This type includes all the fields
13
14
  * necessary to describe a SEPA transfer and various timestamps related to the
@@ -16,20 +17,68 @@ type SepaTransferStatus = (typeof SEPA_TRANSFER_STATUSES)[keyof typeof SEPA_TRAN
16
17
  export interface SepaTransfer {
17
18
  id: string;
18
19
  initiatorId: string;
20
+ /**
21
+ * The ID of the bank account from which the transfer is made.
22
+ */
19
23
  bankAccountId: string;
24
+ /**
25
+ * The amount of money being transferred, represented as a number.
26
+ */
20
27
  amount: number;
28
+ /**
29
+ * The amount of money being transferred, represented in cents as a number.
30
+ */
21
31
  amountCents: number;
32
+ /**
33
+ * The currency of the amount being transferred, represented as a string.
34
+ * @example 'EUR'
35
+ */
22
36
  amountCurrency: string;
37
+ /**
38
+ * The current status of the SEPA transfer, represented as a string.
39
+ */
23
40
  status: SepaTransferStatus;
41
+ /**
42
+ * The ID of the beneficiary to whom the transfer is made.
43
+ */
24
44
  beneficiaryId: string;
45
+ /**
46
+ * A reference string for the transfer, which can be used for tracking or
47
+ * identification purposes.
48
+ */
25
49
  reference: string;
50
+ /**
51
+ * An optional note that can be included with the transfer for additional
52
+ * information or context.
53
+ */
26
54
  note: string;
55
+ /**
56
+ * The reason for the transfer being declined, if applicable.
57
+ */
27
58
  declinedReason: SepaTransferDeclinedReason;
59
+ /**
60
+ * The date when the transfer is scheduled to be processed.
61
+ */
28
62
  scheduledDate: Date;
63
+ /**
64
+ * The date and time when the transfer was created.
65
+ */
29
66
  createdAt: Date;
67
+ /**
68
+ * The date and time when the transfer was last updated.
69
+ */
30
70
  updatedAt: Date;
71
+ /**
72
+ * The date and time when the transfer was processed.
73
+ */
31
74
  processedAt: Date;
75
+ /**
76
+ * The date and time when the transfer was completed.
77
+ */
32
78
  completedAt: Date;
79
+ /**
80
+ * The ID of the transaction associated with this SEPA transfer.
81
+ */
33
82
  transactionId: string;
34
83
  }
35
84
  export interface SepaTransferDataObject {
@@ -66,5 +115,59 @@ export interface GetSepaTransfersResponse {
66
115
  */
67
116
  meta?: PaginationState;
68
117
  }
118
+ /**
119
+ * Represents the parameters required to create a new SEPA transfer.
120
+ * This interface is used to define the structure of the data needed to
121
+ * initiate a SEPA transfer
122
+ */
123
+ export interface NewSepaTransfer {
124
+ /**
125
+ * The ID of the bank account from which the transfer will be made.
126
+ */
127
+ bankAccountId: string;
128
+ /**
129
+ * The ID of the beneficiary to whom the transfer will be made.
130
+ * Required if `beneficiary` is not provided.
131
+ */
132
+ beneficiaryId?: string;
133
+ /**
134
+ * The beneficiary details, which include information about the beneficiary
135
+ * such as their name, account number, and bank details.
136
+ * Required if `beneficiaryId` is not provided.
137
+ */
138
+ beneficiary?: Beneficiary;
139
+ /**
140
+ * The amount to be transferred, represented as a number.
141
+ */
142
+ amount: number;
143
+ /**
144
+ * A reference string for the transfer, which can be used for tracking or
145
+ * identification purposes.
146
+ */
147
+ reference: string;
148
+ /**
149
+ * An optional note that can be included with the transfer for additional
150
+ * information or context.
151
+ */
152
+ note?: string;
153
+ /**
154
+ * An optional date when the transfer is scheduled to be processed.
155
+ * If not provided, the transfer will be processed immediately.
156
+ */
157
+ scheduledDate?: Date;
158
+ /**
159
+ * An optional array of attachment IDs related to the transfer.
160
+ * Attachments are required for transfers over €30,000.
161
+ */
162
+ attachments?: string[];
163
+ }
164
+ export interface NewSepaTransferDataObject {
165
+ bank_account_id: string;
166
+ beneficiary_id: string;
167
+ amount: string;
168
+ reference: string;
169
+ note?: string;
170
+ scheduled_date?: string;
171
+ }
69
172
  export {};
70
173
  //# 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,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,KAAK,0BAA0B,GAC7B,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAC;AAErF;;GAEG;AACH,KAAK,kBAAkB,GACrB,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAEvE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,0BAA0B,CAAC;IAC3C,aAAa,EAAE,IAAI,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,IAAI,CAAC;IAClB,WAAW,EAAE,IAAI,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB"}
1
+ {"version":3,"file":"sepa-transfers.types.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEtE;;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,WAAW,CAAC,EAAE,MAAM,EAAE,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"}
@@ -0,0 +1,12 @@
1
+ import type { NewSepaTransfer } from '@sepa-transfers/sepa-transfers.types';
2
+ import type { SepaTransferParams } from '@sepa-transfers/sepa-transfers';
3
+ /**
4
+ * Extracts a beneficiary object from the provided create new SEPA transfer
5
+ * settings object if it contains it, and otherwise it calls the beneficiaries
6
+ * API to retrieve it by ID.
7
+ * @param param - The settings object containing the SEPA transfer
8
+ * details, including the beneficiary or the beneficiary ID.
9
+ * @returns A promise that resolves to a serialized beneficiary object.
10
+ */
11
+ export declare function findBeneficiary({ sepaTransferSettings, operationSettings, }: SepaTransferParams<NewSepaTransfer>): Promise<import("..").Beneficiary>;
12
+ //# sourceMappingURL=sepa-transfers.utils.d.ts.map
@@ -0,0 +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,gCAAgC,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,qCAWrC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sepa-transfers.utils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sepa-transfers.utils.test.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.utils.test.ts"],"names":[],"mappings":""}
@@ -1,2 +1,4 @@
1
+ import type { NewSepaTransfer } from '@sepa-transfers/sepa-transfers.types';
1
2
  export declare function validateGetSepaTransferParams(sepaTransferId: string): string;
3
+ export declare function validateCreateSepaTransferParams(sepaTransferSettings: NewSepaTransfer): NewSepaTransfer;
2
4
  //# 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":"AAEA,wBAAgB,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAU5E"}
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;AAU5E,wBAAgB,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAU5E;AAED,wBAAgB,gCAAgC,CAC9C,oBAAoB,EAAE,eAAe,mBAsDtC"}
@@ -1 +1 @@
1
- const _={READY:"qonto.ready"},e={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFERS_CREATE:"transfers.create"},E={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},n={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},N={ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},a={PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},A={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},i={BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},I={PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled"};export{e as ACTIONS,N as ACTIVITY_TAGS,a as BENEFICIARY_STATUSES,n as BRANCHES,E as ENVIRONMENTS,_ as IFRAME_EVENTS,A as LOCALES,i as SEPA_TRANSFER_DECLINE_REASONS,I as SEPA_TRANSFER_STATUSES};
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"},E={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},n={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},N={ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},a={PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},A={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},i={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"},r={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device"};export{_ as ACTIONS,N as ACTIVITY_TAGS,a as BENEFICIARY_STATUSES,n as BRANCHES,E as ENVIRONMENTS,e as IFRAME_EVENTS,A as LOCALES,r as MFA_METHODS,i as TRANSFER_DECLINE_REASONS,I as TRANSFER_STATUSES};
@@ -1 +1 @@
1
- import{authManager as e}from"../auth/auth.js";import{localeManager as n}from"../locale/locale-manager.js";function o({accessToken:o,stagingToken:t,idempotencyKey:a}){const p=new Headers;p.append("Authorization",`Bearer ${o}`);const c=t||e.getStagingToken();return c&&p.append("X-Qonto-Staging-Token",c),a&&p.append("X-Qonto-Idempotency-Key",a),p.append("Content-Type","application/json"),p.append("Accept-Language",n.getLocale()),p}export{o as buildRequestHeaders};
1
+ import{authManager as e}from"../auth/auth.js";import{operationSettingsManager as n}from"../operation-settings/operation-settings.js";import{localeManager as o}from"../locale/locale-manager.js";function t({accessToken:t,stagingToken:a,idempotencyKey:p,mfaPreference:r}){const c=new Headers;c.append("Authorization",`Bearer ${t}`);const i=a||e.getStagingToken();i&&c.append("X-Qonto-Staging-Token",i),p&&c.append("X-Qonto-Idempotency-Key",p);const s=r||n.getMFAPreference();return s&&c.append("X-Qonto-2fa-Preference",s),c.append("Content-Type","application/json"),c.append("Accept-Language",o.getLocale()),c}export{t as buildRequestHeaders};
@@ -1 +1 @@
1
- class e{constructor(){this.uiParentElementId=null,this.mfaPreference=null,this.debugMode=!1}static getInstance(){return e.instance||(e.instance=new e),e.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}clearSettings(){this.uiParentElementId=null,this.mfaPreference=null}}const t=e.getInstance();export{e as OperationSettingsManager,t as operationSettingsManager};
1
+ import{MFA_METHODS as e}from"../constants.js";class t{constructor(){this.uiParentElementId=null,this.mfaPreference=e.PASSKEY,this.debugMode=!1}static getInstance(){return t.instance||(t.instance=new t),t.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}clearSettings(){this.uiParentElementId=null,this.mfaPreference=e.PASSKEY}}const n=t.getInstance();export{t as OperationSettingsManager,n as operationSettingsManager};
@@ -0,0 +1 @@
1
+ function e(){return"undefined"!=typeof window&&"undefined"!=typeof document}export{e as isRunningInBrowser};
@@ -0,0 +1 @@
1
+ const e={BROWSER:"browser",SERVER:"server"};class n extends Error{constructor(n){switch(super(),this.name="InvalidRuntimeError",n){case e.BROWSER:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case e.SERVER: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."}}}export{n as InvalidRuntimeError,e as RUNTIME_ENVIRONMENT};
@@ -1 +1 @@
1
- import{EmbedIframe as e}from"./embed-iframe.js";import{environmentManager as n}from"../common/environment/environment-manager.js";import{localeManager as o}from"../common/locale/locale-manager.js";function t({accessToken:e,stagingToken:t,locale:m,debugMode:r}){const a=r||!1,i=m||o.getLocale(),c=n.getEnvironmentUrls().IFRAME_URL,l=t?`&staging_token=${encodeURIComponent(t)}`:"";return`${c}?debug=${a}&lang=${encodeURIComponent(i)}#access_token=${encodeURIComponent(e)}${l}`}function m({parentElementId:n,iframeUrl:o}){return new e({parentElementId:n,iframeUrl:o}).initialize()}export{t as buildIframeUrl,m as createIframe};
1
+ import{EmbedIframe as e}from"./embed-iframe.js";import{environmentManager as n}from"../common/environment/environment-manager.js";import{localeManager as o}from"../common/locale/locale-manager.js";function t({accessToken:e,stagingToken:t,locale:m,debugMode:r}){const a=r||!1,i=m||o.getLocale(),c=n.getEnvironmentUrls().IFRAME_URL,l=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${c}?debug=${a}&lang=${encodeURIComponent(i)}#access_token=${encodeURIComponent(e)}${l}`}function m({parentElementId:n,iframeUrl:o}){return new e({parentElementId:n,iframeUrl:o}).initialize()}export{t as buildIframeUrl,m as createIframe};
@@ -1 +1 @@
1
- import{buildRequestHeaders as n}from"../common/network/network.js";import{environmentManager as e}from"../common/environment/environment-manager.js";import{addPaginationParamsToUrl as r}from"../common/api-pagination/api-pagination.js";import{EmbedApiError as o}from"../errors/EmbedApiError.js";const t="/v2/sepa/transfers";async function a({accessToken:a,stagingToken:s,paginationSettings:i}){const m={method:"GET",headers:n({accessToken:a,stagingToken:s})},c=new URL(e.getEnvironmentUrls().THIRD_PARTY_API_URL+t),f=r({endpointUrl:c,paginationSettings:i}),g=await fetch(f,m);if(!g.ok)throw new o("Failed to fetch SEPA transfers");const p=await g.json();if(p.errors)throw new o(p.errors.map((n=>`${n.code}: ${n.detail}`)));return{transfers:p.transfers,meta:p.meta}}async function s({accessToken:r,stagingToken:a,sepaTransferId:s}){const i={method:"GET",headers:n({accessToken:r,stagingToken:a})},m=`${e.getEnvironmentUrls().THIRD_PARTY_API_URL}${t}/${s}`,c=await fetch(m,i),f=await c.json();if(f.errors)throw new o(f.errors.map((n=>`${n.code}: ${n.detail}`)));return f.external_transfer}export{t as SEPA_TRANSFERS_ENDPOINT,s as getSepaTransfer,a as getSepaTransfers};
1
+ import{buildRequestHeaders as e}from"../common/network/network.js";import{environmentManager as n}from"../common/environment/environment-manager.js";import{addPaginationParamsToUrl as r}from"../common/api-pagination/api-pagination.js";import{EmbedApiError as t}from"../errors/EmbedApiError.js";import{serializeToNewSepaTransferDataObject as o}from"./sepa-transfers.serializer.js";const s="/v2/sepa/transfers";async function a({accessToken:o,stagingToken:a,paginationSettings:i}){const c={method:"GET",headers:e({accessToken:o,stagingToken:a})},m=new URL(n.getEnvironmentUrls().THIRD_PARTY_API_URL+s),f=r({endpointUrl:m,paginationSettings:i}),g=await fetch(f,c);if(!g.ok)throw new t("Failed to fetch SEPA transfers");const p=await g.json();if(p.errors)throw new t(p.errors.map((e=>`${e.code}: ${e.detail}`)));return{transfers:p.transfers,meta:p.meta}}async function i({accessToken:r,stagingToken:o,sepaTransferId:a}){const i={method:"GET",headers:e({accessToken:r,stagingToken:o})},c=`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${s}/${a}`,m=await fetch(c,i),f=await m.json();if(f.errors)throw new t(f.errors.map((e=>`${e.code}: ${e.detail}`)));return f.external_transfer}async function c({transfer:r,accessToken:a,stagingToken:i,idempotencyKey:c}){const m=o(r),f={method:"POST",headers:e({accessToken:a,stagingToken:i,idempotencyKey:c}),body:JSON.stringify({transfer:m})},g=`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${s}`,p=await fetch(g,f),T=await p.json();if(T.errors)throw new t(T.errors.map((e=>`${e.code}: ${e.detail}`)));return T.transfer}export{s as SEPA_TRANSFERS_ENDPOINT,c as createSepaTransfer,i as getSepaTransfer,a as getSepaTransfers};
@@ -1 +1 @@
1
- import"../common/auth/auth.js";import{validatePresenceOfAuthToken as a}from"../common/auth/auth.validate.js";import{serializePaginationResponse as s}from"../common/api-pagination/api-pagination.js";import{getSepaTransfer as n,getSepaTransfers as t}from"./sepa-transfers.api.js";import{serializeSepaTransfer as e}from"./sepa-transfers.serializer.js";import{validateGetSepaTransferParams as r}from"./sepa-transfers.validate.js";async function o(n={}){const r=n?.accessToken||a(),o=await t({accessToken:r,stagingToken:n?.stagingToken,paginationSettings:n?.paginationSettings}),i=o.transfers.map((a=>e(a))),p=s(o.meta);return{transfers:i,...p?{meta:p}:{}}}async function i({sepaTransferId:s,accessToken:t,stagingToken:o}){const i=t||a();r(s);const p=await n({sepaTransferId:s,accessToken:i,stagingToken:o});return e(p)}export{i as getSepaTransfer,o as getSepaTransfers};
1
+ import{authManager as e}from"../common/auth/auth.js";import{validatePresenceOfAuthToken as t}from"../common/auth/auth.validate.js";import{serializePaginationResponse as a}from"../common/api-pagination/api-pagination.js";import{createSepaTransfer as n,getSepaTransfer as s,getSepaTransfers as o}from"./sepa-transfers.api.js";import{serializeToNewSepaTransferDataObject as r,serializeSepaTransfer as i}from"./sepa-transfers.serializer.js";import{validateCreateSepaTransferParams as m,validateGetSepaTransferParams as c}from"./sepa-transfers.validate.js";import{validateOperationSettingsParams as p}from"../validation/operation-settings-validation.js";import{buildIframeUrl as f,createIframe as g}from"../iframe/iframe-manager.js";import{ACTIONS as d}from"../common/constants.js";import{findBeneficiary as T}from"./sepa-transfers.utils.js";import{isRunningInBrowser as u}from"../common/runtime/runtime.validation.js";import{InvalidRuntimeError as l,RUNTIME_ENVIRONMENT as k}from"../errors/InvalidRuntimeError.js";import y from"../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";async function j(e={}){const n=e?.accessToken||t(),s=await o({accessToken:n,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),r=s.transfers.map((e=>i(e))),m=a(s.meta);return{transfers:r,...m?{meta:m}:{}}}async function S({sepaTransferId:e,accessToken:a,stagingToken:n}){const o=a||t();c(e);const r=await s({sepaTransferId:e,accessToken:o,stagingToken:n});return i(r)}async function v({sepaTransferSettings:a,operationSettings:s}){const o=s?.accessToken||t(),c=s?.stagingToken||e.getStagingToken(),j=s?.idempotencyKey||y();let S;m(a);const v={...a,beneficiary:await T({sepaTransferSettings:a,operationSettings:{accessToken:o,stagingToken:c||void 0}})};if(v.beneficiary.trusted)S=await n({transfer:v,accessToken:o,stagingToken:c||void 0,idempotencyKey:j});else{if(!u())throw new l(k.BROWSER);const{uiParentElementId:e,debugMode:t}=p(s);let a;try{const n=f({accessToken:o,stagingToken:c||void 0,debugMode:t});a=await g({iframeUrl:n,parentElementId:e});const s=r(v);S=await a.postMessage({actionId:d.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:j}})}finally{a?.destroy()}}return i(S)}export{v as createSepaTransfer,S as getSepaTransfer,j as getSepaTransfers};
@@ -1 +1 @@
1
- import{getSepaTransfer as e,getSepaTransfers as r}from"./sepa-transfers.js";const s={getSepaTransfers:r,getSepaTransfer:e};export{s as sepaTransfers};
1
+ import{createSepaTransfer as e,getSepaTransfer as r,getSepaTransfers as a}from"./sepa-transfers.js";const s={getSepaTransfers:a,getSepaTransfer:r,createSepaTransfer:e};export{s as sepaTransfers};
@@ -1 +1 @@
1
- function e(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}export{e as serializeSepaTransfer};
1
+ function e(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function t(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.attachments?{attachments:e.attachments}:{}}}export{e as serializeSepaTransfer,t as serializeToNewSepaTransferDataObject};
@@ -0,0 +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 +1 @@
1
- import{InvalidParametersError as r}from"../errors/InvalidParametersError.js";function e(e){if(!e)throw new r("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new r("sepaTransferId must be a string");return e}export{e as validateGetSepaTransferParams};
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";const a=[{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 o(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,a),!i.beneficiaryId&&!i.beneficiary)throw new e("Either beneficiaryId or beneficiary must be provided");const o=[...n({beneficiaryId:i.beneficiaryId,bankAccountId:i.bankAccountId,note:i.note,reference:i.reference}),...t({amount:i.amount})].flat();if(o.length>0)throw new e(o);if(i.amount>3e4&&(!i.attachments||0===i.attachments.length))throw new e("Attachments are required for transfers over €30,000");return i}export{o as validateCreateSepaTransferParams,i as validateGetSepaTransferParams};
@@ -1 +1 @@
1
- import{InvalidParametersError as e}from"../errors/InvalidParametersError.js";import{operationSettingsManager as t}from"../common/operation-settings/operation-settings.js";function o(o){const n=o?.uiParentElementId||t.getUIParentElementId();if(!n)throw new e("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 r=o?.mfaPreference||t.getMFAPreference();if(r&&!["passkey","paired-device","sms-otp"].includes(r))throw new e("operationSettings.mfaPreference must be one of passkey, paired-device or sms-otp.");const i=o?.debugMode||t.getDebugMode();if(void 0!==i&&"boolean"!=typeof i)throw new e("operationSettings.debugMode must be a boolean.");return{uiParentElementId:n,mfaPreference:r,debugMode:i}}export{o as validateOperationSettingsParams};
1
+ import{InvalidParametersError as e}from"../errors/InvalidParametersError.js";import{operationSettingsManager as t}from"../common/operation-settings/operation-settings.js";import{MFA_METHODS as o}from"../common/constants.js";function n(n){const r=n?.uiParentElementId||t.getUIParentElementId();if(!r)throw new e("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 i=n?.mfaPreference||t.getMFAPreference();if(i&&!Object.values(o).includes(i))throw new e("operationSettings.mfaPreference must be one of passkey, paired-device or sms-otp.");const a=n?.debugMode||t.getDebugMode();if(void 0!==a&&"boolean"!=typeof a)throw new e("operationSettings.debugMode must be a boolean.");return{uiParentElementId:r,mfaPreference:i,debugMode:a}}export{n as validateOperationSettingsParams};
@@ -1,3 +1,3 @@
1
- import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, GetSepaTransfersResponse, GetBeneficiariesResponse, PaginationState, Locale, BankAccount, ACCOUNT_STATUS } from './types.public-api';
2
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, GetSepaTransfersResponse, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, };
1
+ import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, GetBeneficiariesResponse, PaginationState, Locale, BankAccount, ACCOUNT_STATUS } from './types.public-api';
2
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, };
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,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,EACf,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,wBAAwB,EACxB,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,GACf,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,eAAe,EACf,MAAM,EACN,WAAW,EACX,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,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,GACf,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings } from '@cards/cards.types';
2
2
  import type { Beneficiary, GetBeneficiariesResponse } from '@beneficiaries/beneficiaries.types';
3
- import type { SepaTransfer, GetSepaTransfersResponse } from '@sepa-transfers/sepa-transfers.types';
3
+ import type { SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse } from '@sepa-transfers/sepa-transfers.types';
4
4
  import type { PaginationState } from '@common/api-pagination/api-pagination.types';
5
5
  import type { Locale } from '@common/locale/locale.types';
6
6
  import type { BankAccount, ACCOUNT_STATUS } from '@organizations/organizations.types';
7
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, GetSepaTransfersResponse, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, };
7
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, };
8
8
  //# 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,wBAAwB,EACzB,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;AAE5C,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,wBAAwB,EACxB,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,GACf,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,EACzB,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;AAE5C,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,GACf,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { MfaMethod } from '@common/operation-settings/operation-settings.types';
1
2
  /**
2
3
  * Optional settings to configure the SDK's operations that will be performed
3
4
  * after the initialization. This can be also provided when calling the
@@ -14,7 +15,7 @@ export interface OperationSettings {
14
15
  * This can be either `MFA_METHODS.PASSKEY`, `MFA_METHODS.PAIRED_DEVICE` or
15
16
  * `MFA_METHODS.SMS_OTP`. If not provided, the SDK will default to 'PASSKEY'.
16
17
  */
17
- mfaPreference?: 'passkey' | 'paired-device' | 'sms-otp' | null;
18
+ mfaPreference?: MfaMethod;
18
19
  /**
19
20
  * Whether to enable debug mode for the SDK. If not provided, the SDK will
20
21
  * default to false.
@@ -22,6 +23,23 @@ export interface OperationSettings {
22
23
  * during the execution of the SDK functions in which an iframe is involved.
23
24
  */
24
25
  debugMode?: boolean;
26
+ /**
27
+ * Optional access token to use for the operation. If not provided, the
28
+ * SDK will use the access token set during initialization.
29
+ */
30
+ accessToken?: string;
31
+ /**
32
+ * Optional staging token to use for the operation. The staging token is only
33
+ * needed when working in the staging environment, and it is irrelevant and not
34
+ * needed in production. If not provided, the SDK will use the staging token
35
+ * set during initialization.
36
+ */
37
+ stagingToken?: string;
38
+ /**
39
+ * Optional idempotency key to use for the operation. If not provided, the
40
+ * SDK will generate a random key for the functions that require it.
41
+ */
42
+ idempotencyKey?: string;
25
43
  }
26
44
  export declare function validateOperationSettingsParams(params: OperationSettings | undefined): OperationSettings;
27
45
  //# sourceMappingURL=operation-settings-validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation-settings-validation.d.ts","sourceRoot":"","sources":["../../src/validation/operation-settings-validation.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,eAAe,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/D;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,iBAAiB,GAAG,SAAS,GACpC,iBAAiB,CAiCnB"}
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;;;;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;CACzB;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,iBAAiB,GAAG,SAAS,GACpC,iBAAiB,CA8BnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qonto/embed-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Library to embed Qonto features in your application",
5
5
  "type": "module",
6
6
  "exports": {