@qonto/embed-sdk 0.25.1 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/common/constants.d.ts +5 -0
  2. package/dist/common/constants.d.ts.map +1 -1
  3. package/dist/index.umd.js +1 -1
  4. package/dist/mocks/handlers.d.ts +55 -2
  5. package/dist/mocks/handlers.d.ts.map +1 -1
  6. package/dist/payment-links/index.d.ts +2 -2
  7. package/dist/payment-links/payment-links.d.ts +2 -2
  8. package/dist/payment-links/payment-links.d.ts.map +1 -1
  9. package/dist/payment-links/payment-links.public-api.d.ts +1 -1
  10. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.api.d.ts +11 -5
  11. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.api.d.ts.map +1 -1
  12. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.d.ts +34 -1
  13. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.d.ts.map +1 -1
  14. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.serializer.d.ts +2 -1
  15. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.serializer.d.ts.map +1 -1
  16. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.types.d.ts +79 -0
  17. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.types.d.ts.map +1 -1
  18. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.utils.d.ts +21 -0
  19. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.utils.d.ts.map +1 -0
  20. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.utils.test.d.ts +2 -0
  21. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.utils.test.d.ts.map +1 -0
  22. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.validate.d.ts +4 -0
  23. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.validate.d.ts.map +1 -0
  24. package/dist/sepa-transfers/index.d.ts +1 -0
  25. package/dist/sepa-transfers/index.d.ts.map +1 -1
  26. package/dist/sepa-transfers/sepa-transfers.public-api.d.ts +2 -1
  27. package/dist/sepa-transfers/sepa-transfers.public-api.d.ts.map +1 -1
  28. package/dist/sepa-transfers/sepa-transfers.validate.d.ts.map +1 -1
  29. package/dist/src/common/constants.js +1 -1
  30. package/dist/src/payment-links/payment-links.js +1 -1
  31. package/dist/src/payment-links/payment-links.public-api.js +1 -1
  32. package/dist/src/sepa-transfers/bulk-transfers/bulk-transfers.js +1 -1
  33. package/dist/src/sepa-transfers/bulk-transfers/bulk-transfers.serializer.js +1 -1
  34. package/dist/src/sepa-transfers/bulk-transfers/bulk-transfers.validate.js +1 -0
  35. package/dist/src/sepa-transfers/sepa-transfers.public-api.js +1 -1
  36. package/dist/src/sepa-transfers/sepa-transfers.validate.js +1 -1
  37. package/package.json +1 -1
  38. package/dist/sepa-transfers/bulk-transfers/bulk-transfer.validate.d.ts +0 -2
  39. package/dist/sepa-transfers/bulk-transfers/bulk-transfer.validate.d.ts.map +0 -1
  40. package/dist/src/sepa-transfers/bulk-transfers/bulk-transfer.validate.js +0 -1
@@ -18,6 +18,7 @@ export declare const ACTIONS: {
18
18
  CARD_SHOW_PIN: string;
19
19
  CARD_SET_PIN: string;
20
20
  TRANSFER_SINGLE_CREATE: string;
21
+ TRANSFER_BULK_CREATE: string;
21
22
  BENEFICIARIES_TRUST: string;
22
23
  };
23
24
  /**
@@ -149,4 +150,8 @@ export declare const MFA_METHODS: {
149
150
  */
150
151
  MOCK: string;
151
152
  };
153
+ /**
154
+ * Amount threshold above which attachments are required for transfers.
155
+ */
156
+ export declare const AMOUNT_REQUIRING_ATTACHMENTS = 30000;
152
157
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;CASnB,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"}
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"}
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const n=t.getInstance();class i extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class a extends i{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function r(){if(!n.hasAccessToken())throw new a;return n.getAccessToken()}class s extends i{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}const o={READY:"qonto.ready"},c={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFER_SINGLE_CREATE:"transfer.single.create",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"};var f=Object.freeze({__proto__:null,ACTIONS:c,ACTIVITY_TAGS:{ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES: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 g{constructor(){this.mfaPreference=l.PASSKEY,this.debugMode=!1}static getInstance(){return g.instance||(g.instance=new g),g.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 p=g.getInstance(),h="https://embed.qonto.com",y="https://embed-js{branch}.staging.qonto.co",T="https://embed.dev.qonto.co",_={[d.PRODUCTION]:{IFRAME_BASE_URL:h,IFRAME_URL:`${h}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:T,IFRAME_URL:`${T}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class I{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 I.instance||(I.instance=new I),I.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 _.production;{const e=_[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const E=I.getInstance(),b={requiresUI:!1};function w(e,{requiresUI:t}=b){const n=e?.uiParentElementId||p.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 i=e?.mfaPreference||p.getMFAPreference();if(i){const e=(a=Object.values(l),E.isProductionEnvironment()?a.filter((e=>e!==l.MOCK)):a);if(!e.includes(i))throw new s(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(E.isProductionEnvironment()&&i===l.MOCK)throw new s("operationSettings.mfaPreference cannot be set to mock in production environment.")}var a;const r=e?.debugMode||p.getDebugMode();if(void 0!==r&&"boolean"!=typeof r)throw new s("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||p.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new s("operationSettings.proxyRequestFunction must be a function.");return{...e,uiParentElementId:n,mfaPreference:i,debugMode:r,proxyRequestFunction:o}}const A=Object.values(m);function k(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&&w(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&&k(e.locale),e}class S{constructor(){this.currentLocale="en"}static getInstance(){return S.instance||(S.instance=new S),S.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const L=S.getInstance();const v={initialize:function(e){const{accessToken:t,stagingToken:i,operationSettings:a,environment:r,branch:s,locale:o}=R(e);t&&n.setAccessToken(t),i&&n.setStagingToken(i),o&&L.setLocale(o),a&&p.setSettings(a),r&&(E.setEnvironment(r),s&&E.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),L.setDefaultLocale(),p.clearSettings()},constants:f},{initialize:P,logout:D,constants:O}=v;class N extends i{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function U(){return"undefined"!=typeof window&&"undefined"!=typeof document}function C(){return!U()}function M({accessToken:e,stagingToken:t,idempotencyKey:i,mfaPreference:a}){const r=new Headers;r.append("Authorization",`Bearer ${e}`);const s=t||n.getStagingToken();s&&r.append("X-Qonto-Staging-Token",s),i&&r.append("X-Qonto-Idempotency-Key",i);const o=a||p.getMFAPreference();return o&&r.append("X-Qonto-2fa-Preference",o),r.append("Content-Type","application/json"),r.append("Accept-Language",L.getLocale()),r}async function $({path:e,options:t}){const n=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,i=await fetch(n,{...t,headers:M(t.headers),body:JSON.stringify(t.body)}),a=await i.json();if(!i.ok)throw a.errors?new N(a.errors.map((e=>`${e.code}: ${e.detail}`))):new N(`${a.code}: ${a.detail}`);return a}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 i=n,C()?Buffer.from(i).toString("base64"):btoa(i);var i}function B(e){return JSON.parse((t=e,C()?Buffer.from(t,"base64").toString("utf-8"):atob(t)));var t}var q;!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"}(q||(q={}));const G={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 K,j;function x(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 H(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function Y(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function z(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"}(K||(K={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(j||(j={}));const V=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],W=[...V,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function X(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return x(e,V),function(e){const{membershipId:t,organizationId:n,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=H({membershipId:t,organizationId:n,bankAccountId:i}),p=Y({hasDailyLimit:a,hasTransactionLimit:r}),h=z({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),y=Q(u),T=J(m),_=[...f,...g,...p,...h,...y,...T];if(_.length>0)throw new s(_)}(e),e}(e):function(e){x(e,W),function(e){const{membershipId:t,organizationId:n,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:E,cardDesign:b,typeOfPrint:w}=e,A=function(e){return Object.values(j).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(l),k=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(w),R=H({membershipId:t,organizationId:n,bankAccountId:i}),S=Y({hasDailyLimit:a,hasTransactionLimit:r,hasAtmOption:y,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,hasAtmDailyLimit:T,shipToBusiness:h}),L=z({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:_,atmMonthlyLimit:I}),v=Q(u),P=J(m),D=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(b),O=function(e,t){if(t)return[];return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(E,h),N=[...A,...R,...S,...L,...v,...P,...k,...D,...O];if(N.length>0)throw new s(N)}(e)}(e)}function Q(e){const t=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function J(e){const t=!Array.isArray(e)||e.some((e=>"string"!=typeof e));return void 0!==e&&t?["categories must be an array of strings"]:[]}class Z extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const ee=[];for(let e=0;e<256;++e)ee.push((e+256).toString(16).slice(1));let te;const ne=new Uint8Array(16);var ie={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ae(e,t,n){if(ie.randomUUID&&!e)return ie.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!te){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");te=crypto.getRandomValues.bind(crypto)}return te(ne)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(ee[e[t+0]]+ee[e[t+1]]+ee[e[t+2]]+ee[e[t+3]]+"-"+ee[e[t+4]]+ee[e[t+5]]+"-"+ee[e[t+6]]+ee[e[t+7]]+"-"+ee[e[t+8]]+ee[e[t+9]]+"-"+ee[e[t+10]]+ee[e[t+11]]+ee[e[t+12]]+ee[e[t+13]]+ee[e[t+14]]+ee[e[t+15]]).toLowerCase()}(i)}class re{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 Z(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,i=setTimeout((()=>{window.removeEventListener("message",a),t(new Z(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),a=t=>{t.data.eventId===o.READY&&(clearTimeout(i),window.removeEventListener("message",a),e(this))};window.addEventListener("message",a),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){if(!this.iframe||!this.iframe.contentWindow)return Promise.reject(new Z("Attempted to perform an Embed operation without having the authentication UI initialized."));const t=function({actionId:e,actionData:t}){const n=p.getMFAPreference();return{actionId:e,actionData:{...t,scaPreference:t.scaPreference||n,idempotencyKey:t.idempotencyKey||ae()}}}(e);return new Promise(((e,n)=>{const i=a=>{if(a.data?.actionId===t.actionId){if("error"===a.data.status)return this.removeMessageListener(t.actionId,i),n(new Z(`An error occurred when performing the action ${t.actionId}.\n${JSON.stringify(a.data.payload)}`));this.removeMessageListener(t.actionId,i),e(a.data.payload)}};this.addMessageListener(t.actionId,i),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 se({accessToken:e,stagingToken:t,locale:n,debugMode:i}){const a=i||!1,r=n||L.getLocale(),s=E.getEnvironmentUrls().IFRAME_URL,o=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${a}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function oe({parentElementId:e,iframeUrl:t}){return new re({parentElementId:e,iframeUrl:t}).initialize()}function ce(e){return"virtual"===e.cardLevel?function(e){const t=ue(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ae(),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=ue(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ae(),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 de(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 ue(e){const t=Object.values(G);return(e||[]).filter((e=>t.includes(e)))}const me={getCards:async function({membershipId:e,accessToken:t,stagingToken:n}){try{const i=t||r();if(e&&"string"!=typeof e)throw new s("membershipId must be a string");const a=await async function({membershipId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:M({accessToken:t,stagingToken:n})},a=E.getEnvironmentUrls().THIRD_PARTY_API_URL,r=e?`${a}/v2/cards?holder_ids[]=${e}`:`${a}/v2/cards`,s=await fetch(r,i),o=await s.json();if(o.errors)throw new N(o.errors.map((e=>`${e.code}: ${e.detail}`)));return o.cards}({membershipId:e,accessToken:i,stagingToken:n});return a.map((e=>de(e)))}catch(e){return Promise.reject(e)}},getCard:async function({cardId:e,accessToken:t,stagingToken:n}){try{const i=t||r();if(e&&"string"!=typeof e)throw new s("cardId must be a string");const a=await async function({cardId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:M({accessToken:t,stagingToken:n})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/cards?ids[]=${e}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new N(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.cards[0]}({cardId:e,accessToken:i,stagingToken:n});return de(a)}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:i,debugMode:a}=w(e.operationSettings,{requiresUI:!0});X(e.cardSettings);const s=se({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),o=await oe({iframeUrl:s,parentElementId:i}),c=ce(e.cardSettings),d=await o.postMessage(c);return o.destroy(),de(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:i,debugMode:a}=w(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=H({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=se({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),d=await oe({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(),de(m)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:t,accessToken:n,stagingToken:i,debugMode:a,mfaPreference:o}=w(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=H({cardId:e.cardId});if(t.length>0)throw new s(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const i=Y(n);if(i.length>0)throw new s(i)}(e.cardSettings);const d=await async function(e){const{accessToken:t,stagingToken:n,mfaPreference:i}=e,a={method:"GET",headers:M({accessToken:t,stagingToken:n,mfaPreference:i})},r=E.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 N(o.errors.map((e=>`${e.code}: ${e.detail}`))):new N(`${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,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:a}),f=await oe({iframeUrl:l,parentElementId:t});return{destroyEmbedUI:()=>{f.destroy()}}}catch(e){return Promise.reject(e)}}},le=me;function fe(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 ge({endpointUrl:e,paginationSettings:t}){return function({url:e,searchParams:t}){const n=new URL(e.toString());for(const[e,i]of t.entries())n.searchParams.append(e,i);return n}({url:new URL(e),searchParams:fe(t)})}function pe(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 he(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 ye(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 Te="/v2/sepa/beneficiaries";function _e({paginationSettings:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:{accessToken:t,stagingToken:n}},a=fe(e),r=a.size?`?${a.toString()}`:"";return{path:`${Te}${r}`,options:i}}function Ie({beneficiaryId:e,accessToken:t,stagingToken:n}){return{path:`${Te}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}async function Ee({accessToken:e,stagingToken:t,beneficiaryId:n}){const i=Ie({beneficiaryId:n,accessToken:e,stagingToken:t}),{beneficiary:a}=await $(i);return a}function be({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:i=ae()}){return{path:Te,options:{method:"POST",headers:{accessToken:t,stagingToken:n,idempotencyKey:i},body:{beneficiary:ye(e)}}}}function we({beneficiaryIds:e,accessToken:t,stagingToken:n}){return{path:`${Te}/untrust`,options:{method:"PATCH",headers:{accessToken:t,stagingToken:n},body:{ids:e}}}}function Ae({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:i,mfaPreference:a}){const{name:r,email:s,activityTag:o}=e,c={method:"PATCH",headers:{accessToken:t,stagingToken:n,idempotencyKey:i,mfaPreference:a},body:{beneficiary:{name:r,email:s,activity_tag:o}}};return{path:`${Te}/${e.id}`,options:c}}const ke=[{name:"name"},{name:"iban"}];const Re={getBeneficiaries:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:i,paginationSettings:a}=w(e?.operationSettings||{});if(n){const e=F(_e({paginationSettings:a})),t=B(await n(e)),i=t.body.beneficiaries.map((e=>he(e))),r=pe(t.body.meta);return{beneficiaries:i,...r?{meta:r}:{}}}{const e=i||r(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const i=_e({paginationSettings:e,accessToken:t,stagingToken:n}),{beneficiaries:a,meta:r}=await $(i);return{beneficiaries:a,meta:r}}({accessToken:e,stagingToken:t,paginationSettings:a}),s=n.beneficiaries.map((e=>he(e))),o=pe(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:i,accessToken:a,stagingToken:o}=w(t||{});if(i){const e=F(Ie({beneficiaryId:n}));return he(B(await i(e)).body.beneficiary)}{const e=a||r();return he(await Ee({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");x(e,ke);const t=H({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:i,accessToken:a,stagingToken:o,idempotencyKey:c}=w(t||{});if(i){const e=F(be({beneficiary:n,idempotencyKey:c}));return he(B(await i(e)).body.beneficiary)}{const e=a||r(),t=await async function({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:i=ae()}){const a=be({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:i}),{beneficiary:r}=await $(a);return r}({beneficiary:n,accessToken:e,stagingToken:o,idempotencyKey:c});return he(t)}},updateBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){const{id:t,name:n,email:i,activityTag:a}=e||{};if(!t)throw new s("Invalid parameters were passed to the function:\nA beneficiary ID is required for the called function");if(!n&&!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=H({name:n,email:i,activityTag:a});if(r.length>0)throw new s(r);return{id:t,name:n,email:i,activityTag:a}}(e),{stagingToken:i,idempotencyKey:a,mfaPreference:o,proxyRequestFunction:c}=w(t),d={beneficiaryParamsBeingEdited:n,idempotencyKey:a,mfaPreference:o};if(c){const e=F(Ae(d));return he(B(await c(e)).body.beneficiary)}{const e=t?.accessToken||r(),n=await async function({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:i,mfaPreference:a}){const r=Ae({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:i,mfaPreference:a}),{beneficiary:s}=await $(r);return s}({...d,accessToken:e,stagingToken:i});return he(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:i,accessToken:a,stagingToken:o}=w(t||{});if(i){const e=F(we({beneficiaryIds:n}));return B(await i(e)).body.beneficiaries.map(he)}{const e=a||r(),t=await async function({beneficiaryIds:e,accessToken:t,stagingToken:n}){const i=we({beneficiaryIds:e,accessToken:t,stagingToken:n}),{beneficiaries:a}=await $(i);return a}({beneficiaryIds:n,accessToken:e,stagingToken:o});return t.map(he)}}},Se=Re,Le="/v2/sepa/bulk_transfers";function ve(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}function Pe(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 De(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 Oe="/v2/sepa/transfers";const Ne=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];async function Ue({sepaTransferSettings:e,operationSettings:t}){if(e?.beneficiary)return e.beneficiary;return he(await Ee({beneficiaryId:e?.beneficiaryId,accessToken:t?.accessToken,stagingToken:t?.stagingToken}))}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."}}}const Fe={getSepaTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||r(),i=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const i={method:"GET",headers:M({accessToken:e,stagingToken:t})},a=ge({endpointUrl:new URL(`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${Oe}`),paginationSettings:n}),r=await fetch(a,i);if(!r.ok)throw new N("Failed to fetch SEPA transfers");const s=await r.json();if(s.errors)throw new N(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{transfers:s.transfers,meta:s.meta}}({accessToken:n,stagingToken:t?.stagingToken,paginationSettings:t?.paginationSettings}),a=i.transfers.map(Pe),s=pe(i.meta);return{transfers:a,...s?{meta:s}:{}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.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 Pe(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const i={method:"GET",headers:M({accessToken:e,stagingToken:t})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${Oe}/${n}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new N(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.transfer}({sepaTransferId:i,accessToken:n,stagingToken:t?.stagingToken}))},createSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const i=t?.accessToken||r(),a=t?.stagingToken||n.getStagingToken(),o=t?.idempotencyKey||ae();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(x(e,Ne),!e.beneficiaryId&&!e.beneficiary)throw new s("Either beneficiaryId or beneficiary must be provided");const t=[...H({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...z({amount:e.amount})].flat();if(t.length>0)throw new s(t);if(e.amount>3e4&&(!e.attachmentIds||0===e.attachmentIds.length))throw new s("Attachments are required for transfers over €30,000")}(e);const u={...e,beneficiary:await Ue({sepaTransferSettings:e,operationSettings:{accessToken:i,stagingToken:a||void 0}})};if(u.beneficiary?.trusted)d=await async function({transfer:e,accessToken:t,stagingToken:n,idempotencyKey:i}){const a=De(e),r={method:"POST",headers:M({accessToken:t,stagingToken:n,idempotencyKey:i}),body:JSON.stringify({transfer:a})},s=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${Oe}`,o=await fetch(s,r),c=await o.json();if(c.errors)throw new N(c.errors.map((e=>`${e.code}: ${e.detail}`)));return c.transfer}({transfer:u,accessToken:i,stagingToken:a||void 0,idempotencyKey:o});else{if(!U())throw new $e(Ce);const{uiParentElementId:e,debugMode:n}=w(t,{requiresUI:!0});let r;try{const t=se({accessToken:i,stagingToken:a||void 0,debugMode:n});r=await oe({iframeUrl:t,parentElementId:e});const s=De(u);d=await r.postMessage({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}})}finally{r?.destroy()}}return Pe(d)},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.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:t,stagingToken:n}){const i={method:"POST",headers:M({accessToken:t,stagingToken:n})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${Oe}/${e}/cancel`,r=await fetch(a,i);if(204!==r.status){const e=await r.json();if(e.errors)throw new N(e.errors.map((e=>`${e.code}: ${e.detail}`)))}}({sepaTransferId:i,accessToken:n,stagingToken:t?.stagingToken})},bulkTransfers:{getBulkTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||r(),{stagingToken:i,paginationSettings:a}=w(t||{}),s=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const i={method:"GET",headers:M({accessToken:e,stagingToken:t})},a=ge({endpointUrl:new URL(`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${Le}`),paginationSettings:n}),r=await fetch(a,i);if(!r.ok)throw new N("Failed to fetch SEPA bulk transfers");const s=await r.json();if(s.errors)throw new N(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{bulkTransfers:s.bulk_transfers,meta:s.meta}}({accessToken:n,stagingToken:i,paginationSettings:a}),o=s.bulkTransfers?.map(ve),c=pe(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),{stagingToken:i}=w(t||{}),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 ve(await async function({accessToken:e,stagingToken:t,bulkTransferId:n}){const i={method:"GET",headers:M({accessToken:e,stagingToken:t})},a=new URL(`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${Le}/${n}`),r=await fetch(a,i),s=await r.json();if(s.errors)throw new N(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.bulk_transfer}({accessToken:n,stagingToken:i,bulkTransferId:a}))}}},Be={GOOD:"good",SERVICE:"service"},qe={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"},Ge=e=>{if(!(e=>Object.values(qe).includes(e))(e))throw new s(`currency ${e} is not valid, valid currencies are ${Object.values(qe).join(", ")}`)},Ke={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"},je=e=>{if(!(e=>Object.values(Ke).includes(e))(e))throw new s(`unit ${e} is not valid, valid units are ${Object.values(Ke).join(", ")}`)},xe=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],He=[{name:"currency"},{name:"value"}];const Ye=e=>{if(!Object.values(Be).includes(e))throw new s(`type ${e} is not valid, valid types are ${Object.values(Be).join(", ")}`)},ze={getCreatePaymentLinkFlowUrl:({paymentLinkSettings:e,operationSettings:t})=>{const{items:n,redirectUrl:i}=e,a=t?.accessToken||r();!function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{x(e,xe),x(e.unitPrice,He);const t=[...H({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}:{}}),...z({quantity:e.quantity})].flat();if(t.length>0)throw new s(t);Ye(e.type),Ge(e.unitPrice.currency),je(e.measureUnit)}))}(n),function(e){if(!e)throw new s("redirectUrl is required for the called function");const t=H({redirectUrl:e});if(t.length>0)throw new s(t);try{new URL(e)}catch{throw new s("redirectUrl is not a valid URL")}}(i);return`${E.getEnvironmentUrls().IFRAME_BASE_URL+"/payment-links/creation-flow/products-and-services"}#access_token=${a}?${new URLSearchParams({...n?{items:JSON.stringify(n)}:{},redirectUrl:i}).toString()}`}};e.beneficiaries=Se,e.cards=le,e.constants=O,e.initialize=P,e.logout=D,e.paymentLinks=ze,e.sepaTransfers=Fe}));
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(),E={requiresUI:!1};function k(e,{requiresUI:n}=E){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&&k(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 F({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 q(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}var G;!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"}(G||(G={}));const K={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 x,j;function H(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 Y(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function z(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function V(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"}(x||(x={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(j||(j={}));const W=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],X=[...W,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function Q(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return H(e,W),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=Y({membershipId:n,organizationId:t,bankAccountId:i}),p=z({hasDailyLimit:a,hasTransactionLimit:r}),h=V({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),y=J(u),T=Z(m),_=[...f,...g,...p,...h,...y,...T];if(_.length>0)throw new s(_)}(e),e}(e):function(e){H(e,X),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:E}=e,k=function(e){return Object.values(j).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']:[]}(E),R=Y({membershipId:n,organizationId:t,bankAccountId:i}),S=z({hasDailyLimit:a,hasTransactionLimit:r,hasAtmOption:y,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,hasAtmDailyLimit:T,shipToBusiness:h}),v=V({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:_,atmMonthlyLimit:I}),L=J(u),P=Z(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=[...k,...R,...S,...v,...L,...P,...A,...D,...O];if(N.length>0)throw new s(N)}(e)}(e)}function J(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 Z(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 ee extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const ne=[];for(let e=0;e<256;++e)ne.push((e+256).toString(16).slice(1));let te;const ie=new Uint8Array(16);var ae={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function re(e,n,t){if(ae.randomUUID&&!e)return ae.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!te){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");te=crypto.getRandomValues.bind(crypto)}return te(ie)}();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(ne[e[n+0]]+ne[e[n+1]]+ne[e[n+2]]+ne[e[n+3]]+"-"+ne[e[n+4]]+ne[e[n+5]]+"-"+ne[e[n+6]]+ne[e[n+7]]+"-"+ne[e[n+8]]+ne[e[n+9]]+"-"+ne[e[n+10]]+ne[e[n+11]]+ne[e[n+12]]+ne[e[n+13]]+ne[e[n+14]]+ne[e[n+15]]).toLowerCase()}(i)}function se({actionId:e,actionData:n}){const t=h.getMFAPreference();return{actionId:e,actionData:{...n,scaPreference:n.scaPreference||t,idempotencyKey:n.idempotencyKey||re()}}}class oe{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 ee(`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 ee(`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 ee("Attempted to perform an Embed operation without having the authentication UI initialized."));const n=se(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 ee(`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 ce({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 de({parentElementId:e,iframeUrl:n}){return new oe({parentElementId:e,iframeUrl:n}).initialize()}function ue(e){return"virtual"===e.cardLevel?function(e){const n=le(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:re(),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=le(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:re(),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 me(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 le(e){const n=Object.values(K);return(e||[]).filter((e=>n.includes(e)))}const fe={getCards:async function({membershipId:e,accessToken:n,stagingToken:t}){try{const i=n||r();if(e&&"string"!=typeof e)throw new s("membershipId must be a string");const a=await async function({membershipId:e,accessToken:n,stagingToken:t}){const i={method:"GET",headers:$({accessToken:n,stagingToken:t})},a=w.getEnvironmentUrls().THIRD_PARTY_API_URL,r=e?`${a}/v2/cards?holder_ids[]=${e}`:`${a}/v2/cards`,s=await fetch(r,i),o=await s.json();if(o.errors)throw new U(o.errors.map((e=>`${e.code}: ${e.detail}`)));return o.cards}({membershipId:e,accessToken:i,stagingToken:t});return a.map((e=>me(e)))}catch(e){return Promise.reject(e)}},getCard:async function({cardId:e,accessToken:n,stagingToken:t}){try{const i=n||r();if(e&&"string"!=typeof e)throw new s("cardId must be a string");const a=await async function({cardId:e,accessToken:n,stagingToken:t}){const i={method:"GET",headers:$({accessToken:n,stagingToken:t})},a=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/cards?ids[]=${e}`,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.cards[0]}({cardId:e,accessToken:i,stagingToken:t});return me(a)}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const n=r(),{uiParentElementId:i,debugMode:a}=k(e.operationSettings,{requiresUI:!0});Q(e.cardSettings);const s=ce({accessToken:n,stagingToken:t.getStagingToken()||void 0,debugMode:a}),o=await de({iframeUrl:s,parentElementId:i}),c=ue(e.cardSettings),d=await o.postMessage(c);return o.destroy(),me(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const n=r(),{uiParentElementId:i,debugMode:a}=k(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=Y({cardId:e.cardId});if(n.length>0)throw new s(n)}(e.cardSettings);const o=ce({accessToken:n,stagingToken:t.getStagingToken()||void 0,debugMode:a}),d=await de({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(),me(m)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:n,accessToken:t,stagingToken:i,debugMode:a,mfaPreference:o}=k(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=Y({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=z(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 de({iframeUrl:l,parentElementId:n});return{destroyEmbedUI:()=>{f.destroy()}}}catch(e){return Promise.reject(e)}}},ge=fe;function pe(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 he({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:pe(n)})}function ye(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 Te(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function _e(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const Ie="/v2/sepa/beneficiaries";function be({paginationSettings:e,accessToken:n,stagingToken:t}){const i={method:"GET",headers:{accessToken:n,stagingToken:t}},a=pe(e),r=a.size?`?${a.toString()}`:"";return{path:`${Ie}${r}`,options:i}}function we({beneficiaryId:e,accessToken:n,stagingToken:t}){return{path:`${Ie}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}async function Ee({accessToken:e,stagingToken:n,beneficiaryId:t}){const i=we({beneficiaryId:t,accessToken:e,stagingToken:n}),{beneficiary:a}=await F(i);return a}function ke({beneficiary:e,accessToken:n,stagingToken:t,idempotencyKey:i=re()}){return{path:Ie,options:{method:"POST",headers:{accessToken:n,stagingToken:t,idempotencyKey:i},body:{beneficiary:_e(e)}}}}function Ae({beneficiaryIds:e,accessToken:n,stagingToken:t}){return{path:`${Ie}/untrust`,options:{method:"PATCH",headers:{accessToken:n,stagingToken:t},body:{ids:e}}}}function Re({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:`${Ie}/${e.id}`,options:c}}const Se=[{name:"name"},{name:"iban"}];const ve={getBeneficiaries:async function(e){const{stagingToken:n,proxyRequestFunction:t,accessToken:i,paginationSettings:a}=k(e?.operationSettings||{});if(t){const e=q(be({paginationSettings:a})),n=B(await t(e)),i=n.body.beneficiaries.map((e=>Te(e))),r=ye(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=be({paginationSettings:e,accessToken:n,stagingToken:t}),{beneficiaries:a,meta:r}=await F(i);return{beneficiaries:a,meta:r}}({accessToken:e,stagingToken:n,paginationSettings:a}),s=t.beneficiaries.map((e=>Te(e))),o=ye(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}=k(n||{});if(i){const e=q(we({beneficiaryId:t}));return Te(B(await i(e)).body.beneficiary)}{const e=a||r();return Te(await Ee({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");H(e,Se);const n=Y({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}=k(n||{});if(i){const e=q(ke({beneficiary:t,idempotencyKey:c}));return Te(B(await i(e)).body.beneficiary)}{const e=a||r(),n=await async function({beneficiary:e,accessToken:n,stagingToken:t,idempotencyKey:i=re()}){const a=ke({beneficiary:e,accessToken:n,stagingToken:t,idempotencyKey:i}),{beneficiary:r}=await F(a);return r}({beneficiary:t,accessToken:e,stagingToken:o,idempotencyKey:c});return Te(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=Y({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}=k(n),d={beneficiaryParamsBeingEdited:t,idempotencyKey:a,mfaPreference:o};if(c){const e=q(Re(d));return Te(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=Re({beneficiaryParamsBeingEdited:e,accessToken:n,stagingToken:t,idempotencyKey:i,mfaPreference:a}),{beneficiary:s}=await F(r);return s}({...d,accessToken:e,stagingToken:i});return Te(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}=k(n||{});if(i){const e=q(Ae({beneficiaryIds:t}));return B(await i(e)).body.beneficiaries.map(Te)}{const e=a||r(),n=await async function({beneficiaryIds:e,accessToken:n,stagingToken:t}){const i=Ae({beneficiaryIds:e,accessToken:n,stagingToken:t}),{beneficiaries:a}=await F(i);return a}({beneficiaryIds:t,accessToken:e,stagingToken:o});return n.map(Te)}}},Le=ve;function Pe(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 De="/v2/sepa/bulk_transfers";function Oe(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=Y({beneficiaryId:e.beneficiaryId,reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),i=V({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 Ne="browser",Ue="server";class Ce extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case Ne:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case Ue: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 Me(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function $e(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 Fe="/v2/sepa/transfers";const qe=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];async function Be({sepaTransferSettings:e,operationSettings:n}){if(e?.beneficiary)return e.beneficiary;return Te(await Ee({beneficiaryId:e?.beneficiaryId,accessToken:n?.accessToken,stagingToken:n?.stagingToken}))}const Ge={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=he({endpointUrl:new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Fe}`),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(Me),s=ye(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 Me(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}${Fe}/${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||re();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(H(e,qe),!e.beneficiaryId&&!e.beneficiary)throw new s("Either beneficiaryId or beneficiary must be provided");const n=[...Y({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...V({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 Be({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=$e(e),r={method:"POST",headers:$({accessToken:n,stagingToken:t,idempotencyKey:i}),body:JSON.stringify({transfer:a})},s=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Fe}`,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 Ce(Ne);const{uiParentElementId:e,debugMode:t}=k(n,{requiresUI:!0});let r;try{const n=ce({accessToken:i,stagingToken:a||void 0,debugMode:t});r=await de({iframeUrl:n,parentElementId:e});const s=$e(u);d=await r.postMessage({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}})}finally{r?.destroy()}}return Me(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}${Fe}/${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}=k(n||{}),s=await async function({accessToken:e,stagingToken:n,paginationSettings:t}){const i={method:"GET",headers:$({accessToken:e,stagingToken:n})},a=he({endpointUrl:new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${De}`),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(Pe),c=ye(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=n?.accessToken||r(),{stagingToken:i}=k(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 Pe(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}${De}/${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||re();if(Oe(e),!C())throw new Ce(Ne);const{uiParentElementId:o,debugMode:d}=k(n,{requiresUI:!0});let u,m;try{const n=ce({accessToken:i,stagingToken:a||void 0,debugMode:d});m=await de({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(se({actionId:c.TRANSFER_BULK_CREATE,actionData:{body:t,idempotencyKey:s}}))}finally{m?.destroy()}return Pe(u)}}},Ke={GOOD:"good",SERVICE:"service"},xe={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"},je=e=>{if(!(e=>Object.values(xe).includes(e))(e))throw new s(`currency ${e} is not valid, valid currencies are ${Object.values(xe).join(", ")}`)},He={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"},Ye=e=>{if(!(e=>Object.values(He).includes(e))(e))throw new s(`unit ${e} is not valid, valid units are ${Object.values(He).join(", ")}`)},ze=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],Ve=[{name:"currency"},{name:"value"}];const We=e=>{if(!Object.values(Ke).includes(e))throw new s(`type ${e} is not valid, valid types are ${Object.values(Ke).join(", ")}`)},Xe={getPaymentLinkCreationFlowUrl:({paymentLinkSettings:e,operationSettings:n})=>{const{items:t,redirectUrl:i}=e,a=n?.accessToken||r();!function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{H(e,ze),H(e.unitPrice,Ve);const n=[...Y({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}:{}}),...V({quantity:e.quantity})].flat();if(n.length>0)throw new s(n);We(e.type),je(e.unitPrice.currency),Ye(e.measureUnit)}))}(t),function(e){if(!e)throw new s("redirectUrl is required for the called function");const n=Y({redirectUrl:e});if(n.length>0)throw new s(n);try{new URL(e)}catch{throw new s("redirectUrl is not a valid URL")}}(i);return`${w.getEnvironmentUrls().IFRAME_BASE_URL+"/payment-links/creation-flow/products-and-services"}#access_token=${a}?${new URLSearchParams({...t?{items:JSON.stringify(t)}:{},redirectUrl:i}).toString()}`}};e.beneficiaries=Le,e.cards=ge,e.constants=N,e.initialize=D,e.logout=O,e.paymentLinks=Xe,e.sepaTransfers=Ge}));
@@ -1,6 +1,6 @@
1
- import type { BeneficiaryDataObject } from '@beneficiaries/beneficiaries.types';
1
+ import type { Beneficiary, BeneficiaryDataObject } from '@beneficiaries/beneficiaries.types';
2
2
  import type { SepaTransferDataObject } from '@sepa-transfers/sepa-transfers.types';
3
- import type { BulkTransferDataObject } from '@sepa-transfers/bulk-transfers/bulk-transfers.types';
3
+ import type { BulkTransferDataObject, NewBulkTransfer, BulkTransferSettings } from '@sepa-transfers/bulk-transfers/bulk-transfers.types';
4
4
  export declare const INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN";
5
5
  export declare const singleBeneficiary: BeneficiaryDataObject;
6
6
  export declare const newBeneficiaryDbFields: {
@@ -17,5 +17,58 @@ export declare const mockListOfSepaTransferDataObjects: SepaTransferDataObject[]
17
17
  export declare const mockBulkTransferDataObject: BulkTransferDataObject;
18
18
  export declare const mockListOfBulkTransferDataObjects: BulkTransferDataObject[];
19
19
  export declare const mockDisplayCardIframeUrl = "https://example.com/card-iframe#access_token=any_valid_token";
20
+ export declare const mockBulkTransferValidBankAccountId = "bank_1";
21
+ export declare const mockUntrustedBeneficiary: Beneficiary;
22
+ export declare const mockValidTrustedTransfer: NewBulkTransfer;
23
+ export declare const mockUntrustedTransfer: NewBulkTransfer;
24
+ export declare const mockBulkTransferValidSettings: BulkTransferSettings<NewBulkTransfer>;
25
+ export declare const mockBulkTransferSingleResponse: {
26
+ id: string;
27
+ initiator_id: string;
28
+ created_at: string;
29
+ updated_at: string;
30
+ total_count: string;
31
+ pending_count: string;
32
+ completed_count: string;
33
+ failed_count: string;
34
+ results: {
35
+ client_transfer_id: string;
36
+ transfer_id: null;
37
+ errors: null;
38
+ status: string;
39
+ }[];
40
+ };
41
+ export declare const mockBulkTransferUntrustedResponse: {
42
+ id: string;
43
+ initiator_id: string;
44
+ created_at: string;
45
+ updated_at: string;
46
+ total_count: string;
47
+ pending_count: string;
48
+ completed_count: string;
49
+ failed_count: string;
50
+ results: {
51
+ client_transfer_id: string;
52
+ transfer_id: null;
53
+ errors: null;
54
+ status: string;
55
+ }[];
56
+ };
57
+ export declare const mockBulkTransferMixedResponse: {
58
+ id: string;
59
+ initiator_id: string;
60
+ created_at: string;
61
+ updated_at: string;
62
+ total_count: string;
63
+ pending_count: string;
64
+ completed_count: string;
65
+ failed_count: string;
66
+ results: {
67
+ client_transfer_id: string;
68
+ transfer_id: null;
69
+ errors: null;
70
+ status: string;
71
+ }[];
72
+ };
20
73
  export declare const mswHandlers: import("msw").HttpHandler[];
21
74
  //# sourceMappingURL=handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAGlG,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,WAAW,6BA+XvB,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;AAG7D,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;AAGjE,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,6BAmcvB,CAAC"}
@@ -8,11 +8,11 @@
8
8
  * Then, the paymentLinks object contains the functions to perform paymentLinks
9
9
  * operations:
10
10
  * ```ts
11
- * const url = paymentLinks.getCreatePaymentLinkFlowUrl({accessToken, items, redirectUrl});
11
+ * const url = paymentLinks.getPaymentLinkCreationFlowUrl({accessToken, items, redirectUrl});
12
12
  * window.open(url, '_blank');
13
13
  * ```
14
14
  */
15
15
  export declare const paymentLinks: {
16
- getCreatePaymentLinkFlowUrl: ({ paymentLinkSettings, operationSettings, }: import("./payment-links.types").PaymentLinkParams<import("./payment-links.types").CreatePaymentLinkSettings>) => string;
16
+ getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import("./payment-links.types").PaymentLinkParams<import("./payment-links.types").CreatePaymentLinkSettings>) => string;
17
17
  };
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -11,7 +11,7 @@ import type { CreatePaymentLinkSettings, PaymentLinkParams } from './payment-lin
11
11
  *
12
12
  * @example
13
13
  * ```ts
14
- * const url = getCreatePaymentLinkFlowUrl({
14
+ * const url = getPaymentLinkCreationFlowUrl({
15
15
  * paymentLinkSettings: {
16
16
  * items: [{ id: '1', title: 'Item 1', type: 'product', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: 10 }, vatRate: '20' }],
17
17
  * redirectUrl: 'https://www.example.com',
@@ -28,5 +28,5 @@ import type { CreatePaymentLinkSettings, PaymentLinkParams } from './payment-lin
28
28
  *
29
29
  * @remarks Ensure initialize has been called before calling this function if you do not provide an accessToken.
30
30
  */
31
- export declare const getCreatePaymentLinkFlowUrl: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings>) => string;
31
+ export declare const getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings>) => string;
32
32
  //# sourceMappingURL=payment-links.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"payment-links.d.ts","sourceRoot":"","sources":["../../src/payment-links/payment-links.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAU/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,2BAA2B,GAAI,6CAGzC,iBAAiB,CAAC,yBAAyB,CAAC,WAe9C,CAAC"}
1
+ {"version":3,"file":"payment-links.d.ts","sourceRoot":"","sources":["../../src/payment-links/payment-links.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAU/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,6BAA6B,GAAI,6CAG3C,iBAAiB,CAAC,yBAAyB,CAAC,WAe9C,CAAC"}
@@ -1,5 +1,5 @@
1
1
  declare const paymentLinks: {
2
- getCreatePaymentLinkFlowUrl: ({ paymentLinkSettings, operationSettings, }: import("./payment-links.types").PaymentLinkParams<import("./payment-links.types").CreatePaymentLinkSettings>) => string;
2
+ getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import("./payment-links.types").PaymentLinkParams<import("./payment-links.types").CreatePaymentLinkSettings>) => string;
3
3
  };
4
4
  export { paymentLinks };
5
5
  //# sourceMappingURL=payment-links.public-api.d.ts.map
@@ -1,21 +1,27 @@
1
1
  import type { PaginationSettings, PaginationResponseDataObject } from '@common/api-pagination/api-pagination.types';
2
- import type { BulkTransferDataObject } from './bulk-transfers.types';
3
- interface GetBulkTransfersParams {
2
+ import type { BulkTransferDataObject, NewBulkTransfer } from './bulk-transfers.types';
3
+ interface AuthParams {
4
4
  accessToken: string;
5
5
  stagingToken?: string;
6
+ }
7
+ interface GetBulkTransfersParams extends AuthParams {
6
8
  paginationSettings?: PaginationSettings;
7
9
  }
8
10
  interface GetBulkTransfersApiResponse {
9
11
  bulkTransfers: BulkTransferDataObject[];
10
12
  meta: PaginationResponseDataObject;
11
13
  }
12
- interface GetBulkTransferParams {
13
- accessToken: string;
14
- stagingToken?: string;
14
+ interface GetBulkTransferParams extends AuthParams {
15
15
  bulkTransferId: string;
16
16
  }
17
+ export interface CreateBulkTransferParams extends AuthParams {
18
+ bulkTransfers: NewBulkTransfer[];
19
+ bankAccountId: string;
20
+ idempotencyKey: string;
21
+ }
17
22
  export declare const BULK_TRANSFERS_ENDPOINT = "/v2/sepa/bulk_transfers";
18
23
  export declare function getBulkTransfers({ accessToken, stagingToken, paginationSettings, }: GetBulkTransfersParams): Promise<GetBulkTransfersApiResponse>;
19
24
  export declare function getBulkTransfer({ accessToken, stagingToken, bulkTransferId, }: GetBulkTransferParams): Promise<BulkTransferDataObject>;
25
+ export declare function createBulkTransfer({ bulkTransfers, accessToken, stagingToken, bankAccountId, idempotencyKey, }: CreateBulkTransferParams): Promise<BulkTransferDataObject>;
20
26
  export {};
21
27
  //# sourceMappingURL=bulk-transfers.api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-transfers.api.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.api.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,2BAA2B;IACnC,aAAa,EAAE,sBAAsB,EAAE,CAAC;IACxC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAEjE,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAiC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAuBzD"}
1
+ {"version":3,"file":"bulk-transfers.api.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.api.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,UAAU,UAAU;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,sBAAuB,SAAQ,UAAU;IACjD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,2BAA2B;IACnC,aAAa,EAAE,sBAAsB,EAAE,CAAC;IACxC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,UAAU,qBAAsB,SAAQ,UAAU;IAChD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,wBAAyB,SAAQ,UAAU;IAC1D,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAEjE,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAiC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAuBzD;AAED,wBAAsB,kBAAkB,CAAC,EACvC,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,GACf,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAoC5D"}
@@ -1,4 +1,4 @@
1
- import type { BulkTransfer, GetBulkTransfer, GetBulkTransfersResponse } from './bulk-transfers.types';
1
+ import type { BulkTransfer, BulkTransferParams, GetBulkTransfer, GetBulkTransfersResponse, NewBulkTransfer } from './bulk-transfers.types';
2
2
  import type { SepaTransferParams } from '@sepa-transfers/sepa-transfers.types';
3
3
  /**
4
4
  * Fetches the list of SEPA bulk transfers for the current user.
@@ -29,4 +29,37 @@ export declare function getBulkTransfers(getBulkTransfersParams?: SepaTransferPa
29
29
  * @throws \{EmbedApiError\} If the API request fails or returns an error.
30
30
  */
31
31
  export declare function getBulkTransfer({ sepaTransferSettings, operationSettings, }: SepaTransferParams<GetBulkTransfer>): Promise<BulkTransfer>;
32
+ /**
33
+ * Creates a new SEPA bulk transfer from the current user to one or more beneficiaries.
34
+ * Depending on the beneficiaries' trust status, this function may either
35
+ * create the bulk transfer directly via the API or open the UI to complete the SCA
36
+ * process for untrusted beneficiaries.
37
+ * @param params - An object containing the settings for the bulk transfer, including:
38
+ * - `bulkTransferSettings`: An object that contains the mandatory `bankAccountId` and an array of `bulkTransfers`.
39
+ * - `operationSettings`: An object with operation-level settings such as
40
+ * `accessToken`, `stagingToken`, and other optional parameters. See {@link BulkTransferParams}.
41
+ * If the transfer needs to be created
42
+ * for an untrusted beneficiary, the `operationSettings` object must also include
43
+ * the `uiParentElementId` property. This has to specify the ID of the DOM element
44
+ * where the UI for MFA will be displayed. Note that this means that creating
45
+ * transfers for untrusted beneficiaries can only happen in the client side.
46
+ * The `createBulkTransfer` function requires an `idempotencyKey` as well. If this
47
+ * property is not passed as part of `operationSettings`, a new one will be
48
+ * generated automatically.
49
+ * You can also specify an `mfaPreference` in the `operationSettings` to choose the
50
+ * multi-factor authentication method to use for the SCA flow (e.g., 'passkey',
51
+ * 'sms-otp', or 'paired-device'). If not provided, the default MFA method will be used.
52
+ * @returns A promise that resolves to a BulkTransfer object containing details of the created bulk transfer.
53
+ * @throws \{AuthenticationError\} If the access token is invalid or missing.
54
+ * Ensure initialize has been called before using this function if you are not
55
+ * passing the access token.
56
+ * @throws \{InvalidParametersError\} If the `transfer` parameter is not an object
57
+ * or is missing, or if the required properties of the transfer object are
58
+ * missing or invalid. Also thrown if `uiParentElementId` is not provided in the
59
+ * `operationSettings`, which is required for the iframe flow.
60
+ * @throws \{EmbedApiError\} If the API request fails or returns an error.
61
+ * @throws \{InvalidRuntimeError\} If the function is called in a non-browser environment.
62
+ * This operation can only be performed from a browser since it requires an iframe.
63
+ */
64
+ export declare function createBulkTransfer({ bulkTransferSettings, operationSettings, }: BulkTransferParams<NewBulkTransfer>): Promise<BulkTransfer>;
32
65
  //# sourceMappingURL=bulk-transfers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-transfers.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAK/E;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,wBAAwB,CAAC,CA0BnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAgB7D"}
1
+ {"version":3,"file":"bulk-transfers.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,YAAY,EAEZ,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAiB/E;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,wBAAwB,CAAC,CA0BnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAgB7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CA4D7D"}
@@ -1,3 +1,4 @@
1
- import type { BulkTransfer, BulkTransferDataObject } from './bulk-transfers.types';
1
+ import type { BulkTransfer, BulkTransferDataObject, NewBulkTransfer, NewBulkTransferDataObject } from './bulk-transfers.types';
2
2
  export declare function serializeBulkTransfer(data: BulkTransferDataObject): BulkTransfer;
3
+ export declare function serializeToNewBulkTransferDataObject(bulkTransfer: NewBulkTransfer): NewBulkTransferDataObject;
3
4
  //# sourceMappingURL=bulk-transfers.serializer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-transfers.serializer.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,YAAY,CAiBd"}
1
+ {"version":3,"file":"bulk-transfers.serializer.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,YAAY,CAiBd;AAED,wBAAgB,oCAAoC,CAClD,YAAY,EAAE,eAAe,GAC5B,yBAAyB,CAqB3B"}
@@ -1,5 +1,7 @@
1
+ import type { Beneficiary } from '@beneficiaries/beneficiaries.types';
1
2
  import type { PaginationState } from '@common/api-pagination/api-pagination.types';
2
3
  import type { TRANSFER_STATUSES } from '@common/constants';
4
+ import type { OperationSettings } from '@validation/operation-settings-validation';
3
5
  /**
4
6
  * Represents the possible statuses of a Bulk transfer result.
5
7
  */
@@ -150,4 +152,81 @@ export interface GetBulkTransfer {
150
152
  */
151
153
  bulkTransferId: string;
152
154
  }
155
+ export interface NewBulkTransferDataObject {
156
+ beneficiary_id: string;
157
+ client_transfer_id: string;
158
+ amount: string;
159
+ reference: string;
160
+ note?: string;
161
+ scheduled_date?: string;
162
+ attachment_ids?: string[];
163
+ }
164
+ /**
165
+ * Represents the parameters required to create a new SEPA bulk transfer.
166
+ * This interface is used to define the structure of the data needed to
167
+ * initiate a SEPA bulk transfer.
168
+ */
169
+ export interface NewBulkTransfer {
170
+ /**
171
+ * The ID of the beneficiary to whom the transfer will be made.
172
+ * Required if `beneficiary` is not provided.
173
+ */
174
+ beneficiaryId?: string;
175
+ /**
176
+ * The beneficiary details, which include information about the beneficiary
177
+ * such as their name, account number, and bank details.
178
+ * Required if `beneficiaryId` is not provided.
179
+ */
180
+ beneficiary?: Beneficiary;
181
+ /**
182
+ * A reference string for the transfer, which can be used for tracking or
183
+ * identification purposes.
184
+ */
185
+ reference: string;
186
+ /**
187
+ * The amount to be transferred, represented as a number.
188
+ */
189
+ amount: number;
190
+ /**
191
+ * An optional date when the transfer is scheduled to be processed.
192
+ * If not provided, the transfer will be processed immediately.
193
+ */
194
+ scheduledDate?: Date;
195
+ /**
196
+ * An optional note that can be included with the transfer for additional
197
+ * information or context.
198
+ */
199
+ note?: string;
200
+ /**
201
+ * An optional array of attachment IDs related to the transfer.
202
+ * Attachments are required for transfers over €30,000.
203
+ */
204
+ attachmentsIds?: string[];
205
+ /**
206
+ * A unique identifier for the transfer provided by the client.
207
+ * This ID is used to track and distinguish individual transfers within the bulk transfer creation process.
208
+ */
209
+ clientTransferId: string;
210
+ }
211
+ /**
212
+ * The settings related to SEPA bulk transfers, including the bank account ID and the bulk transfers to be processed.
213
+ */
214
+ export interface BulkTransferSettings<T> {
215
+ /**
216
+ * The ID of the bank account from which the transfers will be made.
217
+ */
218
+ bankAccountId: string;
219
+ /**
220
+ * An array of individual transfers to process in this bulk operation.
221
+ * Each transfer includes details such as beneficiary ID, amount, reference, and optional note.
222
+ */
223
+ bulkTransfers: T[];
224
+ }
225
+ export interface BulkTransferSettingsDataObject {
226
+ bank_account_id: string;
227
+ }
228
+ export interface BulkTransferParams<T> {
229
+ bulkTransferSettings: BulkTransferSettings<T>;
230
+ operationSettings?: OperationSettings;
231
+ }
153
232
  //# sourceMappingURL=bulk-transfers.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-transfers.types.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,6BAA6B,EAAE,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,MAAM,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAAC;IACzC;;OAEG;IACH,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAAC;IACzC,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,4BAA4B,EAAE,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"bulk-transfers.types.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,6BAA6B,EAAE,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,MAAM,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAAC;IACzC;;OAEG;IACH,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAAC;IACzC,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,4BAA4B,EAAE,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,EAAE,CAAC,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,8BAA8B;IAC7C,eAAe,EAAE,MAAM,CAAC;CACzB;AACD,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC9C,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC"}
@@ -0,0 +1,21 @@
1
+ import type { Beneficiary } from '../../beneficiaries/beneficiaries.types';
2
+ interface FindBeneficiaryParams {
3
+ operationSettings: {
4
+ accessToken?: string;
5
+ stagingToken?: string;
6
+ };
7
+ bulkTransferSettings: {
8
+ beneficiaryId?: string;
9
+ beneficiary?: Beneficiary;
10
+ };
11
+ }
12
+ /**
13
+ * Extracts a beneficiary object from the provided bulk transfer settings.
14
+ * If the beneficiary is not provided, it fetches it from the API using the beneficiaryId.
15
+ * @param param - The settings object containing the bulk transfer details, including the beneficiary or the beneficiary ID.
16
+
17
+ * @returns A promise that resolves to a serialized beneficiary object.
18
+ */
19
+ export declare function findBeneficiary({ bulkTransferSettings, operationSettings, }: FindBeneficiaryParams): Promise<Beneficiary>;
20
+ export {};
21
+ //# sourceMappingURL=bulk-transfers.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-transfers.utils.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAK3E,UAAU,qBAAqB;IAC7B,iBAAiB,EAAE;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,oBAAoB,EAAE;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,CAa9C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bulk-transfers.utils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-transfers.utils.test.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.utils.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { BulkTransferSettings, NewBulkTransfer } from './bulk-transfers.types';
2
+ export declare function validateBulkTransferParams(bulkTransferId: string | undefined): string;
3
+ export declare function validateCreateBulkTransferParams(bulkTransferSettings: BulkTransferSettings<NewBulkTransfer> | undefined): BulkTransferSettings<NewBulkTransfer>;
4
+ //# sourceMappingURL=bulk-transfers.validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-transfers.validate.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.validate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAGhC,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,MAAM,CAUR;AAED,wBAAgB,gCAAgC,CAC9C,oBAAoB,EAAE,oBAAoB,CAAC,eAAe,CAAC,GAAG,SAAS,yCA2BxE"}
@@ -30,6 +30,7 @@ export declare const sepaTransfers: {
30
30
  bulkTransfers: {
31
31
  getBulkTransfers: typeof import("./bulk-transfers/bulk-transfers").getBulkTransfers;
32
32
  getBulkTransfer: typeof import("./bulk-transfers/bulk-transfers").getBulkTransfer;
33
+ createBulkTransfer: typeof import("./bulk-transfers/bulk-transfers").createBulkTransfer;
33
34
  };
34
35
  };
35
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;CAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;CAAuC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { getBulkTransfers, getBulkTransfer } from './bulk-transfers/bulk-transfers';
1
+ import { getBulkTransfers, getBulkTransfer, createBulkTransfer } from './bulk-transfers/bulk-transfers';
2
2
  import { getSepaTransfers, getSepaTransfer, createSepaTransfer, cancelSepaTransfer } from './sepa-transfers';
3
3
  /**
4
4
  * The SEPA transfers namespace containing all transfer-related operations
@@ -12,6 +12,7 @@ declare const sepaTransfers: {
12
12
  bulkTransfers: {
13
13
  getBulkTransfers: typeof getBulkTransfers;
14
14
  getBulkTransfer: typeof getBulkTransfer;
15
+ createBulkTransfer: typeof createBulkTransfer;
15
16
  };
16
17
  };
17
18
  export { sepaTransfers };
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.public-api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,QAAA,MAAM,aAAa;;;;;;;;;CAUlB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"sepa-transfers.public-api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,QAAA,MAAM,aAAa;;;;;;;;;;CAWlB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.validate.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.validate.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAU5E,wBAAgB,6BAA6B,CAC3C,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,MAAM,CAUR;AAED,wBAAgB,gCAAgC,CAC9C,oBAAoB,EAAE,eAAe,GAAG,SAAS,mBAsDlD;AAED,wBAAgB,gCAAgC,CAC9C,cAAc,EAAE,MAAM,GAAG,SAAS,UAWnC"}
1
+ {"version":3,"file":"sepa-transfers.validate.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.validate.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAS5E,wBAAgB,6BAA6B,CAC3C,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,MAAM,CAUR;AAED,wBAAgB,gCAAgC,CAC9C,oBAAoB,EAAE,eAAe,GAAG,SAAS,mBAsDlD;AAED,wBAAgB,gCAAgC,CAC9C,cAAc,EAAE,MAAM,GAAG,SAAS,UAWnC"}
@@ -1 +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",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={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"};export{E as ACTIONS,N as ACTIVITY_TAGS,a as BENEFICIARY_STATUSES,n as BRANCHES,_ as ENVIRONMENTS,e as IFRAME_EVENTS,A 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"},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 +1 @@
1
- import"../common/auth/auth.js";import{validatePresenceOfAuthToken as t}from"../common/auth/auth.validate.js";import{validateItems as n,validateRedirectUrl as e}from"./validation/payment-links.validate.js";import{environmentManager as r}from"../common/environment/environment-manager.js";const o=({paymentLinkSettings:o,operationSettings:i})=>{const{items:a,redirectUrl:m}=o,s=i?.accessToken||t();n(a),e(m);return`${r.getEnvironmentUrls().IFRAME_BASE_URL+"/payment-links/creation-flow/products-and-services"}#access_token=${s}?${new URLSearchParams({...a?{items:JSON.stringify(a)}:{},redirectUrl:m}).toString()}`};export{o as getCreatePaymentLinkFlowUrl};
1
+ import"../common/auth/auth.js";import{validatePresenceOfAuthToken as t}from"../common/auth/auth.validate.js";import{validateItems as n,validateRedirectUrl as e}from"./validation/payment-links.validate.js";import{environmentManager as r}from"../common/environment/environment-manager.js";const o=({paymentLinkSettings:o,operationSettings:i})=>{const{items:a,redirectUrl:m}=o,s=i?.accessToken||t();n(a),e(m);return`${r.getEnvironmentUrls().IFRAME_BASE_URL+"/payment-links/creation-flow/products-and-services"}#access_token=${s}?${new URLSearchParams({...a?{items:JSON.stringify(a)}:{},redirectUrl:m}).toString()}`};export{o as getPaymentLinkCreationFlowUrl};
@@ -1 +1 @@
1
- import{getCreatePaymentLinkFlowUrl as t}from"./payment-links.js";const e={getCreatePaymentLinkFlowUrl:t};export{e as paymentLinks};
1
+ import{getPaymentLinkCreationFlowUrl as t}from"./payment-links.js";const n={getPaymentLinkCreationFlowUrl:t};export{n as paymentLinks};
@@ -1 +1 @@
1
- import"../../common/auth/auth.js";import{validatePresenceOfAuthToken as a}from"../../common/auth/auth.validate.js";import{serializePaginationResponse as n}from"../../common/api-pagination/api-pagination.js";import{getBulkTransfer as t,getBulkTransfers as s}from"./bulk-transfers.api.js";import{serializeBulkTransfer as o}from"./bulk-transfers.serializer.js";import{validateOperationSettingsParams as e}from"../../validation/operation-settings-validation.js";import{validateBulkTransferParams as i}from"./bulk-transfer.validate.js";async function r(t){const{operationSettings:i}=t||{},r=i?.accessToken||a(),{stagingToken:m,paginationSettings:g}=e(i||{}),p=await s({accessToken:r,stagingToken:m,paginationSettings:g}),f=p.bulkTransfers?.map(o),c=n(p.meta);return{bulkTransfers:f,...c?{meta:c}:{}}}async function m({sepaTransferSettings:n,operationSettings:s}){const r=s?.accessToken||a(),{stagingToken:m}=e(s||{}),g=i(n?.bulkTransferId),p=await t({accessToken:r,stagingToken:m,bulkTransferId:g});return o(p)}export{m as getBulkTransfer,r as getBulkTransfers};
1
+ import{authManager as n}from"../../common/auth/auth.js";import{validatePresenceOfAuthToken as e}from"../../common/auth/auth.validate.js";import{serializePaginationResponse as t}from"../../common/api-pagination/api-pagination.js";import{getBulkTransfer as o,getBulkTransfers as a}from"./bulk-transfers.api.js";import{serializeToNewBulkTransferDataObject as r,serializeBulkTransfer as s}from"./bulk-transfers.serializer.js";import{validateOperationSettingsParams as i}from"../../validation/operation-settings-validation.js";import{validateCreateBulkTransferParams as m,validateBulkTransferParams as c}from"./bulk-transfers.validate.js";import{isRunningInBrowser as u}from"../../common/runtime/runtime.validation.js";import{InvalidRuntimeError as f,RUNTIME_ENVIRONMENT as g}from"../../errors/InvalidRuntimeError.js";import{buildIframeUrl as p,createIframe as d}from"../../iframe/iframe-manager.js";import{buildIframeMessage as l}from"../../iframe/iframe-message-builder.js";import{ACTIONS as k}from"../../common/constants.js";import T from"../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";async function b(n){const{operationSettings:o}=n||{},r=o?.accessToken||e(),{stagingToken:m,paginationSettings:c}=i(o||{}),u=await a({accessToken:r,stagingToken:m,paginationSettings:c}),f=u.bulkTransfers?.map(s),g=t(u.meta);return{bulkTransfers:f,...g?{meta:g}:{}}}async function j({sepaTransferSettings:n,operationSettings:t}){const a=t?.accessToken||e(),{stagingToken:r}=i(t||{}),m=c(n?.bulkTransferId),u=await o({accessToken:a,stagingToken:r,bulkTransferId:m});return s(u)}async function y({bulkTransferSettings:t,operationSettings:o}){const a=o?.accessToken||e(),c=o?.stagingToken||n.getStagingToken(),b=o?.idempotencyKey||T();if(m(t),!u())throw new f(g.BROWSER);const{uiParentElementId:j,debugMode:y}=i(o,{requiresUI:!0});let S,I;try{const n=p({accessToken:a,stagingToken:c||void 0,debugMode:y});I=await d({iframeUrl:n,parentElementId:j});const e={bankAccountId:t.bankAccountId,bulkTransfers:t.bulkTransfers.map((n=>r(n)))};S=await I.postMessage(l({actionId:k.TRANSFER_BULK_CREATE,actionData:{body:e,idempotencyKey:b}}))}finally{I?.destroy()}return s(S)}export{y as createBulkTransfer,j as getBulkTransfer,b as getBulkTransfers};
@@ -1 +1 @@
1
- function t(t){return{id:t.id,initiatorId:t.initiator_id,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),totalCount:Number(t.total_count),completedCount:Number(t.completed_count),failedCount:Number(t.failed_count),pendingCount:Number(t.pending_count),results:t.results.map((t=>({clientTransferId:t.client_transfer_id,transferId:t.transfer_id??null,errors:t.errors||null,status:t.status})))}}export{t as serializeBulkTransfer};
1
+ function t(t){return{id:t.id,initiatorId:t.initiator_id,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),totalCount:Number(t.total_count),completedCount:Number(t.completed_count),failedCount:Number(t.failed_count),pendingCount:Number(t.pending_count),results:t.results.map((t=>({clientTransferId:t.client_transfer_id,transferId:t.transfer_id??null,errors:t.errors||null,status:t.status})))}}function e(t){return{beneficiary_id:t.beneficiaryId||t.beneficiary?.id,client_transfer_id:t.clientTransferId,amount:t.amount.toString(),reference:t.reference,...t.note?{note:t.note}:{},...t.scheduledDate?{scheduled_date:t.scheduledDate.toISOString().split("T")[0]}:{},...t.attachmentsIds?{attachment_ids:t.attachmentsIds}:{}}}export{t as serializeBulkTransfer,e as serializeToNewBulkTransferDataObject};
@@ -0,0 +1 @@
1
+ import{InvalidParametersError as e}from"../../errors/InvalidParametersError.js";import{validateExpectedStringValues as r,validateExpectedNumericValues as n}from"../../validation/input-param-validation.js";import{AMOUNT_REQUIRING_ATTACHMENTS as i}from"../../common/constants.js";function a(r){if(!r)throw new e("bulkTransferId parameter is required for the called function.");if("string"!=typeof r)throw new e("bulkTransferId must be a string.");return r}function t(a){if(!a)throw new e("bulkTransferSettings parameter is required for the called function.");if(!a.bankAccountId)throw new e("bankAccountId is required");if(!Array.isArray(a.bulkTransfers))throw new e("bulkTransfers must be an array");if(a.bulkTransfers.length>400)throw new e("Maximum of 400 bulk transfers allowed");return a.bulkTransfers.forEach(((a,t)=>{!function(a,t){if(!a)throw new e(`Invalid bulkTransfer at index ${t}: bulkTransfer object is required`);if(!a.beneficiaryId&&!a.beneficiary)throw new e(`Invalid bulkTransfer at index ${t}: Either beneficiaryId for an existing beneficiary or beneficiary details must be provided`);if(a.beneficiaryId&&a.beneficiary)throw new e(`Invalid bulkTransfer at index ${t}: Provide either beneficiaryId for an existing beneficiary or beneficiary details to create/update one, not both`);if(a.beneficiary){if(!a.beneficiary.iban)throw new e(`Invalid bulkTransfer at index ${t}: IBAN is required when providing beneficiary details`);if(!a.beneficiary.name)throw new e(`Invalid bulkTransfer at index ${t}: Beneficiary name is required when providing beneficiary details`)}const f=r({beneficiaryId:a.beneficiaryId,reference:a.reference,clientTransferId:a.clientTransferId,note:a.note}),o=n({amount:a.amount}),s=[...f,...o].flat();if(s.length>0)throw new e(s);if(a.amount>i&&(!a.attachmentsIds||0===a.attachmentsIds.length))throw new e(`Invalid bulkTransfer at index ${t}: Attachments are required for transfers over €${i}`)}(a,t)})),a}export{a as validateBulkTransferParams,t as validateCreateBulkTransferParams};
@@ -1 +1 @@
1
- import{getBulkTransfer as r,getBulkTransfers as e}from"./bulk-transfers/bulk-transfers.js";import{cancelSepaTransfer as s,createSepaTransfer as a,getSepaTransfer as f,getSepaTransfers as n}from"./sepa-transfers.js";const t={getSepaTransfers:n,getSepaTransfer:f,createSepaTransfer:a,cancelSepaTransfer:s,bulkTransfers:{getBulkTransfers:e,getBulkTransfer:r}};export{t as sepaTransfers};
1
+ import{createBulkTransfer as r,getBulkTransfer as e,getBulkTransfers as s}from"./bulk-transfers/bulk-transfers.js";import{cancelSepaTransfer as a,createSepaTransfer as f,getSepaTransfer as n,getSepaTransfers as t}from"./sepa-transfers.js";const p={getSepaTransfers:t,getSepaTransfer:n,createSepaTransfer:f,cancelSepaTransfer:a,bulkTransfers:{getBulkTransfers:s,getBulkTransfer:e,createBulkTransfer:r}};export{p as sepaTransfers};
@@ -1 +1 @@
1
- import{InvalidParametersError as e}from"../errors/InvalidParametersError.js";import{validatePresenceOfRequiredParams as r,validateExpectedStringValues as n,validateExpectedNumericValues as t}from"../validation/input-param-validation.js";const a=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];function i(r){if(!r)throw new e("sepaTransferId parameter is required for the called function");if(r&&"string"!=typeof r)throw new e("sepaTransferId must be a string");return r}function o(i){if(!i)throw new e("sepaTransferSettings parameter is required for the called function");if("object"!=typeof i)throw new e("sepaTransferSettings must be an object");if(r(i,a),!i.beneficiaryId&&!i.beneficiary)throw new e("Either beneficiaryId or beneficiary must be provided");const o=[...n({beneficiaryId:i.beneficiaryId,bankAccountId:i.bankAccountId,note:i.note,reference:i.reference}),...t({amount:i.amount})].flat();if(o.length>0)throw new e(o);if(i.amount>3e4&&(!i.attachmentIds||0===i.attachmentIds.length))throw new e("Attachments are required for transfers over €30,000");return i}function f(r){if(!r)throw new e("sepaTransferId parameter is required for the called function");if("string"!=typeof r)throw new e("sepaTransferId must be a string");return r}export{f as validateCancelSepaTransferParams,o as validateCreateSepaTransferParams,i as validateGetSepaTransferParams};
1
+ import{InvalidParametersError as e}from"../errors/InvalidParametersError.js";import{validatePresenceOfRequiredParams as r,validateExpectedStringValues as n,validateExpectedNumericValues as t}from"../validation/input-param-validation.js";import{AMOUNT_REQUIRING_ATTACHMENTS as a}from"../common/constants.js";const o=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];function i(r){if(!r)throw new e("sepaTransferId parameter is required for the called function");if(r&&"string"!=typeof r)throw new e("sepaTransferId must be a string");return r}function f(i){if(!i)throw new e("sepaTransferSettings parameter is required for the called function");if("object"!=typeof i)throw new e("sepaTransferSettings must be an object");if(r(i,o),!i.beneficiaryId&&!i.beneficiary)throw new e("Either beneficiaryId or beneficiary must be provided");const f=[...n({beneficiaryId:i.beneficiaryId,bankAccountId:i.bankAccountId,note:i.note,reference:i.reference}),...t({amount:i.amount})].flat();if(f.length>0)throw new e(f);if(i.amount>a&&(!i.attachmentIds||0===i.attachmentIds.length))throw new e("Attachments are required for transfers over €30,000");return i}function s(r){if(!r)throw new e("sepaTransferId parameter is required for the called function");if("string"!=typeof r)throw new e("sepaTransferId must be a string");return r}export{s as validateCancelSepaTransferParams,f as validateCreateSepaTransferParams,i as validateGetSepaTransferParams};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qonto/embed-sdk",
3
- "version": "0.25.1",
3
+ "version": "0.26.1",
4
4
  "description": "Library to embed Qonto features in your application",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,2 +0,0 @@
1
- export declare function validateBulkTransferParams(bulkTransferId: string | undefined): string;
2
- //# sourceMappingURL=bulk-transfer.validate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bulk-transfer.validate.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfer.validate.ts"],"names":[],"mappings":"AAEA,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,MAAM,CAUR"}
@@ -1 +0,0 @@
1
- import{InvalidParametersError as r}from"../../errors/InvalidParametersError.js";function e(e){if(!e)throw new r("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new r("bulkTransferId must be a string.");return e}export{e as validateBulkTransferParams};