@qonto/embed-sdk 0.30.0 → 0.31.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 (36) hide show
  1. package/dist/common/constants.d.ts +8 -0
  2. package/dist/common/constants.d.ts.map +1 -1
  3. package/dist/index.d.ts +4 -3
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.umd.js +1 -1
  6. package/dist/mocks/handlers.d.ts +3 -0
  7. package/dist/mocks/handlers.d.ts.map +1 -1
  8. package/dist/src/common/constants.js +1 -1
  9. package/dist/src/index.js +1 -1
  10. package/dist/src/transactions/index.js +1 -0
  11. package/dist/src/transactions/transactions.api.js +1 -0
  12. package/dist/src/transactions/transactions.js +1 -0
  13. package/dist/src/transactions/transactions.public-api.js +1 -0
  14. package/dist/src/transactions/transactions.serializer.js +1 -0
  15. package/dist/src/transactions/transactions.validation.js +1 -0
  16. package/dist/transactions/index.d.ts +33 -0
  17. package/dist/transactions/index.d.ts.map +1 -0
  18. package/dist/transactions/transactions.api.d.ts +23 -0
  19. package/dist/transactions/transactions.api.d.ts.map +1 -0
  20. package/dist/transactions/transactions.d.ts +56 -0
  21. package/dist/transactions/transactions.d.ts.map +1 -0
  22. package/dist/transactions/transactions.public-api.d.ts +8 -0
  23. package/dist/transactions/transactions.public-api.d.ts.map +1 -0
  24. package/dist/transactions/transactions.serializer.d.ts +11 -0
  25. package/dist/transactions/transactions.serializer.d.ts.map +1 -0
  26. package/dist/transactions/transactions.test.d.ts +2 -0
  27. package/dist/transactions/transactions.test.d.ts.map +1 -0
  28. package/dist/transactions/transactions.types.d.ts +249 -0
  29. package/dist/transactions/transactions.types.d.ts.map +1 -0
  30. package/dist/transactions/transactions.validation.d.ts +3 -0
  31. package/dist/transactions/transactions.validation.d.ts.map +1 -0
  32. package/dist/types/index.d.ts +2 -2
  33. package/dist/types/index.d.ts.map +1 -1
  34. package/dist/types/types.public-api.d.ts +2 -1
  35. package/dist/types/types.public-api.d.ts.map +1 -1
  36. package/package.json +5 -1
@@ -121,6 +121,14 @@ export declare const TRANSFER_STATUSES: {
121
121
  FAILED: string;
122
122
  COMPLETED: string;
123
123
  };
124
+ /**
125
+ * List of all possible statuses a transaction can be in.
126
+ */
127
+ export declare const TRANSACTION_STATUSES: {
128
+ PENDING: string;
129
+ DECLINED: string;
130
+ COMPLETED: string;
131
+ };
124
132
  /**
125
133
  * List of possible methods for Multi-Factor Authentication (MFA).
126
134
  * These methods are used to enhance the security of user accounts.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;CAUnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;CAQpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;CAQ7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW;IACtB;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;;OAKG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,QAAS,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;CAUnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;CAQpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;CAQ7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW;IACtB;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;;OAKG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,QAAS,CAAC"}
package/dist/index.d.ts CHANGED
@@ -4,7 +4,8 @@ import { beneficiaries } from '@beneficiaries';
4
4
  import { sepaTransfers } from '@sepa-transfers';
5
5
  import { paymentLinks } from '@payment-links';
6
6
  import { organizations } from '@organizations';
7
- import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, Item, CreatePaymentLinkSettings, PaymentLinkParams } from '@types';
8
- export { initialize, logout, cards, sepaTransfers, beneficiaries, constants, paymentLinks, organizations, };
9
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, Item, CreatePaymentLinkSettings, PaymentLinkParams, };
7
+ import { transactions } from '@transactions';
8
+ import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, Transaction, Item, CreatePaymentLinkSettings, PaymentLinkParams } from '@types';
9
+ export { initialize, logout, cards, sepaTransfers, beneficiaries, constants, paymentLinks, organizations, transactions, };
10
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, Transaction, Item, CreatePaymentLinkSettings, PaymentLinkParams, };
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,UAAU,EACV,MAAM,EACN,KAAK,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,GACd,CAAC;AACF,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,GAClB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,UAAU,EACV,MAAM,EACN,KAAK,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,EACb,YAAY,GACb,CAAC;AACF,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,GAClB,CAAC"}
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class n{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return n.instance||(n.instance=new n),n.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 t=n.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(!t.hasAccessToken())throw new a;return t.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",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},u={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},m={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},l={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},f=3e4;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"},AMOUNT_REQUIRING_ATTACHMENTS:f,BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:u,ENVIRONMENTS:d,IFRAME_EVENTS:o,LOCALES:m,MFA_METHODS:l,TRANSFER_DECLINE_REASONS:{BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},TRANSFER_STATUSES:{PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled",FAILED:"failed",COMPLETED:"completed"}});class p{constructor(){this.mfaPreference=l.PASSKEY,this.debugMode=!1}static getInstance(){return p.instance||(p.instance=new p),p.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=l.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}}const h=p.getInstance(),y="https://embed.qonto.com",T="https://embed-js{branch}.staging.qonto.co",_="https://embed.dev.qonto.co",I={[d.PRODUCTION]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:T,IFRAME_URL:`${T}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class b{constructor(){this.environment=d.PRODUCTION,this.branch=u.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,n=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(d).includes(e)?e:d.PRODUCTION,this.branch=Object.values(u).includes(n)?n:u.SANDBOX}static getInstance(){return b.instance||(b.instance=new b),b.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===d.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=d.PRODUCTION,this.branch=u.MASTER}getEnvironmentUrls(){if(this.environment===d.PRODUCTION)return I.production;{const e=I[this.environment];return Object.entries(e).reduce(((e,[n,t])=>({...e,[n]:t.replace("{branch}",`-${this.branch}`)})),{})}}}const w=b.getInstance(),k={requiresUI:!1};function E(e,{requiresUI:n}=k){const t=e?.uiParentElementId||h.getUIParentElementId();if(n&&!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 i=e?.mfaPreference||h.getMFAPreference();if(i){const e=(a=Object.values(l),w.isProductionEnvironment()?a.filter((e=>e!==l.MOCK)):a);if(!e.includes(i))throw new s(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(w.isProductionEnvironment()&&i===l.MOCK)throw new s("operationSettings.mfaPreference cannot be set to mock in production environment.")}var a;const r=e?.debugMode||h.getDebugMode();if(void 0!==r&&"boolean"!=typeof r)throw new s("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||h.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new s("operationSettings.proxyRequestFunction must be a function.");return{...e,uiParentElementId:t,mfaPreference:i,debugMode:r,proxyRequestFunction:o}}const A=Object.values(m);function R(e){if(!function(e){return A.includes(e)}(e))throw new s(`Unsupported locale: ${e}. The locale must be one of: ${A.join(", ")}.`);return e}function S(e){if(!e?.accessToken&&!e?.operationSettings?.proxyRequestFunction)throw new s("Either operationSettings.proxyRequestFunction or access token is required when calling initialize()");return e?.operationSettings&&E(e.operationSettings),function(e){if(e.environment){if(!["production","staging","local"].includes(e.environment))throw new s('If provided, environment must be either "production" or "staging"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.environment.PRODUCTION" or "constants.environment.STAGING"');if(e.branch&&!["master","sandbox","qa"].includes(e.branch))throw new s('If provided, branch must be either "master", "sandbox" or "qa"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.branch.MASTER" or "constants.environment.SANDBOX" and so on')}}(e),e.locale&&R(e.locale),e}class v{constructor(){this.currentLocale="en"}static getInstance(){return v.instance||(v.instance=new v),v.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const L=v.getInstance();const P={initialize:function(e){const{accessToken:n,stagingToken:i,operationSettings:a,environment:r,branch:s,locale:o}=S(e);n&&t.setAccessToken(n),i&&t.setStagingToken(i),o&&L.setLocale(o),a&&h.setSettings(a),r&&(w.setEnvironment(r),s&&w.setBranch(s))},logout:function(){t.clearAccessToken(),t.clearStagingToken(),L.setDefaultLocale(),h.clearSettings()},constants:g},{initialize:D,logout:O,constants:N}=P;class U extends i{constructor(e){super();const n=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${n}`}}function C(){return"undefined"!=typeof window&&"undefined"!=typeof document}function M(){return!C()}function $({accessToken:e,stagingToken:n,idempotencyKey:i,mfaPreference:a}){const r=new Headers;r.append("Authorization",`Bearer ${e}`);const s=n||t.getStagingToken();s&&r.append("X-Qonto-Staging-Token",s),i&&r.append("X-Qonto-Idempotency-Key",i);const o=a||h.getMFAPreference();return o&&r.append("X-Qonto-2fa-Preference",o),r.append("Content-Type","application/json"),r.append("Accept-Language",L.getLocale()),r}async function q({path:e,options:n}){const t=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,i=await fetch(t,{...n,headers:$(n.headers),body:JSON.stringify(n.body)}),a=await i.json();if(!i.ok)throw a.errors?new U(a.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${a.code}: ${a.detail}`);return a}function F(e){const n={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},t=JSON.stringify(n);return i=t,M()?Buffer.from(i).toString("base64"):btoa(i);var i}function B(e){return JSON.parse((n=e,M()?Buffer.from(n,"base64").toString("utf-8"):atob(n)));var n}function G({membershipId:e,accessToken:n,stagingToken:t}){return{path:e?`/v2/cards?holder_ids[]=${e}`:"/v2/cards",options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}function K({cardId:e,accessToken:n,stagingToken:t}){return{path:`/v2/cards?ids[]=${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}var x;!function(e){e.PENDING="pending",e.ONHOLD="onhold",e.ORDER_CANCELED="order_canceled",e.LIVE="live",e.PAUSED="paused",e.STOLEN="stolen",e.LOST="lost",e.PIN_BLOCKED="pin_blocked",e.DELETED="deleted",e.PRE_EXPIRED="pre_expired",e.EXPIRED="expired",e.DISCARDED="discarded",e.SHIPPED_LOST="shipped_lost",e.ABUSIVE="abusive"}(x||(x={}));const j={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var H,Y;function z(e,n){const t=n.filter((n=>n.requiredIfPresent?!e[n.name]&&e[n.requiredIfPresent]:void 0===e[n.name])).map((e=>e.name));if(t.length>0)throw new s(t.map((e=>`Missing required parameter: ${e}`)))}function V(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function W(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function X(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}(H||(H={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(Y||(Y={}));const Q=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],J=[...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 z(e,Q),function(e){const{membershipId:n,organizationId:t,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:m,cardLevel:l}=e,f=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(l),g=V({membershipId:n,organizationId:t,bankAccountId:i}),p=W({hasDailyLimit:a,hasTransactionLimit:r}),h=X({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),y=ee(u),T=ne(m),_=[...f,...g,...p,...h,...y,...T];if(_.length>0)throw new s(_)}(e),e}(e):function(e){z(e,J),function(e){const{membershipId:n,organizationId:t,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:m,cardLevel:l,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,shipToBusiness:h,hasAtmOption:y,hasAtmDailyLimit:T,atmDailyLimit:_,atmMonthlyLimit:I,address:b,cardDesign:w,typeOfPrint:k}=e,E=function(e){return Object.values(Y).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(l),A=function(e){const n=null!=e&&"string"!=typeof e,t=!["print","embossed",void 0,null].includes(e);return n||t?['typeOfPrint must be one of "print", "embossed" or null']:[]}(k),R=V({membershipId:n,organizationId:t,bankAccountId:i}),S=W({hasDailyLimit:a,hasTransactionLimit:r,hasAtmOption:y,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,hasAtmDailyLimit:T,shipToBusiness:h}),v=X({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:_,atmMonthlyLimit:I}),L=ee(u),P=ne(m),D=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(w),O=function(e,n){if(n)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"]}(b,h),N=[...E,...R,...S,...v,...L,...P,...A,...D,...O];if(N.length>0)throw new s(N)}(e)}(e)}function ee(e){const n=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&n?["activeDays must be an array of integers between 1 and 7"]:[]}function ne(e){const n=!Array.isArray(e)||e.some((e=>"string"!=typeof e));return void 0!==e&&n?["categories must be an array of strings"]:[]}class te extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const ie=[];for(let e=0;e<256;++e)ie.push((e+256).toString(16).slice(1));let ae;const re=new Uint8Array(16);var se={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function oe(e,n,t){if(se.randomUUID&&!e)return se.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!ae){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ae=crypto.getRandomValues.bind(crypto)}return ae(re)}();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,n=0){return(ie[e[n+0]]+ie[e[n+1]]+ie[e[n+2]]+ie[e[n+3]]+"-"+ie[e[n+4]]+ie[e[n+5]]+"-"+ie[e[n+6]]+ie[e[n+7]]+"-"+ie[e[n+8]]+ie[e[n+9]]+"-"+ie[e[n+10]]+ie[e[n+11]]+ie[e[n+12]]+ie[e[n+13]]+ie[e[n+14]]+ie[e[n+15]]).toLowerCase()}(i)}function ce({actionId:e,actionData:n}){const t=h.getMFAPreference();return{actionId:e,actionData:{...n,scaPreference:n.scaPreference||t,idempotencyKey:n.idempotencyKey||oe()}}}class de{constructor(e){this.options=e,this.iframe=null,this.parentElement=null,this.messageListeners=new Map,this.defaultTimeout=3e4;const n=new URL(e.iframeUrl);this.targetOrigin=`${n.protocol}//${n.host}`}async initialize(){if(this.iframe)return this;if(this.parentElement=document.getElementById(this.options.parentElementId),!this.parentElement)throw new te(`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,n)=>{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 t=this.options.timeout||this.defaultTimeout,i=setTimeout((()=>{window.removeEventListener("message",a),n(new te(`Could not install the authentication UI because the timeout of ${t}ms was reached.\nPlease make sure the application can reach the Internet.`))}),t),a=n=>{n.data.eventId===o.READY&&(clearTimeout(i),window.removeEventListener("message",a),e(this))};window.addEventListener("message",a),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){if(!this.iframe||!this.iframe.contentWindow)return Promise.reject(new te("Attempted to perform an Embed operation without having the authentication UI initialized."));const n=ce(e);return new Promise(((e,t)=>{const i=a=>{if(a.data?.actionId===n.actionId){if("error"===a.data.status)return this.removeMessageListener(n.actionId,i),t(new te(`An error occurred when performing the action ${n.actionId}.\n${JSON.stringify(a.data.payload)}`));this.removeMessageListener(n.actionId,i),e(a.data.payload)}};this.addMessageListener(n.actionId,i),this.iframe?.contentWindow?.postMessage(n,this.targetOrigin)}))}addMessageListener(e,n){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(n),window.addEventListener("message",n)}removeMessageListener(e,n){const t=this.messageListeners.get(e);if(t){const e=t.indexOf(n);-1!==e&&(t.splice(e,1),window.removeEventListener("message",n))}}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 ue({accessToken:e,stagingToken:n,locale:t,debugMode:i}){const a=i||!1,r=t||L.getLocale(),s=w.getEnvironmentUrls().IFRAME_URL,o=n?`;staging_token=${encodeURIComponent(n)}`:"";return`${s}?debug=${a}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function me({parentElementId:e,iframeUrl:n}){return new de({parentElementId:e,iframeUrl:n}).initialize()}function le(e){return"virtual"===e.cardLevel?function(e){const n=ge(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:oe(),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:n,card_level:e.cardLevel}}}}}(e):function(e){const n=ge(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:oe(),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:n,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 fe(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 ge(e){const n=Object.values(j);return(e||[]).filter((e=>n.includes(e)))}const pe={getCards:async function(e){try{const n=e?.cardSettings?.membershipId;if(n&&"string"!=typeof n)throw new s("membershipId must be a string");const{proxyRequestFunction:t,stagingToken:i}=E(e?.operationSettings||{});if(t){const e=F(G({membershipId:n,stagingToken:i})),a=await t(e);return B(a).body.cards.map((e=>fe(e)))}{const t=e?.operationSettings?.accessToken||r(),a=await async function({membershipId:e,accessToken:n,stagingToken:t}){const i=G({membershipId:e,accessToken:n,stagingToken:t}),{cards:a}=await q(i);return a}({membershipId:n,accessToken:t,stagingToken:i});return a.map((e=>fe(e)))}}catch(e){return Promise.reject(e)}},getCard:async function({cardSettings:e,operationSettings:n}){try{!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId parameter is required for the called function");const n=V({cardId:e.cardId});if(n.length>0)throw new s(n)}(e);const t=e.cardId,{proxyRequestFunction:i,stagingToken:a}=E(n||{});if(i){const e=F(K({cardId:t,stagingToken:a})),n=await i(e),r=B(n).body.cards;if(Array.isArray(r)&&r.length>0)return fe(r[0]);throw new s("Unable to retrieve card data")}{const e=n?.accessToken||r(),i=await async function({cardId:e,accessToken:n,stagingToken:t}){const i=K({cardId:e,accessToken:n,stagingToken:t}),{cards:a}=await q(i);return a[0]}({cardId:t,accessToken:e,stagingToken:a});return fe(i)}}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const n=r(),{uiParentElementId:i,debugMode:a}=E(e.operationSettings,{requiresUI:!0});Z(e.cardSettings);const s=ue({accessToken:n,stagingToken:t.getStagingToken()||void 0,debugMode:a}),o=await me({iframeUrl:s,parentElementId:i}),c=le(e.cardSettings),d=await o.postMessage(c);return o.destroy(),fe(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const n=r(),{uiParentElementId:i,debugMode:a}=E(e.operationSettings,{requiresUI:!0});!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const n=V({cardId:e.cardId});if(n.length>0)throw new s(n)}(e.cardSettings);const o=ue({accessToken:n,stagingToken:t.getStagingToken()||void 0,debugMode:a}),d=await me({iframeUrl:o,parentElementId:i}),u=function(e){return{actionId:c.CARD_UNLOCK,actionData:{body:{cardId:e.cardSettings.cardId}}}}(e),m=await d.postMessage(u);return d.destroy(),fe(m)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:n,accessToken:t,stagingToken:i,debugMode:a,mfaPreference:o}=E(e.operationSettings,{requiresUI:!0}),c=t||r();!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const n=V({cardId:e.cardId});if(n.length>0)throw new s(n);let t={};void 0!==e.allowPinReveal&&(t={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(t={...t,allowBlocking:e.allowBlocking});const i=W(t);if(i.length>0)throw new s(i)}(e.cardSettings);const d=await async function(e){const{accessToken:n,stagingToken:t,mfaPreference:i}=e,a={method:"GET",headers:$({accessToken:n,stagingToken:t,mfaPreference:i})},r=w.getEnvironmentUrls().THIRD_PARTY_API_URL,s=await fetch(`${r}/v2/cards/${e.cardId}/data_view`,a),o=await s.json();if(!s.ok)throw o.errors?new U(o.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${o.code}: ${o.detail}`);return o.iframe_url}({...e.cardSettings,accessToken:c,stagingToken:i,mfaPreference:o}),{allowPinReveal:u,allowBlocking:m}=e.cardSettings,l=function(e,n){const t=new URL(e);return"boolean"==typeof n.allowPinReveal&&t.searchParams.set("canSeePin",n.allowPinReveal.toString()),"boolean"==typeof n.allowBlocking&&t.searchParams.set("canBlock",n.allowBlocking.toString()),!0===n.debugMode&&t.searchParams.set("debug",n.debugMode.toString()),t.toString()}(d,{allowPinReveal:u,allowBlocking:m,debugMode:a}),f=await me({iframeUrl:l,parentElementId:n});return{destroyEmbedUI:()=>{f.destroy()}}}catch(e){return Promise.reject(e)}}},he=pe;function ye(e){const n=new URLSearchParams;return e?.page&&n.append("page",e.page.toString()),e?.itemsPerPage&&n.append("per_page",e.itemsPerPage.toString()),n}function Te({endpointUrl:e,paginationSettings:n}){return function({url:e,searchParams:n}){const t=new URL(e.toString());for(const[e,i]of n.entries())t.searchParams.append(e,i);return t}({url:new URL(e),searchParams:ye(n)})}function _e(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 Ie(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 be(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 we="/v2/sepa/beneficiaries";function ke({paginationSettings:e,accessToken:n,stagingToken:t}){const i={method:"GET",headers:{accessToken:n,stagingToken:t}},a=ye(e),r=a.size?`?${a.toString()}`:"";return{path:`${we}${r}`,options:i}}function Ee({beneficiaryId:e,accessToken:n,stagingToken:t}){return{path:`${we}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}async function Ae({accessToken:e,stagingToken:n,beneficiaryId:t}){const i=Ee({beneficiaryId:t,accessToken:e,stagingToken:n}),{beneficiary:a}=await q(i);return a}function Re({beneficiary:e,accessToken:n,stagingToken:t,idempotencyKey:i=oe()}){return{path:we,options:{method:"POST",headers:{accessToken:n,stagingToken:t,idempotencyKey:i},body:{beneficiary:be(e)}}}}function Se({beneficiaryIds:e,accessToken:n,stagingToken:t}){return{path:`${we}/untrust`,options:{method:"PATCH",headers:{accessToken:n,stagingToken:t},body:{ids:e}}}}function ve({beneficiaryParamsBeingEdited:e,accessToken:n,stagingToken:t,idempotencyKey:i,mfaPreference:a}){const{name:r,email:s,activityTag:o}=e,c={method:"PATCH",headers:{accessToken:n,stagingToken:t,idempotencyKey:i,mfaPreference:a},body:{beneficiary:{name:r,email:s,activity_tag:o}}};return{path:`${we}/${e.id}`,options:c}}const Le=[{name:"name"},{name:"iban"}];const Pe={getBeneficiaries:async function(e){const{stagingToken:n,proxyRequestFunction:t,accessToken:i,paginationSettings:a}=E(e?.operationSettings||{});if(t){const e=F(ke({paginationSettings:a})),n=B(await t(e)),i=n.body.beneficiaries.map((e=>Ie(e))),r=_e(n.body.meta);return{beneficiaries:i,...r?{meta:r}:{}}}{const e=i||r(),t=await async function({paginationSettings:e,accessToken:n,stagingToken:t}){const i=ke({paginationSettings:e,accessToken:n,stagingToken:t}),{beneficiaries:a,meta:r}=await q(i);return{beneficiaries:a,meta:r}}({accessToken:e,stagingToken:n,paginationSettings:a}),s=t.beneficiaries.map((e=>Ie(e))),o=_e(t.meta);return{beneficiaries:s,...o?{meta:o}:{}}}},getBeneficiary:async function({beneficiarySettings:e,operationSettings:n}){const t=function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:i,accessToken:a,stagingToken:o}=E(n||{});if(i){const e=F(Ee({beneficiaryId:t}));return Ie(B(await i(e)).body.beneficiary)}{const e=a||r();return Ie(await Ae({beneficiaryId:t,accessToken:e,stagingToken:o}))}},addBeneficiary:async function({beneficiarySettings:e,operationSettings:n}){const t=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");z(e,Le);const n=V({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(n.length>0)throw new s(n);return e}(e),{proxyRequestFunction:i,accessToken:a,stagingToken:o,idempotencyKey:c}=E(n||{});if(i){const e=F(Re({beneficiary:t,idempotencyKey:c}));return Ie(B(await i(e)).body.beneficiary)}{const e=a||r(),n=await async function({beneficiary:e,accessToken:n,stagingToken:t,idempotencyKey:i=oe()}){const a=Re({beneficiary:e,accessToken:n,stagingToken:t,idempotencyKey:i}),{beneficiary:r}=await q(a);return r}({beneficiary:t,accessToken:e,stagingToken:o,idempotencyKey:c});return Ie(n)}},updateBeneficiary:async function({beneficiarySettings:e,operationSettings:n}){const t=function(e){const{id:n,name:t,email:i,activityTag:a}=e||{};if(!n)throw new s("Invalid parameters were passed to the function:\nA beneficiary ID is required for the called function");if(!t&&!i&&!a)throw new s("Invalid parameters were passed to the function:\nAt least one of the following properties must be provided: name, email, activityTag");const r=V({name:t,email:i,activityTag:a});if(r.length>0)throw new s(r);return{id:n,name:t,email:i,activityTag:a}}(e),{stagingToken:i,idempotencyKey:a,mfaPreference:o,proxyRequestFunction:c}=E(n),d={beneficiaryParamsBeingEdited:t,idempotencyKey:a,mfaPreference:o};if(c){const e=F(ve(d));return Ie(B(await c(e)).body.beneficiary)}{const e=n?.accessToken||r(),t=await async function({beneficiaryParamsBeingEdited:e,accessToken:n,stagingToken:t,idempotencyKey:i,mfaPreference:a}){const r=ve({beneficiaryParamsBeingEdited:e,accessToken:n,stagingToken:t,idempotencyKey:i,mfaPreference:a}),{beneficiary:s}=await q(r);return s}({...d,accessToken:e,stagingToken:i});return Ie(t)}},untrustBeneficiaries:async function({beneficiarySettings:e,operationSettings:n}){const t=function(e){if(!e)throw new s("beneficiaryIds parameter is required for the called function");if(!Array.isArray(e)||!e.every((e=>"string"==typeof e)))throw new s("beneficiaryIds must be an array of strings");return e}(e?.beneficiaryIds),{proxyRequestFunction:i,accessToken:a,stagingToken:o}=E(n||{});if(i){const e=F(Se({beneficiaryIds:t}));return B(await i(e)).body.beneficiaries.map(Ie)}{const e=a||r(),n=await async function({beneficiaryIds:e,accessToken:n,stagingToken:t}){const i=Se({beneficiaryIds:e,accessToken:n,stagingToken:t}),{beneficiaries:a}=await q(i);return a}({beneficiaryIds:t,accessToken:e,stagingToken:o});return n.map(Ie)}}},De=Pe;function Oe(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}const Ne="/v2/sepa/bulk_transfers";function Ue(e){if(!e)throw new s("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new s("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new s("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new s("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,n)=>{!function(e,n){if(!e)throw new s(`Invalid bulkTransfer at index ${n}: bulkTransfer object is required`);if(!e.beneficiaryId&&!e.beneficiary)throw new s(`Invalid bulkTransfer at index ${n}: Either beneficiaryId for an existing beneficiary or beneficiary details must be provided`);if(e.beneficiaryId&&e.beneficiary)throw new s(`Invalid bulkTransfer at index ${n}: Provide either beneficiaryId for an existing beneficiary or beneficiary details to create/update one, not both`);if(e.beneficiary){if(!e.beneficiary.iban)throw new s(`Invalid bulkTransfer at index ${n}: IBAN is required when providing beneficiary details`);if(!e.beneficiary.name)throw new s(`Invalid bulkTransfer at index ${n}: Beneficiary name is required when providing beneficiary details`)}const t=V({beneficiaryId:e.beneficiaryId,reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),i=X({amount:e.amount}),a=[...t,...i].flat();if(a.length>0)throw new s(a);if(e.amount>f&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new s(`Invalid bulkTransfer at index ${n}: Attachments are required for transfers over €30000`)}(e,n)})),e}const Ce="browser",Me="server";class $e extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case Ce:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case Me: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."}}}function qe(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 Fe(e){const n=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:n,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}const Be="/v2/sepa/transfers";const Ge=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];async function Ke({sepaTransferSettings:e,operationSettings:n}){if(e?.beneficiary)return e.beneficiary;return Ie(await Ae({beneficiaryId:e?.beneficiaryId,accessToken:n?.accessToken,stagingToken:n?.stagingToken}))}const xe={getSepaTransfers:async function(e){const{operationSettings:n}=e||{},t=n?.accessToken||r(),i=await async function({accessToken:e,stagingToken:n,paginationSettings:t}){const i={method:"GET",headers:$({accessToken:e,stagingToken:n})},a=Te({endpointUrl:new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Be}`),paginationSettings:t}),r=await fetch(a,i);if(!r.ok)throw new U("Failed to fetch SEPA transfers");const s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{transfers:s.transfers,meta:s.meta}}({accessToken:t,stagingToken:n?.stagingToken,paginationSettings:n?.paginationSettings}),a=i.transfers.map(qe),s=_e(i.meta);return{transfers:a,...s?{meta:s}:{}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=n?.accessToken||r(),i=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);return qe(await async function({accessToken:e,stagingToken:n,sepaTransferId:t}){const i={method:"GET",headers:$({accessToken:e,stagingToken:n})},a=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Be}/${t}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.transfer}({sepaTransferId:i,accessToken:t,stagingToken:n?.stagingToken}))},createSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const i=n?.accessToken||r(),a=n?.stagingToken||t.getStagingToken(),o=n?.idempotencyKey||oe();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(z(e,Ge),!e.beneficiaryId&&!e.beneficiary)throw new s("Either beneficiaryId or beneficiary must be provided");const n=[...V({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...X({amount:e.amount})].flat();if(n.length>0)throw new s(n);if(e.amount>f&&(!e.attachmentIds||0===e.attachmentIds.length))throw new s("Attachments are required for transfers over €30,000")}(e);const u={...e,beneficiary:await Ke({sepaTransferSettings:e,operationSettings:{accessToken:i,stagingToken:a||void 0}})};if(u.beneficiary?.trusted)d=await async function({transfer:e,accessToken:n,stagingToken:t,idempotencyKey:i}){const a=Fe(e),r={method:"POST",headers:$({accessToken:n,stagingToken:t,idempotencyKey:i}),body:JSON.stringify({transfer:a})},s=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Be}`,o=await fetch(s,r),c=await o.json();if(c.errors)throw new U(c.errors.map((e=>`${e.code}: ${e.detail}`)));return c.transfer}({transfer:u,accessToken:i,stagingToken:a||void 0,idempotencyKey:o});else{if(!C())throw new $e(Ce);const{uiParentElementId:e,debugMode:t}=E(n,{requiresUI:!0});let r;try{const n=ue({accessToken:i,stagingToken:a||void 0,debugMode:t});r=await me({iframeUrl:n,parentElementId:e});const s=Fe(u);d=await r.postMessage(ce({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}}))}finally{r?.destroy()}}return qe(d)},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=n?.accessToken||r(),i=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);await async function({sepaTransferId:e,accessToken:n,stagingToken:t}){const i={method:"POST",headers:$({accessToken:n,stagingToken:t})},a=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Be}/${e}/cancel`,r=await fetch(a,i);if(204!==r.status){const e=await r.json();if(e.errors)throw new U(e.errors.map((e=>`${e.code}: ${e.detail}`)))}}({sepaTransferId:i,accessToken:t,stagingToken:n?.stagingToken})},bulkTransfers:{getBulkTransfers:async function(e){const{operationSettings:n}=e||{},t=n?.accessToken||r(),{stagingToken:i,paginationSettings:a}=E(n||{}),s=await async function({accessToken:e,stagingToken:n,paginationSettings:t}){const i={method:"GET",headers:$({accessToken:e,stagingToken:n})},a=Te({endpointUrl:new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ne}`),paginationSettings:t}),r=await fetch(a,i);if(!r.ok)throw new U("Failed to fetch SEPA bulk transfers");const s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{bulkTransfers:s.bulk_transfers,meta:s.meta}}({accessToken:t,stagingToken:i,paginationSettings:a}),o=s.bulkTransfers?.map(Oe),c=_e(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=n?.accessToken||r(),{stagingToken:i}=E(n||{}),a=function(e){if(!e)throw new s("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new s("bulkTransferId must be a string.");return e}(e?.bulkTransferId);return Oe(await async function({accessToken:e,stagingToken:n,bulkTransferId:t}){const i={method:"GET",headers:$({accessToken:e,stagingToken:n})},a=new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ne}/${t}`),r=await fetch(a,i),s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.bulk_transfer}({accessToken:t,stagingToken:i,bulkTransferId:a}))},createBulkTransfer:async function({bulkTransferSettings:e,operationSettings:n}){const i=n?.accessToken||r(),a=n?.stagingToken||t.getStagingToken(),s=n?.idempotencyKey||oe();if(Ue(e),!C())throw new $e(Ce);const{uiParentElementId:o,debugMode:d}=E(n,{requiresUI:!0});let u,m;try{const n=ue({accessToken:i,stagingToken:a||void 0,debugMode:d});m=await me({iframeUrl:n,parentElementId:o});const t={bankAccountId:e.bankAccountId,bulkTransfers:e.bulkTransfers.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))};u=await m.postMessage(ce({actionId:c.TRANSFER_BULK_CREATE,actionData:{body:t,idempotencyKey:s}}))}finally{m?.destroy()}return Oe(u)}}},je={GOOD:"good",SERVICE:"service"},He={AED:"AED",AUD:"AUD",BGN:"BGN",CAD:"CAD",CHF:"CHF",CNY:"CNY",CZK:"CZK",DKK:"DKK",EUR:"EUR",GBP:"GBP",GHS:"GHS",HKD:"HKD",HUF:"HUF",ILS:"ILS",INR:"INR",MXN:"MXN",NOK:"NOK",NZD:"NZD",PEN:"PEN",PLN:"PLN",RON:"RON",RSD:"RSD",SAR:"SAR",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",ZAR:"ZAR",ZMW:"ZMW"},Ye=e=>{if(!(e=>Object.values(He).includes(e))(e))throw new s(`currency ${e} is not valid, valid currencies are ${Object.values(He).join(", ")}`)},ze={UNIT:"unit",HOUR:"hour",DAY:"day",MONTH:"month",GRAM:"gram",KILOGRAM:"kilogram",LITER:"liter",METER:"meter",SQUARE_METER:"square_meter",CUBIC_METER:"cubic_meter",AMPERE:"ampere",NUMBER_OF_ARTICLES:"number_of_articles",CENTIMETER:"centimeter",CUBIC_METER_PER_HOUR:"cubic_meter_per_hour",GIGAJOULE:"gigajoule",GIGAWATT:"gigawatt",GIGAWATT_HOUR:"gigawatt_hour",HALF_YEAR:"half_year",JOULE:"joule",KILOJOULE:"kilojoule",KILOVAR:"kilovar",KILOWATT:"kilowatt",KILOWATT_HOUR:"kilowatt_hour",MEGAJOULE:"megajoule",MEGAWATT:"megawatt",MEGAWATT_HOUR:"megawatt_hour",MILLIGRAM:"milligram",MILLILITER:"milliliter",MILLIMETER:"millimeter",MINUTE:"minute",PAIR:"pair",QUARTER:"quarter",SECOND:"second",SET:"set",TON:"ton",TWO_WEEK:"two_week",WATT_HOUR:"watt_hour",WEEK:"week",YEAR:"year"},Ve=e=>{if(!(e=>Object.values(ze).includes(e))(e))throw new s(`unit ${e} is not valid, valid units are ${Object.values(ze).join(", ")}`)},We=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],Xe=[{name:"currency"},{name:"value"}];const Qe=e=>{if(!Object.values(je).includes(e))throw new s(`type ${e} is not valid, valid types are ${Object.values(je).join(", ")}`)},Je={getPaymentLinkCreationFlowUrl:({paymentLinkSettings:e})=>{const{items:n,authUrl:t}=e;!function(e){if(!e)throw new s("authUrl is required for the called function");const n=V({authUrl:e});if(n.length>0)throw new s(n);try{new URL(e)}catch{throw new s("authUrl is not a valid URL")}}(t),function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{z(e,We),z(e.unitPrice,Xe);const n=[...V({id:e.id,title:e.title,vatRate:e.vatRate,currency:e.unitPrice.currency,measureUnit:e.measureUnit,unitPrice:e.unitPrice.value,...e.description?{description:e.description}:{}}),...X({quantity:e.quantity})].flat();if(n.length>0)throw new s(n);Qe(e.type),Ye(e.unitPrice.currency),Ve(e.measureUnit)}))}(n);const i=new URLSearchParams({...n?{items:JSON.stringify(n)}:{}});return i.toString()?`${t}?${i.toString()}`:t}},Ze=({accessToken:e,stagingToken:n})=>({path:"/v2/organizations/",options:{method:"GET",headers:{accessToken:e,stagingToken:n}}}),en=e=>({slug:e.slug,iban:e.iban,bic:e.bic,currency:e.currency,balance:e.balance,balanceCents:e.balance_cents,authorizedBalance:e.authorized_balance,authorizedBalanceCents:e.authorized_balance_cents,name:e.name,updatedAt:new Date(e.updated_at),status:e.status,main:e.main}),nn={getBankAccounts:async e=>{const{stagingToken:n,proxyRequestFunction:t}=E(e);if(t){const e=Ze({stagingToken:n}),i=await t(F(e)),{body:a}=B(i);return a.bank_accounts.map(en)}{const t=e.accessToken||r(),i=await(async({accessToken:e,stagingToken:n})=>{const t=Ze({accessToken:e,stagingToken:n});return await q(t)})({accessToken:t,stagingToken:n});return i.bank_accounts.map(en)}}};e.beneficiaries=De,e.cards=he,e.constants=N,e.initialize=D,e.logout=O,e.organizations=nn,e.paymentLinks=Je,e.sepaTransfers=xe}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const n=t.getInstance();class a extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class i extends a{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function r(){if(!n.hasAccessToken())throw new i;return n.getAccessToken()}class s extends a{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}const o={READY:"qonto.ready"},c={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},u={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},m={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},l={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},f=3e4;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"},AMOUNT_REQUIRING_ATTACHMENTS:f,BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:u,ENVIRONMENTS:d,IFRAME_EVENTS:o,LOCALES:m,MFA_METHODS:l,TRANSACTION_STATUSES:{PENDING:"pending",DECLINED:"declined",COMPLETED:"completed"},TRANSFER_DECLINE_REASONS:{BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},TRANSFER_STATUSES:{PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled",FAILED:"failed",COMPLETED:"completed"}});class p{constructor(){this.mfaPreference=l.PASSKEY,this.debugMode=!1}static getInstance(){return p.instance||(p.instance=new p),p.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=l.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}}const h=p.getInstance(),y="https://embed.qonto.com",T="https://embed-js{branch}.staging.qonto.co",_="https://embed.dev.qonto.co",I={[d.PRODUCTION]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:T,IFRAME_URL:`${T}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class b{constructor(){this.environment=d.PRODUCTION,this.branch=u.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(d).includes(e)?e:d.PRODUCTION,this.branch=Object.values(u).includes(t)?t:u.SANDBOX}static getInstance(){return b.instance||(b.instance=new b),b.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===d.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=d.PRODUCTION,this.branch=u.MASTER}getEnvironmentUrls(){if(this.environment===d.PRODUCTION)return I.production;{const e=I[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const w=b.getInstance(),k={requiresUI:!1};function E(e,{requiresUI:t}=k){const n=e?.uiParentElementId||h.getUIParentElementId();if(t&&!n)throw new s("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");const a=e?.mfaPreference||h.getMFAPreference();if(a){const e=(i=Object.values(l),w.isProductionEnvironment()?i.filter((e=>e!==l.MOCK)):i);if(!e.includes(a))throw new s(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(w.isProductionEnvironment()&&a===l.MOCK)throw new s("operationSettings.mfaPreference cannot be set to mock in production environment.")}var i;const r=e?.debugMode||h.getDebugMode();if(void 0!==r&&"boolean"!=typeof r)throw new s("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||h.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new s("operationSettings.proxyRequestFunction must be a function.");return{...e,uiParentElementId:n,mfaPreference:a,debugMode:r,proxyRequestFunction:o}}const A=Object.values(m);function S(e){if(!function(e){return A.includes(e)}(e))throw new s(`Unsupported locale: ${e}. The locale must be one of: ${A.join(", ")}.`);return e}function R(e){if(!e?.accessToken&&!e?.operationSettings?.proxyRequestFunction)throw new s("Either operationSettings.proxyRequestFunction or access token is required when calling initialize()");return e?.operationSettings&&E(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&&S(e.locale),e}class v{constructor(){this.currentLocale="en"}static getInstance(){return v.instance||(v.instance=new v),v.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const L=v.getInstance();const P={initialize:function(e){const{accessToken:t,stagingToken:a,operationSettings:i,environment:r,branch:s,locale:o}=R(e);t&&n.setAccessToken(t),a&&n.setStagingToken(a),o&&L.setLocale(o),i&&h.setSettings(i),r&&(w.setEnvironment(r),s&&w.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),L.setDefaultLocale(),h.clearSettings()},constants:g},{initialize:D,logout:O,constants:N}=P;class U extends a{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function C(){return"undefined"!=typeof window&&"undefined"!=typeof document}function M(){return!C()}function $({accessToken:e,stagingToken:t,idempotencyKey:a,mfaPreference:i}){const r=new Headers;r.append("Authorization",`Bearer ${e}`);const s=t||n.getStagingToken();s&&r.append("X-Qonto-Staging-Token",s),a&&r.append("X-Qonto-Idempotency-Key",a);const o=i||h.getMFAPreference();return o&&r.append("X-Qonto-2fa-Preference",o),r.append("Content-Type","application/json"),r.append("Accept-Language",L.getLocale()),r}async function q({path:e,options:t}){const n=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(n,{...t,headers:$(t.headers),body:JSON.stringify(t.body)}),i=await a.json();if(!a.ok)throw i.errors?new U(i.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${i.code}: ${i.detail}`);return i}function F(e){const t={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},n=JSON.stringify(t);return a=n,M()?Buffer.from(a).toString("base64"):btoa(a);var a}function B(e){return JSON.parse((t=e,M()?Buffer.from(t,"base64").toString("utf-8"):atob(t)));var t}function G({membershipId:e,accessToken:t,stagingToken:n}){return{path:e?`/v2/cards?holder_ids[]=${e}`:"/v2/cards",options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function x({cardId:e,accessToken:t,stagingToken:n}){return{path:`/v2/cards?ids[]=${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}var K;!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"}(K||(K={}));const j={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var H,Y;function z(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 V(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function W(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function X(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}(H||(H={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(Y||(Y={}));const Q=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],J=[...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 z(e,Q),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:m,cardLevel:l}=e,f=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(l),g=V({membershipId:t,organizationId:n,bankAccountId:a}),p=W({hasDailyLimit:i,hasTransactionLimit:r}),h=X({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),y=ee(u),T=te(m),_=[...f,...g,...p,...h,...y,...T];if(_.length>0)throw new s(_)}(e),e}(e):function(e){z(e,J),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:m,cardLevel:l,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,shipToBusiness:h,hasAtmOption:y,hasAtmDailyLimit:T,atmDailyLimit:_,atmMonthlyLimit:I,address:b,cardDesign:w,typeOfPrint:k}=e,E=function(e){return Object.values(Y).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(l),A=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(k),S=V({membershipId:t,organizationId:n,bankAccountId:a}),R=W({hasDailyLimit:i,hasTransactionLimit:r,hasAtmOption:y,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,hasAtmDailyLimit:T,shipToBusiness:h}),v=X({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:_,atmMonthlyLimit:I}),L=ee(u),P=te(m),D=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(w),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"]}(b,h),N=[...E,...S,...R,...v,...L,...P,...A,...D,...O];if(N.length>0)throw new s(N)}(e)}(e)}function ee(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 te(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 ne extends a{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const ae=[];for(let e=0;e<256;++e)ae.push((e+256).toString(16).slice(1));let ie;const re=new Uint8Array(16);var se={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function oe(e,t,n){if(se.randomUUID&&!e)return se.randomUUID();const a=(e=e||{}).random??e.rng?.()??function(){if(!ie){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ie=crypto.getRandomValues.bind(crypto)}return ie(re)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=15&a[6]|64,a[8]=63&a[8]|128,function(e,t=0){return(ae[e[t+0]]+ae[e[t+1]]+ae[e[t+2]]+ae[e[t+3]]+"-"+ae[e[t+4]]+ae[e[t+5]]+"-"+ae[e[t+6]]+ae[e[t+7]]+"-"+ae[e[t+8]]+ae[e[t+9]]+"-"+ae[e[t+10]]+ae[e[t+11]]+ae[e[t+12]]+ae[e[t+13]]+ae[e[t+14]]+ae[e[t+15]]).toLowerCase()}(a)}function ce({actionId:e,actionData:t}){const n=h.getMFAPreference();return{actionId:e,actionData:{...t,scaPreference:t.scaPreference||n,idempotencyKey:t.idempotencyKey||oe()}}}class de{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 ne(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,a=setTimeout((()=>{window.removeEventListener("message",i),t(new ne(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),i=t=>{t.data.eventId===o.READY&&(clearTimeout(a),window.removeEventListener("message",i),e(this))};window.addEventListener("message",i),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){if(!this.iframe||!this.iframe.contentWindow)return Promise.reject(new ne("Attempted to perform an Embed operation without having the authentication UI initialized."));const t=ce(e);return new Promise(((e,n)=>{const a=i=>{if(i.data?.actionId===t.actionId){if("error"===i.data.status)return this.removeMessageListener(t.actionId,a),n(new ne(`An error occurred when performing the action ${t.actionId}.\n${JSON.stringify(i.data.payload)}`));this.removeMessageListener(t.actionId,a),e(i.data.payload)}};this.addMessageListener(t.actionId,a),this.iframe?.contentWindow?.postMessage(t,this.targetOrigin)}))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function ue({accessToken:e,stagingToken:t,locale:n,debugMode:a}){const i=a||!1,r=n||L.getLocale(),s=w.getEnvironmentUrls().IFRAME_URL,o=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${i}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function me({parentElementId:e,iframeUrl:t}){return new de({parentElementId:e,iframeUrl:t}).initialize()}function le(e){return"virtual"===e.cardLevel?function(e){const t=ge(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:oe(),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=ge(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:oe(),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 fe(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 ge(e){const t=Object.values(j);return(e||[]).filter((e=>t.includes(e)))}const pe={getCards:async function(e){try{const t=e?.cardSettings?.membershipId;if(t&&"string"!=typeof t)throw new s("membershipId must be a string");const{proxyRequestFunction:n,stagingToken:a}=E(e?.operationSettings||{});if(n){const e=F(G({membershipId:t,stagingToken:a})),i=await n(e);return B(i).body.cards.map((e=>fe(e)))}{const n=e?.operationSettings?.accessToken||r(),i=await async function({membershipId:e,accessToken:t,stagingToken:n}){const a=G({membershipId:e,accessToken:t,stagingToken:n}),{cards:i}=await q(a);return i}({membershipId:t,accessToken:n,stagingToken:a});return i.map((e=>fe(e)))}}catch(e){return Promise.reject(e)}},getCard:async function({cardSettings:e,operationSettings:t}){try{!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId parameter is required for the called function");const t=V({cardId:e.cardId});if(t.length>0)throw new s(t)}(e);const n=e.cardId,{proxyRequestFunction:a,stagingToken:i}=E(t||{});if(a){const e=F(x({cardId:n,stagingToken:i})),t=await a(e),r=B(t).body.cards;if(Array.isArray(r)&&r.length>0)return fe(r[0]);throw new s("Unable to retrieve card data")}{const e=t?.accessToken||r(),a=await async function({cardId:e,accessToken:t,stagingToken:n}){const a=x({cardId:e,accessToken:t,stagingToken:n}),{cards:i}=await q(a);return i[0]}({cardId:n,accessToken:e,stagingToken:i});return fe(a)}}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=E(e.operationSettings,{requiresUI:!0});Z(e.cardSettings);const s=ue({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),o=await me({iframeUrl:s,parentElementId:a}),c=le(e.cardSettings),d=await o.postMessage(c);return o.destroy(),fe(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=E(e.operationSettings,{requiresUI:!0});!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=V({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=ue({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),d=await me({iframeUrl:o,parentElementId:a}),u=function(e){return{actionId:c.CARD_UNLOCK,actionData:{body:{cardId:e.cardSettings.cardId}}}}(e),m=await d.postMessage(u);return d.destroy(),fe(m)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:t,accessToken:n,stagingToken:a,debugMode:i,mfaPreference:o}=E(e.operationSettings,{requiresUI:!0}),c=n||r();!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=V({cardId:e.cardId});if(t.length>0)throw new s(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const a=W(n);if(a.length>0)throw new s(a)}(e.cardSettings);const d=await async function(e){const{accessToken:t,stagingToken:n,mfaPreference:a}=e,i={method:"GET",headers:$({accessToken:t,stagingToken:n,mfaPreference:a})},r=w.getEnvironmentUrls().THIRD_PARTY_API_URL,s=await fetch(`${r}/v2/cards/${e.cardId}/data_view`,i),o=await s.json();if(!s.ok)throw o.errors?new U(o.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${o.code}: ${o.detail}`);return o.iframe_url}({...e.cardSettings,accessToken:c,stagingToken:a,mfaPreference:o}),{allowPinReveal:u,allowBlocking:m}=e.cardSettings,l=function(e,t){const n=new URL(e);return"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal.toString()),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking.toString()),!0===t.debugMode&&n.searchParams.set("debug",t.debugMode.toString()),n.toString()}(d,{allowPinReveal:u,allowBlocking:m,debugMode:i}),f=await me({iframeUrl:l,parentElementId:t});return{destroyEmbedUI:()=>{f.destroy()}}}catch(e){return Promise.reject(e)}}},he=pe;function ye(e){const t=new URLSearchParams;return e?.page&&t.append("page",e.page.toString()),e?.itemsPerPage&&t.append("per_page",e.itemsPerPage.toString()),t}function Te({endpointUrl:e,paginationSettings:t}){return function({url:e,searchParams:t}){const n=new URL(e.toString());for(const[e,a]of t.entries())n.searchParams.append(e,a);return n}({url:new URL(e),searchParams:ye(t)})}function _e(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 Ie(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 be(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 we="/v2/sepa/beneficiaries";function ke({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},i=ye(e),r=i.size?`?${i.toString()}`:"";return{path:`${we}${r}`,options:a}}function Ee({beneficiaryId:e,accessToken:t,stagingToken:n}){return{path:`${we}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}async function Ae({accessToken:e,stagingToken:t,beneficiaryId:n}){const a=Ee({beneficiaryId:n,accessToken:e,stagingToken:t}),{beneficiary:i}=await q(a);return i}function Se({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=oe()}){return{path:we,options:{method:"POST",headers:{accessToken:t,stagingToken:n,idempotencyKey:a},body:{beneficiary:be(e)}}}}function Re({beneficiaryIds:e,accessToken:t,stagingToken:n}){return{path:`${we}/untrust`,options:{method:"PATCH",headers:{accessToken:t,stagingToken:n},body:{ids:e}}}}function ve({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}){const{name:r,email:s,activityTag:o}=e,c={method:"PATCH",headers:{accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i},body:{beneficiary:{name:r,email:s,activity_tag:o}}};return{path:`${we}/${e.id}`,options:c}}const Le=[{name:"name"},{name:"iban"}];const Pe={getBeneficiaries:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=E(e?.operationSettings||{});if(n){const e=F(ke({paginationSettings:i})),t=B(await n(e)),a=t.body.beneficiaries.map((e=>Ie(e))),r=_e(t.body.meta);return{beneficiaries:a,...r?{meta:r}:{}}}{const e=a||r(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const a=ke({paginationSettings:e,accessToken:t,stagingToken:n}),{beneficiaries:i,meta:r}=await q(a);return{beneficiaries:i,meta:r}}({accessToken:e,stagingToken:t,paginationSettings:i}),s=n.beneficiaries.map((e=>Ie(e))),o=_e(n.meta);return{beneficiaries:s,...o?{meta:o}:{}}}},getBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:a,accessToken:i,stagingToken:o}=E(t||{});if(a){const e=F(Ee({beneficiaryId:n}));return Ie(B(await a(e)).body.beneficiary)}{const e=i||r();return Ie(await Ae({beneficiaryId:n,accessToken:e,stagingToken:o}))}},addBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new s("beneficiary must be an object");z(e,Le);const t=V({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new s(t);return e}(e),{proxyRequestFunction:a,accessToken:i,stagingToken:o,idempotencyKey:c}=E(t||{});if(a){const e=F(Se({beneficiary:n,idempotencyKey:c}));return Ie(B(await a(e)).body.beneficiary)}{const e=i||r(),t=await async function({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=oe()}){const i=Se({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a}),{beneficiary:r}=await q(i);return r}({beneficiary:n,accessToken:e,stagingToken:o,idempotencyKey:c});return Ie(t)}},updateBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){const{id:t,name:n,email:a,activityTag:i}=e||{};if(!t)throw new s("Invalid parameters were passed to the function:\nA beneficiary ID is required for the called function");if(!n&&!a&&!i)throw new s("Invalid parameters were passed to the function:\nAt least one of the following properties must be provided: name, email, activityTag");const r=V({name:n,email:a,activityTag:i});if(r.length>0)throw new s(r);return{id:t,name:n,email:a,activityTag:i}}(e),{stagingToken:a,idempotencyKey:i,mfaPreference:o,proxyRequestFunction:c}=E(t),d={beneficiaryParamsBeingEdited:n,idempotencyKey:i,mfaPreference:o};if(c){const e=F(ve(d));return Ie(B(await c(e)).body.beneficiary)}{const e=t?.accessToken||r(),n=await async function({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}){const r=ve({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}),{beneficiary:s}=await q(r);return s}({...d,accessToken:e,stagingToken:a});return Ie(n)}},untrustBeneficiaries:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiaryIds parameter is required for the called function");if(!Array.isArray(e)||!e.every((e=>"string"==typeof e)))throw new s("beneficiaryIds must be an array of strings");return e}(e?.beneficiaryIds),{proxyRequestFunction:a,accessToken:i,stagingToken:o}=E(t||{});if(a){const e=F(Re({beneficiaryIds:n}));return B(await a(e)).body.beneficiaries.map(Ie)}{const e=i||r(),t=await async function({beneficiaryIds:e,accessToken:t,stagingToken:n}){const a=Re({beneficiaryIds:e,accessToken:t,stagingToken:n}),{beneficiaries:i}=await q(a);return i}({beneficiaryIds:n,accessToken:e,stagingToken:o});return t.map(Ie)}}},De=Pe;function Oe(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}const Ne="/v2/sepa/bulk_transfers";function Ue(e){if(!e)throw new s("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new s("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new s("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new s("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,t)=>{!function(e,t){if(!e)throw new s(`Invalid bulkTransfer at index ${t}: bulkTransfer object is required`);if(!e.beneficiaryId&&!e.beneficiary)throw new s(`Invalid bulkTransfer at index ${t}: Either beneficiaryId for an existing beneficiary or beneficiary details must be provided`);if(e.beneficiaryId&&e.beneficiary)throw new s(`Invalid bulkTransfer at index ${t}: Provide either beneficiaryId for an existing beneficiary or beneficiary details to create/update one, not both`);if(e.beneficiary){if(!e.beneficiary.iban)throw new s(`Invalid bulkTransfer at index ${t}: IBAN is required when providing beneficiary details`);if(!e.beneficiary.name)throw new s(`Invalid bulkTransfer at index ${t}: Beneficiary name is required when providing beneficiary details`)}const n=V({beneficiaryId:e.beneficiaryId,reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=X({amount:e.amount}),i=[...n,...a].flat();if(i.length>0)throw new s(i);if(e.amount>f&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new s(`Invalid bulkTransfer at index ${t}: Attachments are required for transfers over €30000`)}(e,t)})),e}const Ce="browser",Me="server";class $e extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case Ce:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case Me: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."}}}function qe(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 Fe(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}const Be="/v2/sepa/transfers";const Ge=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];async function xe({sepaTransferSettings:e,operationSettings:t}){if(e?.beneficiary)return e.beneficiary;return Ie(await Ae({beneficiaryId:e?.beneficiaryId,accessToken:t?.accessToken,stagingToken:t?.stagingToken}))}const Ke={getSepaTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||r(),a=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a={method:"GET",headers:$({accessToken:e,stagingToken:t})},i=Te({endpointUrl:new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Be}`),paginationSettings:n}),r=await fetch(i,a);if(!r.ok)throw new U("Failed to fetch SEPA transfers");const s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{transfers:s.transfers,meta:s.meta}}({accessToken:n,stagingToken:t?.stagingToken,paginationSettings:t?.paginationSettings}),i=a.transfers.map(qe),s=_e(a.meta);return{transfers:i,...s?{meta:s}:{}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);return qe(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const a={method:"GET",headers:$({accessToken:e,stagingToken:t})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Be}/${n}`,r=await fetch(i,a),s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.transfer}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken}))},createSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),o=t?.idempotencyKey||oe();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(z(e,Ge),!e.beneficiaryId&&!e.beneficiary)throw new s("Either beneficiaryId or beneficiary must be provided");const t=[...V({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...X({amount:e.amount})].flat();if(t.length>0)throw new s(t);if(e.amount>f&&(!e.attachmentIds||0===e.attachmentIds.length))throw new s("Attachments are required for transfers over €30,000")}(e);const u={...e,beneficiary:await xe({sepaTransferSettings:e,operationSettings:{accessToken:a,stagingToken:i||void 0}})};if(u.beneficiary?.trusted)d=await async function({transfer:e,accessToken:t,stagingToken:n,idempotencyKey:a}){const i=Fe(e),r={method:"POST",headers:$({accessToken:t,stagingToken:n,idempotencyKey:a}),body:JSON.stringify({transfer:i})},s=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Be}`,o=await fetch(s,r),c=await o.json();if(c.errors)throw new U(c.errors.map((e=>`${e.code}: ${e.detail}`)));return c.transfer}({transfer:u,accessToken:a,stagingToken:i||void 0,idempotencyKey:o});else{if(!C())throw new $e(Ce);const{uiParentElementId:e,debugMode:n}=E(t,{requiresUI:!0});let r;try{const t=ue({accessToken:a,stagingToken:i||void 0,debugMode:n});r=await me({iframeUrl:t,parentElementId:e});const s=Fe(u);d=await r.postMessage(ce({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}}))}finally{r?.destroy()}}return qe(d)},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);await async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const a={method:"POST",headers:$({accessToken:t,stagingToken:n})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Be}/${e}/cancel`,r=await fetch(i,a);if(204!==r.status){const e=await r.json();if(e.errors)throw new U(e.errors.map((e=>`${e.code}: ${e.detail}`)))}}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken})},bulkTransfers:{getBulkTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||r(),{stagingToken:a,paginationSettings:i}=E(t||{}),s=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a={method:"GET",headers:$({accessToken:e,stagingToken:t})},i=Te({endpointUrl:new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ne}`),paginationSettings:n}),r=await fetch(i,a);if(!r.ok)throw new U("Failed to fetch SEPA bulk transfers");const s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{bulkTransfers:s.bulk_transfers,meta:s.meta}}({accessToken:n,stagingToken:a,paginationSettings:i}),o=s.bulkTransfers?.map(Oe),c=_e(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),{stagingToken:a}=E(t||{}),i=function(e){if(!e)throw new s("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new s("bulkTransferId must be a string.");return e}(e?.bulkTransferId);return Oe(await async function({accessToken:e,stagingToken:t,bulkTransferId:n}){const a={method:"GET",headers:$({accessToken:e,stagingToken:t})},i=new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ne}/${n}`),r=await fetch(i,a),s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.bulk_transfer}({accessToken:n,stagingToken:a,bulkTransferId:i}))},createBulkTransfer:async function({bulkTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),s=t?.idempotencyKey||oe();if(Ue(e),!C())throw new $e(Ce);const{uiParentElementId:o,debugMode:d}=E(t,{requiresUI:!0});let u,m;try{const t=ue({accessToken:a,stagingToken:i||void 0,debugMode:d});m=await me({iframeUrl:t,parentElementId:o});const n={bankAccountId:e.bankAccountId,bulkTransfers:e.bulkTransfers.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))};u=await m.postMessage(ce({actionId:c.TRANSFER_BULK_CREATE,actionData:{body:n,idempotencyKey:s}}))}finally{m?.destroy()}return Oe(u)}}},je={GOOD:"good",SERVICE:"service"},He={AED:"AED",AUD:"AUD",BGN:"BGN",CAD:"CAD",CHF:"CHF",CNY:"CNY",CZK:"CZK",DKK:"DKK",EUR:"EUR",GBP:"GBP",GHS:"GHS",HKD:"HKD",HUF:"HUF",ILS:"ILS",INR:"INR",MXN:"MXN",NOK:"NOK",NZD:"NZD",PEN:"PEN",PLN:"PLN",RON:"RON",RSD:"RSD",SAR:"SAR",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",ZAR:"ZAR",ZMW:"ZMW"},Ye=e=>{if(!(e=>Object.values(He).includes(e))(e))throw new s(`currency ${e} is not valid, valid currencies are ${Object.values(He).join(", ")}`)},ze={UNIT:"unit",HOUR:"hour",DAY:"day",MONTH:"month",GRAM:"gram",KILOGRAM:"kilogram",LITER:"liter",METER:"meter",SQUARE_METER:"square_meter",CUBIC_METER:"cubic_meter",AMPERE:"ampere",NUMBER_OF_ARTICLES:"number_of_articles",CENTIMETER:"centimeter",CUBIC_METER_PER_HOUR:"cubic_meter_per_hour",GIGAJOULE:"gigajoule",GIGAWATT:"gigawatt",GIGAWATT_HOUR:"gigawatt_hour",HALF_YEAR:"half_year",JOULE:"joule",KILOJOULE:"kilojoule",KILOVAR:"kilovar",KILOWATT:"kilowatt",KILOWATT_HOUR:"kilowatt_hour",MEGAJOULE:"megajoule",MEGAWATT:"megawatt",MEGAWATT_HOUR:"megawatt_hour",MILLIGRAM:"milligram",MILLILITER:"milliliter",MILLIMETER:"millimeter",MINUTE:"minute",PAIR:"pair",QUARTER:"quarter",SECOND:"second",SET:"set",TON:"ton",TWO_WEEK:"two_week",WATT_HOUR:"watt_hour",WEEK:"week",YEAR:"year"},Ve=e=>{if(!(e=>Object.values(ze).includes(e))(e))throw new s(`unit ${e} is not valid, valid units are ${Object.values(ze).join(", ")}`)},We=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],Xe=[{name:"currency"},{name:"value"}];const Qe=e=>{if(!Object.values(je).includes(e))throw new s(`type ${e} is not valid, valid types are ${Object.values(je).join(", ")}`)},Je={getPaymentLinkCreationFlowUrl:({paymentLinkSettings:e})=>{const{items:t,authUrl:n}=e;!function(e){if(!e)throw new s("authUrl is required for the called function");const t=V({authUrl:e});if(t.length>0)throw new s(t);try{new URL(e)}catch{throw new s("authUrl is not a valid URL")}}(n),function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{z(e,We),z(e.unitPrice,Xe);const t=[...V({id:e.id,title:e.title,vatRate:e.vatRate,currency:e.unitPrice.currency,measureUnit:e.measureUnit,unitPrice:e.unitPrice.value,...e.description?{description:e.description}:{}}),...X({quantity:e.quantity})].flat();if(t.length>0)throw new s(t);Qe(e.type),Ye(e.unitPrice.currency),Ve(e.measureUnit)}))}(t);const a=new URLSearchParams({...t?{items:JSON.stringify(t)}:{}});return a.toString()?`${n}?${a.toString()}`:n}},Ze=({accessToken:e,stagingToken:t})=>({path:"/v2/organizations/",options:{method:"GET",headers:{accessToken:e,stagingToken:t}}}),et=e=>({slug:e.slug,iban:e.iban,bic:e.bic,currency:e.currency,balance:e.balance,balanceCents:e.balance_cents,authorizedBalance:e.authorized_balance,authorizedBalanceCents:e.authorized_balance_cents,name:e.name,updatedAt:new Date(e.updated_at),status:e.status,main:e.main}),tt={getBankAccounts:async e=>{const{stagingToken:t,proxyRequestFunction:n}=E(e);if(n){const e=Ze({stagingToken:t}),a=await n(F(e)),{body:i}=B(a);return i.bank_accounts.map(et)}{const n=e.accessToken||r(),a=await(async({accessToken:e,stagingToken:t})=>{const n=Ze({accessToken:e,stagingToken:t});return await q(n)})({accessToken:n,stagingToken:t});return a.bank_accounts.map(et)}}},nt="/v2/transactions";function at({bankAccountId:e,iban:t,status:n,updatedAtFrom:a,updatedAtTo:i,emittedAtFrom:r,emittedAtTo:s,settledAtFrom:o,settledAtTo:c,side:d,operationType:u,withAttachments:m,paginationSettings:l,accessToken:f,stagingToken:g}){const p={method:"GET",headers:{accessToken:f,stagingToken:g}},h=new URLSearchParams;e&&h.append("bank_account_id",e),t&&h.append("iban",t),n&&h.append("status",n),a&&h.append("updated_at_from",a),i&&h.append("updated_at_to",i),r&&h.append("emitted_at_from",r),s&&h.append("emitted_at_to",s),o&&h.append("settled_at_from",o),c&&h.append("settled_at_to",c),d&&h.append("side",d),u&&h.append("operation_type",u),void 0!==m&&h.append("with_attachments",String(m));const y=ye(l);for(const[e,t]of y)h.append(e,t);const T=h.toString();return{path:`${nt}${T?`?${T}`:""}`,options:p}}function it({transactionId:e,accessToken:t,stagingToken:n}){return{path:`${nt}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function rt(e){return{transactionId:e.transaction_id,amount:e.amount,amountCents:e.amount_cents,settledBalance:e.settled_balance,settledBalanceCents:e.settled_balance_cents,attachmentIds:e.attachment_ids,localAmount:e.local_amount,localAmountCents:e.local_amount_cents,side:e.side,operationType:e.operation_type,currency:e.currency,localCurrency:e.local_currency,label:e.label,settledAt:new Date(e.settled_at),emittedAt:new Date(e.emitted_at),updatedAt:new Date(e.updated_at),status:e.status,note:e.note,reference:e.reference,vatAmount:e.vat_amount,vatAmountCents:e.vat_amount_cents,vatRate:e.vat_rate,initiatorId:e.initiator_id,labelIds:e.label_ids,attachmentLost:e.attachment_lost,attachmentRequired:e.attachment_required,cardLastDigits:e.card_last_digits,category:e.category,cashflowCategory:{name:e.cashflow_category?.name||""},cashflowSubcategory:{name:e.cashflow_subcategory?.name||""},id:e.id,subjectType:e.subject_type,...e.transfer?{transfer:{counterpartyAccountNumber:e.transfer.counterparty_account_number,counterpartyName:e.transfer.counterparty_name,counterpartyBic:e.transfer.counterparty_bic,counterpartyIban:e.transfer.counterparty_iban}}:{}}}const st={getTransactions:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=E(e?.operationSettings||{}),s={...e?.transactionSettings||{},paginationSettings:i};if(n){const e=F(at(s)),t=B(await n(e));return{transactions:t.body.transactions.map(rt),meta:t.body.meta}}{const e=a||r(),n=await async function(e){const t=at(e),{transactions:n,meta:a}=await q(t);return{transactions:n,meta:a}}({...s,accessToken:e,stagingToken:t});return{transactions:n.transactions.map(rt),meta:n.meta}}},getTransaction:async function({transactionSettings:e,operationSettings:t}){const{proxyRequestFunction:n,accessToken:a,stagingToken:i}=E(t||{}),{transactionId:o}=function(e){if(!e)throw new s("transactionSettings parameter is required for the called function");if(!e.transactionId)throw new s("transactionSettings.transactionId parameter is required for the called function");if(e.transactionId&&"string"!=typeof e.transactionId)throw new s("transactionSettings.transactionId must be a string.");return e}(e);if(n){const e=F(it({transactionId:o}));return rt(B(await n(e)).body.transaction)}{const e=a||r();return rt(await async function(e){const t=it(e),{transaction:n}=await q(t);return n}({transactionId:o,accessToken:e,stagingToken:i}))}}},ot=st;e.beneficiaries=De,e.cards=he,e.constants=N,e.initialize=D,e.logout=O,e.organizations=tt,e.paymentLinks=Je,e.sepaTransfers=Ke,e.transactions=ot}));
@@ -2,6 +2,7 @@ import type { Beneficiary, BeneficiaryDataObject } from '@beneficiaries/benefici
2
2
  import type { SepaTransferDataObject } from '@sepa-transfers/sepa-transfers.types';
3
3
  import type { BulkTransferDataObject, NewBulkTransfer, BulkTransferSettings } from '@sepa-transfers/bulk-transfers/bulk-transfers.types';
4
4
  import type { CardDataObject } from '@cards/cards.types';
5
+ import type { TransactionDataObject } from '@transactions/transactions.types';
5
6
  export declare const INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN";
6
7
  export declare const singleBeneficiary: BeneficiaryDataObject;
7
8
  export declare const newBeneficiaryDbFields: {
@@ -19,6 +20,8 @@ export declare const mockBulkTransferDataObject: BulkTransferDataObject;
19
20
  export declare const mockListOfBulkTransferDataObjects: BulkTransferDataObject[];
20
21
  export declare const mockDisplayCardIframeUrl = "https://example.com/card-iframe#access_token=any_valid_token";
21
22
  export declare const mockCardData: CardDataObject;
23
+ export declare const singleTransactionDataObject: TransactionDataObject;
24
+ export declare const mockedTransactionsList: TransactionDataObject[];
22
25
  export declare const mockBulkTransferValidBankAccountId = "bank_1";
23
26
  export declare const mockUntrustedBeneficiary: Beneficiary;
24
27
  export declare const mockValidTrustedTransfer: NewBulkTransfer;
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EACV,sBAAsB,EAGtB,eAAe,EACf,oBAAoB,EACrB,MAAM,qDAAqD,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAOzD,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAqBrE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,sBAqBxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAoBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,iEAC2B,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,cAuD1B,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,eAKnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC,eAAe,CAI7E,CAAC;AAEJ,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;CAiB1C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;CAiB7C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,WAAW,6BA2YvB,CAAC"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EACV,sBAAsB,EAGtB,eAAe,EACf,oBAAoB,EACrB,MAAM,qDAAqD,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAE9E,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAqBrE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,sBAqBxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAoBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,iEAC2B,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,cAuD1B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,qBA2CzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA8EzD,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,eAKnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC,eAAe,CAI7E,CAAC;AAEJ,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;CAiB1C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;CAiB7C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,WAAW,6BAocvB,CAAC"}
@@ -1 +1 @@
1
- const e={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",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},_={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},n={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},a={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"},N={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",FAILED:"failed",COMPLETED:"completed"},r={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},R=3e4;export{E as ACTIONS,a as ACTIVITY_TAGS,R as AMOUNT_REQUIRING_ATTACHMENTS,A as BENEFICIARY_STATUSES,n as BRANCHES,_ as ENVIRONMENTS,e as IFRAME_EVENTS,N as LOCALES,r as MFA_METHODS,I as TRANSFER_DECLINE_REASONS,i as TRANSFER_STATUSES};
1
+ const e={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",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},_={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",FAILED:"failed",COMPLETED:"completed"},r={PENDING:"pending",DECLINED:"declined",COMPLETED:"completed"},R={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},t=3e4;export{E as ACTIONS,N as ACTIVITY_TAGS,t as AMOUNT_REQUIRING_ATTACHMENTS,a as BENEFICIARY_STATUSES,n as BRANCHES,_ as ENVIRONMENTS,e as IFRAME_EVENTS,A as LOCALES,R as MFA_METHODS,r as TRANSACTION_STATUSES,I as TRANSFER_DECLINE_REASONS,i as TRANSFER_STATUSES};
package/dist/src/index.js CHANGED
@@ -1 +1 @@
1
- export{constants,initialize,logout}from"./common/index.js";export{cards}from"./cards/index.js";export{beneficiaries}from"./beneficiaries/index.js";export{sepaTransfers}from"./sepa-transfers/index.js";export{paymentLinks}from"./payment-links/index.js";export{organizations}from"./organizations/index.js";
1
+ export{constants,initialize,logout}from"./common/index.js";export{cards}from"./cards/index.js";export{beneficiaries}from"./beneficiaries/index.js";export{sepaTransfers}from"./sepa-transfers/index.js";export{paymentLinks}from"./payment-links/index.js";export{organizations}from"./organizations/index.js";export{transactions}from"./transactions/index.js";
@@ -0,0 +1 @@
1
+ import{transactions as s}from"./transactions.public-api.js";const t=s;export{t as transactions};
@@ -0,0 +1 @@
1
+ import{buildPaginationParams as t}from"../common/api-pagination/api-pagination.js";import{makeNetworkCall as n}from"../common/network/network.js";const a="/v2/transactions";function e({bankAccountId:n,iban:e,status:o,updatedAtFrom:s,updatedAtTo:p,emittedAtFrom:i,emittedAtTo:d,settledAtFrom:c,settledAtTo:r,side:m,operationType:u,withAttachments:_,paginationSettings:g,accessToken:T,stagingToken:k}){const f={method:"GET",headers:{accessToken:T,stagingToken:k}},h=new URLSearchParams;n&&h.append("bank_account_id",n),e&&h.append("iban",e),o&&h.append("status",o),s&&h.append("updated_at_from",s),p&&h.append("updated_at_to",p),i&&h.append("emitted_at_from",i),d&&h.append("emitted_at_to",d),c&&h.append("settled_at_from",c),r&&h.append("settled_at_to",r),m&&h.append("side",m),u&&h.append("operation_type",u),void 0!==_&&h.append("with_attachments",String(_));const A=t(g);for(const[t,n]of A)h.append(t,n);const w=h.toString();return{path:`${a}${w?`?${w}`:""}`,options:f}}async function o(t){const a=e(t),{transactions:o,meta:s}=await n(a);return{transactions:o,meta:s}}function s({transactionId:t,accessToken:n,stagingToken:e}){return{path:`${a}/${t}`,options:{method:"GET",headers:{accessToken:n,stagingToken:e}}}}async function p(t){const a=s(t),{transaction:e}=await n(a);return e}export{p as getTransaction,o as getTransactions,s as prepareGetTransactionCall,e as prepareGetTransactionsCall};
@@ -0,0 +1 @@
1
+ import"../common/auth/auth.js";import{validatePresenceOfAuthToken as t}from"../common/auth/auth.validate.js";import{getTransaction as n,prepareGetTransactionsCall as a,getTransactions as o,prepareGetTransactionCall as s}from"./transactions.api.js";import{validateOperationSettingsParams as i}from"../validation/operation-settings-validation.js";import{encodeNetworkCall as r,decodeNetworkResponse as e}from"../common/network/network.js";import{serializeTransaction as c}from"./transactions.serializer.js";import{validateGetTransactionParams as m}from"./transactions.validation.js";async function g(n){const{stagingToken:s,proxyRequestFunction:m,accessToken:g,paginationSettings:p}=i(n?.operationSettings||{}),u={...n?.transactionSettings||{},paginationSettings:p};if(m){const t=a(u),n=r(t),o=await m(n),s=e(o);return{transactions:s.body.transactions.map(c),meta:s.body.meta}}{const n=g||t(),a=await o({...u,accessToken:n,stagingToken:s});return{transactions:a.transactions.map(c),meta:a.meta}}}async function p({transactionSettings:a,operationSettings:o}){const{proxyRequestFunction:g,accessToken:p,stagingToken:u}=i(o||{}),{transactionId:d}=m(a);if(g){const t=s({transactionId:d}),n=r(t),a=await g(n),o=e(a);return c(o.body.transaction)}{const a=p||t(),o=await n({transactionId:d,accessToken:a,stagingToken:u});return c(o)}}export{p as getTransaction,g as getTransactions};
@@ -0,0 +1 @@
1
+ import{getTransaction as t,getTransactions as n}from"./transactions.js";const o={getTransactions:n,getTransaction:t};export{o as transactions};
@@ -0,0 +1 @@
1
+ function t(t){return{transactionId:t.transaction_id,amount:t.amount,amountCents:t.amount_cents,settledBalance:t.settled_balance,settledBalanceCents:t.settled_balance_cents,attachmentIds:t.attachment_ids,localAmount:t.local_amount,localAmountCents:t.local_amount_cents,side:t.side,operationType:t.operation_type,currency:t.currency,localCurrency:t.local_currency,label:t.label,settledAt:new Date(t.settled_at),emittedAt:new Date(t.emitted_at),updatedAt:new Date(t.updated_at),status:t.status,note:t.note,reference:t.reference,vatAmount:t.vat_amount,vatAmountCents:t.vat_amount_cents,vatRate:t.vat_rate,initiatorId:t.initiator_id,labelIds:t.label_ids,attachmentLost:t.attachment_lost,attachmentRequired:t.attachment_required,cardLastDigits:t.card_last_digits,category:t.category,cashflowCategory:{name:t.cashflow_category?.name||""},cashflowSubcategory:{name:t.cashflow_subcategory?.name||""},id:t.id,subjectType:t.subject_type,...t.transfer?{transfer:{counterpartyAccountNumber:t.transfer.counterparty_account_number,counterpartyName:t.transfer.counterparty_name,counterpartyBic:t.transfer.counterparty_bic,counterpartyIban:t.transfer.counterparty_iban}}:{}}}export{t as serializeTransaction};
@@ -0,0 +1 @@
1
+ import{InvalidParametersError as t}from"../errors/InvalidParametersError.js";function r(r){if(!r)throw new t("transactionSettings parameter is required for the called function");if(!r.transactionId)throw new t("transactionSettings.transactionId parameter is required for the called function");if(r.transactionId&&"string"!=typeof r.transactionId)throw new t("transactionSettings.transactionId must be a string.");return r}export{r as validateGetTransactionParams};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The transactions namespace contains all the functions related to transaction operations.
3
+ * It provides functionality to fetch and filter transactions for the authenticated user.
4
+ *
5
+ * It can be accessed like this:
6
+ * ```ts
7
+ * import { transactions } from '@qonto/embed-sdk/transactions';
8
+ * ```
9
+ *
10
+ * Then, the transactions object contains the functions to perform transaction operations:
11
+ * ```ts
12
+ * // Fetch all transactions with optional filtering
13
+ * const { transactions: txns, meta } = await transactions.getTransactions({
14
+ * transactionSettings: {
15
+ * status: 'completed',
16
+ * side: 'debit',
17
+ * bankAccountId: 'account_123'
18
+ * },
19
+ * operationSettings: { accessToken: 'your_token' }
20
+ * });
21
+ *
22
+ * // Fetch a specific transaction by ID
23
+ * const transaction = await transactions.getTransaction({
24
+ * transactionSettings: { transactionId: 'txn_123' },
25
+ * operationSettings: { accessToken: 'your_token' }
26
+ * });
27
+ * ```
28
+ */
29
+ export declare const transactions: {
30
+ getTransactions: typeof import("./transactions").getTransactions;
31
+ getTransaction: typeof import("./transactions").getTransaction;
32
+ };
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transactions/index.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,YAAY;;;CAAqC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { TransactionDataObject, GetTransactionsSettings, GetTransactionSettings } from './transactions.types';
2
+ import type { PaginationResponseDataObject } from '@common/api-pagination/api-pagination.types';
3
+ import { type NetworkCallDescriptor } from '@common/network/network';
4
+ import type { OperationSettings } from '@validation/operation-settings-validation';
5
+ interface GetTransactionsParams extends GetTransactionsSettings {
6
+ accessToken?: string;
7
+ stagingToken?: string;
8
+ }
9
+ interface GetTransactionParams extends GetTransactionSettings {
10
+ accessToken?: string;
11
+ stagingToken?: string;
12
+ }
13
+ interface GetTransactionsApiResponse {
14
+ transactions: TransactionDataObject[];
15
+ meta: PaginationResponseDataObject;
16
+ }
17
+ type GetTransactionsCallParams = GetTransactionsParams & OperationSettings;
18
+ export declare function prepareGetTransactionsCall({ bankAccountId, iban, status, updatedAtFrom, updatedAtTo, emittedAtFrom, emittedAtTo, settledAtFrom, settledAtTo, side, operationType, withAttachments, paginationSettings, accessToken, stagingToken, }: GetTransactionsCallParams): NetworkCallDescriptor;
19
+ export declare function getTransactions(params: GetTransactionsParams): Promise<GetTransactionsApiResponse>;
20
+ export declare function prepareGetTransactionCall({ transactionId, accessToken, stagingToken, }: GetTransactionParams): NetworkCallDescriptor;
21
+ export declare function getTransaction(params: GetTransactionParams): Promise<TransactionDataObject>;
22
+ export {};
23
+ //# sourceMappingURL=transactions.api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.api.d.ts","sourceRoot":"","sources":["../../src/transactions/transactions.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,UAAU,qBAAsB,SAAQ,uBAAuB;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,oBAAqB,SAAQ,sBAAsB;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,0BAA0B;IAClC,YAAY,EAAE,qBAAqB,EAAE,CAAC;IACtC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,KAAK,yBAAyB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;AAI3E,wBAAgB,0BAA0B,CAAC,EACzC,aAAa,EACb,IAAI,EACJ,MAAM,EACN,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,IAAI,EACJ,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,YAAY,GACb,EAAE,yBAAyB,GAAG,qBAAqB,CAqCnD;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,0BAA0B,CAAC,CAYrC;AAED,wBAAgB,yBAAyB,CAAC,EACxC,aAAa,EACb,WAAW,EACX,YAAY,GACb,EAAE,oBAAoB,GAAG,qBAAqB,CAW9C;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,qBAAqB,CAAC,CAQhC"}
@@ -0,0 +1,56 @@
1
+ import type { Transaction, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings } from './transactions.types';
2
+ import type { OperationSettings } from '@validation/operation-settings-validation';
3
+ /**
4
+ * This is the common parameter format all the transaction functions expect
5
+ * as their only parameter. It consists of a `transactionSettings` object and an
6
+ * optional `operationSettings` object. The `transactionSettings` object's
7
+ * properties will be different depending on the function being called. Read the
8
+ * docs of each transaction related function to see the expected properties of
9
+ * the `transactionSettings` object.
10
+ */
11
+ export interface TransactionParams<T> {
12
+ /**
13
+ * An object with the parameters relevant to different transaction operations.
14
+ * Read the documentation of each function to see the expected properties of
15
+ * this object.
16
+ */
17
+ transactionSettings?: T;
18
+ operationSettings?: OperationSettings;
19
+ }
20
+ /**
21
+ * Fetches the list of transactions for the current user with optional filtering.
22
+ * @param getTransactionsParams - An object containing:
23
+ * - `transactionSettings`: An object with optional filtering parameters such as
24
+ * `bankAccountId`, `iban`, `status`, `side`, `operationType`, date ranges, and
25
+ * attachment filters.
26
+ * - `operationSettings`: An object with operation-level settings such as
27
+ * `proxyRequestFunction` (preferred over using the access token flow),
28
+ * `accessToken`, `stagingToken`, `mfaPreference`, and other optional
29
+ * parameters. This function also allows managing pagination by passing the
30
+ * `paginationSettings` property under `operationSettings`, which accepts an
31
+ * object with the page and itemsPerPage properties. See {@link TransactionParams}.
32
+ * @returns A promise that resolves to an array of transactions and a `meta`
33
+ * object containing pagination state.
34
+ * @throws \{InvalidParametersError\} If any of the values provided under
35
+ * operationSettings or transactionSettings is invalid.
36
+ * @throws \{AuthenticationError\} If both the `proxyRequestFunction` and
37
+ * `accessToken` are invalid or missing within `operationSettings`.
38
+ * @throws \{EmbedApiError\} If the API request fails or returns an error.
39
+ */
40
+ export declare function getTransactions(getTransactionsParams?: TransactionParams<GetTransactionsSettings>): Promise<GetTransactionsResponse>;
41
+ /**
42
+ * Fetches a single transaction of the current user by ID.
43
+ * @param getTransactionParams - An object containing:
44
+ * - `transactionSettings`: An object with the `transactionId` property (string).
45
+ * - `operationSettings`: An object with operation-level settings such as
46
+ * `proxyRequestFunction` (preferred over using the access token flow),
47
+ * `accessToken`, `stagingToken`, `mfaPreference`, and other optional parameters.
48
+ * See {@link TransactionParams}.
49
+ * @returns A promise that resolves to a transaction.
50
+ * @throws \{InvalidParametersError\} If the `transactionId` parameter is not a string or is missing.
51
+ * @throws \{AuthenticationError\} If both the `proxyRequestFunction` and `accessToken` are invalid or missing within
52
+ * `operationSettings`.
53
+ * @throws \{EmbedApiError\} If the API request fails or returns an error.
54
+ */
55
+ export declare function getTransaction({ transactionSettings, operationSettings, }: TransactionParams<GetTransactionSettings>): Promise<Transaction>;
56
+ //# sourceMappingURL=transactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../src/transactions/transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAEX,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAUnF;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CACnC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC,uBAAuB,CAAC,GACjE,OAAO,CAAC,uBAAuB,CAAC,CAwClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAyBlE"}
@@ -0,0 +1,8 @@
1
+ import { getTransactions, getTransaction } from './transactions';
2
+ declare const transactions: {
3
+ getTransactions: typeof getTransactions;
4
+ getTransaction: typeof getTransaction;
5
+ };
6
+ export { transactions };
7
+ export type { Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, } from './transactions.types';
8
+ //# sourceMappingURL=transactions.public-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.public-api.d.ts","sourceRoot":"","sources":["../../src/transactions/transactions.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEjE,QAAA,MAAM,YAAY;;;CAGjB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,YAAY,EACV,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type Transaction, type TransactionDataObject } from './transactions.types';
2
+ /**
3
+ * Serializes raw transaction data from the API into a clean Transaction object.
4
+ * This function converts snake_case properties to camelCase, transforms date strings
5
+ * to Date objects, and handles optional transfer details.
6
+ *
7
+ * @param transactionData - Raw transaction data object from the API
8
+ * @returns Serialized transaction object with camelCase properties and Date objects
9
+ */
10
+ export declare function serializeTransaction(transactionData: TransactionDataObject): Transaction;
11
+ //# sourceMappingURL=transactions.serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.serializer.d.ts","sourceRoot":"","sources":["../../src/transactions/transactions.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,qBAAqB,GACrC,WAAW,CAkDb"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transactions.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.test.d.ts","sourceRoot":"","sources":["../../src/transactions/transactions.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,249 @@
1
+ import type { PaginationResponseDataObject } from '@common/api-pagination/api-pagination.types';
2
+ import type { TRANSACTION_STATUSES } from '@common/constants';
3
+ /**
4
+ * Raw transaction data object as received from the Qonto API.
5
+ * This interface represents the exact structure returned by the `/v2/transactions` endpoints.
6
+ */
7
+ export interface TransactionDataObject {
8
+ transaction_id: string;
9
+ amount: number;
10
+ amount_cents: number;
11
+ settled_balance: number;
12
+ settled_balance_cents: number;
13
+ attachment_ids: string[];
14
+ local_amount: number;
15
+ local_amount_cents: number;
16
+ side: 'debit' | 'credit';
17
+ operation_type: string;
18
+ currency: string;
19
+ local_currency: string;
20
+ label: string;
21
+ settled_at: string;
22
+ emitted_at: string;
23
+ updated_at: string;
24
+ status: TransactionStatus;
25
+ note: string;
26
+ reference: string | null;
27
+ vat_amount: number | null;
28
+ vat_amount_cents: number | null;
29
+ vat_rate: number | null;
30
+ initiator_id: string;
31
+ label_ids: string[];
32
+ attachment_lost: boolean;
33
+ attachment_required: boolean;
34
+ card_last_digits: string;
35
+ category: string;
36
+ cashflow_category: {
37
+ name: string;
38
+ };
39
+ cashflow_subcategory: {
40
+ name: string;
41
+ };
42
+ id: string;
43
+ subject_type: string;
44
+ transfer?: {
45
+ counterparty_account_number: string;
46
+ counterparty_name: string;
47
+ counterparty_bic: string;
48
+ counterparty_iban: string;
49
+ };
50
+ }
51
+ /**
52
+ * Serialized transaction object with camelCase properties and proper Date objects.
53
+ * This interface represents a transaction after being processed by the serializer
54
+ * for use within the SDK.
55
+ */
56
+ export interface Transaction {
57
+ /**
58
+ * Unique identifier for the transaction
59
+ */
60
+ transactionId: string;
61
+ /**
62
+ * Transaction amount in the currency
63
+ */
64
+ amount: number;
65
+ /**
66
+ * Transaction amount in cents
67
+ */
68
+ amountCents: number;
69
+ /**
70
+ * Balance after transaction settlement
71
+ */
72
+ settledBalance: number;
73
+ /**
74
+ * Balance after settlement in cents
75
+ */
76
+ settledBalanceCents: number;
77
+ /**
78
+ * List of attachment identifiers associated with this transaction
79
+ */
80
+ attachmentIds: string[];
81
+ /**
82
+ * Transaction amount in local currency
83
+ */
84
+ localAmount: number;
85
+ /**
86
+ * Local amount in cents
87
+ */
88
+ localAmountCents: number;
89
+ /**
90
+ * Transaction direction - 'credit' for incoming, 'debit' for outgoing
91
+ */
92
+ side: 'debit' | 'credit';
93
+ /**
94
+ * Type of operation (e.g., "transfer", "card_payment", "direct_debit")
95
+ */
96
+ operationType: string;
97
+ /**
98
+ * Transaction currency (e.g., "EUR", "USD")
99
+ */
100
+ currency: string;
101
+ /**
102
+ * Local currency of the transaction
103
+ */
104
+ localCurrency: string;
105
+ /**
106
+ * Transaction description/label
107
+ */
108
+ label: string;
109
+ /**
110
+ * Date and time when the transaction was settled
111
+ */
112
+ settledAt: Date;
113
+ /**
114
+ * Date and time when the transaction was emitted
115
+ */
116
+ emittedAt: Date;
117
+ /**
118
+ * Date and time when the transaction was last updated
119
+ */
120
+ updatedAt: Date;
121
+ /**
122
+ * Current status of the transaction
123
+ */
124
+ status: TransactionStatus;
125
+ /**
126
+ * Additional notes for the transaction
127
+ */
128
+ note: string;
129
+ /**
130
+ * Transaction reference identifier
131
+ */
132
+ reference: string | null;
133
+ /**
134
+ * VAT amount if applicable
135
+ */
136
+ vatAmount: number | null;
137
+ /**
138
+ * VAT amount in cents if applicable
139
+ */
140
+ vatAmountCents: number | null;
141
+ /**
142
+ * VAT rate as a percentage if applicable
143
+ */
144
+ vatRate: number | null;
145
+ /**
146
+ * ID of the person/entity who initiated the transaction
147
+ */
148
+ initiatorId: string;
149
+ /**
150
+ * Associated label identifiers for categorization
151
+ */
152
+ labelIds: string[];
153
+ /**
154
+ * Whether the transaction attachment has been lost
155
+ */
156
+ attachmentLost: boolean;
157
+ /**
158
+ * Whether an attachment is required for this transaction
159
+ */
160
+ attachmentRequired: boolean;
161
+ /**
162
+ * Last 4 digits of the card used (if card transaction)
163
+ */
164
+ cardLastDigits: string;
165
+ /**
166
+ * Transaction category
167
+ */
168
+ category: string;
169
+ /**
170
+ * Cashflow category information
171
+ */
172
+ cashflowCategory: {
173
+ name: string;
174
+ };
175
+ /**
176
+ * Cashflow subcategory information
177
+ */
178
+ cashflowSubcategory: {
179
+ name: string;
180
+ };
181
+ /**
182
+ * Alternative unique transaction identifier
183
+ */
184
+ id: string;
185
+ /**
186
+ * Type of the transaction subject
187
+ */
188
+ subjectType: string;
189
+ /**
190
+ * Transfer details if this is a transfer transaction
191
+ */
192
+ transfer?: {
193
+ counterpartyAccountNumber: string;
194
+ counterpartyName: string;
195
+ counterpartyBic: string;
196
+ counterpartyIban: string;
197
+ };
198
+ }
199
+ /**
200
+ * Response object returned by the getTransactions function.
201
+ */
202
+ export interface GetTransactionsResponse {
203
+ /** Array of serialized transaction objects */
204
+ transactions: Transaction[];
205
+ /** Pagination metadata containing information about the current page, total pages, etc. */
206
+ meta?: PaginationResponseDataObject;
207
+ }
208
+ /**
209
+ * Settings object for filtering transactions in the getTransactions function.
210
+ * All properties are optional and can be combined for more specific filtering.
211
+ */
212
+ export interface GetTransactionsSettings {
213
+ /** Filter by specific bank account ID */
214
+ bankAccountId?: string;
215
+ /** Filter by specific IBAN */
216
+ iban?: string;
217
+ /** Filter by transaction status */
218
+ status?: TransactionStatus;
219
+ /** Filter transactions updated after this date (ISO string) */
220
+ updatedAtFrom?: string;
221
+ /** Filter transactions updated before this date (ISO string) */
222
+ updatedAtTo?: string;
223
+ /** Filter transactions emitted after this date (ISO string) */
224
+ emittedAtFrom?: string;
225
+ /** Filter transactions emitted before this date (ISO string) */
226
+ emittedAtTo?: string;
227
+ /** Filter transactions settled after this date (ISO string) */
228
+ settledAtFrom?: string;
229
+ /** Filter transactions settled before this date (ISO string) */
230
+ settledAtTo?: string;
231
+ /** Filter by transaction side: 'credit' for incoming, 'debit' for outgoing */
232
+ side?: 'credit' | 'debit';
233
+ /** Filter by operation type (e.g., 'transfer', 'card_payment', 'direct_debit') */
234
+ operationType?: string;
235
+ /** Filter to include only transactions with or without attachments */
236
+ withAttachments?: boolean;
237
+ }
238
+ /**
239
+ * Settings object for the getTransaction function.
240
+ */
241
+ export interface GetTransactionSettings {
242
+ /** The unique identifier of the transaction to fetch */
243
+ transactionId: string;
244
+ }
245
+ /**
246
+ * Represents the possible statuses of a transaction.
247
+ */
248
+ export type TransactionStatus = (typeof TRANSACTION_STATUSES)[keyof typeof TRANSACTION_STATUSES];
249
+ //# sourceMappingURL=transactions.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.types.d.ts","sourceRoot":"","sources":["../../src/transactions/transactions.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,oBAAoB,EAAE;QACpB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,2BAA2B,EAAE,MAAM,CAAC;QACpC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,gBAAgB,EAAE,MAAM,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,iBAAiB,CAAC;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,gBAAgB,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF;;OAEG;IACH,mBAAmB,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,yBAAyB,EAAE,MAAM,CAAC;QAClC,gBAAgB,EAAE,MAAM,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,8CAA8C;IAC9C,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,2FAA2F;IAC3F,IAAI,CAAC,EAAE,4BAA4B,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,wDAAwD;IACxD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { GetTransactionSettings } from '@transactions/transactions.types';
2
+ export declare function validateGetTransactionParams(params: GetTransactionSettings | undefined): GetTransactionSettings;
3
+ //# sourceMappingURL=transactions.validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.validation.d.ts","sourceRoot":"","sources":["../../src/transactions/transactions.validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE/E,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,sBAAsB,GAAG,SAAS,GACzC,sBAAsB,CAiBxB"}
@@ -1,3 +1,3 @@
1
- import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, GetBeneficiariesResponse, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams } from './types.public-api';
2
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams, };
1
+ import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, GetBeneficiariesResponse, Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams } from './types.public-api';
2
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams, };
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,GAClB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,eAAe,EACf,MAAM,EACN,WAAW,EAEX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,GAClB,CAAC"}
@@ -5,5 +5,6 @@ import type { PaginationState } from '@common/api-pagination/api-pagination.type
5
5
  import type { Locale } from '@common/locale/locale.types';
6
6
  import type { BankAccount, ACCOUNT_STATUS } from '@organizations/organizations.types';
7
7
  import type { CreatePaymentLinkSettings, Item, PaymentLinkParams } from '@payment-links/payment-links.types';
8
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams, };
8
+ import type { Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings } from '@transactions/transactions.types';
9
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, NewSepaTransfer, GetSepaTransfersResponse, Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams, };
9
10
  //# sourceMappingURL=types.public-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.public-api.d.ts","sourceRoot":"","sources":["../../src/types/types.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,wBAAwB,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;AAC5C,OAAO,KAAK,EACV,yBAAyB,EACzB,IAAI,EACJ,iBAAiB,EAClB,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,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,GAClB,CAAC"}
1
+ {"version":3,"file":"types.public-api.d.ts","sourceRoot":"","sources":["../../src/types/types.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,wBAAwB,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;AAC5C,OAAO,KAAK,EACV,yBAAyB,EACzB,IAAI,EACJ,iBAAiB,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,GAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qonto/embed-sdk",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "Library to embed Qonto features in your application",
5
5
  "type": "module",
6
6
  "exports": {
@@ -21,6 +21,10 @@
21
21
  "types": "./dist/sepa-transfers/index.d.ts",
22
22
  "import": "./dist/src/sepa-transfers/index.js"
23
23
  },
24
+ "./transactions": {
25
+ "types": "./dist/transactions/index.d.ts",
26
+ "import": "./dist/src/transactions/index.js"
27
+ },
24
28
  "./common": {
25
29
  "types": "./dist/common/index.d.ts",
26
30
  "import": "./dist/src/common/index.js"