@qonto/embed-sdk 0.34.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const n=t.getInstance();class a extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class i extends a{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function r(){if(!n.hasAccessToken())throw new i;return n.getAccessToken()}class s extends a{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}const o={READY:"qonto.ready"},c={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},u={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},m={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},l={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},f=3e4,g={ACCEPT:"ACCEPT",REJECT:"REJECT"};var p=Object.freeze({__proto__:null,ACTIONS:c,ACTIVITY_TAGS:{ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},AMOUNT_REQUIRING_ATTACHMENTS:f,BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:u,ENVIRONMENTS:d,IFRAME_EVENTS:o,LOCALES:m,MFA_METHODS:l,TRANSACTION_STATUSES:{PENDING:"pending",DECLINED:"declined",COMPLETED:"completed"},TRANSFER_DECLINE_REASONS:{BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},TRANSFER_STATUSES:{PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled",FAILED:"failed",COMPLETED:"completed"},VOP_CHECK_RESULTS:{MATCH_RESULT_MATCH:"MATCH_RESULT_MATCH",MATCH_RESULT_NO_MATCH:"MATCH_RESULT_NO_MATCH",MATCH_RESULT_CLOSE_MATCH:"MATCH_RESULT_CLOSE_MATCH",MATCH_RESULT_NOT_POSSIBLE:"MATCH_RESULT_NOT_POSSIBLE",MATCH_RESULT_UNSPECIFIED:"MATCH_RESULT_UNSPECIFIED"},VOP_DECISIONS:g});class h{constructor(){this.mfaPreference=l.PASSKEY,this.debugMode=!1}static getInstance(){return h.instance||(h.instance=new h),h.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=l.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}}const T=h.getInstance(),y="https://embed.qonto.com",_="https://embed-js{branch}.staging.qonto.co",I="https://embed.dev.qonto.co",b={[d.PRODUCTION]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:I,IFRAME_URL:`${I}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class w{constructor(){this.environment=d.PRODUCTION,this.branch=u.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(d).includes(e)?e:d.PRODUCTION,this.branch=Object.values(u).includes(t)?t:u.SANDBOX}static getInstance(){return w.instance||(w.instance=new w),w.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===d.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=d.PRODUCTION,this.branch=u.MASTER}getEnvironmentUrls(){if(this.environment===d.PRODUCTION)return b.production;{const e=b[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const k=w.getInstance(),E={requiresUI:!1};function A(e,{requiresUI:t}=E){const n=e?.uiParentElementId||T.getUIParentElementId();if(t&&!n)throw new s("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");const a=e?.mfaPreference||T.getMFAPreference();if(a){const e=(i=Object.values(l),k.isProductionEnvironment()?i.filter((e=>e!==l.MOCK)):i);if(!e.includes(a))throw new s(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(k.isProductionEnvironment()&&a===l.MOCK)throw new s("operationSettings.mfaPreference cannot be set to mock in production environment.")}var i;const r=e?.debugMode||T.getDebugMode();if(void 0!==r&&"boolean"!=typeof r)throw new s("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||T.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new s("operationSettings.proxyRequestFunction must be a function.");return{...e,uiParentElementId:n,mfaPreference:a,debugMode:r,proxyRequestFunction:o}}const S=Object.values(m);function R(e){if(!function(e){return S.includes(e)}(e))throw new s(`Unsupported locale: ${e}. The locale must be one of: ${S.join(", ")}.`);return e}function L(e){if(!e?.accessToken&&!e?.operationSettings?.proxyRequestFunction)throw new s("Either operationSettings.proxyRequestFunction or access token is required when calling initialize()");return e?.operationSettings&&A(e.operationSettings),function(e){if(e.environment){if(!["production","staging","local"].includes(e.environment))throw new s('If provided, environment must be either "production" or "staging"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.environment.PRODUCTION" or "constants.environment.STAGING"');if(e.branch&&!["master","sandbox","qa"].includes(e.branch))throw new s('If provided, branch must be either "master", "sandbox" or "qa"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.branch.MASTER" or "constants.environment.SANDBOX" and so on')}}(e),e.locale&&R(e.locale),e}class v{constructor(){this.currentLocale="en"}static getInstance(){return v.instance||(v.instance=new v),v.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const P=v.getInstance();const D={initialize:function(e){const{accessToken:t,stagingToken:a,operationSettings:i,environment:r,branch:s,locale:o}=L(e);t&&n.setAccessToken(t),a&&n.setStagingToken(a),o&&P.setLocale(o),i&&T.setSettings(i),r&&(k.setEnvironment(r),s&&k.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),P.setDefaultLocale(),T.clearSettings()},constants:p},{initialize:O,logout:N,constants:C}=D;class U extends a{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function M(){return"undefined"!=typeof window&&"undefined"!=typeof document}function $(){return!M()}function q({accessToken:e,stagingToken:t,idempotencyKey:a,mfaPreference:i}){const r=new Headers;r.append("Authorization",`Bearer ${e}`);const s=t||n.getStagingToken();s&&r.append("X-Qonto-Staging-Token",s),a&&r.append("X-Qonto-Idempotency-Key",a);const o=i||T.getMFAPreference();return o&&r.append("X-Qonto-2fa-Preference",o),r.append("Content-Type","application/json"),r.append("Accept-Language",P.getLocale()),r}async function F({path:e,options:t}){const n=`${k.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(n,{...t,headers:q(t.headers),body:JSON.stringify(t.body)}),i=await a.json();if(!a.ok)throw i.errors?new U(i.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${i.code}: ${i.detail}`);return i}function B(e){const t={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},n=JSON.stringify(t);return a=n,$()?Buffer.from(a).toString("base64"):btoa(a);var a}function G(e){return JSON.parse((t=e,$()?Buffer.from(t,"base64").toString("utf-8"):atob(t)));var t}function x({membershipId:e,accessToken:t,stagingToken:n}){return{path:e?`/v2/cards?holder_ids[]=${e}`:"/v2/cards",options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function H({cardId:e,accessToken:t,stagingToken:n}){return{path:`/v2/cards?ids[]=${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}var K;!function(e){e.PENDING="pending",e.ONHOLD="onhold",e.ORDER_CANCELED="order_canceled",e.LIVE="live",e.PAUSED="paused",e.STOLEN="stolen",e.LOST="lost",e.PIN_BLOCKED="pin_blocked",e.DELETED="deleted",e.PRE_EXPIRED="pre_expired",e.EXPIRED="expired",e.DISCARDED="discarded",e.SHIPPED_LOST="shipped_lost",e.ABUSIVE="abusive"}(K||(K={}));const j={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var Y,z;function V(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:void 0===e[t.name])).map((e=>e.name));if(n.length>0)throw new s(n.map((e=>`Missing required parameter: ${e}`)))}function W(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function J(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function X(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}(Y||(Y={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(z||(z={}));const Q=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],Z=[...Q,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function ee(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return V(e,Q),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:m,cardLevel:l}=e,f=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(l),g=W({membershipId:t,organizationId:n,bankAccountId:a}),p=J({hasDailyLimit:i,hasTransactionLimit:r}),h=X({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),T=te(u),y=ne(m),_=[...f,...g,...p,...h,...T,...y];if(_.length>0)throw new s(_)}(e),e}(e):function(e){V(e,Z),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:m,cardLevel:l,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,shipToBusiness:h,hasAtmOption:T,hasAtmDailyLimit:y,atmDailyLimit:_,atmMonthlyLimit:I,address:b,cardDesign:w,typeOfPrint:k}=e,E=function(e){return Object.values(z).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(l),A=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(k),S=W({membershipId:t,organizationId:n,bankAccountId:a}),R=J({hasDailyLimit:i,hasTransactionLimit:r,hasAtmOption:T,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,hasAtmDailyLimit:y,shipToBusiness:h}),L=X({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:_,atmMonthlyLimit:I}),v=te(u),P=ne(m),D=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(w),O=function(e,t){if(t)return[];return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(b,h),N=[...E,...S,...R,...L,...v,...P,...A,...D,...O];if(N.length>0)throw new s(N)}(e)}(e)}function te(e){const t=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function ne(e){const t=!Array.isArray(e)||e.some((e=>"string"!=typeof e));return void 0!==e&&t?["categories must be an array of strings"]:[]}class ae extends a{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const ie=[];for(let e=0;e<256;++e)ie.push((e+256).toString(16).slice(1));let re;const se=new Uint8Array(16);var oe={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ce(e,t,n){if(oe.randomUUID&&!e)return oe.randomUUID();const a=(e=e||{}).random??e.rng?.()??function(){if(!re){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");re=crypto.getRandomValues.bind(crypto)}return re(se)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=15&a[6]|64,a[8]=63&a[8]|128,function(e,t=0){return(ie[e[t+0]]+ie[e[t+1]]+ie[e[t+2]]+ie[e[t+3]]+"-"+ie[e[t+4]]+ie[e[t+5]]+"-"+ie[e[t+6]]+ie[e[t+7]]+"-"+ie[e[t+8]]+ie[e[t+9]]+"-"+ie[e[t+10]]+ie[e[t+11]]+ie[e[t+12]]+ie[e[t+13]]+ie[e[t+14]]+ie[e[t+15]]).toLowerCase()}(a)}function de({actionId:e,actionData:t}){const n=T.getMFAPreference();return{actionId:e,actionData:{...t,scaPreference:t.scaPreference||n,idempotencyKey:t.idempotencyKey||ce()}}}class ue{constructor(e){this.options=e,this.iframe=null,this.parentElement=null,this.messageListeners=new Map,this.defaultTimeout=3e4;const t=new URL(e.iframeUrl);this.targetOrigin=`${t.protocol}//${t.host}`}async initialize(){if(this.iframe)return this;if(this.parentElement=document.getElementById(this.options.parentElementId),!this.parentElement)throw new ae(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,a=setTimeout((()=>{window.removeEventListener("message",i),t(new ae(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),i=t=>{t.data.eventId===o.READY&&(clearTimeout(a),window.removeEventListener("message",i),e(this))};window.addEventListener("message",i),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){if(!this.iframe||!this.iframe.contentWindow)return Promise.reject(new ae("Attempted to perform an Embed operation without having the authentication UI initialized."));const t=de(e);return new Promise(((e,n)=>{const a=i=>{if(i.data?.actionId===t.actionId){if("error"===i.data.status)return this.removeMessageListener(t.actionId,a),n(new ae(`An error occurred when performing the action ${t.actionId}.\n${JSON.stringify(i.data.payload)}`));this.removeMessageListener(t.actionId,a),e(i.data.payload)}};this.addMessageListener(t.actionId,a),this.iframe?.contentWindow?.postMessage(t,this.targetOrigin)}))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function me({accessToken:e,stagingToken:t,locale:n,debugMode:a}){const i=a||!1,r=n||P.getLocale(),s=k.getEnvironmentUrls().IFRAME_URL,o=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${i}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function le({parentElementId:e,iframeUrl:t}){return new ue({parentElementId:e,iframeUrl:t}).initialize()}function fe(e){return"virtual"===e.cardLevel?function(e){const t=pe(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ce(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel}}}}}(e):function(e){const t=pe(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ce(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel,card_design:e.cardDesign,..."plus"===e.cardLevel&&{type_of_print:e.typeOfPrint},ship_to_business_address:e.shipToBusiness,atm_option:e.hasAtmOption,nfc_option:e.hasNfcOption,foreign_option:e.hasForeignPaymentOption,online_option:e.hasOnlinePaymentOption,atm_daily_limit:e.atmDailyLimit,atm_monthly_limit:e.atmMonthlyLimit,...!e.shipToBusiness&&{address:{contact_name:e.address?.contactName,first_line:e.address?.firstLine,second_line:e.address?.secondLine,third_line:e.address?.thirdLine,zipcode:e.address?.zipCode,city:e.address?.city,country:e.address?.country}}}}}}}(e)}function ge(e){return{id:e.id,nickname:e.nickname,embossedName:e.embossed_name,status:e.status,maskPan:e.mask_pan,expMonth:parseInt(e.exp_month,10),expYear:parseInt(e.exp_year,10),lastActivityAt:new Date(e.last_activity_at),lastDigits:e.last_digits,shipToBusiness:e.ship_to_business,atmOption:e.atm_option,atmDailyLimitOption:e.atm_daily_limit_option,nfcOption:e.nfc_option,onlineOption:e.online_option,foreignOption:e.foreign_option,atmMonthlyLimit:e.atm_monthly_limit,atmMonthlySpent:e.atm_monthly_spent,atmDailyLimit:e.atm_daily_limit,atmDailySpent:e.atm_daily_spent,paymentMonthlyLimit:e.payment_monthly_limit,paymentMonthlySpent:e.payment_monthly_spent,paymentDailyLimit:e.payment_daily_limit,paymentDailySpent:e.payment_daily_spent,paymentDailyLimitOption:e.payment_daily_limit_option,paymentTransactionLimit:e.payment_transaction_limit,paymentTransactionLimitOption:e.payment_transaction_limit_option,activeDays:e.active_days,holderId:e.holder_id,bankAccountId:e.bank_account_id,organizationId:e.organization_id,updatedAt:new Date(e.updated_at),createdAt:new Date(e.created_at),shippedAt:new Date(e.shipped_at),cardType:e.card_type,cardLevel:e.card_level,paymentLifespanLimit:e.payment_lifespan_limit,paymentLifespanSpent:e.payment_lifespan_spent,preExpiresAt:new Date(e.pre_expires_at),categories:e.categories,renewed:e.renewed,renewal:e.renewal,...e.parent_card_summary&&{parentCardSummary:{id:e.parent_card_summary.id,lastDigits:e.parent_card_summary.last_digits}},hadOperation:e.had_operation,hadPinOperation:e.had_pin_operation,cardDesign:e.card_design,typeOfPrint:e.type_of_print,upsold:e.upsold,upsell:e.upsell,discardOn:new Date(e.discard_on),reordered:e.reordered}}function pe(e){const t=Object.values(j);return(e||[]).filter((e=>t.includes(e)))}const he="--qonto-embed";function Te(e){return!e.href||e.href.startsWith(window.location.origin)}function ye(e){return"CSSStyleRule"===e.constructor.name}function _e(e=he){return M()?function(e,t){return[...e].filter(Te).reduce(((e,n)=>[...n.cssRules].filter(ye).reduce(((e,n)=>{if("style"in n){const a=[...n.style].map((e=>[e.trim(),n.style.getPropertyValue(e).trim()])).filter((([e])=>e.startsWith(t))).reduce(((e,[n,a])=>({...e,[n.replace(`${t}-`,"")]:a})),{});return{...e,...a}}return e}),e)),{})}(document.styleSheets,e):{}}const Ie={getCards:async function(e){try{const t=e?.cardSettings?.membershipId;if(t&&"string"!=typeof t)throw new s("membershipId must be a string");const{proxyRequestFunction:n,stagingToken:a}=A(e?.operationSettings||{});if(n){const e=B(x({membershipId:t,stagingToken:a})),i=await n(e);return G(i).body.cards.map((e=>ge(e)))}{const n=e?.operationSettings?.accessToken||r(),i=await async function({membershipId:e,accessToken:t,stagingToken:n}){const a=x({membershipId:e,accessToken:t,stagingToken:n}),{cards:i}=await F(a);return i}({membershipId:t,accessToken:n,stagingToken:a});return i.map((e=>ge(e)))}}catch(e){return Promise.reject(e)}},getCard:async function({cardSettings:e,operationSettings:t}){try{!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId parameter is required for the called function");const t=W({cardId:e.cardId});if(t.length>0)throw new s(t)}(e);const n=e.cardId,{proxyRequestFunction:a,stagingToken:i}=A(t||{});if(a){const e=B(H({cardId:n,stagingToken:i})),t=await a(e),r=G(t).body.cards;if(Array.isArray(r)&&r.length>0)return ge(r[0]);throw new s("Unable to retrieve card data")}{const e=t?.accessToken||r(),a=await async function({cardId:e,accessToken:t,stagingToken:n}){const a=H({cardId:e,accessToken:t,stagingToken:n}),{cards:i}=await F(a);return i[0]}({cardId:n,accessToken:e,stagingToken:i});return ge(a)}}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=A(e.operationSettings,{requiresUI:!0});ee(e.cardSettings);const s=me({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),o=await le({iframeUrl:s,parentElementId:a}),c=fe(e.cardSettings),d=await o.postMessage(c);return o.destroy(),ge(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=A(e.operationSettings,{requiresUI:!0});!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=W({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=me({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),d=await le({iframeUrl:o,parentElementId:a}),u=function(e){return{actionId:c.CARD_UNLOCK,actionData:{body:{cardId:e.cardSettings.cardId}}}}(e),m=await d.postMessage(u);return d.destroy(),ge(m)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:t,accessToken:n,stagingToken:a,debugMode:i,mfaPreference:o}=A(e.operationSettings,{requiresUI:!0}),c=n||r();!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=W({cardId:e.cardId});if(t.length>0)throw new s(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const a=J(n);if(a.length>0)throw new s(a)}(e.cardSettings);const d=await async function(e){const{accessToken:t,stagingToken:n,mfaPreference:a}=e,i={method:"GET",headers:q({accessToken:t,stagingToken:n,mfaPreference:a})},r=k.getEnvironmentUrls().THIRD_PARTY_API_URL,s=await fetch(`${r}/v2/cards/${e.cardId}/data_view`,i),o=await s.json();if(!s.ok)throw o.errors?new U(o.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${o.code}: ${o.detail}`);return o.iframe_url}({...e.cardSettings,accessToken:c,stagingToken:a,mfaPreference:o}),{allowPinReveal:u,allowBlocking:m}=e.cardSettings,l=function(e,t){const n=new URL(e);"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal.toString()),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking.toString()),!0===t.debugMode&&n.searchParams.set("debug",t.debugMode.toString());const a=_e(he);return Object.keys(a).length>0&&n.searchParams.set("customization",JSON.stringify(a)),n.toString()}(d,{allowPinReveal:u,allowBlocking:m,debugMode:i}),f=await le({iframeUrl:l,parentElementId:t});return{destroyEmbedUI:()=>{f.destroy()}}}catch(e){return Promise.reject(e)}}},be=Ie;function we(e){const t=new URLSearchParams;return e?.page&&t.append("page",e.page.toString()),e?.itemsPerPage&&t.append("per_page",e.itemsPerPage.toString()),t}function ke({endpointUrl:e,paginationSettings:t}){return function({url:e,searchParams:t}){const n=new URL(e.toString());for(const[e,a]of t.entries())n.searchParams.append(e,a);return n}({url:new URL(e),searchParams:we(t)})}function Ee(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}function Ae(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function Se(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const Re="/v2/sepa/beneficiaries";function Le({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},i=we(e),r=i.size?`?${i.toString()}`:"";return{path:`${Re}${r}`,options:a}}function ve({beneficiaryId:e,accessToken:t,stagingToken:n}){return{path:`${Re}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}async function Pe({accessToken:e,stagingToken:t,beneficiaryId:n}){const a=ve({beneficiaryId:n,accessToken:e,stagingToken:t}),{beneficiary:i}=await F(a);return i}function De({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=ce()}){return{path:Re,options:{method:"POST",headers:{accessToken:t,stagingToken:n,idempotencyKey:a},body:{beneficiary:Se(e)}}}}function Oe({beneficiaryIds:e,accessToken:t,stagingToken:n}){return{path:`${Re}/untrust`,options:{method:"PATCH",headers:{accessToken:t,stagingToken:n},body:{ids:e}}}}function Ne({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}){const{name:r,email:s,activityTag:o}=e,c={method:"PATCH",headers:{accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i},body:{beneficiary:{name:r,email:s,activity_tag:o}}};return{path:`${Re}/${e.id}`,options:c}}const Ce=[{name:"name"},{name:"iban"}];const Ue={getBeneficiaries:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=A(e?.operationSettings||{});if(n){const e=B(Le({paginationSettings:i})),t=G(await n(e)),a=t.body.beneficiaries.map((e=>Ae(e))),r=Ee(t.body.meta);return{beneficiaries:a,...r?{meta:r}:{}}}{const e=a||r(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const a=Le({paginationSettings:e,accessToken:t,stagingToken:n}),{beneficiaries:i,meta:r}=await F(a);return{beneficiaries:i,meta:r}}({accessToken:e,stagingToken:t,paginationSettings:i}),s=n.beneficiaries.map((e=>Ae(e))),o=Ee(n.meta);return{beneficiaries:s,...o?{meta:o}:{}}}},getBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:a,accessToken:i,stagingToken:o}=A(t||{});if(a){const e=B(ve({beneficiaryId:n}));return Ae(G(await a(e)).body.beneficiary)}{const e=i||r();return Ae(await Pe({beneficiaryId:n,accessToken:e,stagingToken:o}))}},addBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new s("beneficiary must be an object");V(e,Ce);const t=W({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new s(t);return e}(e),{proxyRequestFunction:a,accessToken:i,stagingToken:o,idempotencyKey:c}=A(t||{});if(a){const e=B(De({beneficiary:n,idempotencyKey:c}));return Ae(G(await a(e)).body.beneficiary)}{const e=i||r(),t=await async function({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=ce()}){const i=De({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a}),{beneficiary:r}=await F(i);return r}({beneficiary:n,accessToken:e,stagingToken:o,idempotencyKey:c});return Ae(t)}},updateBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){const{id:t,name:n,email:a,activityTag:i}=e||{};if(!t)throw new s("Invalid parameters were passed to the function:\nA beneficiary ID is required for the called function");if(!n&&!a&&!i)throw new s("Invalid parameters were passed to the function:\nAt least one of the following properties must be provided: name, email, activityTag");const r=W({name:n,email:a,activityTag:i});if(r.length>0)throw new s(r);return{id:t,name:n,email:a,activityTag:i}}(e),{stagingToken:a,idempotencyKey:i,mfaPreference:o,proxyRequestFunction:c}=A(t),d={beneficiaryParamsBeingEdited:n,idempotencyKey:i,mfaPreference:o};if(c){const e=B(Ne(d));return Ae(G(await c(e)).body.beneficiary)}{const e=t?.accessToken||r(),n=await async function({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}){const r=Ne({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}),{beneficiary:s}=await F(r);return s}({...d,accessToken:e,stagingToken:a});return Ae(n)}},untrustBeneficiaries:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiaryIds parameter is required for the called function");if(!Array.isArray(e)||!e.every((e=>"string"==typeof e)))throw new s("beneficiaryIds must be an array of strings");return e}(e?.beneficiaryIds),{proxyRequestFunction:a,accessToken:i,stagingToken:o}=A(t||{});if(a){const e=B(Oe({beneficiaryIds:n}));return G(await a(e)).body.beneficiaries.map(Ae)}{const e=i||r(),t=await async function({beneficiaryIds:e,accessToken:t,stagingToken:n}){const a=Oe({beneficiaryIds:e,accessToken:t,stagingToken:n}),{beneficiaries:i}=await F(a);return i}({beneficiaryIds:n,accessToken:e,stagingToken:o});return t.map(Ae)}}},Me=Ue;function $e(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}const qe="/v2/sepa/bulk_transfers";function Fe(e){if(!e)throw new s("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new s("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new s("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new s("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,t)=>{!function(e,t){if(!e)throw new s(`Invalid bulkTransfer at index ${t}: bulkTransfer object is required`);if(!e.beneficiaryId&&!e.beneficiary)throw new s(`Invalid bulkTransfer at index ${t}: Either beneficiaryId for an existing beneficiary or beneficiary details must be provided`);if(e.beneficiaryId&&e.beneficiary)throw new s(`Invalid bulkTransfer at index ${t}: Provide either beneficiaryId for an existing beneficiary or beneficiary details to create/update one, not both`);if(e.beneficiary){if(!e.beneficiary.iban)throw new s(`Invalid bulkTransfer at index ${t}: IBAN is required when providing beneficiary details`);if(!e.beneficiary.name)throw new s(`Invalid bulkTransfer at index ${t}: Beneficiary name is required when providing beneficiary details`)}const n=W({beneficiaryId:e.beneficiaryId,reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=X({amount:e.amount}),i=[...n,...a].flat();if(i.length>0)throw new s(i);if(e.amount>f&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new s(`Invalid bulkTransfer at index ${t}: Attachments are required for transfers over €30000`)}(e,t)})),e}const Be="browser",Ge="server";class xe extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case Be:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case Ge:this.message="This code is running in a server environment, but it is expected to run in a browser environment.";break;default:this.message="This code is not expected to run in this environment. Check if the function was server-only or browser-only."}}}function 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 Ke(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}const je="/v2/sepa",Ye=`${je}/transfers`;function ze({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},i=we(e),r=i.size?`?${i.toString()}`:"";return{path:`${Ye}${r}`,options:a}}async function Ve({sepaPayee:e,accessToken:t,stagingToken:n}){const a=function({sepaPayee:e,accessToken:t,stagingToken:n}){return{path:`${je}/verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:t,stagingToken:n});return await F(a)}const We=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];const Je={getSepaTransfers:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=A(e?.operationSettings||{});if(n){const e=B(ze({paginationSettings:i})),t=G(await n(e)),a=t.body.transfers.map(He),r=Ee(t.body.meta);return{transfers:a,...r?{meta:r}:{}}}{const e=a||r(),n=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a=ze({paginationSettings:n,accessToken:e,stagingToken:t}),{transfers:i,meta:r}=await F(a);return{transfers:i,meta:r}}({accessToken:e,stagingToken:t,paginationSettings:i}),s=n.transfers.map(He),o=Ee(n.meta);return{transfers:s,...o?{meta:o}:{}}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);return He(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const a={method:"GET",headers:q({accessToken:e,stagingToken:t})},i=`${k.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ye}/${n}`,r=await fetch(i,a),s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.transfer}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken}))},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),o=t?.idempotencyKey||ce();let d;!function(e){if(!e)throw new s("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new s("sepaTransferSettings must be an object");if(V(e,We),!e.beneficiaryId&&!e.beneficiary)throw new s("Either beneficiaryId or beneficiary must be provided");const t=[...W({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...X({amount:e.amount})].flat();if(t.length>0)throw new s(t);if(e.amount>f&&(!e.attachmentIds||0===e.attachmentIds.length))throw new s("Attachments are required for transfers over €30,000")}(e);const u=await async function({sepaTransferSettings:e,operationSettings:t}){return e?.beneficiary?e.beneficiary:Ae(await Pe({beneficiaryId:e?.beneficiaryId,accessToken:t?.accessToken,stagingToken:t?.stagingToken}))}({sepaTransferSettings:e,operationSettings:{accessToken:a,stagingToken:i||void 0}}),m={name:u.name,iban:u.iban},l=await Ve({sepaPayee:m,accessToken:a,stagingToken:i||void 0});var p;if((yield(p=l,{matchResult:p.match_result,matchedName:p.matched_name}))===g.REJECT)return;const h={...e,beneficiary:u};if(h.beneficiary?.trusted)d=await async function({transfer:e,vopProofToken:t,accessToken:n,stagingToken:a,idempotencyKey:i}){const r=Ke(e),s={method:"POST",headers:q({accessToken:n,stagingToken:a,idempotencyKey:i}),body:JSON.stringify({transfer:r,vop_proof_token:t})},o=`${k.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ye}`,c=await fetch(o,s),d=await c.json();if(d.errors)throw new U(d.errors.map((e=>`${e.code}: ${e.detail}`)));return d.transfer}({transfer:h,vopProofToken:l.proof_token.token,accessToken:a,stagingToken:i||void 0,idempotencyKey:o});else{if(!M())throw new xe(Be);const{uiParentElementId:e,debugMode:n}=A(t,{requiresUI:!0});let r;try{const t=me({accessToken:a,stagingToken:i||void 0,debugMode:n});r=await le({iframeUrl:t,parentElementId:e});const s=Ke(h);d=await r.postMessage(de({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}}))}finally{r?.destroy()}}return He(d)},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);await async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const a={method:"POST",headers:q({accessToken:t,stagingToken:n})},i=`${k.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 U(e.errors.map((e=>`${e.code}: ${e.detail}`)))}}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken})},bulkTransfers:{getBulkTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||r(),{stagingToken:a,paginationSettings:i}=A(t||{}),s=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a={method:"GET",headers:q({accessToken:e,stagingToken:t})},i=ke({endpointUrl:new URL(`${k.getEnvironmentUrls().THIRD_PARTY_API_URL}${qe}`),paginationSettings:n}),r=await fetch(i,a);if(!r.ok)throw new U("Failed to fetch SEPA bulk transfers");const s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{bulkTransfers:s.bulk_transfers,meta:s.meta}}({accessToken:n,stagingToken:a,paginationSettings:i}),o=s.bulkTransfers?.map($e),c=Ee(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),{stagingToken:a}=A(t||{}),i=function(e){if(!e)throw new s("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new s("bulkTransferId must be a string.");return e}(e?.bulkTransferId);return $e(await async function({accessToken:e,stagingToken:t,bulkTransferId:n}){const a={method:"GET",headers:q({accessToken:e,stagingToken:t})},i=new URL(`${k.getEnvironmentUrls().THIRD_PARTY_API_URL}${qe}/${n}`),r=await fetch(i,a),s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.bulk_transfer}({accessToken:n,stagingToken:a,bulkTransferId:i}))},createBulkTransfer:async function({bulkTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),s=t?.idempotencyKey||ce();if(Fe(e),!M())throw new xe(Be);const{uiParentElementId:o,debugMode:d}=A(t,{requiresUI:!0});let u,m;try{const t=me({accessToken:a,stagingToken:i||void 0,debugMode:d});m=await le({iframeUrl:t,parentElementId:o});const n={bankAccountId:e.bankAccountId,bulkTransfers:e.bulkTransfers.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))};u=await m.postMessage(de({actionId:c.TRANSFER_BULK_CREATE,actionData:{body:n,idempotencyKey:s}}))}finally{m?.destroy()}return $e(u)}}},Xe={GOOD:"good",SERVICE:"service"},Qe={AED:"AED",AUD:"AUD",BGN:"BGN",CAD:"CAD",CHF:"CHF",CNY:"CNY",CZK:"CZK",DKK:"DKK",EUR:"EUR",GBP:"GBP",GHS:"GHS",HKD:"HKD",HUF:"HUF",ILS:"ILS",INR:"INR",MXN:"MXN",NOK:"NOK",NZD:"NZD",PEN:"PEN",PLN:"PLN",RON:"RON",RSD:"RSD",SAR:"SAR",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",ZAR:"ZAR",ZMW:"ZMW"},Ze=e=>{if(!(e=>Object.values(Qe).includes(e))(e))throw new s(`currency ${e} is not valid, valid currencies are ${Object.values(Qe).join(", ")}`)},et={UNIT:"unit",HOUR:"hour",DAY:"day",MONTH:"month",GRAM:"gram",KILOGRAM:"kilogram",LITER:"liter",METER:"meter",SQUARE_METER:"square_meter",CUBIC_METER:"cubic_meter",AMPERE:"ampere",NUMBER_OF_ARTICLES:"number_of_articles",CENTIMETER:"centimeter",CUBIC_METER_PER_HOUR:"cubic_meter_per_hour",GIGAJOULE:"gigajoule",GIGAWATT:"gigawatt",GIGAWATT_HOUR:"gigawatt_hour",HALF_YEAR:"half_year",JOULE:"joule",KILOJOULE:"kilojoule",KILOVAR:"kilovar",KILOWATT:"kilowatt",KILOWATT_HOUR:"kilowatt_hour",MEGAJOULE:"megajoule",MEGAWATT:"megawatt",MEGAWATT_HOUR:"megawatt_hour",MILLIGRAM:"milligram",MILLILITER:"milliliter",MILLIMETER:"millimeter",MINUTE:"minute",PAIR:"pair",QUARTER:"quarter",SECOND:"second",SET:"set",TON:"ton",TWO_WEEK:"two_week",WATT_HOUR:"watt_hour",WEEK:"week",YEAR:"year"},tt=e=>{if(!(e=>Object.values(et).includes(e))(e))throw new s(`unit ${e} is not valid, valid units are ${Object.values(et).join(", ")}`)},nt=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],at=[{name:"currency"},{name:"value"}];const it=e=>{if(!Object.values(Xe).includes(e))throw new s(`type ${e} is not valid, valid types are ${Object.values(Xe).join(", ")}`)},rt={getPaymentLinkCreationFlowUrl:({paymentLinkSettings:e})=>{const{items:t,authUrl:n}=e;!function(e){if(!e)throw new s("authUrl is required for the called function");const t=W({authUrl:e});if(t.length>0)throw new s(t);try{new URL(e)}catch{throw new s("authUrl is not a valid URL")}}(n),function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{V(e,nt),V(e.unitPrice,at);const t=[...W({id:e.id,title:e.title,vatRate:e.vatRate,currency:e.unitPrice.currency,measureUnit:e.measureUnit,unitPrice:e.unitPrice.value,...e.description?{description:e.description}:{}}),...X({quantity:e.quantity})].flat();if(t.length>0)throw new s(t);it(e.type),Ze(e.unitPrice.currency),tt(e.measureUnit)}))}(t);const a=new URLSearchParams({...t?{items:JSON.stringify(t)}:{}});return a.toString()?`${n}?${a.toString()}`:n}},st=({accessToken:e,stagingToken:t})=>({path:"/v2/organizations/",options:{method:"GET",headers:{accessToken:e,stagingToken:t}}}),ot=e=>({slug:e.slug,iban:e.iban,bic:e.bic,currency:e.currency,balance:e.balance,balanceCents:e.balance_cents,authorizedBalance:e.authorized_balance,authorizedBalanceCents:e.authorized_balance_cents,name:e.name,updatedAt:new Date(e.updated_at),status:e.status,main:e.main}),ct={getBankAccounts:async e=>{const{stagingToken:t,proxyRequestFunction:n}=A(e);if(n){const e=st({stagingToken:t}),a=await n(B(e)),{body:i}=G(a);return i.bank_accounts.map(ot)}{const n=e.accessToken||r(),a=await(async({accessToken:e,stagingToken:t})=>{const n=st({accessToken:e,stagingToken:t});return await F(n)})({accessToken:n,stagingToken:t});return a.bank_accounts.map(ot)}}},dt="/v2/transactions";function ut({bankAccountId:e,iban:t,status:n,updatedAtFrom:a,updatedAtTo:i,emittedAtFrom:r,emittedAtTo:s,settledAtFrom:o,settledAtTo:c,side:d,operationType:u,withAttachments:m,paginationSettings:l,accessToken:f,stagingToken:g}){const p={method:"GET",headers:{accessToken:f,stagingToken:g}},h=new URLSearchParams;e&&h.append("bank_account_id",e),t&&h.append("iban",t),n&&h.append("status",n),a&&h.append("updated_at_from",a),i&&h.append("updated_at_to",i),r&&h.append("emitted_at_from",r),s&&h.append("emitted_at_to",s),o&&h.append("settled_at_from",o),c&&h.append("settled_at_to",c),d&&h.append("side",d),u&&h.append("operation_type",u),void 0!==m&&h.append("with_attachments",String(m));const T=we(l);for(const[e,t]of T)h.append(e,t);const y=h.toString();return{path:`${dt}${y?`?${y}`:""}`,options:p}}function mt({transactionId:e,accessToken:t,stagingToken:n}){return{path:`${dt}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function lt(e){return{transactionId:e.transaction_id,amount:e.amount,amountCents:e.amount_cents,settledBalance:e.settled_balance,settledBalanceCents:e.settled_balance_cents,attachmentIds:e.attachment_ids,localAmount:e.local_amount,localAmountCents:e.local_amount_cents,side:e.side,operationType:e.operation_type,currency:e.currency,localCurrency:e.local_currency,label:e.label,settledAt:new Date(e.settled_at),emittedAt:new Date(e.emitted_at),updatedAt:new Date(e.updated_at),status:e.status,note:e.note,reference:e.reference,vatAmount:e.vat_amount,vatAmountCents:e.vat_amount_cents,vatRate:e.vat_rate,initiatorId:e.initiator_id,labelIds:e.label_ids,attachmentLost:e.attachment_lost,attachmentRequired:e.attachment_required,cardLastDigits:e.card_last_digits,category:e.category,cashflowCategory:{name:e.cashflow_category?.name||""},cashflowSubcategory:{name:e.cashflow_subcategory?.name||""},id:e.id,subjectType:e.subject_type,...e.transfer?{transfer:{counterpartyAccountNumber:e.transfer.counterparty_account_number,counterpartyName:e.transfer.counterparty_name,counterpartyBic:e.transfer.counterparty_bic,counterpartyIban:e.transfer.counterparty_iban}}:{}}}const ft={getTransactions:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=A(e?.operationSettings||{}),s={...e?.transactionSettings||{},paginationSettings:i};if(n){const e=B(ut(s)),t=G(await n(e));return{transactions:t.body.transactions.map(lt),meta:t.body.meta}}{const e=a||r(),n=await async function(e){const t=ut(e),{transactions:n,meta:a}=await F(t);return{transactions:n,meta:a}}({...s,accessToken:e,stagingToken:t});return{transactions:n.transactions.map(lt),meta:n.meta}}},getTransaction:async function({transactionSettings:e,operationSettings:t}){const{proxyRequestFunction:n,accessToken:a,stagingToken:i}=A(t||{}),{transactionId:o}=function(e){if(!e)throw new s("transactionSettings parameter is required for the called function");if(!e.transactionId)throw new s("transactionSettings.transactionId parameter is required for the called function");if(e.transactionId&&"string"!=typeof e.transactionId)throw new s("transactionSettings.transactionId must be a string.");return e}(e);if(n){const e=B(mt({transactionId:o}));return lt(G(await n(e)).body.transaction)}{const e=a||r();return lt(await async function(e){const t=mt(e),{transaction:n}=await F(t);return n}({transactionId:o,accessToken:e,stagingToken:i}))}}},gt=ft;e.beneficiaries=Me,e.cards=be,e.constants=C,e.initialize=O,e.logout=N,e.organizations=ct,e.paymentLinks=rt,e.sepaTransfers=Je,e.transactions=gt}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const n=t.getInstance();class a extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class i extends a{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function r(){if(!n.hasAccessToken())throw new i;return n.getAccessToken()}class s extends a{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}const o={READY:"qonto.ready"},c={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},u={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},m={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},l={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},f=3e4,g={ACCEPT:"ACCEPT",REJECT:"REJECT"};var p=Object.freeze({__proto__:null,ACTIONS:c,ACTIVITY_TAGS:{ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},AMOUNT_REQUIRING_ATTACHMENTS:f,BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:u,ENVIRONMENTS:d,IFRAME_EVENTS:o,LOCALES:m,MFA_METHODS:l,TRANSACTION_STATUSES:{PENDING:"pending",DECLINED:"declined",COMPLETED:"completed"},TRANSFER_DECLINE_REASONS:{BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},TRANSFER_STATUSES:{PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled",FAILED:"failed",COMPLETED:"completed"},VOP_CHECK_RESULTS:{MATCH_RESULT_MATCH:"MATCH_RESULT_MATCH",MATCH_RESULT_NO_MATCH:"MATCH_RESULT_NO_MATCH",MATCH_RESULT_CLOSE_MATCH:"MATCH_RESULT_CLOSE_MATCH",MATCH_RESULT_NOT_POSSIBLE:"MATCH_RESULT_NOT_POSSIBLE",MATCH_RESULT_UNSPECIFIED:"MATCH_RESULT_UNSPECIFIED"},VOP_DECISIONS:g});class h{constructor(){this.mfaPreference=l.PASSKEY,this.debugMode=!1}static getInstance(){return h.instance||(h.instance=new h),h.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=l.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}}const T=h.getInstance(),y="https://embed.qonto.com",_="https://embed-js{branch}.staging.qonto.co",b="https://embed.dev.qonto.co",I={[d.PRODUCTION]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:b,IFRAME_URL:`${b}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class k{constructor(){this.environment=d.PRODUCTION,this.branch=u.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(d).includes(e)?e:d.PRODUCTION,this.branch=Object.values(u).includes(t)?t:u.SANDBOX}static getInstance(){return k.instance||(k.instance=new k),k.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===d.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=d.PRODUCTION,this.branch=u.MASTER}getEnvironmentUrls(){if(this.environment===d.PRODUCTION)return I.production;{const e=I[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const w=k.getInstance(),E={requiresUI:!1};function A(e,{requiresUI:t}=E){const n=e?.uiParentElementId||T.getUIParentElementId();if(t&&!n)throw new s("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");const a=e?.mfaPreference||T.getMFAPreference();if(a){const e=(i=Object.values(l),w.isProductionEnvironment()?i.filter((e=>e!==l.MOCK)):i);if(!e.includes(a))throw new s(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(w.isProductionEnvironment()&&a===l.MOCK)throw new s("operationSettings.mfaPreference cannot be set to mock in production environment.")}var i;const r=e?.debugMode||T.getDebugMode();if(void 0!==r&&"boolean"!=typeof r)throw new s("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||T.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new s("operationSettings.proxyRequestFunction must be a function.");return{...e,uiParentElementId:n,mfaPreference:a,debugMode:r,proxyRequestFunction:o}}const S=Object.values(m);function R(e){if(!function(e){return S.includes(e)}(e))throw new s(`Unsupported locale: ${e}. The locale must be one of: ${S.join(", ")}.`);return e}function L(e){if(!e?.accessToken&&!e?.operationSettings?.proxyRequestFunction)throw new s("Either operationSettings.proxyRequestFunction or access token is required when calling initialize()");return e?.operationSettings&&A(e.operationSettings),function(e){if(e.environment){if(!["production","staging","local"].includes(e.environment))throw new s('If provided, environment must be either "production" or "staging"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.environment.PRODUCTION" or "constants.environment.STAGING"');if(e.branch&&!["master","sandbox","qa"].includes(e.branch))throw new s('If provided, branch must be either "master", "sandbox" or "qa"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.branch.MASTER" or "constants.environment.SANDBOX" and so on')}}(e),e.locale&&R(e.locale),e}class v{constructor(){this.currentLocale="en"}static getInstance(){return v.instance||(v.instance=new v),v.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const P=v.getInstance();const D={initialize:function(e){const{accessToken:t,stagingToken:a,operationSettings:i,environment:r,branch:s,locale:o}=L(e);t&&n.setAccessToken(t),a&&n.setStagingToken(a),o&&P.setLocale(o),i&&T.setSettings(i),r&&(w.setEnvironment(r),s&&w.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),P.setDefaultLocale(),T.clearSettings()},constants:p},{initialize:O,logout:N,constants:C}=D;class U extends a{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function M(){return"undefined"!=typeof window&&"undefined"!=typeof document}function $(){return!M()}function q({accessToken:e,stagingToken:t,idempotencyKey:a,mfaPreference:i}){const r=new Headers;r.append("Authorization",`Bearer ${e}`);const s=t||n.getStagingToken();s&&r.append("X-Qonto-Staging-Token",s),a&&r.append("X-Qonto-Idempotency-Key",a);const o=i||T.getMFAPreference();return o&&r.append("X-Qonto-2fa-Preference",o),r.append("Content-Type","application/json"),r.append("Accept-Language",P.getLocale()),r}async function F({path:e,options:t}){const n=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(n,{...t,headers:q(t.headers),body:JSON.stringify(t.body)}),i=await a.json();if(!a.ok)throw i.errors?new U(i.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${i.code}: ${i.detail}`);return i}function B(e){const t={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},n=JSON.stringify(t);return a=n,$()?Buffer.from(a).toString("base64"):btoa(a);var a}function G(e){return JSON.parse((t=e,$()?Buffer.from(t,"base64").toString("utf-8"):atob(t)));var t}function H({membershipId:e,accessToken:t,stagingToken:n}){return{path:e?`/v2/cards?holder_ids[]=${e}`:"/v2/cards",options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function K({cardId:e,accessToken:t,stagingToken:n}){return{path:`/v2/cards?ids[]=${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}var x;!function(e){e.PENDING="pending",e.ONHOLD="onhold",e.ORDER_CANCELED="order_canceled",e.LIVE="live",e.PAUSED="paused",e.STOLEN="stolen",e.LOST="lost",e.PIN_BLOCKED="pin_blocked",e.DELETED="deleted",e.PRE_EXPIRED="pre_expired",e.EXPIRED="expired",e.DISCARDED="discarded",e.SHIPPED_LOST="shipped_lost",e.ABUSIVE="abusive"}(x||(x={}));const j={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var Y,z;function V(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:void 0===e[t.name])).map((e=>e.name));if(n.length>0)throw new s(n.map((e=>`Missing required parameter: ${e}`)))}function W(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function J(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function X(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}(Y||(Y={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(z||(z={}));const Q=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],Z=[...Q,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function ee(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return V(e,Q),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:m,cardLevel:l}=e,f=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(l),g=W({membershipId:t,organizationId:n,bankAccountId:a}),p=J({hasDailyLimit:i,hasTransactionLimit:r}),h=X({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),T=te(u),y=ne(m),_=[...f,...g,...p,...h,...T,...y];if(_.length>0)throw new s(_)}(e),e}(e):function(e){V(e,Z),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:i,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:u,categories:m,cardLevel:l,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,shipToBusiness:h,hasAtmOption:T,hasAtmDailyLimit:y,atmDailyLimit:_,atmMonthlyLimit:b,address:I,cardDesign:k,typeOfPrint:w}=e,E=function(e){return Object.values(z).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(l),A=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(w),S=W({membershipId:t,organizationId:n,bankAccountId:a}),R=J({hasDailyLimit:i,hasTransactionLimit:r,hasAtmOption:T,hasNfcOption:f,hasForeignPaymentOption:g,hasOnlinePaymentOption:p,hasAtmDailyLimit:y,shipToBusiness:h}),L=X({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:_,atmMonthlyLimit:b}),v=te(u),P=ne(m),D=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(k),O=function(e,t){if(t)return[];return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(I,h),N=[...E,...S,...R,...L,...v,...P,...A,...D,...O];if(N.length>0)throw new s(N)}(e)}(e)}function te(e){const t=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function ne(e){const t=!Array.isArray(e)||e.some((e=>"string"!=typeof e));return void 0!==e&&t?["categories must be an array of strings"]:[]}class ae extends a{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const ie=[];for(let e=0;e<256;++e)ie.push((e+256).toString(16).slice(1));let re;const se=new Uint8Array(16);var oe={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ce(e,t,n){if(oe.randomUUID&&!e)return oe.randomUUID();const a=(e=e||{}).random??e.rng?.()??function(){if(!re){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");re=crypto.getRandomValues.bind(crypto)}return re(se)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=15&a[6]|64,a[8]=63&a[8]|128,function(e,t=0){return(ie[e[t+0]]+ie[e[t+1]]+ie[e[t+2]]+ie[e[t+3]]+"-"+ie[e[t+4]]+ie[e[t+5]]+"-"+ie[e[t+6]]+ie[e[t+7]]+"-"+ie[e[t+8]]+ie[e[t+9]]+"-"+ie[e[t+10]]+ie[e[t+11]]+ie[e[t+12]]+ie[e[t+13]]+ie[e[t+14]]+ie[e[t+15]]).toLowerCase()}(a)}function de({actionId:e,actionData:t}){const n=T.getMFAPreference();return{actionId:e,actionData:{...t,scaPreference:t.scaPreference||n,idempotencyKey:t.idempotencyKey||ce()}}}class ue{constructor(e){this.options=e,this.iframe=null,this.parentElement=null,this.messageListeners=new Map,this.defaultTimeout=3e4;const t=new URL(e.iframeUrl);this.targetOrigin=`${t.protocol}//${t.host}`}async initialize(){if(this.iframe)return this;if(this.parentElement=document.getElementById(this.options.parentElementId),!this.parentElement)throw new ae(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,a=setTimeout((()=>{window.removeEventListener("message",i),t(new ae(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),i=t=>{t.data.eventId===o.READY&&(clearTimeout(a),window.removeEventListener("message",i),e(this))};window.addEventListener("message",i),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){if(!this.iframe||!this.iframe.contentWindow)return Promise.reject(new ae("Attempted to perform an Embed operation without having the authentication UI initialized."));const t=de(e);return new Promise(((e,n)=>{const a=i=>{if(i.data?.actionId===t.actionId){if("error"===i.data.status)return this.removeMessageListener(t.actionId,a),n(new ae(`An error occurred when performing the action ${t.actionId}.\n${JSON.stringify(i.data.payload)}`));this.removeMessageListener(t.actionId,a),e(i.data.payload)}};this.addMessageListener(t.actionId,a),this.iframe?.contentWindow?.postMessage(t,this.targetOrigin)}))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function me({accessToken:e,stagingToken:t,locale:n,debugMode:a}){const i=a||!1,r=n||P.getLocale(),s=w.getEnvironmentUrls().IFRAME_URL,o=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${i}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function le({parentElementId:e,iframeUrl:t}){return new ue({parentElementId:e,iframeUrl:t}).initialize()}function fe(e){return"virtual"===e.cardLevel?function(e){const t=pe(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ce(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel}}}}}(e):function(e){const t=pe(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ce(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel,card_design:e.cardDesign,..."plus"===e.cardLevel&&{type_of_print:e.typeOfPrint},ship_to_business_address:e.shipToBusiness,atm_option:e.hasAtmOption,nfc_option:e.hasNfcOption,foreign_option:e.hasForeignPaymentOption,online_option:e.hasOnlinePaymentOption,atm_daily_limit:e.atmDailyLimit,atm_monthly_limit:e.atmMonthlyLimit,...!e.shipToBusiness&&{address:{contact_name:e.address?.contactName,first_line:e.address?.firstLine,second_line:e.address?.secondLine,third_line:e.address?.thirdLine,zipcode:e.address?.zipCode,city:e.address?.city,country:e.address?.country}}}}}}}(e)}function ge(e){return{id:e.id,nickname:e.nickname,embossedName:e.embossed_name,status:e.status,maskPan:e.mask_pan,expMonth:parseInt(e.exp_month,10),expYear:parseInt(e.exp_year,10),lastActivityAt:new Date(e.last_activity_at),lastDigits:e.last_digits,shipToBusiness:e.ship_to_business,atmOption:e.atm_option,atmDailyLimitOption:e.atm_daily_limit_option,nfcOption:e.nfc_option,onlineOption:e.online_option,foreignOption:e.foreign_option,atmMonthlyLimit:e.atm_monthly_limit,atmMonthlySpent:e.atm_monthly_spent,atmDailyLimit:e.atm_daily_limit,atmDailySpent:e.atm_daily_spent,paymentMonthlyLimit:e.payment_monthly_limit,paymentMonthlySpent:e.payment_monthly_spent,paymentDailyLimit:e.payment_daily_limit,paymentDailySpent:e.payment_daily_spent,paymentDailyLimitOption:e.payment_daily_limit_option,paymentTransactionLimit:e.payment_transaction_limit,paymentTransactionLimitOption:e.payment_transaction_limit_option,activeDays:e.active_days,holderId:e.holder_id,bankAccountId:e.bank_account_id,organizationId:e.organization_id,updatedAt:new Date(e.updated_at),createdAt:new Date(e.created_at),shippedAt:new Date(e.shipped_at),cardType:e.card_type,cardLevel:e.card_level,paymentLifespanLimit:e.payment_lifespan_limit,paymentLifespanSpent:e.payment_lifespan_spent,preExpiresAt:new Date(e.pre_expires_at),categories:e.categories,renewed:e.renewed,renewal:e.renewal,...e.parent_card_summary&&{parentCardSummary:{id:e.parent_card_summary.id,lastDigits:e.parent_card_summary.last_digits}},hadOperation:e.had_operation,hadPinOperation:e.had_pin_operation,cardDesign:e.card_design,typeOfPrint:e.type_of_print,upsold:e.upsold,upsell:e.upsell,discardOn:new Date(e.discard_on),reordered:e.reordered}}function pe(e){const t=Object.values(j);return(e||[]).filter((e=>t.includes(e)))}const he="--qonto-embed";function Te(e){return!e.href||e.href.startsWith(window.location.origin)}function ye(e){return"CSSStyleRule"===e.constructor.name}function _e(e=he){return M()?function(e,t){return[...e].filter(Te).reduce(((e,n)=>[...n.cssRules].filter(ye).reduce(((e,n)=>{if("style"in n){const a=[...n.style].map((e=>[e.trim(),n.style.getPropertyValue(e).trim()])).filter((([e])=>e.startsWith(t))).reduce(((e,[n,a])=>({...e,[n.replace(`${t}-`,"")]:a})),{});return{...e,...a}}return e}),e)),{})}(document.styleSheets,e):{}}const be={getCards:async function(e){try{const t=e?.cardSettings?.membershipId;if(t&&"string"!=typeof t)throw new s("membershipId must be a string");const{proxyRequestFunction:n,stagingToken:a}=A(e?.operationSettings||{});if(n){const e=B(H({membershipId:t,stagingToken:a})),i=await n(e);return G(i).body.cards.map((e=>ge(e)))}{const n=e?.operationSettings?.accessToken||r(),i=await async function({membershipId:e,accessToken:t,stagingToken:n}){const a=H({membershipId:e,accessToken:t,stagingToken:n}),{cards:i}=await F(a);return i}({membershipId:t,accessToken:n,stagingToken:a});return i.map((e=>ge(e)))}}catch(e){return Promise.reject(e)}},getCard:async function({cardSettings:e,operationSettings:t}){try{!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId parameter is required for the called function");const t=W({cardId:e.cardId});if(t.length>0)throw new s(t)}(e);const n=e.cardId,{proxyRequestFunction:a,stagingToken:i}=A(t||{});if(a){const e=B(K({cardId:n,stagingToken:i})),t=await a(e),r=G(t).body.cards;if(Array.isArray(r)&&r.length>0)return ge(r[0]);throw new s("Unable to retrieve card data")}{const e=t?.accessToken||r(),a=await async function({cardId:e,accessToken:t,stagingToken:n}){const a=K({cardId:e,accessToken:t,stagingToken:n}),{cards:i}=await F(a);return i[0]}({cardId:n,accessToken:e,stagingToken:i});return ge(a)}}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=A(e.operationSettings,{requiresUI:!0});ee(e.cardSettings);const s=me({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),o=await le({iframeUrl:s,parentElementId:a}),c=fe(e.cardSettings),d=await o.postMessage(c);return o.destroy(),ge(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:a,debugMode:i}=A(e.operationSettings,{requiresUI:!0});!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=W({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=me({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:i}),d=await le({iframeUrl:o,parentElementId:a}),u=function(e){return{actionId:c.CARD_UNLOCK,actionData:{body:{cardId:e.cardSettings.cardId}}}}(e),m=await d.postMessage(u);return d.destroy(),ge(m)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:t,accessToken:n,stagingToken:a,debugMode:i,mfaPreference:o}=A(e.operationSettings,{requiresUI:!0}),c=n||r();!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=W({cardId:e.cardId});if(t.length>0)throw new s(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const a=J(n);if(a.length>0)throw new s(a)}(e.cardSettings);const d=await async function(e){const{accessToken:t,stagingToken:n,mfaPreference:a}=e,i={method:"GET",headers:q({accessToken:t,stagingToken:n,mfaPreference:a})},r=w.getEnvironmentUrls().THIRD_PARTY_API_URL,s=await fetch(`${r}/v2/cards/${e.cardId}/data_view`,i),o=await s.json();if(!s.ok)throw o.errors?new U(o.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${o.code}: ${o.detail}`);return o.iframe_url}({...e.cardSettings,accessToken:c,stagingToken:a,mfaPreference:o}),{allowPinReveal:u,allowBlocking:m}=e.cardSettings,l=function(e,t){const n=new URL(e);"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal.toString()),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking.toString()),!0===t.debugMode&&n.searchParams.set("debug",t.debugMode.toString());const a=_e(he);return Object.keys(a).length>0&&n.searchParams.set("customization",JSON.stringify(a)),n.toString()}(d,{allowPinReveal:u,allowBlocking:m,debugMode:i}),f=await le({iframeUrl:l,parentElementId:t});return{destroyEmbedUI:()=>{f.destroy()}}}catch(e){return Promise.reject(e)}}},Ie=be;function ke(e){const t=new URLSearchParams;return e?.page&&t.append("page",e.page.toString()),e?.itemsPerPage&&t.append("per_page",e.itemsPerPage.toString()),t}function we({endpointUrl:e,paginationSettings:t}){return function({url:e,searchParams:t}){const n=new URL(e.toString());for(const[e,a]of t.entries())n.searchParams.append(e,a);return n}({url:new URL(e),searchParams:ke(t)})}function Ee(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}function Ae(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function Se(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const Re="/v2/sepa/beneficiaries";function Le({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},i=ke(e),r=i.size?`?${i.toString()}`:"";return{path:`${Re}${r}`,options:a}}function ve({beneficiaryId:e,accessToken:t,stagingToken:n}){return{path:`${Re}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}async function Pe({accessToken:e,stagingToken:t,beneficiaryId:n}){const a=ve({beneficiaryId:n,accessToken:e,stagingToken:t}),{beneficiary:i}=await F(a);return i}function De({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=ce()}){return{path:Re,options:{method:"POST",headers:{accessToken:t,stagingToken:n,idempotencyKey:a},body:{beneficiary:Se(e)}}}}function Oe({beneficiaryIds:e,accessToken:t,stagingToken:n}){return{path:`${Re}/untrust`,options:{method:"PATCH",headers:{accessToken:t,stagingToken:n},body:{ids:e}}}}function Ne({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}){const{name:r,email:s,activityTag:o}=e,c={method:"PATCH",headers:{accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i},body:{beneficiary:{name:r,email:s,activity_tag:o}}};return{path:`${Re}/${e.id}`,options:c}}const Ce=[{name:"name"},{name:"iban"}];const Ue={getBeneficiaries:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=A(e?.operationSettings||{});if(n){const e=B(Le({paginationSettings:i})),t=G(await n(e)),a=t.body.beneficiaries.map((e=>Ae(e))),r=Ee(t.body.meta);return{beneficiaries:a,...r?{meta:r}:{}}}{const e=a||r(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const a=Le({paginationSettings:e,accessToken:t,stagingToken:n}),{beneficiaries:i,meta:r}=await F(a);return{beneficiaries:i,meta:r}}({accessToken:e,stagingToken:t,paginationSettings:i}),s=n.beneficiaries.map((e=>Ae(e))),o=Ee(n.meta);return{beneficiaries:s,...o?{meta:o}:{}}}},getBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:a,accessToken:i,stagingToken:o}=A(t||{});if(a){const e=B(ve({beneficiaryId:n}));return Ae(G(await a(e)).body.beneficiary)}{const e=i||r();return Ae(await Pe({beneficiaryId:n,accessToken:e,stagingToken:o}))}},addBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new s("beneficiary must be an object");V(e,Ce);const t=W({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new s(t);return e}(e),{proxyRequestFunction:a,accessToken:i,stagingToken:o,idempotencyKey:c}=A(t||{});if(a){const e=B(De({beneficiary:n,idempotencyKey:c}));return Ae(G(await a(e)).body.beneficiary)}{const e=i||r(),t=await async function({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=ce()}){const i=De({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a}),{beneficiary:r}=await F(i);return r}({beneficiary:n,accessToken:e,stagingToken:o,idempotencyKey:c});return Ae(t)}},updateBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){const{id:t,name:n,email:a,activityTag:i}=e||{};if(!t)throw new s("Invalid parameters were passed to the function:\nA beneficiary ID is required for the called function");if(!n&&!a&&!i)throw new s("Invalid parameters were passed to the function:\nAt least one of the following properties must be provided: name, email, activityTag");const r=W({name:n,email:a,activityTag:i});if(r.length>0)throw new s(r);return{id:t,name:n,email:a,activityTag:i}}(e),{stagingToken:a,idempotencyKey:i,mfaPreference:o,proxyRequestFunction:c}=A(t),d={beneficiaryParamsBeingEdited:n,idempotencyKey:i,mfaPreference:o};if(c){const e=B(Ne(d));return Ae(G(await c(e)).body.beneficiary)}{const e=t?.accessToken||r(),n=await async function({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}){const r=Ne({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:i}),{beneficiary:s}=await F(r);return s}({...d,accessToken:e,stagingToken:a});return Ae(n)}},untrustBeneficiaries:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new s("beneficiaryIds parameter is required for the called function");if(!Array.isArray(e)||!e.every((e=>"string"==typeof e)))throw new s("beneficiaryIds must be an array of strings");return e}(e?.beneficiaryIds),{proxyRequestFunction:a,accessToken:i,stagingToken:o}=A(t||{});if(a){const e=B(Oe({beneficiaryIds:n}));return G(await a(e)).body.beneficiaries.map(Ae)}{const e=i||r(),t=await async function({beneficiaryIds:e,accessToken:t,stagingToken:n}){const a=Oe({beneficiaryIds:e,accessToken:t,stagingToken:n}),{beneficiaries:i}=await F(a);return i}({beneficiaryIds:n,accessToken:e,stagingToken:o});return t.map(Ae)}}},Me=Ue;function $e(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}function qe(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}function Fe(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function Be(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}function Ge(e){return{name:e.name,iban:e.iban}}const He="/v2/sepa",Ke=`${He}/transfers`;function xe({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},i=ke(e),r=i.size?`?${i.toString()}`:"";return{path:`${Ke}${r}`,options:a}}async function je({sepaPayee:e,accessToken:t,stagingToken:n}){const a=function({sepaPayee:e,accessToken:t,stagingToken:n}){return{path:`${He}/verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:t,stagingToken:n});return await F(a)}const Ye="/v2/sepa/bulk_transfers";async function ze({sepaPayees:e,accessToken:t,stagingToken:n}){const a=function({sepaPayees:e,accessToken:t,stagingToken:n}){return{path:`${He}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{requests:e.map(Ge)}}}}({sepaPayees:e,accessToken:t,stagingToken:n});return await F(a)}function Ve(e){if(!e)throw new s("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new s("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new s("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new s("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,t)=>{!function(e,t){if(!e)throw new s(`Invalid bulkTransfer at index ${t}: bulkTransfer object is required`);if(!e.beneficiary)throw new s(`Invalid bulkTransfer at index ${t}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new s(`Invalid bulkTransfer at index ${t}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new s(`Invalid bulkTransfer at index ${t}: Beneficiary name is required as part of the beneficiary details`);const n=W({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=X({amount:e.amount}),i=[...n,...a].flat();if(i.length>0)throw new s(i);if(e.amount>f&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new s(`Invalid bulkTransfer at index ${t}: Attachments are required for transfers over €30000`)}(e,t)})),e}const We="browser",Je="server";class Xe extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case We:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case Je:this.message="This code is running in a server environment, but it is expected to run in a browser environment.";break;default:this.message="This code is not expected to run in this environment. Check if the function was server-only or browser-only."}}}const Qe=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];const Ze={getSepaTransfers:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=A(e?.operationSettings||{});if(n){const e=B(xe({paginationSettings:i})),t=G(await n(e)),a=t.body.transfers.map(Fe),r=Ee(t.body.meta);return{transfers:a,...r?{meta:r}:{}}}{const e=a||r(),n=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a=xe({paginationSettings:n,accessToken:e,stagingToken:t}),{transfers:i,meta:r}=await F(a);return{transfers:i,meta:r}}({accessToken:e,stagingToken:t,paginationSettings:i}),s=n.transfers.map(Fe),o=Ee(n.meta);return{transfers:s,...o?{meta:o}:{}}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);return Fe(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const a={method:"GET",headers:q({accessToken:e,stagingToken:t})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ke}/${n}`,r=await fetch(i,a),s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.transfer}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken}))},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),o=t?.idempotencyKey||ce();let d;!function(e){if(!e)throw new s("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new s("sepaTransferSettings must be an object");if(V(e,Qe),!e.beneficiaryId&&!e.beneficiary)throw new s("Either beneficiaryId or beneficiary must be provided");const t=[...W({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...X({amount:e.amount})].flat();if(t.length>0)throw new s(t);if(e.amount>f&&(!e.attachmentIds||0===e.attachmentIds.length))throw new s("Attachments are required for transfers over €30,000")}(e);const u=await async function({sepaTransferSettings:e,operationSettings:t}){return e?.beneficiary?e.beneficiary:Ae(await Pe({beneficiaryId:e?.beneficiaryId,accessToken:t?.accessToken,stagingToken:t?.stagingToken}))}({sepaTransferSettings:e,operationSettings:{accessToken:a,stagingToken:i||void 0}}),m={name:u.name,iban:u.iban},l=await je({sepaPayee:m,accessToken:a,stagingToken:i||void 0});var p;if((yield(p=l,{matchResult:p.match_result,matchedName:p.matched_name}))===g.REJECT)return;const h={...e,beneficiary:u};if(h.beneficiary?.trusted)d=await async function({transfer:e,vopProofToken:t,accessToken:n,stagingToken:a,idempotencyKey:i}){const r=Be(e),s={method:"POST",headers:q({accessToken:n,stagingToken:a,idempotencyKey:i}),body:JSON.stringify({transfer:r,vop_proof_token:t})},o=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ke}`,c=await fetch(o,s),d=await c.json();if(d.errors)throw new U(d.errors.map((e=>`${e.code}: ${e.detail}`)));return d.transfer}({transfer:h,vopProofToken:l.proof_token.token,accessToken:a,stagingToken:i||void 0,idempotencyKey:o});else{if(!M())throw new Xe(We);const{uiParentElementId:e,debugMode:n}=A(t,{requiresUI:!0});let r;try{const t=me({accessToken:a,stagingToken:i||void 0,debugMode:n});r=await le({iframeUrl:t,parentElementId:e});const s=Be(h);d=await r.postMessage(de({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...s}},idempotencyKey:o}}))}finally{r?.destroy()}}return Fe(d)},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),a=function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new s("sepaTransferId must be a string");return e}(e?.sepaTransferId);await async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const a={method:"POST",headers:q({accessToken:t,stagingToken:n})},i=`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ke}/${e}/cancel`,r=await fetch(i,a);if(204!==r.status){const e=await r.json();if(e.errors)throw new U(e.errors.map((e=>`${e.code}: ${e.detail}`)))}}({sepaTransferId:a,accessToken:n,stagingToken:t?.stagingToken})},bulkTransfers:{getBulkTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||r(),{stagingToken:a,paginationSettings:i}=A(t||{}),s=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a={method:"GET",headers:q({accessToken:e,stagingToken:t})},i=we({endpointUrl:new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ye}`),paginationSettings:n}),r=await fetch(i,a);if(!r.ok)throw new U("Failed to fetch SEPA bulk transfers");const s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{bulkTransfers:s.bulk_transfers,meta:s.meta}}({accessToken:n,stagingToken:a,paginationSettings:i}),o=s.bulkTransfers?.map($e),c=Ee(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||r(),{stagingToken:a}=A(t||{}),i=function(e){if(!e)throw new s("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new s("bulkTransferId must be a string.");return e}(e?.bulkTransferId);return $e(await async function({accessToken:e,stagingToken:t,bulkTransferId:n}){const a={method:"GET",headers:q({accessToken:e,stagingToken:t})},i=new URL(`${w.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ye}/${n}`),r=await fetch(i,a),s=await r.json();if(s.errors)throw new U(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.bulk_transfer}({accessToken:n,stagingToken:a,bulkTransferId:i}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:t}){const a=t?.accessToken||r(),i=t?.stagingToken||n.getStagingToken(),s=t?.idempotencyKey||ce();Ve(e);const{uiParentElementId:o,debugMode:d}=A(t,{requiresUI:!0});if(!M())throw new Xe(We);const u=new Map;for(const t of e.bulkTransfers){const e=t.beneficiary.iban;e&&!u.has(e)&&u.set(e,{name:t.beneficiary.name,iban:e})}const m=Array.from(u.values()),l=await ze({sepaPayees:m,accessToken:a,stagingToken:i||void 0});if((yield l.requests.map(qe))===g.REJECT)return;let f,p;try{const t=me({accessToken:a,stagingToken:i||void 0,debugMode:d});p=await le({iframeUrl:t,parentElementId:o});const n={bankAccountId:e.bankAccountId,bulkTransfers:e.bulkTransfers.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))};f=await p.postMessage(de({actionId:c.TRANSFER_BULK_CREATE,actionData:{body:n,idempotencyKey:s}}))}finally{p?.destroy()}return $e(f)}}},et={GOOD:"good",SERVICE:"service"},tt={AED:"AED",AUD:"AUD",BGN:"BGN",CAD:"CAD",CHF:"CHF",CNY:"CNY",CZK:"CZK",DKK:"DKK",EUR:"EUR",GBP:"GBP",GHS:"GHS",HKD:"HKD",HUF:"HUF",ILS:"ILS",INR:"INR",MXN:"MXN",NOK:"NOK",NZD:"NZD",PEN:"PEN",PLN:"PLN",RON:"RON",RSD:"RSD",SAR:"SAR",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",ZAR:"ZAR",ZMW:"ZMW"},nt=e=>{if(!(e=>Object.values(tt).includes(e))(e))throw new s(`currency ${e} is not valid, valid currencies are ${Object.values(tt).join(", ")}`)},at={UNIT:"unit",HOUR:"hour",DAY:"day",MONTH:"month",GRAM:"gram",KILOGRAM:"kilogram",LITER:"liter",METER:"meter",SQUARE_METER:"square_meter",CUBIC_METER:"cubic_meter",AMPERE:"ampere",NUMBER_OF_ARTICLES:"number_of_articles",CENTIMETER:"centimeter",CUBIC_METER_PER_HOUR:"cubic_meter_per_hour",GIGAJOULE:"gigajoule",GIGAWATT:"gigawatt",GIGAWATT_HOUR:"gigawatt_hour",HALF_YEAR:"half_year",JOULE:"joule",KILOJOULE:"kilojoule",KILOVAR:"kilovar",KILOWATT:"kilowatt",KILOWATT_HOUR:"kilowatt_hour",MEGAJOULE:"megajoule",MEGAWATT:"megawatt",MEGAWATT_HOUR:"megawatt_hour",MILLIGRAM:"milligram",MILLILITER:"milliliter",MILLIMETER:"millimeter",MINUTE:"minute",PAIR:"pair",QUARTER:"quarter",SECOND:"second",SET:"set",TON:"ton",TWO_WEEK:"two_week",WATT_HOUR:"watt_hour",WEEK:"week",YEAR:"year"},it=e=>{if(!(e=>Object.values(at).includes(e))(e))throw new s(`unit ${e} is not valid, valid units are ${Object.values(at).join(", ")}`)},rt=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],st=[{name:"currency"},{name:"value"}];const ot=e=>{if(!Object.values(et).includes(e))throw new s(`type ${e} is not valid, valid types are ${Object.values(et).join(", ")}`)},ct={getPaymentLinkCreationFlowUrl:({paymentLinkSettings:e})=>{const{items:t,authUrl:n}=e;!function(e){if(!e)throw new s("authUrl is required for the called function");const t=W({authUrl:e});if(t.length>0)throw new s(t);try{new URL(e)}catch{throw new s("authUrl is not a valid URL")}}(n),function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{V(e,rt),V(e.unitPrice,st);const t=[...W({id:e.id,title:e.title,vatRate:e.vatRate,currency:e.unitPrice.currency,measureUnit:e.measureUnit,unitPrice:e.unitPrice.value,...e.description?{description:e.description}:{}}),...X({quantity:e.quantity})].flat();if(t.length>0)throw new s(t);ot(e.type),nt(e.unitPrice.currency),it(e.measureUnit)}))}(t);const a=new URLSearchParams({...t?{items:JSON.stringify(t)}:{}});return a.toString()?`${n}?${a.toString()}`:n}},dt=({accessToken:e,stagingToken:t})=>({path:"/v2/organizations/",options:{method:"GET",headers:{accessToken:e,stagingToken:t}}}),ut=e=>({slug:e.slug,iban:e.iban,bic:e.bic,currency:e.currency,balance:e.balance,balanceCents:e.balance_cents,authorizedBalance:e.authorized_balance,authorizedBalanceCents:e.authorized_balance_cents,name:e.name,updatedAt:new Date(e.updated_at),status:e.status,main:e.main}),mt={getBankAccounts:async e=>{const{stagingToken:t,proxyRequestFunction:n}=A(e);if(n){const e=dt({stagingToken:t}),a=await n(B(e)),{body:i}=G(a);return i.bank_accounts.map(ut)}{const n=e.accessToken||r(),a=await(async({accessToken:e,stagingToken:t})=>{const n=dt({accessToken:e,stagingToken:t});return await F(n)})({accessToken:n,stagingToken:t});return a.bank_accounts.map(ut)}}},lt="/v2/transactions";function ft({bankAccountId:e,iban:t,status:n,updatedAtFrom:a,updatedAtTo:i,emittedAtFrom:r,emittedAtTo:s,settledAtFrom:o,settledAtTo:c,side:d,operationType:u,withAttachments:m,paginationSettings:l,accessToken:f,stagingToken:g}){const p={method:"GET",headers:{accessToken:f,stagingToken:g}},h=new URLSearchParams;e&&h.append("bank_account_id",e),t&&h.append("iban",t),n&&h.append("status",n),a&&h.append("updated_at_from",a),i&&h.append("updated_at_to",i),r&&h.append("emitted_at_from",r),s&&h.append("emitted_at_to",s),o&&h.append("settled_at_from",o),c&&h.append("settled_at_to",c),d&&h.append("side",d),u&&h.append("operation_type",u),void 0!==m&&h.append("with_attachments",String(m));const T=ke(l);for(const[e,t]of T)h.append(e,t);const y=h.toString();return{path:`${lt}${y?`?${y}`:""}`,options:p}}function gt({transactionId:e,accessToken:t,stagingToken:n}){return{path:`${lt}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function pt(e){return{transactionId:e.transaction_id,amount:e.amount,amountCents:e.amount_cents,settledBalance:e.settled_balance,settledBalanceCents:e.settled_balance_cents,attachmentIds:e.attachment_ids,localAmount:e.local_amount,localAmountCents:e.local_amount_cents,side:e.side,operationType:e.operation_type,currency:e.currency,localCurrency:e.local_currency,label:e.label,settledAt:new Date(e.settled_at),emittedAt:new Date(e.emitted_at),updatedAt:new Date(e.updated_at),status:e.status,note:e.note,reference:e.reference,vatAmount:e.vat_amount,vatAmountCents:e.vat_amount_cents,vatRate:e.vat_rate,initiatorId:e.initiator_id,labelIds:e.label_ids,attachmentLost:e.attachment_lost,attachmentRequired:e.attachment_required,cardLastDigits:e.card_last_digits,category:e.category,cashflowCategory:{name:e.cashflow_category?.name||""},cashflowSubcategory:{name:e.cashflow_subcategory?.name||""},id:e.id,subjectType:e.subject_type,...e.transfer?{transfer:{counterpartyAccountNumber:e.transfer.counterparty_account_number,counterpartyName:e.transfer.counterparty_name,counterpartyBic:e.transfer.counterparty_bic,counterpartyIban:e.transfer.counterparty_iban}}:{}}}const ht={getTransactions:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:i}=A(e?.operationSettings||{}),s={...e?.transactionSettings||{},paginationSettings:i};if(n){const e=B(ft(s)),t=G(await n(e));return{transactions:t.body.transactions.map(pt),meta:t.body.meta}}{const e=a||r(),n=await async function(e){const t=ft(e),{transactions:n,meta:a}=await F(t);return{transactions:n,meta:a}}({...s,accessToken:e,stagingToken:t});return{transactions:n.transactions.map(pt),meta:n.meta}}},getTransaction:async function({transactionSettings:e,operationSettings:t}){const{proxyRequestFunction:n,accessToken:a,stagingToken:i}=A(t||{}),{transactionId:o}=function(e){if(!e)throw new s("transactionSettings parameter is required for the called function");if(!e.transactionId)throw new s("transactionSettings.transactionId parameter is required for the called function");if(e.transactionId&&"string"!=typeof e.transactionId)throw new s("transactionSettings.transactionId must be a string.");return e}(e);if(n){const e=B(gt({transactionId:o}));return pt(G(await n(e)).body.transaction)}{const e=a||r();return pt(await async function(e){const t=gt(e),{transaction:n}=await F(t);return n}({transactionId:o,accessToken:e,stagingToken:i}))}}},Tt=ht;e.beneficiaries=Me,e.cards=Ie,e.constants=C,e.initialize=O,e.logout=N,e.organizations=mt,e.paymentLinks=ct,e.sepaTransfers=Ze,e.transactions=Tt}));
@@ -1,6 +1,6 @@
1
1
  import type { Beneficiary, BeneficiaryDataObject } from '@beneficiaries/beneficiaries.types';
2
2
  import type { SepaTransferDataObject } from '@sepa-transfers/sepa-transfers.types';
3
- import type { BulkTransferDataObject, NewBulkTransfer, BulkTransferSettings } from '@sepa-transfers/bulk-transfers/bulk-transfers.types';
3
+ import type { BulkTransferDataObject, NewBulkTransfer, BulkTransferSettings, NewBulkTransferWithBeneficiary } from '@sepa-transfers/bulk-transfers/bulk-transfers.types';
4
4
  import type { CardDataObject } from '@cards/cards.types';
5
5
  import type { TransactionDataObject } from '@transactions/transactions.types';
6
6
  export declare const INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN";
@@ -25,7 +25,7 @@ export declare const mockedTransactionsList: TransactionDataObject[];
25
25
  export declare const mockBulkTransferValidBankAccountId = "bank_1";
26
26
  export declare const mockUntrustedBeneficiary: Beneficiary;
27
27
  export declare const mockValidTrustedTransfer: NewBulkTransfer;
28
- export declare const mockUntrustedTransfer: NewBulkTransfer;
28
+ export declare const mockUntrustedTransfer: NewBulkTransferWithBeneficiary;
29
29
  export declare const mockBulkTransferValidSettings: BulkTransferSettings<NewBulkTransfer>;
30
30
  export declare const mockBulkTransferSing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BAAsB,EAAE,qBAAqB,EA8EzD,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,8BAKnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC,eAAe,CAI7E,CAAC;AAEJ,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;CAiB1C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;CAiB7C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,WAAW,6BA2evB,CAAC"}
@@ -1,5 +1,7 @@
1
+ import { type NetworkCallDescriptor } from '@common/network/network';
1
2
  import type { PaginationSettings, PaginationResponseDataObject } from '@common/api-pagination/api-pagination.types';
2
- import type { BulkTransferDataObject, NewBulkTransfer } from './bulk-transfers.types';
3
+ import type { BulkTransferDataObject, NewBulkTransfer, VerifyBulkSepaPayeeApiResponse } from './bulk-transfers.types';
4
+ import type { SepaPayee } from '@sepa-transfers/sepa-transfers.types';
3
5
  interface AuthParams {
4
6
  accessToken: string;
5
7
  stagingToken?: string;
@@ -19,9 +21,16 @@ export interface CreateBulkTransferParams extends AuthParams {
19
21
  bankAccountId: string;
20
22
  idempotencyKey: string;
21
23
  }
24
+ interface VerifySepaPayeesParams {
25
+ sepaPayees: SepaPayee[];
26
+ accessToken?: string;
27
+ stagingToken?: string;
28
+ }
22
29
  export declare const BULK_TRANSFERS_ENDPOINT = "/v2/sepa/bulk_transfers";
23
30
  export declare function getBulkTransfers({ accessToken, stagingToken, paginationSettings, }: GetBulkTransfersParams): Promise<GetBulkTransfersApiResponse>;
24
31
  export declare function getBulkTransfer({ accessToken, stagingToken, bulkTransferId, }: GetBulkTransferParams): Promise<BulkTransferDataObject>;
25
32
  export declare function createBulkTransfer({ bulkTransfers, accessToken, stagingToken, bankAccountId, idempotencyKey, }: CreateBulkTransferParams): Promise<BulkTransferDataObject>;
33
+ export declare function prepareVerifySepaPayeesCall({ sepaPayees, accessToken, stagingToken, }: VerifySepaPayeesParams): NetworkCallDescriptor;
34
+ export declare function verifySepaPayees({ sepaPayees, accessToken, stagingToken, }: VerifySepaPayeesParams): Promise<VerifyBulkSepaPayeeApiResponse>;
26
35
  export {};
27
36
  //# sourceMappingURL=bulk-transfers.api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-transfers.api.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.api.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,UAAU,UAAU;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,sBAAuB,SAAQ,UAAU;IACjD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,2BAA2B;IACnC,aAAa,EAAE,sBAAsB,EAAE,CAAC;IACxC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,UAAU,qBAAsB,SAAQ,UAAU;IAChD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,wBAAyB,SAAQ,UAAU;IAC1D,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAEjE,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAiC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAuBzD;AAED,wBAAsB,kBAAkB,CAAC,EACvC,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,GACf,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAoC5D"}
1
+ {"version":3,"file":"bulk-transfers.api.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EACV,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EACf,8BAA8B,EAC/B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAGtE,UAAU,UAAU;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,sBAAuB,SAAQ,UAAU;IACjD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,2BAA2B;IACnC,aAAa,EAAE,sBAAsB,EAAE,CAAC;IACxC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,UAAU,qBAAsB,SAAQ,UAAU;IAChD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,wBAAyB,SAAQ,UAAU;IAC1D,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,sBAAsB;IAC9B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAEjE,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAiC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAuBzD;AAED,wBAAsB,kBAAkB,CAAC,EACvC,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,GACf,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAoC5D;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,UAAU,EACV,WAAW,EACX,YAAY,GACb,EAAE,sBAAsB,GAAG,qBAAqB,CAchD;AAED,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,WAAW,EACX,YAAY,GACb,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CASlE"}
@@ -1,4 +1,4 @@
1
- import type { BulkTransfer, BulkTransferParams, GetBulkTransfer, GetBulkTransfersResponse, NewBulkTransfer } from './bulk-transfers.types';
1
+ import type { BulkTransfer, BulkTransferParams, GetBulkTransfer, GetBulkTransfersResponse, NewBulkTransferWithBeneficiary, SingleBulkVopVerificationResult } from './bulk-transfers.types';
2
2
  import type { SepaTransferParams } from '@sepa-transfers/sepa-transfers.types';
3
3
  /**
4
4
  * Fetches the list of SEPA bulk transfers for the current user.
@@ -30,36 +30,45 @@ export declare function getBulkTransfers(getBulkTransfersParams?: SepaTransferPa
30
30
  */
31
31
  export declare function getBulkTransfer({ sepaTransferSettings, operationSettings, }: SepaTransferParams<GetBulkTransfer>): Promise<BulkTransfer>;
32
32
  /**
33
- * Creates a new SEPA bulk transfer from the current user to one or more beneficiaries.
34
- * Depending on the beneficiaries' trust status, this function may either
35
- * create the bulk transfer directly via the API or open the UI to complete the SCA
36
- * process for untrusted beneficiaries.
33
+ * Creates a new SEPA bulk transfer from the current user to one or more beneficiaries
34
+ * including a Verification of Payee (VoP) check first for each beneficiary. If the VoP check is
35
+ * responded with a rejection by the caller, the bulk transfer creation will be aborted.
36
+ * This function is implemented as an async
37
+ * <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators#generator_functions">generator</a>
38
+ * to allow the caller to handle the VoP verification results before proceeding
39
+ * with the bulk transfer creation. The generator will yield VoP verification
40
+ * results for each unique beneficiary, and if the caller decides to proceed, it
41
+ * can call `next()` to continue the bulk transfer creation process. If the caller
42
+ * decides to abort the process, it can simply call `next(VOP_DECISIONS.REJECT)`,
43
+ * and the generator will terminate without creating the bulk transfer.
37
44
  * @param params - An object containing the settings for the bulk transfer, including:
38
- * - `bulkTransferSettings`: An object that contains the mandatory `bankAccountId` and an array of `bulkTransfers`.
45
+ * - `bulkTransferSettings`: An object that contains the mandatory `bankAccountId`
46
+ * and an array of `bulkTransfers`.
39
47
  * - `operationSettings`: An object with operation-level settings such as
40
48
  * `accessToken`, `stagingToken`, and other optional parameters. See {@link BulkTransferParams}.
41
- * If the transfer needs to be created
42
- * for an untrusted beneficiary, the `operationSettings` object must also include
43
- * the `uiParentElementId` property. This has to specify the ID of the DOM element
44
- * where the UI for MFA will be displayed. Note that this means that creating
45
- * transfers for untrusted beneficiaries can only happen in the client side.
46
- * The `createBulkTransfer` function requires an `idempotencyKey` as well. If this
47
- * property is not passed as part of `operationSettings`, a new one will be
48
- * generated automatically.
49
+ * The `operationSettings` object must also include the `uiParentElementId` property.
50
+ * This has to specify the ID of the DOM element where the UI for MFA will be
51
+ * displayed. Note that this means that creating transfers
52
+ * can only happen in the client side. The `createBulkTransfer` function
53
+ * expects an `idempotencyKey` as well. If this property is not passed as part
54
+ * of `operationSettings`, a new one will be generated automatically.
49
55
  * You can also specify an `mfaPreference` in the `operationSettings` to choose the
50
56
  * multi-factor authentication method to use for the SCA flow (e.g., 'passkey',
51
57
  * 'sms-otp', or 'paired-device'). If not provided, the default MFA method will be used.
52
- * @returns A promise that resolves to a BulkTransfer object containing details of the created bulk transfer.
58
+ * @returns As a yielded value, a promise that resolves to VoP check results for
59
+ * all unique beneficiaries.
60
+ * @returns As the final return value, a promise that resolves to the created
61
+ * bulk transfer.
53
62
  * @throws `AuthenticationError` If the access token is invalid or missing.
54
63
  * Ensure initialize has been called before using this function if you are not
55
64
  * passing the access token.
56
- * @throws `InvalidParametersError` If the `transfer` parameter is not an object
57
- * or is missing, or if the required properties of the transfer object are
65
+ * @throws `InvalidParametersError` If the `bulkTransferSettings` parameter is not an object
66
+ * or is missing, or if the required properties of the bulk transfer object are
58
67
  * missing or invalid. Also thrown if `uiParentElementId` is not provided in the
59
68
  * `operationSettings`, which is required for the iframe flow.
60
69
  * @throws `EmbedApiError` If the API request fails or returns an error.
61
70
  * @throws `InvalidRuntimeError` If the function is called in a non-browser environment.
62
71
  * This operation can only be performed from a browser since it requires an iframe.
63
72
  */
64
- export declare function createBulkTransfer({ bulkTransferSettings, operationSettings, }: BulkTransferParams<NewBulkTransfer>): Promise<BulkTransfer>;
73
+ export declare function createBulkTransfer({ bulkTransferSettings, operationSettings, }: BulkTransferParams<NewBulkTransferWithBeneficiary>): AsyncGenerator<SingleBulkVopVerificationResult[], BulkTransfer | undefined>;
65
74
  //# sourceMappingURL=bulk-transfers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-transfers.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,YAAY,EAEZ,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAiB/E;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,wBAAwB,CAAC,CA0BnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAgB7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CA4D7D"}
1
+ {"version":3,"file":"bulk-transfers.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,YAAY,EAEZ,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAEV,kBAAkB,EACnB,MAAM,sCAAsC,CAAC;AAkB9C;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,wBAAwB,CAAC,CA0BnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,eAAe,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAgB7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAuB,kBAAkB,CAAC,EACxC,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,kBAAkB,CAAC,8BAA8B,CAAC,GAAG,cAAc,CACpE,+BAA+B,EAAE,EACjC,YAAY,GAAG,SAAS,CACzB,CAyFA"}
@@ -1,4 +1,5 @@
1
- import type { BulkTransfer, BulkTransferDataObject, NewBulkTransfer, NewBulkTransferDataObject } from './bulk-transfers.types';
1
+ import type { BulkTransfer, BulkTransferDataObject, NewBulkTransfer, NewBulkTransferDataObject, SingleBulkVopVerificationResult, SingleVopResultFromBulkRequestApiResponse } from './bulk-transfers.types';
2
2
  export declare function serializeBulkTransfer(data: BulkTransferDataObject): BulkTransfer;
3
3
  export declare function serializeToNewBulkTransferDataObject(bulkTransfer: NewBulkTransfer): NewBulkTransferDataObject;
4
+ export declare function serializeToBulkVopVerificationResult(bulkVopResult: SingleVopResultFromBulkRequestApiResponse): SingleBulkVopVerificationResult;
4
5
  //# sourceMappingURL=bulk-transfers.serializer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-transfers.serializer.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,YAAY,CAiBd;AAED,wBAAgB,oCAAoC,CAClD,YAAY,EAAE,eAAe,GAC5B,yBAAyB,CAqB3B"}
1
+ {"version":3,"file":"bulk-transfers.serializer.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,yBAAyB,EACzB,+BAA+B,EAC/B,yCAAyC,EAC1C,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,YAAY,CAiBd;AAED,wBAAgB,oCAAoC,CAClD,YAAY,EAAE,eAAe,GAC5B,yBAAyB,CAqB3B;AAED,wBAAgB,oCAAoC,CAClD,aAAa,EAAE,yCAAyC,GACvD,+BAA+B,CAQjC"}
@@ -2,6 +2,8 @@ import type { Beneficiary } from '@beneficiaries/beneficiaries.types';
2
2
  import type { PaginationState } from '@common/api-pagination/api-pagination.types';
3
3
  import type { TRANSFER_STATUSES } from '@common/constants';
4
4
  import type { OperationSettings } from '@validation/operation-settings-validation';
5
+ import type { VerifySepaPayeeApiResponse } from '@sepa-transfers/sepa-transfers.api';
6
+ import type { VopVerificationResult } from '@sepa-transfers/sepa-transfers.types';
5
7
  /**
6
8
  * Represents the possible statuses of a Bulk transfer result.
7
9
  */
@@ -208,6 +210,9 @@ export interface NewBulkTransfer {
208
210
  */
209
211
  clientTransferId: string;
210
212
  }
213
+ export type NewBulkTransferWithBeneficiary = Omit<NewBulkTransfer, 'beneficiaryId'> & {
214
+ beneficiary: Beneficiary;
215
+ };
211
216
  /**
212
217
  * The settings related to SEPA bulk transfers, including the bank account ID and the bulk transfers to be processed.
213
218
  */
@@ -229,4 +234,18 @@ export interface BulkTransferParams<T> {
229
234
  bulkTransferSettings: BulkTransferSettings<T>;
230
235
  operationSettings?: OperationSettings;
231
236
  }
237
+ export interface SingleVopResultFromBulkRequestApiResponse {
238
+ id: string;
239
+ response: Pick<VerifySepaPayeeApiResponse, 'match_result' | 'matched_name'>;
240
+ }
241
+ export interface VerifyBulkSepaPayeeApiResponse {
242
+ proof_token: {
243
+ token: string;
244
+ };
245
+ requests: SingleVopResultFromBulkRequestApiResponse[];
246
+ }
247
+ export interface SingleBulkVopVerificationResult {
248
+ id: string;
249
+ response: VopVerificationResult;
250
+ }
232
251
  //# sourceMappingURL=bulk-transfers.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-transfers.types.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE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IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,EAAE,CAAC,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,8BAA8B;IAC7C,eAAe,EAAE,MAAM,CAAC;CACzB;AACD,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC9C,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC"}
1
+ {"version":3,"file":"bulk-transfers.types.d.ts","sourceRoot":"","sources":["../../../src/sepa-transfers/bulk-transfers/bulk-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAElF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM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AM,CAAC;IACd;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,eAAe,EACf,eAAe,CAChB,GAAG;IACF,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,EAAE,CAAC,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,8BAA8B;IAC7C,eAAe,EAAE,MAAM,CAAC;CACzB;AACD,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC9C,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED,MAAM,WAAW,yCAAyC;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,IAAI,CAAC,0BAA0B,EAAE,cAAc,GAAG,cAAc,CAAC,CAAC;CAC7E;AAED,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,QAAQ,EAAE,yCAAyC,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,+BAA+B;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,qBAAqB,CAAC;CACjC"}
@@ -1,6 +1,7 @@
1
- import type { SepaTransfer, SepaTransferDataObject, NewSepaTransfer, NewSepaTransferDataObject, VopVerificationResult } from './sepa-transfers.types';
1
+ import type { SepaTransfer, SepaTransferDataObject, NewSepaTransfer, NewSepaTransferDataObject, VopVerificationResult, SepaPayee, SepaPayeeDataObject } from './sepa-transfers.types';
2
2
  import type { VerifySepaPayeeApiResponse } from '@sepa-transfers/sepa-transfers.api';
3
3
  export declare function serializeSepaTransfer(data: SepaTransferDataObject): SepaTransfer;
4
4
  export declare function serializeToNewSepaTransferDataObject(transfer: NewSepaTransfer): NewSepaTransferDataObject;
5
5
  export declare function serializeToVopVerificationResult(vopResult: VerifySepaPayeeApiResponse): VopVerificationResult;
6
+ export declare function serializeToSepaPayeeDataObject(payee: SepaPayee): SepaPayeeDataObject;
6
7
  //# sourceMappingURL=sepa-transfers.serializer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.serializer.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAErF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,YAAY,CAoBd;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,eAAe,GACxB,yBAAyB,CAgB3B;AAED,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,0BAA0B,GACpC,qBAAqB,CAKvB"}
1
+ {"version":3,"file":"sepa-transfers.serializer.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,SAAS,EACT,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAErF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,YAAY,CAoBd;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,eAAe,GACxB,yBAAyB,CAgB3B;AAED,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,0BAA0B,GACpC,qBAAqB,CAKvB;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,SAAS,GACf,mBAAmB,CAKrB"}
@@ -221,6 +221,10 @@ export interface CancelSepaTransferParams {
221
221
  sepaTransferId: string;
222
222
  }
223
223
  export type SepaPayee = Pick<Beneficiary, 'iban' | 'name'>;
224
+ export interface SepaPayeeDataObject {
225
+ name: string;
226
+ iban: string;
227
+ }
224
228
  export interface VopVerificationResult {
225
229
  matchResult: string;
226
230
  matchedName?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"sepa-transfers.types.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EAChB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF;;GAEG;AACH,KAAK,0BAA0B,GAC7B,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAC;AAE3E;;GAEG;AACH,KAAK,kBAAkB,GACrB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,MAAM,EAAE,kBAAkB,CAAC;IAC3B;;OAEG;IACH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AAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
1
+ {"version":3,"file":"sepa-transfers.types.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EAChB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF;;GAEG;AACH,KAAK,0BAA0B,GAC7B,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAC;AAE3E;;GAEG;AACH,KAAK,kBAAkB,GACrB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,MAAM,EAAE,kBAAkB,CAAC;IAC3B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,cAAc,EAAE,0BAA0B,CAAC;IAC3C;;OAEG;IACH,aAAa,EAAE,IAAI,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;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;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,CAAC,CAAC;IACzB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1 +1 @@
1
- import{buildRequestHeaders as n}from"../../common/network/network.js";import{environmentManager as e}from"../../common/environment/environment-manager.js";import{addPaginationParamsToUrl as r}from"../../common/api-pagination/api-pagination.js";import{EmbedApiError as o}from"../../errors/EmbedApiError.js";const t="/v2/sepa/bulk_transfers";async function a({accessToken:a,stagingToken:s,paginationSettings:i}){const m={method:"GET",headers:n({accessToken:a,stagingToken:s})},c=new URL(`${e.getEnvironmentUrls().THIRD_PARTY_API_URL}${t}`),f=r({endpointUrl:c,paginationSettings:i}),g=await fetch(f,m);if(!g.ok)throw new o("Failed to fetch SEPA bulk transfers");const k=await g.json();if(k.errors)throw new o(k.errors.map((n=>`${n.code}: ${n.detail}`)));return{bulkTransfers:k.bulk_transfers,meta:k.meta}}async function s({accessToken:r,stagingToken:a,bulkTransferId:s}){const i={method:"GET",headers:n({accessToken:r,stagingToken:a})},m=new URL(`${e.getEnvironmentUrls().THIRD_PARTY_API_URL}${t}/${s}`),c=await fetch(m,i),f=await c.json();if(f.errors)throw new o(f.errors.map((n=>`${n.code}: ${n.detail}`)));return f.bulk_transfer}export{t as BULK_TRANSFERS_ENDPOINT,s as getBulkTransfer,a as getBulkTransfers};
1
+ import{makeNetworkCall as e,buildRequestHeaders as n}from"../../common/network/network.js";import{environmentManager as s}from"../../common/environment/environment-manager.js";import{addPaginationParamsToUrl as o}from"../../common/api-pagination/api-pagination.js";import{EmbedApiError as r}from"../../errors/EmbedApiError.js";import{SEPA_ENDPOINT as a}from"../sepa-transfers.api.js";import{serializeToSepaPayeeDataObject as t}from"../sepa-transfers.serializer.js";const i="/v2/sepa/bulk_transfers";async function c({accessToken:e,stagingToken:a,paginationSettings:t}){const c={method:"GET",headers:n({accessToken:e,stagingToken:a})},m=new URL(`${s.getEnvironmentUrls().THIRD_PARTY_API_URL}${i}`),p=o({endpointUrl:m,paginationSettings:t}),k=await fetch(p,c);if(!k.ok)throw new r("Failed to fetch SEPA bulk transfers");const f=await k.json();if(f.errors)throw new r(f.errors.map((e=>`${e.code}: ${e.detail}`)));return{bulkTransfers:f.bulk_transfers,meta:f.meta}}async function m({accessToken:e,stagingToken:o,bulkTransferId:a}){const t={method:"GET",headers:n({accessToken:e,stagingToken:o})},c=new URL(`${s.getEnvironmentUrls().THIRD_PARTY_API_URL}${i}/${a}`),m=await fetch(c,t),p=await m.json();if(p.errors)throw new r(p.errors.map((e=>`${e.code}: ${e.detail}`)));return p.bulk_transfer}function p({sepaPayees:e,accessToken:n,stagingToken:s}){return{path:`${a}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:s},body:{requests:e.map(t)}}}}async function k({sepaPayees:n,accessToken:s,stagingToken:o}){const r=p({sepaPayees:n,accessToken:s,stagingToken:o});return await e(r)}export{i as BULK_TRANSFERS_ENDPOINT,m as getBulkTransfer,c as getBulkTransfers,p as prepareVerifySepaPayeesCall,k as verifySepaPayees};
@@ -1 +1 @@
1
- import{authManager as n}from"../../common/auth/auth.js";import{validatePresenceOfAuthToken as e}from"../../common/auth/auth.validate.js";import{serializePaginationResponse as t}from"../../common/api-pagination/api-pagination.js";import{getBulkTransfer as o,getBulkTransfers as a}from"./bulk-transfers.api.js";import{serializeToNewBulkTransferDataObject as r,serializeBulkTransfer as s}from"./bulk-transfers.serializer.js";import{validateOperationSettingsParams as i}from"../../validation/operation-settings-validation.js";import{validateCreateBulkTransferParams as m,validateBulkTransferParams as c}from"./bulk-transfers.validate.js";import{isRunningInBrowser as u}from"../../common/runtime/runtime.validation.js";import{InvalidRuntimeError as f,RUNTIME_ENVIRONMENT as g}from"../../errors/InvalidRuntimeError.js";import{buildIframeUrl as p,createIframe as d}from"../../iframe/iframe-manager.js";import{buildIframeMessage as l}from"../../iframe/iframe-message-builder.js";import{ACTIONS as k}from"../../common/constants.js";import T from"../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";async function b(n){const{operationSettings:o}=n||{},r=o?.accessToken||e(),{stagingToken:m,paginationSettings:c}=i(o||{}),u=await a({accessToken:r,stagingToken:m,paginationSettings:c}),f=u.bulkTransfers?.map(s),g=t(u.meta);return{bulkTransfers:f,...g?{meta:g}:{}}}async function j({sepaTransferSettings:n,operationSettings:t}){const a=t?.accessToken||e(),{stagingToken:r}=i(t||{}),m=c(n?.bulkTransferId),u=await o({accessToken:a,stagingToken:r,bulkTransferId:m});return s(u)}async function y({bulkTransferSettings:t,operationSettings:o}){const a=o?.accessToken||e(),c=o?.stagingToken||n.getStagingToken(),b=o?.idempotencyKey||T();if(m(t),!u())throw new f(g.BROWSER);const{uiParentElementId:j,debugMode:y}=i(o,{requiresUI:!0});let S,I;try{const n=p({accessToken:a,stagingToken:c||void 0,debugMode:y});I=await d({iframeUrl:n,parentElementId:j});const e={bankAccountId:t.bankAccountId,bulkTransfers:t.bulkTransfers.map((n=>r(n)))};S=await I.postMessage(l({actionId:k.TRANSFER_BULK_CREATE,actionData:{body:e,idempotencyKey:b}}))}finally{I?.destroy()}return s(S)}export{y as createBulkTransfer,j as getBulkTransfer,b as getBulkTransfers};
1
+ import{authManager as e}from"../../common/auth/auth.js";import{validatePresenceOfAuthToken as n}from"../../common/auth/auth.validate.js";import{serializePaginationResponse as a}from"../../common/api-pagination/api-pagination.js";import{verifySepaPayees as t,getBulkTransfer as o,getBulkTransfers as s}from"./bulk-transfers.api.js";import{serializeToBulkVopVerificationResult as r,serializeToNewBulkTransferDataObject as i,serializeBulkTransfer as m}from"./bulk-transfers.serializer.js";import{validateOperationSettingsParams as c}from"../../validation/operation-settings-validation.js";import{validateCreateBulkTransferParams as f,validateBulkTransferParams as u}from"./bulk-transfers.validate.js";import{isRunningInBrowser as p}from"../../common/runtime/runtime.validation.js";import{InvalidRuntimeError as g,RUNTIME_ENVIRONMENT as d}from"../../errors/InvalidRuntimeError.js";import{buildIframeUrl as l,createIframe as k}from"../../iframe/iframe-manager.js";import{buildIframeMessage as T}from"../../iframe/iframe-message-builder.js";import{VOP_DECISIONS as b,ACTIONS as y}from"../../common/constants.js";import j from"../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";async function v(e){const{operationSettings:t}=e||{},o=t?.accessToken||n(),{stagingToken:r,paginationSettings:i}=c(t||{}),f=await s({accessToken:o,stagingToken:r,paginationSettings:i}),u=f.bulkTransfers?.map(m),p=a(f.meta);return{bulkTransfers:u,...p?{meta:p}:{}}}async function S({sepaTransferSettings:e,operationSettings:a}){const t=a?.accessToken||n(),{stagingToken:s}=c(a||{}),r=u(e?.bulkTransferId),i=await o({accessToken:t,stagingToken:s,bulkTransferId:r});return m(i)}async function*w({bulkTransferSettings:a,operationSettings:o}){const s=o?.accessToken||n(),u=o?.stagingToken||e.getStagingToken(),v=o?.idempotencyKey||j();f(a);const{uiParentElementId:S,debugMode:w}=c(o,{requiresUI:!0});if(!p())throw new g(d.BROWSER);const E=new Map;for(const e of a.bulkTransfers){const n=e.beneficiary.iban;n&&!E.has(n)&&E.set(n,{name:e.beneficiary.name,iban:n})}const I=Array.from(E.values()),R=await t({sepaPayees:I,accessToken:s,stagingToken:u||void 0});if((yield R.requests.map(r))===b.REJECT)return;let h,A;try{const e=l({accessToken:s,stagingToken:u||void 0,debugMode:w});A=await k({iframeUrl:e,parentElementId:S});const n={bankAccountId:a.bankAccountId,bulkTransfers:a.bulkTransfers.map((e=>i(e)))};h=await A.postMessage(T({actionId:y.TRANSFER_BULK_CREATE,actionData:{body:n,idempotencyKey:v}}))}finally{A?.destroy()}return m(h)}export{w as createBulkTransfer,S as getBulkTransfer,v as getBulkTransfers};
@@ -1 +1 @@
1
- function t(t){return{id:t.id,initiatorId:t.initiator_id,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),totalCount:Number(t.total_count),completedCount:Number(t.completed_count),failedCount:Number(t.failed_count),pendingCount:Number(t.pending_count),results:t.results.map((t=>({clientTransferId:t.client_transfer_id,transferId:t.transfer_id??null,errors:t.errors||null,status:t.status})))}}function e(t){return{beneficiary_id:t.beneficiaryId||t.beneficiary?.id,client_transfer_id:t.clientTransferId,amount:t.amount.toString(),reference:t.reference,...t.note?{note:t.note}:{},...t.scheduledDate?{scheduled_date:t.scheduledDate.toISOString().split("T")[0]}:{},...t.attachmentsIds?{attachment_ids:t.attachmentsIds}:{}}}export{t as serializeBulkTransfer,e as serializeToNewBulkTransferDataObject};
1
+ function e(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}function t(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}function n(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}export{e as serializeBulkTransfer,n as serializeToBulkVopVerificationResult,t as serializeToNewBulkTransferDataObject};
@@ -1 +1 @@
1
- import{InvalidParametersError as e}from"../../errors/InvalidParametersError.js";import{validateExpectedStringValues as r,validateExpectedNumericValues as n}from"../../validation/input-param-validation.js";import{AMOUNT_REQUIRING_ATTACHMENTS as i}from"../../common/constants.js";function a(r){if(!r)throw new e("bulkTransferId parameter is required for the called function.");if("string"!=typeof r)throw new e("bulkTransferId must be a string.");return r}function t(a){if(!a)throw new e("bulkTransferSettings parameter is required for the called function.");if(!a.bankAccountId)throw new e("bankAccountId is required");if(!Array.isArray(a.bulkTransfers))throw new e("bulkTransfers must be an array");if(a.bulkTransfers.length>400)throw new e("Maximum of 400 bulk transfers allowed");return a.bulkTransfers.forEach(((a,t)=>{!function(a,t){if(!a)throw new e(`Invalid bulkTransfer at index ${t}: bulkTransfer object is required`);if(!a.beneficiaryId&&!a.beneficiary)throw new e(`Invalid bulkTransfer at index ${t}: Either beneficiaryId for an existing beneficiary or beneficiary details must be provided`);if(a.beneficiaryId&&a.beneficiary)throw new e(`Invalid bulkTransfer at index ${t}: Provide either beneficiaryId for an existing beneficiary or beneficiary details to create/update one, not both`);if(a.beneficiary){if(!a.beneficiary.iban)throw new e(`Invalid bulkTransfer at index ${t}: IBAN is required when providing beneficiary details`);if(!a.beneficiary.name)throw new e(`Invalid bulkTransfer at index ${t}: Beneficiary name is required when providing beneficiary details`)}const f=r({beneficiaryId:a.beneficiaryId,reference:a.reference,clientTransferId:a.clientTransferId,note:a.note}),o=n({amount:a.amount}),s=[...f,...o].flat();if(s.length>0)throw new e(s);if(a.amount>i&&(!a.attachmentsIds||0===a.attachmentsIds.length))throw new e(`Invalid bulkTransfer at index ${t}: Attachments are required for transfers over €${i}`)}(a,t)})),a}export{a as validateBulkTransferParams,t as validateCreateBulkTransferParams};
1
+ import{InvalidParametersError as e}from"../../errors/InvalidParametersError.js";import{validateExpectedStringValues as r,validateExpectedNumericValues as n}from"../../validation/input-param-validation.js";import{AMOUNT_REQUIRING_ATTACHMENTS as a}from"../../common/constants.js";function t(r){if(!r)throw new e("bulkTransferId parameter is required for the called function.");if("string"!=typeof r)throw new e("bulkTransferId must be a string.");return r}function i(t){if(!t)throw new e("bulkTransferSettings parameter is required for the called function.");if(!t.bankAccountId)throw new e("bankAccountId is required");if(!Array.isArray(t.bulkTransfers))throw new e("bulkTransfers must be an array");if(t.bulkTransfers.length>400)throw new e("Maximum of 400 bulk transfers allowed");return t.bulkTransfers.forEach(((t,i)=>{!function(t,i){if(!t)throw new e(`Invalid bulkTransfer at index ${i}: bulkTransfer object is required`);if(!t.beneficiary)throw new e(`Invalid bulkTransfer at index ${i}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!t.beneficiary.iban)throw new e(`Invalid bulkTransfer at index ${i}: IBAN is required as part of the beneficiary details`);if(!t.beneficiary.name)throw new e(`Invalid bulkTransfer at index ${i}: Beneficiary name is required as part of the beneficiary details`);const f=r({reference:t.reference,clientTransferId:t.clientTransferId,note:t.note}),s=n({amount:t.amount}),o=[...f,...s].flat();if(o.length>0)throw new e(o);if(t.amount>a&&(!t.attachmentsIds||0===t.attachmentsIds.length))throw new e(`Invalid bulkTransfer at index ${i}: Attachments are required for transfers over €${a}`)}(t,i)})),t}export{t as validateBulkTransferParams,i as validateCreateBulkTransferParams};
@@ -1 +1 @@
1
- function e(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function t(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}function n(e){return{matchResult:e.match_result,matchedName:e.matched_name}}export{e as serializeSepaTransfer,t as serializeToNewSepaTransferDataObject,n as serializeToVopVerificationResult};
1
+ function e(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function t(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}function n(e){return{matchResult:e.match_result,matchedName:e.matched_name}}function a(e){return{name:e.name,iban:e.iban}}export{e as serializeSepaTransfer,t as serializeToNewSepaTransferDataObject,a as serializeToSepaPayeeDataObject,n as serializeToVopVerificationResult};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qonto/embed-sdk",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "description": "Library to embed Qonto features in your application",
5
5
  "type": "module",
6
6
  "exports": {