@qonto/embed-sdk 0.20.0 → 0.21.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 (27) hide show
  1. package/dist/common/constants.d.ts +2 -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 +3 -0
  5. package/dist/mocks/handlers.d.ts.map +1 -1
  6. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.api.d.ts +15 -0
  7. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.api.d.ts.map +1 -0
  8. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.d.ts +17 -0
  9. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.d.ts.map +1 -0
  10. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.serializer.d.ts +3 -0
  11. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.serializer.d.ts.map +1 -0
  12. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.test.d.ts +2 -0
  13. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.test.d.ts.map +1 -0
  14. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.types.d.ts +142 -0
  15. package/dist/sepa-transfers/bulk-transfers/bulk-transfers.types.d.ts.map +1 -0
  16. package/dist/sepa-transfers/index.d.ts +14 -1
  17. package/dist/sepa-transfers/index.d.ts.map +1 -1
  18. package/dist/sepa-transfers/sepa-transfers.api.d.ts.map +1 -1
  19. package/dist/sepa-transfers/sepa-transfers.public-api.d.ts +8 -0
  20. package/dist/sepa-transfers/sepa-transfers.public-api.d.ts.map +1 -1
  21. package/dist/src/common/constants.js +1 -1
  22. package/dist/src/sepa-transfers/bulk-transfers/bulk-transfers.api.js +1 -0
  23. package/dist/src/sepa-transfers/bulk-transfers/bulk-transfers.js +1 -0
  24. package/dist/src/sepa-transfers/bulk-transfers/bulk-transfers.serializer.js +1 -0
  25. package/dist/src/sepa-transfers/sepa-transfers.api.js +1 -1
  26. package/dist/src/sepa-transfers/sepa-transfers.public-api.js +1 -1
  27. package/package.json +1 -1
@@ -117,6 +117,8 @@ export declare const TRANSFER_STATUSES: {
117
117
  CANCELED: string;
118
118
  DECLINED: string;
119
119
  SETTLED: string;
120
+ FAILED: string;
121
+ COMPLETED: string;
120
122
  };
121
123
  /**
122
124
  * List of possible methods for Multi-Factor Authentication (MFA).
@@ -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;;;;;;CAM7B,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;;;;;;;;;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"}
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class n{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return n.instance||(n.instance=new n),n.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const t=n.getInstance();class i extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class a extends i{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function r(){if(!t.hasAccessToken())throw new a;return t.getAccessToken()}class s extends i{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}const o={READY:"qonto.ready"},c={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFER_SINGLE_CREATE:"transfer.single.create",BENEFICIARIES_TRUST:"beneficiary.trust"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},m={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},l={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},u={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",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:m,ENVIRONMENTS:d,IFRAME_EVENTS:o,LOCALES:l,MFA_METHODS:u,TRANSFER_DECLINE_REASONS:{BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},TRANSFER_STATUSES:{PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled"}});class g{constructor(){this.mfaPreference=u.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)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=u.PASSKEY}}const p=g.getInstance(),h="https://embed.qonto.com",_="https://embed-js{branch}.staging.qonto.co",T="https://embed.dev.qonto.co",y={[d.PRODUCTION]:{IFRAME_BASE_URL:h,IFRAME_URL:`${h}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:T,IFRAME_URL:`${T}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class I{constructor(){this.environment=d.PRODUCTION,this.branch=m.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(m).includes(n)?n:m.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=m.MASTER}getEnvironmentUrls(){if(this.environment===d.PRODUCTION)return y.production;{const e=y[this.environment];return Object.entries(e).reduce(((e,[n,t])=>({...e,[n]:t.replace("{branch}",`-${this.branch}`)})),{})}}}const E=I.getInstance(),w={requiresUI:!1};function b(e,{requiresUI:n}=w){const t=e?.uiParentElementId||p.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||p.getMFAPreference();if(i){const e=(a=Object.values(u),E.isProductionEnvironment()?a.filter((e=>e!==u.MOCK)):a);if(!e.includes(i))throw new s(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(E.isProductionEnvironment()&&i===u.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.");return{...e,uiParentElementId:t,mfaPreference:i,debugMode:r,...e}}const A=Object.values(l);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)throw new s("Access token is required when calling initialize()");return e?.operationSettings&&b(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:n,stagingToken:i,operationSettings:a,environment:r,branch:s,locale:o}=R(e);t.setAccessToken(n),i&&t.setStagingToken(i),o&&L.setLocale(o),a&&p.setSettings(a),r&&(E.setEnvironment(r),s&&E.setBranch(s))},logout:function(){t.clearAccessToken(),t.clearStagingToken(),L.setDefaultLocale()},constants:f},{initialize:P,logout:D,constants:O}=v;class N 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 U({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||p.getMFAPreference();return o&&r.append("X-Qonto-2fa-Preference",o),r.append("Content-Type","application/json"),r.append("Accept-Language",L.getLocale()),r}var C;!function(e){e.PENDING="pending",e.ONHOLD="onhold",e.ORDER_CANCELED="order_canceled",e.LIVE="live",e.PAUSED="paused",e.STOLEN="stolen",e.LOST="lost",e.PIN_BLOCKED="pin_blocked",e.DELETED="deleted",e.PRE_EXPIRED="pre_expired",e.EXPIRED="expired",e.DISCARDED="discarded",e.SHIPPED_LOST="shipped_lost",e.ABUSIVE="abusive"}(C||(C={}));const M={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var $,B;function F(e,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 j(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function q(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function Y(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}($||($={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(B||(B={}));const G=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],x=[...G,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function H(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return F(e,G),function(e){const{membershipId:n,organizationId:t,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u}=e,f=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(u),g=j({membershipId:n,organizationId:t,bankAccountId:i}),p=q({hasDailyLimit:a,hasTransactionLimit:r}),h=Y({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),_=z(m),T=K(l),y=[...f,...g,...p,...h,..._,...T];if(y.length>0)throw new s(y)}(e),e}(e):function(e){F(e,x),function(e){const{membershipId:n,organizationId:t,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,shipToBusiness:h,hasAtmOption:_,hasAtmDailyLimit:T,atmDailyLimit:y,atmMonthlyLimit:I,address:E,cardDesign:w,typeOfPrint:b}=e,A=function(e){return Object.values(B).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(u),k=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']:[]}(b),R=j({membershipId:n,organizationId:t,bankAccountId:i}),S=q({hasDailyLimit:a,hasTransactionLimit:r,hasAtmOption:_,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,hasAtmDailyLimit:T,shipToBusiness:h}),L=Y({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:y,atmMonthlyLimit:I}),v=z(m),P=K(l),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"]}(E,h),N=[...A,...R,...S,...L,...v,...P,...k,...D,...O];if(N.length>0)throw new s(N)}(e)}(e)}function z(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 K(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 V extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const X=[];for(let e=0;e<256;++e)X.push((e+256).toString(16).slice(1));let Q;const W=new Uint8Array(16);var J={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Z(e,n,t){if(J.randomUUID&&!e)return J.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!Q){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Q=crypto.getRandomValues.bind(crypto)}return Q(W)}();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(X[e[n+0]]+X[e[n+1]]+X[e[n+2]]+X[e[n+3]]+"-"+X[e[n+4]]+X[e[n+5]]+"-"+X[e[n+6]]+X[e[n+7]]+"-"+X[e[n+8]]+X[e[n+9]]+"-"+X[e[n+10]]+X[e[n+11]]+X[e[n+12]]+X[e[n+13]]+X[e[n+14]]+X[e[n+15]]).toLowerCase()}(i)}class ee{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 V(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,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 V(`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 V("Attempted to perform an Embed operation without having the authentication UI initialized."));const n=function({actionId:e,actionData:n}){const t=p.getMFAPreference();return{actionId:e,actionData:{...n,scaPreference:n.scaPreference||t,idempotencyKey:n.idempotencyKey||Z()}}}(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 V(`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 ne({accessToken:e,stagingToken:n,locale:t,debugMode:i}){const a=i||!1,r=t||L.getLocale(),s=E.getEnvironmentUrls().IFRAME_URL,o=n?`;staging_token=${encodeURIComponent(n)}`:"";return`${s}?debug=${a}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function te({parentElementId:e,iframeUrl:n}){return new ee({parentElementId:e,iframeUrl:n}).initialize()}function ie(e){return"virtual"===e.cardLevel?function(e){const n=re(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:Z(),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=re(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:Z(),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 ae(e){return{id:e.id,nickname:e.nickname,embossedName:e.embossed_name,status:e.status,maskPan:e.mask_pan,expMonth:parseInt(e.exp_month,10),expYear:parseInt(e.exp_year,10),lastActivityAt:new Date(e.last_activity_at),lastDigits:e.last_digits,shipToBusiness:e.ship_to_business,atmOption:e.atm_option,atmDailyLimitOption:e.atm_daily_limit_option,nfcOption:e.nfc_option,onlineOption:e.online_option,foreignOption:e.foreign_option,atmMonthlyLimit:e.atm_monthly_limit,atmMonthlySpent:e.atm_monthly_spent,atmDailyLimit:e.atm_daily_limit,atmDailySpent:e.atm_daily_spent,paymentMonthlyLimit:e.payment_monthly_limit,paymentMonthlySpent:e.payment_monthly_spent,paymentDailyLimit:e.payment_daily_limit,paymentDailySpent:e.payment_daily_spent,paymentDailyLimitOption:e.payment_daily_limit_option,paymentTransactionLimit:e.payment_transaction_limit,paymentTransactionLimitOption:e.payment_transaction_limit_option,activeDays:e.active_days,holderId:e.holder_id,bankAccountId:e.bank_account_id,organizationId:e.organization_id,updatedAt:new Date(e.updated_at),createdAt:new Date(e.created_at),shippedAt:new Date(e.shipped_at),cardType:e.card_type,cardLevel:e.card_level,paymentLifespanLimit:e.payment_lifespan_limit,paymentLifespanSpent:e.payment_lifespan_spent,preExpiresAt:new Date(e.pre_expires_at),categories:e.categories,renewed:e.renewed,renewal:e.renewal,...e.parent_card_summary&&{parentCardSummary:{id:e.parent_card_summary.id,lastDigits:e.parent_card_summary.last_digits}},hadOperation:e.had_operation,hadPinOperation:e.had_pin_operation,cardDesign:e.card_design,typeOfPrint:e.type_of_print,upsold:e.upsold,upsell:e.upsell,discardOn:new Date(e.discard_on),reordered:e.reordered}}function re(e){const n=Object.values(M);return(e||[]).filter((e=>n.includes(e)))}const se={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:U({accessToken:n,stagingToken:t})},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:t});return a.map((e=>ae(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:U({accessToken:n,stagingToken:t})},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:t});return ae(a)}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const n=r(),{uiParentElementId:i,debugMode:a}=b(e.operationSettings,{requiresUI:!0});H(e.cardSettings);const s=ne({accessToken:n,stagingToken:t.getStagingToken()||void 0,debugMode:a}),o=await te({iframeUrl:s,parentElementId:i}),c=ie(e.cardSettings),d=await o.postMessage(c);return o.destroy(),ae(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const n=r(),{uiParentElementId:i,debugMode:a}=b(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=j({cardId:e.cardId});if(n.length>0)throw new s(n)}(e.cardSettings);const o=ne({accessToken:n,stagingToken:t.getStagingToken()||void 0,debugMode:a}),d=await te({iframeUrl:o,parentElementId:i}),m=function(e){return{actionId:c.CARD_UNLOCK,actionData:{body:{cardId:e.cardSettings.cardId}}}}(e),l=await d.postMessage(m);return d.destroy(),ae(l)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:n,accessToken:t,stagingToken:i,debugMode:a,mfaPreference:o}=b(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=j({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=q(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:U({accessToken:n,stagingToken:t,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:m,allowBlocking:l}=e.cardSettings,u=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:m,allowBlocking:l,debugMode:a}),f=await te({iframeUrl:u,parentElementId:n});return{destroyEmbedUI:()=>{f.destroy()}}}catch(e){return Promise.reject(e)}}},oe=se;function ce({endpointUrl:e,paginationSettings:n}){const t=new URL(e);return n?.page&&t.searchParams.set("page",n.page.toString()),n?.itemsPerPage&&t.searchParams.set("per_page",n.itemsPerPage.toString()),t}function de(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}function me(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function le(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const ue="/v2/sepa/beneficiaries";async function fe({accessToken:e,stagingToken:n,beneficiaryId:t}){const i={method:"GET",headers:U({accessToken:e,stagingToken:n})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${ue}/${t}`,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.beneficiary}const ge=[{name:"name"},{name:"iban"}];const pe={getBeneficiaries:async function(e){const n=e?.accessToken||r(),t=await async function({paginationSettings:e,accessToken:n,stagingToken:t}){const i={method:"GET",headers:U({accessToken:n,stagingToken:t})},a=ce({endpointUrl:new URL(E.getEnvironmentUrls().THIRD_PARTY_API_URL+ue),paginationSettings: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{beneficiaries:s.beneficiaries,meta:s.meta}}({accessToken:n,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),i=t.beneficiaries.map((e=>me(e))),a=de(t.meta);return{beneficiaries:i,...a?{meta:a}:{}}},getBeneficiary:async function({beneficiaryId:e,accessToken:n,stagingToken:t}){const i=n||r();return function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string")}(e),me(await fe({beneficiaryId:e,accessToken:i,stagingToken:t}))},addBeneficiary:async function({beneficiary:e,accessToken:n,stagingToken:t}){const i=n||r();!function(e){if(!e)throw new s("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new s("beneficiary must be an object");F(e,ge);const n=j({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(n.length>0)throw new s(n)}(e);return me(await async function({beneficiary:e,accessToken:n,stagingToken:t}){const i={method:"POST",headers:U({accessToken:n,stagingToken:t,idempotencyKey:Z()}),body:JSON.stringify({beneficiary:le(e)})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${ue}`,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.beneficiary}({beneficiary:e,accessToken:i,stagingToken:t}))},untrustBeneficiaries:async function({beneficiaryIds:e,accessToken:n,stagingToken:t}){const i=n||r();!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")}(e);return(await async function({beneficiaryIds:e,accessToken:n,stagingToken:t}){const i={method:"PATCH",headers:U({accessToken:n,stagingToken:t}),body:JSON.stringify({ids:e})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${ue}/untrust`,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.beneficiaries}({beneficiaryIds:e,accessToken:i,stagingToken:t})).map(me)}};function he(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function _e(e){const 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.attachments?{attachments:e.attachments}:{}}}const Te="/v2/sepa/transfers";const ye=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];async function Ie({sepaTransferSettings:e,operationSettings:n}){if(e?.beneficiary)return e.beneficiary;return me(await fe({beneficiaryId:e?.beneficiaryId,accessToken:n?.accessToken,stagingToken:n?.stagingToken}))}const Ee="browser",we="server";class be extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case Ee:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case we: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 Ae={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:U({accessToken:e,stagingToken:n})},a=ce({endpointUrl:new URL(E.getEnvironmentUrls().THIRD_PARTY_API_URL+Te),paginationSettings:t}),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:t,stagingToken:n?.stagingToken,paginationSettings:n?.paginationSettings}),a=i.transfers.map(he),s=de(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 he(await async function({accessToken:e,stagingToken:n,sepaTransferId:t}){const i={method:"GET",headers:U({accessToken:e,stagingToken:n})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${Te}/${t}`,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.external_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||Z();let d;!function(e){if(!e)throw new s("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new s("sepaTransferSettings must be an object");if(F(e,ye),!e.beneficiaryId&&!e.beneficiary)throw new s("Either beneficiaryId or beneficiary must be provided");const n=[...j({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...Y({amount:e.amount})].flat();if(n.length>0)throw new s(n);if(e.amount>3e4&&(!e.attachments||0===e.attachments.length))throw new s("Attachments are required for transfers over €30,000")}(e);const m={...e,beneficiary:await Ie({sepaTransferSettings:e,operationSettings:{accessToken:i,stagingToken:a||void 0}})};if(m.beneficiary?.trusted)d=await async function({transfer:e,accessToken:n,stagingToken:t,idempotencyKey:i}){const a=_e(e),r={method:"POST",headers:U({accessToken:n,stagingToken:t,idempotencyKey:i}),body:JSON.stringify({transfer:a})},s=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${Te}`,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:m,accessToken:i,stagingToken:a||void 0,idempotencyKey:o});else{if("undefined"==typeof window||"undefined"==typeof document)throw new be(Ee);const{uiParentElementId:e,debugMode:t}=b(n,{requiresUI:!0});let r;try{const n=ne({accessToken:i,stagingToken:a||void 0,debugMode:t});r=await te({iframeUrl:n,parentElementId:e});const s=_e(m);d=await r.postMessage({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}})}finally{r?.destroy()}}return he(d)},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:U({accessToken:n,stagingToken:t})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${Te}/${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:t,stagingToken:n?.stagingToken})}};e.beneficiaries=pe,e.cards=oe,e.constants=O,e.initialize=P,e.logout=D,e.sepaTransfers=Ae}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const n=t.getInstance();class a extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class i extends a{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function r(){if(!n.hasAccessToken())throw new i;return n.getAccessToken()}class s extends a{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}const o={READY:"qonto.ready"},c={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFER_SINGLE_CREATE:"transfer.single.create",BENEFICIARIES_TRUST:"beneficiary.trust"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},m={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},u={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:m,ENVIRONMENTS:d,IFRAME_EVENTS:o,LOCALES:u,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)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=l.PASSKEY}}const p=g.getInstance(),h="https://embed.qonto.com",_="https://embed-js{branch}.staging.qonto.co",T="https://embed.dev.qonto.co",y={[d.PRODUCTION]:{IFRAME_BASE_URL:h,IFRAME_URL:`${h}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:T,IFRAME_URL:`${T}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class I{constructor(){this.environment=d.PRODUCTION,this.branch=m.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(d).includes(e)?e:d.PRODUCTION,this.branch=Object.values(m).includes(t)?t:m.SANDBOX}static getInstance(){return 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=m.MASTER}getEnvironmentUrls(){if(this.environment===d.PRODUCTION)return y.production;{const e=y[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const w=I.getInstance(),E={requiresUI:!1};function b(e,{requiresUI:t}=E){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 a=e?.mfaPreference||p.getMFAPreference();if(a){const e=(i=Object.values(l),w.isProductionEnvironment()?i.filter((e=>e!==l.MOCK)):i);if(!e.includes(a))throw new s(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(w.isProductionEnvironment()&&a===l.MOCK)throw new s("operationSettings.mfaPreference cannot be set to mock in production environment.")}var i;const r=e?.debugMode||p.getDebugMode();if(void 0!==r&&"boolean"!=typeof r)throw new s("operationSettings.debugMode must be a boolean.");return{...e,uiParentElementId:n,mfaPreference:a,debugMode:r,...e}}const A=Object.values(u);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 S(e){if(!e?.accessToken)throw new s("Access token is required when calling initialize()");return e?.operationSettings&&b(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 R{constructor(){this.currentLocale="en"}static getInstance(){return R.instance||(R.instance=new R),R.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const L=R.getInstance();const v={initialize:function(e){const{accessToken:t,stagingToken:a,operationSettings:i,environment:r,branch:s,locale:o}=S(e);n.setAccessToken(t),a&&n.setStagingToken(a),o&&L.setLocale(o),i&&p.setSettings(i),r&&(w.setEnvironment(r),s&&w.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),L.setDefaultLocale()},constants:f},{initialize:P,logout:D,constants:O}=v;class N extends a{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function U({accessToken:e,stagingToken:t,idempotencyKey:a,mfaPreference:i}){const r=new Headers;r.append("Authorization",`Bearer ${e}`);const s=t||n.getStagingToken();s&&r.append("X-Qonto-Staging-Token",s),a&&r.append("X-Qonto-Idempotency-Key",a);const o=i||p.getMFAPreference();return o&&r.append("X-Qonto-2fa-Preference",o),r.append("Content-Type","application/json"),r.append("Accept-Language",L.getLocale()),r}var C;!function(e){e.PENDING="pending",e.ONHOLD="onhold",e.ORDER_CANCELED="order_canceled",e.LIVE="live",e.PAUSED="paused",e.STOLEN="stolen",e.LOST="lost",e.PIN_BLOCKED="pin_blocked",e.DELETED="deleted",e.PRE_EXPIRED="pre_expired",e.EXPIRED="expired",e.DISCARDED="discarded",e.SHIPPED_LOST="shipped_lost",e.ABUSIVE="abusive"}(C||(C={}));const $={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var M,B;function F(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:void 0===e[t.name])).map((e=>e.name));if(n.length>0)throw new s(n.map((e=>`Missing required parameter: ${e}`)))}function j(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function q(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function Y(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}(M||(M={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(B||(B={}));const G=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],H=[...G,{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 F(e,G),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:u,cardLevel:l}=e,f=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(l),g=j({membershipId:t,organizationId:n,bankAccountId:a}),p=q({hasDailyLimit:i,hasTransactionLimit:r}),h=Y({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),_=z(m),T=K(u),y=[...f,...g,...p,...h,..._,...T];if(y.length>0)throw new s(y)}(e),e}(e):function(e){F(e,H),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:u,cardLevel:l,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,shipToBusiness:h,hasAtmOption:_,hasAtmDailyLimit:T,atmDailyLimit:y,atmMonthlyLimit:I,address:w,cardDesign:E,typeOfPrint:b}=e,A=function(e){return Object.values(B).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']:[]}(b),S=j({membershipId:t,organizationId:n,bankAccountId:a}),R=q({hasDailyLimit:i,hasTransactionLimit:r,hasAtmOption:_,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,hasAtmDailyLimit:T,shipToBusiness:h}),L=Y({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:y,atmMonthlyLimit:I}),v=z(m),P=K(u),D=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(E),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"]}(w,h),N=[...A,...S,...R,...L,...v,...P,...k,...D,...O];if(N.length>0)throw new s(N)}(e)}(e)}function z(e){const t=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function K(e){const t=!Array.isArray(e)||e.some((e=>"string"!=typeof e));return void 0!==e&&t?["categories must be an array of strings"]:[]}class V extends a{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const X=[];for(let e=0;e<256;++e)X.push((e+256).toString(16).slice(1));let Q;const W=new Uint8Array(16);var J={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Z(e,t,n){if(J.randomUUID&&!e)return J.randomUUID();const a=(e=e||{}).random??e.rng?.()??function(){if(!Q){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Q=crypto.getRandomValues.bind(crypto)}return Q(W)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=15&a[6]|64,a[8]=63&a[8]|128,function(e,t=0){return(X[e[t+0]]+X[e[t+1]]+X[e[t+2]]+X[e[t+3]]+"-"+X[e[t+4]]+X[e[t+5]]+"-"+X[e[t+6]]+X[e[t+7]]+"-"+X[e[t+8]]+X[e[t+9]]+"-"+X[e[t+10]]+X[e[t+11]]+X[e[t+12]]+X[e[t+13]]+X[e[t+14]]+X[e[t+15]]).toLowerCase()}(a)}class ee{constructor(e){this.options=e,this.iframe=null,this.parentElement=null,this.messageListeners=new Map,this.defaultTimeout=3e4;const t=new URL(e.iframeUrl);this.targetOrigin=`${t.protocol}//${t.host}`}async initialize(){if(this.iframe)return this;if(this.parentElement=document.getElementById(this.options.parentElementId),!this.parentElement)throw new V(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,a=setTimeout((()=>{window.removeEventListener("message",i),t(new V(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),i=t=>{t.data.eventId===o.READY&&(clearTimeout(a),window.removeEventListener("message",i),e(this))};window.addEventListener("message",i),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){if(!this.iframe||!this.iframe.contentWindow)return Promise.reject(new V("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||Z()}}}(e);return new Promise(((e,n)=>{const a=i=>{if(i.data?.actionId===t.actionId){if("error"===i.data.status)return this.removeMessageListener(t.actionId,a),n(new V(`An error occurred when performing the action ${t.actionId}.\n${JSON.stringify(i.data.payload)}`));this.removeMessageListener(t.actionId,a),e(i.data.payload)}};this.addMessageListener(t.actionId,a),this.iframe?.contentWindow?.postMessage(t,this.targetOrigin)}))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function te({accessToken:e,stagingToken:t,locale:n,debugMode:a}){const i=a||!1,r=n||L.getLocale(),s=w.getEnvironmentUrls().IFRAME_URL,o=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${i}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function ne({parentElementId:e,iframeUrl:t}){return new ee({parentElementId:e,iframeUrl:t}).initialize()}function ae(e){return"virtual"===e.cardLevel?function(e){const t=re(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:Z(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel}}}}}(e):function(e){const t=re(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:Z(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel,card_design:e.cardDesign,..."plus"===e.cardLevel&&{type_of_print:e.typeOfPrint},ship_to_business_address:e.shipToBusiness,atm_option:e.hasAtmOption,nfc_option:e.hasNfcOption,foreign_option:e.hasForeignPaymentOption,online_option:e.hasOnlinePaymentOption,atm_daily_limit:e.atmDailyLimit,atm_monthly_limit:e.atmMonthlyLimit,...!e.shipToBusiness&&{address:{contact_name:e.address?.contactName,first_line:e.address?.firstLine,second_line:e.address?.secondLine,third_line:e.address?.thirdLine,zipcode:e.address?.zipCode,city:e.address?.city,country:e.address?.country}}}}}}}(e)}function ie(e){return{id:e.id,nickname:e.nickname,embossedName:e.embossed_name,status:e.status,maskPan:e.mask_pan,expMonth:parseInt(e.exp_month,10),expYear:parseInt(e.exp_year,10),lastActivityAt:new Date(e.last_activity_at),lastDigits:e.last_digits,shipToBusiness:e.ship_to_business,atmOption:e.atm_option,atmDailyLimitOption:e.atm_daily_limit_option,nfcOption:e.nfc_option,onlineOption:e.online_option,foreignOption:e.foreign_option,atmMonthlyLimit:e.atm_monthly_limit,atmMonthlySpent:e.atm_monthly_spent,atmDailyLimit:e.atm_daily_limit,atmDailySpent:e.atm_daily_spent,paymentMonthlyLimit:e.payment_monthly_limit,paymentMonthlySpent:e.payment_monthly_spent,paymentDailyLimit:e.payment_daily_limit,paymentDailySpent:e.payment_daily_spent,paymentDailyLimitOption:e.payment_daily_limit_option,paymentTransactionLimit:e.payment_transaction_limit,paymentTransactionLimitOption:e.payment_transaction_limit_option,activeDays:e.active_days,holderId:e.holder_id,bankAccountId:e.bank_account_id,organizationId:e.organization_id,updatedAt:new Date(e.updated_at),createdAt:new Date(e.created_at),shippedAt:new Date(e.shipped_at),cardType:e.card_type,cardLevel:e.card_level,paymentLifespanLimit:e.payment_lifespan_limit,paymentLifespanSpent:e.payment_lifespan_spent,preExpiresAt:new Date(e.pre_expires_at),categories:e.categories,renewed:e.renewed,renewal:e.renewal,...e.parent_card_summary&&{parentCardSummary:{id:e.parent_card_summary.id,lastDigits:e.parent_card_summary.last_digits}},hadOperation:e.had_operation,hadPinOperation:e.had_pin_operation,cardDesign:e.card_design,typeOfPrint:e.type_of_print,upsold:e.upsold,upsell:e.upsell,discardOn:new Date(e.discard_on),reordered:e.reordered}}function re(e){const t=Object.values($);return(e||[]).filter((e=>t.includes(e)))}const se={getCards:async function({membershipId:e,accessToken:t,stagingToken:n}){try{const a=t||r();if(e&&"string"!=typeof e)throw new s("membershipId must be a string");const i=await async function({membershipId:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:U({accessToken:t,stagingToken:n})},i=w.getEnvironmentUrls().THIRD_PARTY_API_URL,r=e?`${i}/v2/cards?holder_ids[]=${e}`:`${i}/v2/cards`,s=await fetch(r,a),o=await s.json();if(o.errors)throw new N(o.errors.map((e=>`${e.code}: ${e.detail}`)));return o.cards}({membershipId:e,accessToken:a,stagingToken:n});return i.map((e=>ie(e)))}catch(e){return Promise.reject(e)}},getCard:async function({cardId:e,accessToken:t,stagingToken:n}){try{const a=t||r();if(e&&"string"!=typeof e)throw new s("cardId must be a string");const i=await async function({cardId:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:U({accessToken:t,stagingToken:n})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/cards?ids[]=${e}`,r=await fetch(i,a),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:a,stagingToken:n});return ie(i)}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=b(e.operationSettings,{requiresUI:!0});x(e.cardSettings);const s=te({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),o=await ne({iframeUrl:s,parentElementId:a}),c=ae(e.cardSettings),d=await o.postMessage(c);return o.destroy(),ie(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=b(e.operationSettings,{requiresUI:!0});!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=j({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=te({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),d=await ne({iframeUrl:o,parentElementId:a}),m=function(e){return{actionId:c.CARD_UNLOCK,actionData:{body:{cardId:e.cardSettings.cardId}}}}(e),u=await d.postMessage(m);return d.destroy(),ie(u)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:t,accessToken:n,stagingToken:a,debugMode:i,mfaPreference:o}=b(e.operationSettings,{requiresUI:!0}),c=n||r();!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=j({cardId:e.cardId});if(t.length>0)throw new s(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const a=q(n);if(a.length>0)throw new s(a)}(e.cardSettings);const d=await async function(e){const{accessToken:t,stagingToken:n,mfaPreference:a}=e,i={method:"GET",headers:U({accessToken:t,stagingToken:n,mfaPreference:a})},r=w.getEnvironmentUrls().THIRD_PARTY_API_URL,s=await fetch(`${r}/v2/cards/${e.cardId}/data_view`,i),o=await s.json();if(!s.ok)throw o.errors?new N(o.errors.map((e=>`${e.code}: ${e.detail}`))):new N(`${o.code}: ${o.detail}`);return o.iframe_url}({...e.cardSettings,accessToken:c,stagingToken:a,mfaPreference:o}),{allowPinReveal:m,allowBlocking:u}=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:m,allowBlocking:u,debugMode:i}),f=await ne({iframeUrl:l,parentElementId:t});return{destroyEmbedUI:()=>{f.destroy()}}}catch(e){return Promise.reject(e)}}},oe=se;function ce({endpointUrl:e,paginationSettings:t}){const n=new URL(e);return t?.page&&n.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&n.searchParams.set("per_page",t.itemsPerPage.toString()),n}function de(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}function me(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function ue(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const le="/v2/sepa/beneficiaries";async function fe({accessToken:e,stagingToken:t,beneficiaryId:n}){const a={method:"GET",headers:U({accessToken:e,stagingToken:t})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${le}/${n}`,r=await fetch(i,a),s=await r.json();if(s.errors)throw new N(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiary}const ge=[{name:"name"},{name:"iban"}];const pe={getBeneficiaries:async function(e){const t=e?.accessToken||r(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:U({accessToken:t,stagingToken:n})},i=ce({endpointUrl:new URL(w.getEnvironmentUrls().THIRD_PARTY_API_URL+le),paginationSettings:e}),r=await fetch(i,a),s=await r.json();if(s.errors)throw new N(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{beneficiaries:s.beneficiaries,meta:s.meta}}({accessToken:t,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),a=n.beneficiaries.map((e=>me(e))),i=de(n.meta);return{beneficiaries:a,...i?{meta:i}:{}}},getBeneficiary:async function({beneficiaryId:e,accessToken:t,stagingToken:n}){const a=t||r();return function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string")}(e),me(await fe({beneficiaryId:e,accessToken:a,stagingToken:n}))},addBeneficiary:async function({beneficiary:e,accessToken:t,stagingToken:n}){const a=t||r();!function(e){if(!e)throw new s("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new s("beneficiary must be an object");F(e,ge);const t=j({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new s(t)}(e);return me(await async function({beneficiary:e,accessToken:t,stagingToken:n}){const a={method:"POST",headers:U({accessToken:t,stagingToken:n,idempotencyKey:Z()}),body:JSON.stringify({beneficiary:ue(e)})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${le}`,r=await fetch(i,a),s=await r.json();if(s.errors)throw new N(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiary}({beneficiary:e,accessToken:a,stagingToken:n}))},untrustBeneficiaries:async function({beneficiaryIds:e,accessToken:t,stagingToken:n}){const a=t||r();!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")}(e);return(await async function({beneficiaryIds:e,accessToken:t,stagingToken:n}){const a={method:"PATCH",headers:U({accessToken:t,stagingToken:n}),body:JSON.stringify({ids:e})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${le}/untrust`,r=await fetch(i,a),s=await r.json();if(s.errors)throw new N(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiaries}({beneficiaryIds:e,accessToken:a,stagingToken:n})).map(me)}};function he(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 _e(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function Te(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachments?{attachments:e.attachments}:{}}}const ye="/v2/sepa/transfers";const Ie=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];async function we({sepaTransferSettings:e,operationSettings:t}){if(e?.beneficiary)return e.beneficiary;return me(await fe({beneficiaryId:e?.beneficiaryId,accessToken:t?.accessToken,stagingToken:t?.stagingToken}))}const Ee="browser",be="server";class Ae extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case Ee:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case be: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 ke={getSepaTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||r(),a=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a={method:"GET",headers:U({accessToken:e,stagingToken:t})},i=ce({endpointUrl:new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${ye}`),paginationSettings:n}),r=await fetch(i,a);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}),i=a.transfers.map(_e),s=de(a.meta);return{transfers:i,...s?{meta:s}:{}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);return _e(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const a={method:"GET",headers:U({accessToken:e,stagingToken:t})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${ye}/${n}`,r=await fetch(i,a),s=await r.json();if(s.errors)throw new N(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.transfer}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken}))},createSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),o=t?.idempotencyKey||Z();let d;!function(e){if(!e)throw new s("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new s("sepaTransferSettings must be an object");if(F(e,Ie),!e.beneficiaryId&&!e.beneficiary)throw new s("Either beneficiaryId or beneficiary must be provided");const t=[...j({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...Y({amount:e.amount})].flat();if(t.length>0)throw new s(t);if(e.amount>3e4&&(!e.attachments||0===e.attachments.length))throw new s("Attachments are required for transfers over €30,000")}(e);const m={...e,beneficiary:await we({sepaTransferSettings:e,operationSettings:{accessToken:a,stagingToken:i||void 0}})};if(m.beneficiary?.trusted)d=await async function({transfer:e,accessToken:t,stagingToken:n,idempotencyKey:a}){const i=Te(e),r={method:"POST",headers:U({accessToken:t,stagingToken:n,idempotencyKey:a}),body:JSON.stringify({transfer:i})},s=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${ye}`,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:m,accessToken:a,stagingToken:i||void 0,idempotencyKey:o});else{if("undefined"==typeof window||"undefined"==typeof document)throw new Ae(Ee);const{uiParentElementId:e,debugMode:n}=b(t,{requiresUI:!0});let r;try{const t=te({accessToken:a,stagingToken:i||void 0,debugMode:n});r=await ne({iframeUrl:t,parentElementId:e});const s=Te(m);d=await r.postMessage({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}})}finally{r?.destroy()}}return _e(d)},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);await async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const a={method:"POST",headers:U({accessToken:t,stagingToken:n})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${ye}/${e}/cancel`,r=await fetch(i,a);if(204!==r.status){const e=await r.json();if(e.errors)throw new N(e.errors.map((e=>`${e.code}: ${e.detail}`)))}}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken})},bulkTransfers:{getBulkTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||r(),{stagingToken:a,paginationSettings:i}=b(t||{}),s=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a={method:"GET",headers:U({accessToken:e,stagingToken:t})},i=ce({endpointUrl:new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/sepa/bulk_transfers`),paginationSettings:n}),r=await fetch(i,a);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:a,paginationSettings:i}),o=s.bulkTransfers?.map(he),c=de(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}}}};e.beneficiaries=pe,e.cards=oe,e.constants=O,e.initialize=P,e.logout=D,e.sepaTransfers=ke}));
@@ -1,5 +1,6 @@
1
1
  import type { 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
4
  export declare const INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN";
4
5
  export declare const singleBeneficiary: BeneficiaryDataObject;
5
6
  export declare const newBeneficiaryDbFields: {
@@ -13,6 +14,8 @@ export declare const newBeneficiaryDbFields: {
13
14
  export declare const mockedBeneficiariesList: BeneficiaryDataObject[];
14
15
  export declare const mockTransferDataObject: SepaTransferDataObject;
15
16
  export declare const mockListOfSepaTransferDataObjects: SepaTransferDataObject[];
17
+ export declare const mockBulkTransferDataObject: BulkTransferDataObject;
18
+ export declare const mockListOfBulkTransferDataObjects: BulkTransferDataObject[];
16
19
  export declare const mockDisplayCardIframeUrl = "https://example.com/card-iframe#access_token=any_valid_token";
17
20
  export declare const mswHandlers: import("msw").HttpHandler[];
18
21
  //# 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;AAG9C,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAqBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,iEAC2B,CAAC;AAEjE,eAAO,MAAM,WAAW,6BAqUvB,CAAC"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;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,6BA0WvB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { PaginationSettings, PaginationResponseDataObject } from '@common/api-pagination/api-pagination.types';
2
+ import type { BulkTransferDataObject } from './bulk-transfers.types';
3
+ interface GetBulkTransfersParams {
4
+ accessToken: string;
5
+ stagingToken?: string;
6
+ paginationSettings?: PaginationSettings;
7
+ }
8
+ interface GetBulkTransfersApiResponse {
9
+ bulkTransfers: BulkTransferDataObject[];
10
+ meta: PaginationResponseDataObject;
11
+ }
12
+ export declare const BULK_TRANSFERS_ENDPOINT = "/v2/sepa/bulk_transfers";
13
+ export declare function getBulkTransfers({ accessToken, stagingToken, paginationSettings, }: GetBulkTransfersParams): Promise<GetBulkTransfersApiResponse>;
14
+ export {};
15
+ //# sourceMappingURL=bulk-transfers.api.d.ts.map
@@ -0,0 +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,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"}
@@ -0,0 +1,17 @@
1
+ import type { GetBulkTransfersResponse } from './bulk-transfers.types';
2
+ import type { SepaTransferParams } from '@sepa-transfers/sepa-transfers.types';
3
+ /**
4
+ * Fetches the list of SEPA bulk transfers for the current user.
5
+ * @param getBulkTransfersParams - An optional object containing `operationSettings`.
6
+ * The `operationSettings` object can include:
7
+ * - `accessToken`: If not provided, the function will use the token from initialize.
8
+ * - `stagingToken`: Optional, required only for staging environments.
9
+ * - `paginationSettings`: Optional object with `page` and `itemsPerPage` properties for pagination control.
10
+ * @returns A promise that resolves to an object containing an array of bulk transfers and a `meta` object containing pagination state.
11
+ * @throws \{AuthenticationError\} If the access token is invalid or missing.
12
+ * @throws \{ValidationError\} If the provided parameters fail validation.
13
+ * Ensure initialize has been called before using this function if you are not passing the access token.
14
+ * @throws \{EmbedApiError\} If the API request fails or returns an error.
15
+ */
16
+ export declare function getBulkTransfers(getBulkTransfersParams?: SepaTransferParams<never>): Promise<GetBulkTransfersResponse>;
17
+ //# sourceMappingURL=bulk-transfers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-transfers.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAI/E;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,wBAAwB,CAAC,CA0BnC"}
@@ -0,0 +1,3 @@
1
+ import type { BulkTransfer, BulkTransferDataObject } from './bulk-transfers.types';
2
+ export declare function serializeBulkTransfer(data: BulkTransferDataObject): BulkTransfer;
3
+ //# sourceMappingURL=bulk-transfers.serializer.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bulk-transfers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-transfers.test.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,142 @@
1
+ import type { PaginationState } from '@common/api-pagination/api-pagination.types';
2
+ import type { TRANSFER_STATUSES } from '@common/constants';
3
+ /**
4
+ * Represents the possible statuses of a Bulk transfer result.
5
+ */
6
+ export type BulkTransferStatus = (typeof TRANSFER_STATUSES)[keyof typeof TRANSFER_STATUSES];
7
+ export interface BulkTransferResultErrorDetail {
8
+ /**
9
+ * The error code associated with the transfer result.
10
+ */
11
+ code: string;
12
+ /**
13
+ * A detailed description of the error.
14
+ */
15
+ detail: string;
16
+ /**
17
+ * Optional status of the error, which can provide additional context.
18
+ */
19
+ status?: string;
20
+ /**
21
+ * Optional message providing more information about the error.
22
+ */
23
+ message?: string;
24
+ /**
25
+ * Optional source information for the error, which can include a pointer or parameter.
26
+ */
27
+ source?: {
28
+ /**
29
+ * A pointer to the specific part of the request that caused the error.
30
+ */
31
+ pointer?: string;
32
+ /**
33
+ * A parameter that caused the error, if applicable.
34
+ */
35
+ parameter?: string;
36
+ };
37
+ }
38
+ export interface BulkTransferResultError {
39
+ errors: BulkTransferResultErrorDetail[];
40
+ }
41
+ /**
42
+ * Represents the result of a single transfer within a bulk transfer.
43
+ * This interface includes the client transfer ID, transfer ID, any errors that occurred, and the
44
+ * status of the transfer.
45
+ */
46
+ export interface BulkTransferResult {
47
+ /**
48
+ * The client provided key to identify the transfer.
49
+ */
50
+ clientTransferId: string;
51
+ /**
52
+ * The transfer ID of the created bulk transfer, only populated if the transfer was completed.
53
+ */
54
+ transferId: string | null;
55
+ /**
56
+ * An array of errors that occurred during the transfer, if any.
57
+ * Each error includes details about the error code and description.
58
+ */
59
+ errors: BulkTransferResultError[] | null;
60
+ /**
61
+ * The status of the transfer, which can indicate whether it was successful, pending, or failed.
62
+ */
63
+ status: BulkTransferStatus;
64
+ }
65
+ export interface BulkTransferResultDataObject {
66
+ client_transfer_id: string;
67
+ transfer_id: string | null;
68
+ errors: BulkTransferResultError[] | null;
69
+ status: BulkTransferStatus;
70
+ }
71
+ /**
72
+ * Represents a SEPA bulk transfer in the system.
73
+ * This interface includes all the necessary fields to describe a bulk transfer, including its ID, initiator, timestamps, and results.
74
+ */
75
+ export interface BulkTransfer {
76
+ /**
77
+ * Unique identifier for the bulk transfer job.
78
+ */
79
+ id: string;
80
+ /**
81
+ * Unique identifier for the member that created the BulkTransfer.
82
+ */
83
+ initiatorId: string;
84
+ /**
85
+ * The date and time when the bulk transfer was created.
86
+ */
87
+ createdAt: Date;
88
+ /**
89
+ * The date and time when the bulk transfer was last updated.
90
+ */
91
+ updatedAt: Date;
92
+ /**
93
+ * The total number of transfers included in the bulk transfer.
94
+ */
95
+ totalCount: number;
96
+ /**
97
+ * The number of transfers that were successfully completed.
98
+ */
99
+ completedCount: number;
100
+ /**
101
+ * The number of transfers that failed.
102
+ */
103
+ failedCount: number;
104
+ /**
105
+ * The number of transfers that are pending.
106
+ */
107
+ pendingCount: number;
108
+ /**
109
+ * An array of results for each transfer in the bulk transfer, containing details about each transfer's status and any errors.
110
+ */
111
+ results: BulkTransferResult[];
112
+ }
113
+ /**
114
+ * Represents the data object structure for a SEPA bulk transfer.
115
+ * This interface is used to map the raw data from the API to the BulkTransfer interface.
116
+ */
117
+ export interface BulkTransferDataObject {
118
+ id: string;
119
+ initiator_id: string;
120
+ created_at: string;
121
+ updated_at: string;
122
+ total_count: string;
123
+ completed_count: string;
124
+ failed_count: string;
125
+ pending_count: string;
126
+ results: BulkTransferResultDataObject[];
127
+ }
128
+ /**
129
+ * Represents the response structure for fetching a list of SEPA bulk transfers.
130
+ */
131
+ export interface GetBulkTransfersResponse {
132
+ /**
133
+ * An array of BulkTransfer objects representing the bulk transfers, each containing detailed information about the transfer.
134
+ */
135
+ bulkTransfers: BulkTransfer[];
136
+ /**
137
+ * Metadata about the pagination state of the response, such as the current
138
+ * page and total pages.
139
+ */
140
+ meta?: PaginationState;
141
+ }
142
+ //# sourceMappingURL=bulk-transfers.types.d.ts.map
@@ -0,0 +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"}
@@ -1,5 +1,7 @@
1
1
  /**
2
- * The sepaTransfers namespace contains all the functions related to SEPA transfer operations.
2
+ * The sepaTransfers namespace contains all the functions related to SEPA transfer operations,
3
+ * including both single and bulk transfers.
4
+ *
3
5
  * It can be accessed like this:
4
6
  * ```ts
5
7
  * import { sepaTransfers } from '@qonto/embed-sdk/sepa-transfers';
@@ -7,8 +9,16 @@
7
9
  *
8
10
  * Then, the sepaTransfers object contains the functions to perform SEPA transfer operations:
9
11
  * ```ts
12
+ * // Single SEPA transfers
10
13
  * await sepaTransfers.getSepaTransfers();
11
14
  * await sepaTransfers.getSepaTransfer({ sepaTransferId: '...' });
15
+ *
16
+ * // Bulk transfers are nested under sepaTransfers.bulkTransfers
17
+ * const { bulkTransfers } = sepaTransfers;
18
+ * await bulkTransfers.getBulkTransfers();
19
+ *
20
+ * // Or access bulk transfers directly
21
+ * await sepaTransfers.bulkTransfers.getBulkTransfers();
12
22
  * ```
13
23
  */
14
24
  export declare const sepaTransfers: {
@@ -16,5 +26,8 @@ export declare const sepaTransfers: {
16
26
  getSepaTransfer: typeof import("./sepa-transfers").getSepaTransfer;
17
27
  createSepaTransfer: typeof import("./sepa-transfers").createSepaTransfer;
18
28
  cancelSepaTransfer: typeof import("./sepa-transfers").cancelSepaTransfer;
29
+ bulkTransfers: {
30
+ getBulkTransfers: typeof import("./bulk-transfers/bulk-transfers").getBulkTransfers;
31
+ };
19
32
  };
20
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;;;;;CAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,aAAa;;;;;;;;CAAuC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAEV,eAAe,EACf,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAOhC,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,KAAK,wBAAwB,GAAG,qBAAqB,CAAC;AAEtD,UAAU,2BAA2B;IACnC,SAAS,EAAE,sBAAsB,EAAE,CAAC;IACpC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAE5D,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAkC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqBzD;AAED,wBAAsB,kBAAkB,CAAC,EACvC,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAyB5D;AAED,wBAAsB,kBAAkB,CAAC,EACvC,cAAc,EACd,WAAW,EACX,YAAY,GACb,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB1C"}
1
+ {"version":3,"file":"sepa-transfers.api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAEV,eAAe,EACf,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAOhC,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,KAAK,wBAAwB,GAAG,qBAAqB,CAAC;AAEtD,UAAU,2BAA2B;IACnC,SAAS,EAAE,sBAAsB,EAAE,CAAC;IACpC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAE5D,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAiC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqBzD;AAED,wBAAsB,kBAAkB,CAAC,EACvC,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAyB5D;AAED,wBAAsB,kBAAkB,CAAC,EACvC,cAAc,EACd,WAAW,EACX,YAAY,GACb,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB1C"}
@@ -1,9 +1,17 @@
1
+ import { getBulkTransfers } from './bulk-transfers/bulk-transfers';
1
2
  import { getSepaTransfers, getSepaTransfer, createSepaTransfer, cancelSepaTransfer } from './sepa-transfers';
3
+ /**
4
+ * The SEPA transfers namespace containing all transfer-related operations
5
+ * including both single transfers and bulk transfers.
6
+ */
2
7
  declare const sepaTransfers: {
3
8
  getSepaTransfers: typeof getSepaTransfers;
4
9
  getSepaTransfer: typeof getSepaTransfer;
5
10
  createSepaTransfer: typeof createSepaTransfer;
6
11
  cancelSepaTransfer: typeof cancelSepaTransfer;
12
+ bulkTransfers: {
13
+ getBulkTransfers: typeof getBulkTransfers;
14
+ };
7
15
  };
8
16
  export { sepaTransfers };
9
17
  //# sourceMappingURL=sepa-transfers.public-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.public-api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,QAAA,MAAM,aAAa;;;;;CAKlB,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,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,QAAA,MAAM,aAAa;;;;;;;;CASlB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1 +1 @@
1
- const e={READY:"qonto.ready"},E={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFER_SINGLE_CREATE:"transfer.single.create",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"},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",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};
@@ -0,0 +1 @@
1
+ import{buildRequestHeaders as n}from"../../common/network/network.js";import{environmentManager as o}from"../../common/environment/environment-manager.js";import{addPaginationParamsToUrl as e}from"../../common/api-pagination/api-pagination.js";import{EmbedApiError as r}from"../../errors/EmbedApiError.js";const t="/v2/sepa/bulk_transfers";async function a({accessToken:a,stagingToken:s,paginationSettings:i}){const m={method:"GET",headers:n({accessToken:a,stagingToken:s})},c=new URL(`${o.getEnvironmentUrls().THIRD_PARTY_API_URL}${t}`),p=e({endpointUrl:c,paginationSettings:i}),f=await fetch(p,m);if(!f.ok)throw new r("Failed to fetch SEPA bulk transfers");const g=await f.json();if(g.errors)throw new r(g.errors.map((n=>`${n.code}: ${n.detail}`)));return{bulkTransfers:g.bulk_transfers,meta:g.meta}}export{t as BULK_TRANSFERS_ENDPOINT,a as getBulkTransfers};
@@ -0,0 +1 @@
1
+ import"../../common/auth/auth.js";import{validatePresenceOfAuthToken as a}from"../../common/auth/auth.validate.js";import{serializePaginationResponse as t}from"../../common/api-pagination/api-pagination.js";import{getBulkTransfers as n}from"./bulk-transfers.api.js";import{serializeBulkTransfer as i}from"./bulk-transfers.serializer.js";import{validateOperationSettingsParams as o}from"../../validation/operation-settings-validation.js";async function s(s){const{operationSettings:r}=s||{},e=r?.accessToken||a(),{stagingToken:m,paginationSettings:p}=o(r||{}),g=await n({accessToken:e,stagingToken:m,paginationSettings:p}),f=g.bulkTransfers?.map(i),u=t(g.meta);return{bulkTransfers:f,...u?{meta:u}:{}}}export{s as getBulkTransfers};
@@ -0,0 +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 +1 @@
1
- import{buildRequestHeaders as e}from"../common/network/network.js";import{environmentManager as n}from"../common/environment/environment-manager.js";import{addPaginationParamsToUrl as r}from"../common/api-pagination/api-pagination.js";import{EmbedApiError as t}from"../errors/EmbedApiError.js";import{serializeToNewSepaTransferDataObject as o}from"./sepa-transfers.serializer.js";const s="/v2/sepa/transfers";async function a({accessToken:o,stagingToken:a,paginationSettings:i}){const c={method:"GET",headers:e({accessToken:o,stagingToken:a})},m=new URL(n.getEnvironmentUrls().THIRD_PARTY_API_URL+s),f=r({endpointUrl:m,paginationSettings:i}),T=await fetch(f,c);if(!T.ok)throw new t("Failed to fetch SEPA transfers");const g=await T.json();if(g.errors)throw new t(g.errors.map((e=>`${e.code}: ${e.detail}`)));return{transfers:g.transfers,meta:g.meta}}async function i({accessToken:r,stagingToken:o,sepaTransferId:a}){const i={method:"GET",headers:e({accessToken:r,stagingToken:o})},c=`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${s}/${a}`,m=await fetch(c,i),f=await m.json();if(f.errors)throw new t(f.errors.map((e=>`${e.code}: ${e.detail}`)));return f.external_transfer}async function c({transfer:r,accessToken:a,stagingToken:i,idempotencyKey:c}){const m=o(r),f={method:"POST",headers:e({accessToken:a,stagingToken:i,idempotencyKey:c}),body:JSON.stringify({transfer:m})},T=`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${s}`,g=await fetch(T,f),d=await g.json();if(d.errors)throw new t(d.errors.map((e=>`${e.code}: ${e.detail}`)));return d.transfer}async function m({sepaTransferId:r,accessToken:o,stagingToken:a}){const i={method:"POST",headers:e({accessToken:o,stagingToken:a})},c=`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${s}/${r}/cancel`,m=await fetch(c,i);if(204!==m.status){const e=await m.json();if(e.errors)throw new t(e.errors.map((e=>`${e.code}: ${e.detail}`)))}}export{s as SEPA_TRANSFERS_ENDPOINT,m as cancelSepaTransfer,c as createSepaTransfer,i as getSepaTransfer,a as getSepaTransfers};
1
+ import{buildRequestHeaders as e}from"../common/network/network.js";import{environmentManager as n}from"../common/environment/environment-manager.js";import{addPaginationParamsToUrl as r}from"../common/api-pagination/api-pagination.js";import{EmbedApiError as t}from"../errors/EmbedApiError.js";import{serializeToNewSepaTransferDataObject as o}from"./sepa-transfers.serializer.js";const s="/v2/sepa/transfers";async function a({accessToken:o,stagingToken:a,paginationSettings:i}){const c={method:"GET",headers:e({accessToken:o,stagingToken:a})},m=new URL(`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${s}`),f=r({endpointUrl:m,paginationSettings:i}),T=await fetch(f,c);if(!T.ok)throw new t("Failed to fetch SEPA transfers");const g=await T.json();if(g.errors)throw new t(g.errors.map((e=>`${e.code}: ${e.detail}`)));return{transfers:g.transfers,meta:g.meta}}async function i({accessToken:r,stagingToken:o,sepaTransferId:a}){const i={method:"GET",headers:e({accessToken:r,stagingToken:o})},c=`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${s}/${a}`,m=await fetch(c,i),f=await m.json();if(f.errors)throw new t(f.errors.map((e=>`${e.code}: ${e.detail}`)));return f.transfer}async function c({transfer:r,accessToken:a,stagingToken:i,idempotencyKey:c}){const m=o(r),f={method:"POST",headers:e({accessToken:a,stagingToken:i,idempotencyKey:c}),body:JSON.stringify({transfer:m})},T=`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${s}`,g=await fetch(T,f),d=await g.json();if(d.errors)throw new t(d.errors.map((e=>`${e.code}: ${e.detail}`)));return d.transfer}async function m({sepaTransferId:r,accessToken:o,stagingToken:a}){const i={method:"POST",headers:e({accessToken:o,stagingToken:a})},c=`${n.getEnvironmentUrls().THIRD_PARTY_API_URL}${s}/${r}/cancel`,m=await fetch(c,i);if(204!==m.status){const e=await m.json();if(e.errors)throw new t(e.errors.map((e=>`${e.code}: ${e.detail}`)))}}export{s as SEPA_TRANSFERS_ENDPOINT,m as cancelSepaTransfer,c as createSepaTransfer,i as getSepaTransfer,a as getSepaTransfers};
@@ -1 +1 @@
1
- import{cancelSepaTransfer as e,createSepaTransfer as r,getSepaTransfer as a,getSepaTransfers as s}from"./sepa-transfers.js";const n={getSepaTransfers:s,getSepaTransfer:a,createSepaTransfer:r,cancelSepaTransfer:e};export{n as sepaTransfers};
1
+ import{getBulkTransfers as r}from"./bulk-transfers/bulk-transfers.js";import{cancelSepaTransfer as e,createSepaTransfer as s,getSepaTransfer as a,getSepaTransfers as f}from"./sepa-transfers.js";const n={getSepaTransfers:f,getSepaTransfer:a,createSepaTransfer:s,cancelSepaTransfer:e,bulkTransfers:{getBulkTransfers:r}};export{n as sepaTransfers};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qonto/embed-sdk",
3
- "version": "0.20.0",
3
+ "version": "0.21.1",
4
4
  "description": "Library to embed Qonto features in your application",
5
5
  "type": "module",
6
6
  "exports": {