@qonto/embed-sdk 0.53.0 → 0.54.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.
@@ -6,7 +6,7 @@ import type { BulkTransfer, BulkTransferParams, GetBulkTransfer, GetBulkTransfer
6
6
  * - `operationSettings`: An object with operation-level settings such as
7
7
  * `proxyRequestFunction` (preferred over using the access token flow),
8
8
  * `accessToken`, `stagingToken`, `paginationSettings`, and other optional
9
- * parameters. See {@link BulkTransferParams}.
9
+ * parameters.
10
10
  * @returns A promise that resolves to an object containing an array of bulk
11
11
  * transfers and a `meta` object containing pagination state.
12
12
  * @throws `InvalidParametersError` If any parameter validation fails.
@@ -23,7 +23,7 @@ export declare function getBulkTransfers(getBulkTransfersParams?: SepaTransferPa
23
23
  * - `operationSettings`: An object with operation-level settings such as
24
24
  * `proxyRequestFunction` (preferred over using the access token flow),
25
25
  * `accessToken`, `stagingToken`, and other optional
26
- * parameters. See {@link BulkTransferParams}.
26
+ * parameters.
27
27
  * @returns A promise that resolves to a BulkTransfer object containing details of
28
28
  * the requested bulk transfer.
29
29
  * @throws `InvalidParametersError` If the `bulkTransferId` parameter is not a string
@@ -50,7 +50,7 @@ export declare function getBulkTransfer({ sepaTransferSettings, operationSetting
50
50
  * and an array of `bulkTransfers`.
51
51
  * - `operationSettings`: An object with operation-level settings such as
52
52
  * `accessToken`, `stagingToken`, `idempotencyKey`, `mfaPreference`, `uiParentElementId`,
53
- * and other optional parameters. See {@link BulkTransferParams}.
53
+ * and other optional parameters.
54
54
  * @returns As a yielded value, a promise that resolves to VoP check results for
55
55
  * all unique beneficiaries.
56
56
  * @returns As the final return value, a promise that resolves to the created
@@ -7,7 +7,7 @@ import '../ui/ui-elements/sca-passkey/qonto-sca-passkey-waiting.ts';
7
7
  * - `operationSettings`: An object with operation-level settings such as
8
8
  * `proxyRequestFunction` (preferred over using the access token flow),
9
9
  * `accessToken`, `stagingToken`, `paginationSettings`, and other optional
10
- * parameters. See {@link SepaTransferParams}.
10
+ * parameters.
11
11
  * @returns A promise that resolves to an object containing an array of SEPA
12
12
  * transfers and a `meta` object containing pagination state.
13
13
  * @throws `InvalidParametersError` If any parameter validation fails.
@@ -23,7 +23,7 @@ export declare function getSepaTransfers(getSepaTransfersParams?: SepaTransferPa
23
23
  * - `operationSettings`: An object with operation-level settings such as
24
24
  * `proxyRequestFunction` (preferred over using the access token flow),
25
25
  * `accessToken`, `stagingToken`, and other optional
26
- * parameters. See {@link SepaTransferParams}.
26
+ * parameters.
27
27
  * @returns A promise that resolves to a SEPA transfer.
28
28
  * @throws `InvalidParametersError` If the `sepaTransferId` parameter is not a string
29
29
  * or missing, or if any parameter validation fails.
@@ -63,7 +63,7 @@ export declare function getSepaTransfer({ sepaTransferSettings, operationSetting
63
63
  * - `operationSettings`: An object with operation-level settings such as
64
64
  * `proxyRequestFunction` (preferred over using the access token flow),
65
65
  * `accessToken`, `stagingToken`, `idempotencyKey`, `mfaPreference`,
66
- * `uiParentElementId`, and other optional parameters. See {@link SepaTransferParams}.
66
+ * `uiParentElementId`, and other optional parameters.
67
67
  * @returns As the first yielded value, a promise that resolves to the VoP check
68
68
  * result.
69
69
  * @returns As the final return value, a promise that resolves to the created
@@ -137,7 +137,7 @@ export declare function createSepaTransfer({ sepaTransferSettings, operationSett
137
137
  * - `operationSettings`: An object with operation-level settings such as
138
138
  * `proxyRequestFunction` (preferred over using the access token flow),
139
139
  * `accessToken`, `stagingToken`, and other optional
140
- * parameters. See {@link SepaTransferParams}.
140
+ * parameters.
141
141
  * @returns A promise that resolves without return value.
142
142
  * @throws `InvalidParametersError` If the `sepaTransferId` parameter is missing
143
143
  * or not a string, or if any parameter validation fails.
@@ -157,7 +157,7 @@ export declare function cancelSepaTransfer({ sepaTransferSettings, operationSett
157
157
  * - `operationSettings`: An object with operation-level settings such as
158
158
  * `proxyRequestFunction` (preferred over using the access token flow),
159
159
  * `accessToken`, `stagingToken`, `locale`, and other optional
160
- * parameters. See {@link SepaTransferParams}.
160
+ * parameters.
161
161
  * @returns A promise that resolves to an object representing the Embed Auth Link.
162
162
  * This object contains a `url` property with the link to start the SEPA transfer.
163
163
  * @throws `InvalidParametersError` If the callbackUrl is invalid or missing, or
@@ -1 +1 @@
1
- {"version":3,"file":"beneficiaries.d.ts","sourceRoot":"","sources":["../../../src/beneficiaries/beneficiaries.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,iBAAiB,EAGvB,MAAM,2CAA2C,CAAC;AAenD,OAAO,KAAK,EACV,WAAW,EAEX,6BAA6B,EAC7B,wBAAwB,EACxB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAG/B;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAChD,OAAO,CAAC,wBAAwB,CAAC,CAuDnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CA2BrE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CA2B1D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,6BAA6B,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAmCzE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC;IACnB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAwB1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC;IAAE,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CA2B1E"}
1
+ {"version":3,"file":"beneficiaries.d.ts","sourceRoot":"","sources":["../../../src/beneficiaries/beneficiaries.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,iBAAiB,EAGvB,MAAM,2CAA2C,CAAC;AAenD,OAAO,KAAK,EACV,WAAW,EAEX,6BAA6B,EAC7B,wBAAwB,EACxB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAG/B;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAChD,OAAO,CAAC,wBAAwB,CAAC,CAyDnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAgCrE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAiC1D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,6BAA6B,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAyCzE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC;IACnB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAwB1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC;IAAE,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAgC1E"}
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbedServer={})}(this,(function(e){"use strict";const n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));let t;const a=new Uint8Array(16);var r={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function s(e,s,o){if(r.randomUUID&&!e)return r.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!t){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t=crypto.getRandomValues.bind(crypto)}return t(a)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}(i)}function o(e){const n=new URLSearchParams;return e?.page&&n.append("page",e.page.toString()),e?.itemsPerPage&&n.append("per_page",e.itemsPerPage.toString()),n}function i(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}}class c{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return c.instance||(c.instance=new c),c.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 u=c.getInstance();class d extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class f extends d{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid authentication method. Provide either a proxyRequestFunction (recommended) or accessToken, either as parameters or by calling the initialize function first."}}function p(){if(!u.hasAccessToken())throw new f;return u.getAccessToken()}const g={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},l={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},T={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},m=3e4,h="REJECT",k={CARD_DISPLAY:"display_card",PAYMENT_LINK_CREATE:"create_payment_link",SEPA_TRANSFER_CREATE:"create_sepa_transfer"},b="https://embed.qonto.com",y="https://embed-js{branch}.staging.qonto.co",w="https://embed.dev.qonto.co",I={[g.PRODUCTION]:{EMBED_BASE_URL:b,EMBED_URL:`${b}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[g.STAGING]:{EMBED_BASE_URL:y,EMBED_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[g.LOCAL]:{EMBED_BASE_URL:w,EMBED_URL:`${w}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class S{constructor(){let e,n;this.environment=g.PRODUCTION,this.branch=l.SANDBOX,"undefined"!=typeof process&&process.env&&(e=process.env.QONTO_EMBED_ENVIRONMENT,n=process.env.QONTO_EMBED_BRANCH),this.environment=Object.values(g).includes(e)?e:g.PRODUCTION,this.branch=Object.values(l).includes(n)?n:l.SANDBOX}static getInstance(){return S.instance||(S.instance=new S),S.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===g.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=g.PRODUCTION,this.branch=l.MASTER}getEnvironmentUrls(){if(this.environment===g.PRODUCTION)return I.production;{const e=I[this.environment];return Object.entries(e).reduce(((e,[n,t])=>({...e,[n]:t.replace("{branch}",`-${this.branch}`)})),{})}}}const _=S.getInstance();function P(){return!("undefined"!=typeof window&&"undefined"!=typeof document)}class E{constructor(){this.currentLocale="en"}static getInstance(){return E.instance||(E.instance=new E),E.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const A=E.getInstance();class v{constructor(){this.mfaPreference=T.PASSKEY,this.debugMode=!1}static getInstance(){return v.instance||(v.instance=new v),v.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),e.proxyEndpointDescriptor&&(this.proxyEndpointDescriptor=e.proxyEndpointDescriptor)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}getProxyEndpointDescriptor(){return this.proxyEndpointDescriptor}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=T.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}getSettings(){return{uiParentElementId:this.uiParentElementId,mfaPreference:this.mfaPreference,debugMode:this.debugMode,proxyRequestFunction:this.proxyRequestFunction}}}const R=v.getInstance();class D extends d{constructor({message:e,data:n,code:t}){super(),this.code=500;const a=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${a}`,this.data=n||{},this.code=t||this.code}}function x({accessToken:e,stagingToken:n,idempotencyKey:t,mfaPreference:a,scaSessionToken:r}){const s=new Headers;s.append("Authorization",`Bearer ${e}`);const o=n||u.getStagingToken();o&&s.append("X-Qonto-Staging-Token",o),t&&s.append("X-Qonto-Idempotency-Key",t);const i=a||R.getMFAPreference();return i&&s.append("X-Qonto-2fa-Preference",i),r&&s.append("X-Qonto-SCA-Session-Token",r),s.append("Content-Type","application/json"),s.append("Accept-Language",A.getLocale()),s}async function U({path:e,options:n}){const t=`${_.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(t,{...n,headers:x(n.headers),body:n.body?JSON.stringify(n.body):void 0});if(204===a.status)return;const r=await a.json();if(!a.ok)throw r.errors?new D({code:a.status,message:r.errors.map((e=>`${e.code}: ${e.detail}`))}):new D({code:a.status,message:`${r.code}: ${r.detail}`,data:r});return r}function O(e){const n={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},t=JSON.stringify(n);return a=t,P()?Buffer.from(a).toString("base64"):btoa(a);var a}function q(e){return JSON.parse((n=e,P()?Buffer.from(n,"base64").toString("utf-8"):atob(n)));var n}function $(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 M(e){return{name:e.name,iban:e.iban}}const N="/v2/sepa",L=`${N}/transfers`;async function C({accessToken:e,stagingToken:n,paginationSettings:t}){const a=function({paginationSettings:e,accessToken:n,stagingToken:t}){const a={method:"GET",headers:{accessToken:n,stagingToken:t}},r=o(e),s=r.size?`?${r.toString()}`:"";return{path:`${L}${s}`,options:a}}({paginationSettings:t,accessToken:e,stagingToken:n}),{transfers:r,meta:s}=await U(a);return{transfers:r,meta:s}}async function j({accessToken:e,stagingToken:n,sepaTransferId:t}){const a=function({sepaTransferId:e,accessToken:n,stagingToken:t}){return{path:`${L}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}({sepaTransferId:t,accessToken:e,stagingToken:n}),{transfer:r}=await U(a);return r}async function B({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}){const o=function({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}){const o=function(e){const n=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:n,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}(e);return{path:L,options:{method:"POST",headers:{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s},body:{transfer:o,vop_proof_token:n}}}}({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}),{transfer:i}=await U(o);return i}async function F({sepaTransferId:e,accessToken:n,stagingToken:t}){const a=function({sepaTransferId:e,accessToken:n,stagingToken:t}){return{path:`${L}/${e}/cancel`,options:{method:"POST",headers:{accessToken:n,stagingToken:t}}}}({sepaTransferId:e,accessToken:n,stagingToken:t});await U(a)}async function K({sepaPayee:e,accessToken:n,stagingToken:t}){const a=function({sepaPayee:e,accessToken:n,stagingToken:t}){return{path:`${N}/verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:t},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:n,stagingToken:t});return await U(a)}function Y(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 G(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}const H="/v2/sepa/bulk_transfers";async function Q({accessToken:e,stagingToken:n,paginationSettings:t}){const a=function({paginationSettings:e,accessToken:n,stagingToken:t}){const a={method:"GET",headers:{accessToken:n,stagingToken:t}},r=o(e),s=r.size?`?${r.toString()}`:"";return{path:`${H}${s}`,options:a}}({paginationSettings:t,accessToken:e,stagingToken:n}),{bulk_transfers:r,meta:s}=await U(a);return{bulkTransfers:r,meta:s}}async function X({accessToken:e,stagingToken:n,bulkTransferId:t}){const a=function({bulkTransferId:e,accessToken:n,stagingToken:t}){return{path:`${H}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}({bulkTransferId:t,accessToken:e,stagingToken:n}),{bulk_transfer:r}=await U(a);return r}async function z({sepaPayees:e,accessToken:n,stagingToken:t}){const a=function({sepaPayees:e,accessToken:n,stagingToken:t}){return{path:`${N}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:t},body:{requests:e.map(M)}}}}({sepaPayees:e,accessToken:n,stagingToken:t});return await U(a)}class J extends d{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")}`}}function V(e,n){const t=n.filter((n=>n.requiredIfPresent?!e[n.name]&&e[n.requiredIfPresent]:void 0===e[n.name])).map((e=>e.name));if(t.length>0)throw new J(t.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 Z(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}function ee(e){if(!e)throw new J("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new J("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new J("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new J("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,n)=>{!function(e,n){if(!e)throw new J(`Invalid bulkTransfer at index ${n}: bulkTransfer object is required`);if(!e.beneficiary)throw new J(`Invalid bulkTransfer at index ${n}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new J(`Invalid bulkTransfer at index ${n}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new J(`Invalid bulkTransfer at index ${n}: Beneficiary name is required as part of the beneficiary details`);const t=W({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=Z({amount:e.amount}),r=[...t,...a].flat();if(r.length>0)throw new J(r);if(e.amount>m&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new J(`Invalid bulkTransfer at index ${n}: Attachments are required for transfers over €30000`)}(e,n)})),e}const ne={getBulkTransfers:async function(e){const{accessToken:n,stagingToken:t,paginationSettings:a}=e?.operationSettings||{},r=n||p(),s=await Q({accessToken:r,stagingToken:t,paginationSettings:a}),o=s.bulkTransfers?.map(Y),c=i(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({bulkTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new J("bulkTransferId must be a string.");return e}(e?.bulkTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();return Y(await X({accessToken:s,stagingToken:r,bulkTransferId:t}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:n}){const{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:o}=n||{},i=t||p(),c=o||s(),u=ee(e),d=new Map;for(const e of u.bulkTransfers){const n=e.beneficiary;if(n){const e=n.iban;e&&!d.has(e)&&d.set(e,{name:n.name,iban:e})}}const f=Array.from(d.values()),g=await z({sepaPayees:f,accessToken:i,stagingToken:a});if((yield g.requests.map(G))===h)return;const l=await async function({bulkTransfers:e,accessToken:n,stagingToken:t,scaSessionToken:a,bankAccountId:r,idempotencyKey:s}){const o={method:"POST",headers:{...x({accessToken:n,stagingToken:t,scaSessionToken:a,idempotencyKey:s})},body:JSON.stringify({bank_account_id:r,bulk_transfers:e.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)))})},i=new URL(`${_.getEnvironmentUrls().THIRD_PARTY_API_URL}${H}`),c=await fetch(i,o),u=await c.json();if(!c.ok||u.errors)throw new D({message:u.errors?u.errors.map((e=>`${e.code}: ${e.detail}`)).join(", "):"Failed to create SEPA bulk transfer"});return u.bulk_transfer}({bulkTransfers:u.bulkTransfers,bankAccountId:u.bankAccountId,accessToken:i,stagingToken:a,scaSessionToken:r,idempotencyKey:c});return{bulkTransfer:Y(l),meta:{idempotencyKey:c}}}};class te extends d{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}async function ae({proxyFunction:e,networkCallDescriptor:n,proxyEndpointDescriptor:t}){if(t){const e={...Object.fromEntries([...x(n.options?.headers)??{}])},a=O({...n,options:{...n.options,headers:e}}),r=await fetch(t.path,{method:t.method,headers:t.options.headers,body:a}),s=q(await r.text());if(!r.ok)throw new D({code:r.status,data:s,message:`Error from proxy endpoint: ${r.status} ${r.statusText}`});return s}if(e){const t=Object.fromEntries([...x(n.options?.headers)??{}]),a=O({...n,options:{...n.options,headers:t}});return q(await e(a))}throw new te("No proxy function or proxy endpoint descriptor provided for proxy call.")}const re={requiresUI:!1};function se(e,{requiresUI:n}=re){const t=e?.uiParentElementId||R.getUIParentElementId();if(n){if(!t)throw new J("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.");if(!["string","function"].includes(typeof t))throw new J("operationSettings.uiParentElementId must be a string or a function returning an HTMLElement")}const a=e?.mfaPreference||R.getMFAPreference();if(a){const e=(r=Object.values(T),_.isProductionEnvironment()?r.filter((e=>e!==T.MOCK)):r);if(!e.includes(a))throw new J(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(_.isProductionEnvironment()&&a===T.MOCK)throw new J("operationSettings.mfaPreference cannot be set to mock in production environment.")}var r;const s=e?.debugMode||R.getDebugMode();if(void 0!==s&&"boolean"!=typeof s)throw new J("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||R.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new J("operationSettings.proxyRequestFunction must be a function.");const i=e?.proxyEndpointDescriptor||R.getProxyEndpointDescriptor();if(i&&!i.path)throw new J("operationSettings.proxyEndpointDescriptor must have at least a string-formatted path property.");return{...e,uiParentElementId:t,mfaPreference:a,debugMode:s,proxyRequestFunction:o,proxyEndpointDescriptor:i}}function oe({accessToken:e,stagingToken:n,action:t,callbackUrl:a}){const r={post_authn_action:t};return a&&(r.callback_url=a),{path:"/v1/embed_auth_links",options:{method:"POST",headers:{accessToken:e,stagingToken:n},body:{embed_auth_link:r}}}}function ie(e){return{url:e.url,postAuthAction:e.post_authn_action,callbackUrl:e.callback_url,expiresAt:e.expired_at,usedAt:e.used_at}}const ce={request:async function({requestSettings:e,operationSettings:n}){!function(e){if(!e||"object"!=typeof e)throw new J("requestSettings must be an object");const n=e,{action:t,callbackUrl:a}=e;V(n,[{name:"action"}]);const r=W(n),s=Object.values(k);if(s.includes(t)||r.push(`action must be one of ${s.join(", ")}`),r.length>0)throw new J(r);if(void 0!==a&&""===a.trim())throw new J("callbackUrl cannot be empty")}(e);const{proxyRequestFunction:t,stagingToken:a}=se(n||{});if(t){const n=oe({stagingToken:a,action:e.action,callbackUrl:e.callbackUrl});return ie((await ae({proxyFunction:t,networkCallDescriptor:n})).body)}{const t=n?.accessToken||p();return ie(await async function(e){const n=oe({accessToken:e.accessToken,stagingToken:e.stagingToken,action:e.action,callbackUrl:e.callbackUrl}),{embed_auth_link:t}=await U(n);return{url:t.url,post_authn_action:t.post_authn_action,callback_url:t.callback_url,expired_at:t.expired_at,used_at:t.used_at}}({accessToken:t,stagingToken:a,action:e.action,callbackUrl:e.callbackUrl}))}}};function ue(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 de({beneficiaryId:e,accessToken:n,stagingToken:t}){return{path:`/v2/sepa/beneficiaries/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}async function fe({beneficiarySettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new J("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:a,accessToken:r,stagingToken:s}=se(n||{});if(a){const e=de({beneficiaryId:t});return ue((await ae({proxyFunction:a,networkCallDescriptor:e})).body.beneficiary)}{const e=r||p(),n=await async function({accessToken:e,stagingToken:n,beneficiaryId:t}){const a=de({beneficiaryId:t,accessToken:e,stagingToken:n}),{beneficiary:r}=await U(a);return r}({beneficiaryId:t,accessToken:e,stagingToken:s});return ue(n)}}function pe(e,n){const t=n?.locale||A.getLocale(),a=new URL(e);return t&&a.searchParams.append("lang",t),n?.mfaPreference&&a.searchParams.append("mfaPreference",n.mfaPreference),n?.idempotencyKey&&a.searchParams.append("idempotencyKey",n.idempotencyKey),a.toString()}const ge=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];const le={getSepaTransfers:async function(e){const{accessToken:n,stagingToken:t,paginationSettings:a}=e?.operationSettings||{},r=n||p(),s=await C({accessToken:r,stagingToken:t,paginationSettings:a}),o=s.transfers.map($),c=i(s.meta);return{transfers:o,...c?{meta:c}:{}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new J("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();return $(await j({sepaTransferId:t,accessToken:s,stagingToken:r}))},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:n}){const{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:o}=n||{},i=t||p(),c=o||s();!function(e){if(!e)throw new J("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new J("sepaTransferSettings must be an object");if(!e.beneficiaryId&&!e.beneficiary)throw new J("Either beneficiaryId or beneficiary must be provided");const n=W({beneficiaryId:e.beneficiaryId});if(n.length>0)throw new J(n)}(e);const u=e?.beneficiary?e.beneficiary:await async function({sepaTransferSettings:e,operationSettings:n}){return e?.beneficiary?e.beneficiary:await fe({beneficiarySettings:{beneficiaryId:e?.beneficiaryId},operationSettings:n})}({sepaTransferSettings:e,operationSettings:n}),d={name:u.name,iban:u.iban},f=await K({sepaPayee:d,accessToken:i,stagingToken:a}),g=yield(l=f,{matchResult:l.match_result,matchedName:l.matched_name});var l;let T;if("string"==typeof g){if(g===h)return}else{if(g.vopDecision===h)return;T=g.sepaTransferSettings}const k={...e,...T};!function(e){if(!e)throw new J("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new J("sepaTransferSettings must be an object");V(e,ge);const n=[...W({bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...Z({amount:e.amount})].flat();if(n.length>0)throw new J(n);if(e.amount>m&&(!e.attachmentIds||0===e.attachmentIds.length))throw new J("Attachments are required for transfers over €30,000")}(k);const b={...k,beneficiary:u};return{transfer:$(await B({transfer:b,vopProofToken:f.proof_token.token,accessToken:i,stagingToken:a,scaSessionToken:r,idempotencyKey:c})),meta:{idempotencyKey:c}}},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new J("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();await F({sepaTransferId:t,accessToken:s,stagingToken:r})},getSepaTransferCreationFlowLink:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e||!e.callbackUrl)throw new J("callbackUrl parameter is required for the getSepaTransferCreationFlowLink function");if("string"!=typeof e.callbackUrl)throw new J("callbackUrl must be a string");return e.callbackUrl}(e),{accessToken:a,stagingToken:r}=n||{},s=a||p(),o=await ce.request({requestSettings:{action:k.SEPA_TRANSFER_CREATE,callbackUrl:t},operationSettings:{stagingToken:r,accessToken:s}});return{...o,url:pe(o.url,n)}},bulkTransfers:ne};e.sepaTransfers=le}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbedServer={})}(this,(function(e){"use strict";const n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));let t;const a=new Uint8Array(16);var r={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function s(e,s,o){if(r.randomUUID&&!e)return r.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!t){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t=crypto.getRandomValues.bind(crypto)}return t(a)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}(i)}function o(e){const n=new URLSearchParams;return e?.page&&n.append("page",e.page.toString()),e?.itemsPerPage&&n.append("per_page",e.itemsPerPage.toString()),n}function i(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}}class c{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return c.instance||(c.instance=new c),c.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 u=c.getInstance();class d extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class f extends d{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid authentication method. Provide either a proxyRequestFunction (recommended) or accessToken, either as parameters or by calling the initialize function first."}}function p(){if(!u.hasAccessToken())throw new f;return u.getAccessToken()}const g={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},l={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},T={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},m=3e4,h="REJECT",k={CARD_DISPLAY:"display_card",PAYMENT_LINK_CREATE:"create_payment_link",SEPA_TRANSFER_CREATE:"create_sepa_transfer"},b="https://embed.qonto.com",y="https://embed-js{branch}.staging.qonto.co",w="https://embed.dev.qonto.co",I={[g.PRODUCTION]:{EMBED_BASE_URL:b,EMBED_URL:`${b}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[g.STAGING]:{EMBED_BASE_URL:y,EMBED_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[g.LOCAL]:{EMBED_BASE_URL:w,EMBED_URL:`${w}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class S{constructor(){let e,n;this.environment=g.PRODUCTION,this.branch=l.SANDBOX,"undefined"!=typeof process&&process.env&&(e=process.env.QONTO_EMBED_ENVIRONMENT,n=process.env.QONTO_EMBED_BRANCH),this.environment=Object.values(g).includes(e)?e:g.PRODUCTION,this.branch=Object.values(l).includes(n)?n:l.SANDBOX}static getInstance(){return S.instance||(S.instance=new S),S.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===g.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=g.PRODUCTION,this.branch=l.MASTER}getEnvironmentUrls(){if(this.environment===g.PRODUCTION)return I.production;{const e=I[this.environment];return Object.entries(e).reduce(((e,[n,t])=>({...e,[n]:t.replace("{branch}",`-${this.branch}`)})),{})}}}const _=S.getInstance();function P(){return!("undefined"!=typeof window&&"undefined"!=typeof document)}class E{constructor(){this.currentLocale="en"}static getInstance(){return E.instance||(E.instance=new E),E.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const A=E.getInstance();class v{constructor(){this.mfaPreference=T.PASSKEY,this.debugMode=!1}static getInstance(){return v.instance||(v.instance=new v),v.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),e.proxyEndpointDescriptor&&(this.proxyEndpointDescriptor=e.proxyEndpointDescriptor)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}getProxyEndpointDescriptor(){return this.proxyEndpointDescriptor}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=T.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}getSettings(){return{uiParentElementId:this.uiParentElementId,mfaPreference:this.mfaPreference,debugMode:this.debugMode,proxyRequestFunction:this.proxyRequestFunction}}}const R=v.getInstance();class D extends d{constructor({message:e,data:n,code:t}){super(),this.code=500;const a=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${a}`,this.data=n||{},this.code=t||this.code}}function x({accessToken:e,stagingToken:n,idempotencyKey:t,mfaPreference:a,scaSessionToken:r}){const s=new Headers;s.append("Authorization",`Bearer ${e}`);const o=n||u.getStagingToken();o&&s.append("X-Qonto-Staging-Token",o),t&&s.append("X-Qonto-Idempotency-Key",t);const i=a||R.getMFAPreference();return i&&s.append("X-Qonto-2fa-Preference",i),r&&s.append("X-Qonto-SCA-Session-Token",r),s.append("Content-Type","application/json"),s.append("Accept-Language",A.getLocale()),s}async function U({path:e,options:n}){const t=`${_.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(t,{...n,headers:x(n.headers),body:n.body?JSON.stringify(n.body):void 0});if(204===a.status)return;const r=await a.json();if(!a.ok)throw r.errors?new D({code:a.status,message:r.errors.map((e=>`${e.code}: ${e.detail}`))}):new D({code:a.status,message:`${r.code}: ${r.detail}`,data:r});return r}function O(e){const n={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},t=JSON.stringify(n);return a=t,P()?Buffer.from(a).toString("base64"):btoa(a);var a}function q(e){return JSON.parse((n=e,P()?Buffer.from(n,"base64").toString("utf-8"):atob(n)));var n}function $(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 M(e){return{name:e.name,iban:e.iban}}const N="/v2/sepa",L=`${N}/transfers`;async function C({accessToken:e,stagingToken:n,paginationSettings:t}){const a=function({paginationSettings:e,accessToken:n,stagingToken:t}){const a={method:"GET",headers:{accessToken:n,stagingToken:t}},r=o(e),s=r.size?`?${r.toString()}`:"";return{path:`${L}${s}`,options:a}}({paginationSettings:t,accessToken:e,stagingToken:n}),{transfers:r,meta:s}=await U(a);return{transfers:r,meta:s}}async function j({accessToken:e,stagingToken:n,sepaTransferId:t}){const a=function({sepaTransferId:e,accessToken:n,stagingToken:t}){return{path:`${L}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}({sepaTransferId:t,accessToken:e,stagingToken:n}),{transfer:r}=await U(a);return r}async function B({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}){const o=function({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}){const o=function(e){const n=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:n,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}(e);return{path:L,options:{method:"POST",headers:{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s},body:{transfer:o,vop_proof_token:n}}}}({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}),{transfer:i}=await U(o);return i}async function F({sepaTransferId:e,accessToken:n,stagingToken:t}){const a=function({sepaTransferId:e,accessToken:n,stagingToken:t}){return{path:`${L}/${e}/cancel`,options:{method:"POST",headers:{accessToken:n,stagingToken:t}}}}({sepaTransferId:e,accessToken:n,stagingToken:t});await U(a)}async function K({sepaPayee:e,accessToken:n,stagingToken:t}){const a=function({sepaPayee:e,accessToken:n,stagingToken:t}){return{path:`${N}/verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:t},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:n,stagingToken:t});return await U(a)}function Y(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 G(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}const H="/v2/sepa/bulk_transfers";async function Q({accessToken:e,stagingToken:n,paginationSettings:t}){const a=function({paginationSettings:e,accessToken:n,stagingToken:t}){const a={method:"GET",headers:{accessToken:n,stagingToken:t}},r=o(e),s=r.size?`?${r.toString()}`:"";return{path:`${H}${s}`,options:a}}({paginationSettings:t,accessToken:e,stagingToken:n}),{bulk_transfers:r,meta:s}=await U(a);return{bulkTransfers:r,meta:s}}async function X({accessToken:e,stagingToken:n,bulkTransferId:t}){const a=function({bulkTransferId:e,accessToken:n,stagingToken:t}){return{path:`${H}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}({bulkTransferId:t,accessToken:e,stagingToken:n}),{bulk_transfer:r}=await U(a);return r}async function z({sepaPayees:e,accessToken:n,stagingToken:t}){const a=function({sepaPayees:e,accessToken:n,stagingToken:t}){return{path:`${N}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:t},body:{requests:e.map(M)}}}}({sepaPayees:e,accessToken:n,stagingToken:t});return await U(a)}class J extends d{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")}`}}function V(e,n){const t=n.filter((n=>n.requiredIfPresent?!e[n.name]&&e[n.requiredIfPresent]:void 0===e[n.name])).map((e=>e.name));if(t.length>0)throw new J(t.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 Z(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}function ee(e){if(!e)throw new J("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new J("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new J("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new J("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,n)=>{!function(e,n){if(!e)throw new J(`Invalid bulkTransfer at index ${n}: bulkTransfer object is required`);if(!e.beneficiary)throw new J(`Invalid bulkTransfer at index ${n}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new J(`Invalid bulkTransfer at index ${n}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new J(`Invalid bulkTransfer at index ${n}: Beneficiary name is required as part of the beneficiary details`);const t=W({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=Z({amount:e.amount}),r=[...t,...a].flat();if(r.length>0)throw new J(r);if(e.amount>m&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new J(`Invalid bulkTransfer at index ${n}: Attachments are required for transfers over €30000`)}(e,n)})),e}const ne={getBulkTransfers:async function(e){const{accessToken:n,stagingToken:t,paginationSettings:a}=e?.operationSettings||{},r=n||p(),s=await Q({accessToken:r,stagingToken:t,paginationSettings:a}),o=s.bulkTransfers?.map(Y),c=i(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({bulkTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new J("bulkTransferId must be a string.");return e}(e?.bulkTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();return Y(await X({accessToken:s,stagingToken:r,bulkTransferId:t}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:n}){const{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:o}=n||{},i=t||p(),c=o||s(),u=ee(e),d=new Map;for(const e of u.bulkTransfers){const n=e.beneficiary;if(n){const e=n.iban;e&&!d.has(e)&&d.set(e,{name:n.name,iban:e})}}const f=Array.from(d.values()),g=await z({sepaPayees:f,accessToken:i,stagingToken:a});if((yield g.requests.map(G))===h)return;const l=await async function({bulkTransfers:e,accessToken:n,stagingToken:t,scaSessionToken:a,bankAccountId:r,idempotencyKey:s}){const o={method:"POST",headers:{...x({accessToken:n,stagingToken:t,scaSessionToken:a,idempotencyKey:s})},body:JSON.stringify({bank_account_id:r,bulk_transfers:e.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)))})},i=new URL(`${_.getEnvironmentUrls().THIRD_PARTY_API_URL}${H}`),c=await fetch(i,o),u=await c.json();if(!c.ok||u.errors)throw new D({message:u.errors?u.errors.map((e=>`${e.code}: ${e.detail}`)).join(", "):"Failed to create SEPA bulk transfer"});return u.bulk_transfer}({bulkTransfers:u.bulkTransfers,bankAccountId:u.bankAccountId,accessToken:i,stagingToken:a,scaSessionToken:r,idempotencyKey:c});return{bulkTransfer:Y(l),meta:{idempotencyKey:c}}}};class te extends d{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}async function ae({proxyFunction:e,networkCallDescriptor:n,proxyEndpointDescriptor:t}){if(t){const e={...Object.fromEntries([...x(n.options?.headers)??{}])},a=O({...n,options:{...n.options,headers:e}}),r=await fetch(t.path,{method:t.method,headers:t.options.headers,body:a}),s=q(await r.text());if(!r.ok)throw new D({code:r.status,data:s,message:`Error from proxy endpoint: ${r.status} ${r.statusText}`});return s}if(e){const t=Object.fromEntries([...x(n.options?.headers)??{}]),a=O({...n,options:{...n.options,headers:t}});return q(await e(a))}throw new te("No proxy function or proxy endpoint descriptor provided for proxy call.")}const re={requiresUI:!1};function se(e,{requiresUI:n}=re){const t=e?.uiParentElementId||R.getUIParentElementId();if(n){if(!t)throw new J("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.");if(!["string","function"].includes(typeof t))throw new J("operationSettings.uiParentElementId must be a string or a function returning an HTMLElement")}const a=e?.mfaPreference||R.getMFAPreference();if(a){const e=(r=Object.values(T),_.isProductionEnvironment()?r.filter((e=>e!==T.MOCK)):r);if(!e.includes(a))throw new J(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(_.isProductionEnvironment()&&a===T.MOCK)throw new J("operationSettings.mfaPreference cannot be set to mock in production environment.")}var r;const s=e?.debugMode||R.getDebugMode();if(void 0!==s&&"boolean"!=typeof s)throw new J("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||R.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new J("operationSettings.proxyRequestFunction must be a function.");const i=e?.proxyEndpointDescriptor||R.getProxyEndpointDescriptor();if(i&&!i.path)throw new J("operationSettings.proxyEndpointDescriptor must have at least a string-formatted path property.");return{...e,uiParentElementId:t,mfaPreference:a,debugMode:s,proxyRequestFunction:o,proxyEndpointDescriptor:i}}function oe({accessToken:e,stagingToken:n,action:t,callbackUrl:a}){const r={post_authn_action:t};return a&&(r.callback_url=a),{path:"/v1/embed_auth_links",options:{method:"POST",headers:{accessToken:e,stagingToken:n},body:{embed_auth_link:r}}}}function ie(e){return{url:e.url,postAuthAction:e.post_authn_action,callbackUrl:e.callback_url,expiresAt:e.expired_at,usedAt:e.used_at}}const ce={request:async function({requestSettings:e,operationSettings:n}){!function(e){if(!e||"object"!=typeof e)throw new J("requestSettings must be an object");const n=e,{action:t,callbackUrl:a}=e;V(n,[{name:"action"}]);const r=W(n),s=Object.values(k);if(s.includes(t)||r.push(`action must be one of ${s.join(", ")}`),r.length>0)throw new J(r);if(void 0!==a&&""===a.trim())throw new J("callbackUrl cannot be empty")}(e);const{proxyRequestFunction:t,stagingToken:a}=se(n||{});if(t){const n=oe({stagingToken:a,action:e.action,callbackUrl:e.callbackUrl});return ie((await ae({proxyFunction:t,networkCallDescriptor:n})).body)}{const t=n?.accessToken||p();return ie(await async function(e){const n=oe({accessToken:e.accessToken,stagingToken:e.stagingToken,action:e.action,callbackUrl:e.callbackUrl}),{embed_auth_link:t}=await U(n);return{url:t.url,post_authn_action:t.post_authn_action,callback_url:t.callback_url,expired_at:t.expired_at,used_at:t.used_at}}({accessToken:t,stagingToken:a,action:e.action,callbackUrl:e.callbackUrl}))}}};function ue(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 de({beneficiaryId:e,accessToken:n,stagingToken:t}){return{path:`/v2/sepa/beneficiaries/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}async function fe({beneficiarySettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new J("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:a,proxyEndpointDescriptor:r,accessToken:s,stagingToken:o}=se(n||{});if(a||r){const e=de({beneficiaryId:t});return ue((await ae({proxyFunction:a,proxyEndpointDescriptor:r,networkCallDescriptor:e})).body.beneficiary)}{const e=s||p(),n=await async function({accessToken:e,stagingToken:n,beneficiaryId:t}){const a=de({beneficiaryId:t,accessToken:e,stagingToken:n}),{beneficiary:r}=await U(a);return r}({beneficiaryId:t,accessToken:e,stagingToken:o});return ue(n)}}function pe(e,n){const t=n?.locale||A.getLocale(),a=new URL(e);return t&&a.searchParams.append("lang",t),n?.mfaPreference&&a.searchParams.append("mfaPreference",n.mfaPreference),n?.idempotencyKey&&a.searchParams.append("idempotencyKey",n.idempotencyKey),a.toString()}const ge=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];const le={getSepaTransfers:async function(e){const{accessToken:n,stagingToken:t,paginationSettings:a}=e?.operationSettings||{},r=n||p(),s=await C({accessToken:r,stagingToken:t,paginationSettings:a}),o=s.transfers.map($),c=i(s.meta);return{transfers:o,...c?{meta:c}:{}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new J("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();return $(await j({sepaTransferId:t,accessToken:s,stagingToken:r}))},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:n}){const{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:o}=n||{},i=t||p(),c=o||s();!function(e){if(!e)throw new J("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new J("sepaTransferSettings must be an object");if(!e.beneficiaryId&&!e.beneficiary)throw new J("Either beneficiaryId or beneficiary must be provided");const n=W({beneficiaryId:e.beneficiaryId});if(n.length>0)throw new J(n)}(e);const u=e?.beneficiary?e.beneficiary:await async function({sepaTransferSettings:e,operationSettings:n}){return e?.beneficiary?e.beneficiary:await fe({beneficiarySettings:{beneficiaryId:e?.beneficiaryId},operationSettings:n})}({sepaTransferSettings:e,operationSettings:n}),d={name:u.name,iban:u.iban},f=await K({sepaPayee:d,accessToken:i,stagingToken:a}),g=yield(l=f,{matchResult:l.match_result,matchedName:l.matched_name});var l;let T;if("string"==typeof g){if(g===h)return}else{if(g.vopDecision===h)return;T=g.sepaTransferSettings}const k={...e,...T};!function(e){if(!e)throw new J("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new J("sepaTransferSettings must be an object");V(e,ge);const n=[...W({bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...Z({amount:e.amount})].flat();if(n.length>0)throw new J(n);if(e.amount>m&&(!e.attachmentIds||0===e.attachmentIds.length))throw new J("Attachments are required for transfers over €30,000")}(k);const b={...k,beneficiary:u};return{transfer:$(await B({transfer:b,vopProofToken:f.proof_token.token,accessToken:i,stagingToken:a,scaSessionToken:r,idempotencyKey:c})),meta:{idempotencyKey:c}}},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new J("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();await F({sepaTransferId:t,accessToken:s,stagingToken:r})},getSepaTransferCreationFlowLink:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e||!e.callbackUrl)throw new J("callbackUrl parameter is required for the getSepaTransferCreationFlowLink function");if("string"!=typeof e.callbackUrl)throw new J("callbackUrl must be a string");return e.callbackUrl}(e),{accessToken:a,stagingToken:r}=n||{},s=a||p(),o=await ce.request({requestSettings:{action:k.SEPA_TRANSFER_CREATE,callbackUrl:t},operationSettings:{stagingToken:r,accessToken:s}});return{...o,url:pe(o.url,n)}},bulkTransfers:ne};e.sepaTransfers=le}));
@@ -6,7 +6,7 @@ import type { BulkTransfer, BulkTransferParams, GetBulkTransfer, GetBulkTransfer
6
6
  * - `operationSettings`: An object with operation-level settings such as
7
7
  * `proxyRequestFunction` (preferred over using the access token flow),
8
8
  * `accessToken`, `stagingToken`, `paginationSettings`, and other optional
9
- * parameters. See {@link BulkTransferParams}.
9
+ * parameters.
10
10
  * @returns A promise that resolves to an object containing an array of bulk
11
11
  * transfers and a `meta` object containing pagination state.
12
12
  * @throws `InvalidParametersError` If any parameter validation fails.
@@ -23,7 +23,7 @@ export declare function getBulkTransfers(getBulkTransfersParams?: SepaTransferPa
23
23
  * - `operationSettings`: An object with operation-level settings such as
24
24
  * `proxyRequestFunction` (preferred over using the access token flow),
25
25
  * `accessToken`, `stagingToken`, and other optional
26
- * parameters. See {@link BulkTransferParams}.
26
+ * parameters.
27
27
  * @returns A promise that resolves to a BulkTransfer object containing details of
28
28
  * the requested bulk transfer.
29
29
  * @throws `InvalidParametersError` If the `bulkTransferId` parameter is not a string
@@ -50,7 +50,7 @@ export declare function getBulkTransfer({ sepaTransferSettings, operationSetting
50
50
  * and an array of `bulkTransfers`.
51
51
  * - `operationSettings`: An object with operation-level settings such as
52
52
  * `accessToken`, `stagingToken`, `idempotencyKey`, `mfaPreference`, `uiParentElementId`,
53
- * and other optional parameters. See {@link BulkTransferParams}.
53
+ * and other optional parameters.
54
54
  * @returns As a yielded value, a promise that resolves to VoP check results for
55
55
  * all unique beneficiaries.
56
56
  * @returns As the final return value, a promise that resolves to the created
@@ -7,7 +7,7 @@ import '../ui/ui-elements/sca-passkey/qonto-sca-passkey-waiting.ts';
7
7
  * - `operationSettings`: An object with operation-level settings such as
8
8
  * `proxyRequestFunction` (preferred over using the access token flow),
9
9
  * `accessToken`, `stagingToken`, `paginationSettings`, and other optional
10
- * parameters. See {@link SepaTransferParams}.
10
+ * parameters.
11
11
  * @returns A promise that resolves to an object containing an array of SEPA
12
12
  * transfers and a `meta` object containing pagination state.
13
13
  * @throws `InvalidParametersError` If any parameter validation fails.
@@ -23,7 +23,7 @@ export declare function getSepaTransfers(getSepaTransfersParams?: SepaTransferPa
23
23
  * - `operationSettings`: An object with operation-level settings such as
24
24
  * `proxyRequestFunction` (preferred over using the access token flow),
25
25
  * `accessToken`, `stagingToken`, and other optional
26
- * parameters. See {@link SepaTransferParams}.
26
+ * parameters.
27
27
  * @returns A promise that resolves to a SEPA transfer.
28
28
  * @throws `InvalidParametersError` If the `sepaTransferId` parameter is not a string
29
29
  * or missing, or if any parameter validation fails.
@@ -63,7 +63,7 @@ export declare function getSepaTransfer({ sepaTransferSettings, operationSetting
63
63
  * - `operationSettings`: An object with operation-level settings such as
64
64
  * `proxyRequestFunction` (preferred over using the access token flow),
65
65
  * `accessToken`, `stagingToken`, `idempotencyKey`, `mfaPreference`,
66
- * `uiParentElementId`, and other optional parameters. See {@link SepaTransferParams}.
66
+ * `uiParentElementId`, and other optional parameters.
67
67
  * @returns As the first yielded value, a promise that resolves to the VoP check
68
68
  * result.
69
69
  * @returns As the final return value, a promise that resolves to the created
@@ -137,7 +137,7 @@ export declare function createSepaTransfer({ sepaTransferSettings, operationSett
137
137
  * - `operationSettings`: An object with operation-level settings such as
138
138
  * `proxyRequestFunction` (preferred over using the access token flow),
139
139
  * `accessToken`, `stagingToken`, and other optional
140
- * parameters. See {@link SepaTransferParams}.
140
+ * parameters.
141
141
  * @returns A promise that resolves without return value.
142
142
  * @throws `InvalidParametersError` If the `sepaTransferId` parameter is missing
143
143
  * or not a string, or if any parameter validation fails.
@@ -157,7 +157,7 @@ export declare function cancelSepaTransfer({ sepaTransferSettings, operationSett
157
157
  * - `operationSettings`: An object with operation-level settings such as
158
158
  * `proxyRequestFunction` (preferred over using the access token flow),
159
159
  * `accessToken`, `stagingToken`, `locale`, and other optional
160
- * parameters. See {@link SepaTransferParams}.
160
+ * parameters.
161
161
  * @returns A promise that resolves to an object representing the Embed Auth Link.
162
162
  * This object contains a `url` property with the link to start the SEPA transfer.
163
163
  * @throws `InvalidParametersError` If the callbackUrl is invalid or missing, or
@@ -1 +1 @@
1
- import{validateGetBeneficiaryParams as i}from"./beneficiaries.validate.js";import"../common/auth/auth.js";import{validatePresenceOfAuthToken as o}from"../common/auth/auth.validate.js";import{callProxyFunction as e}from"../common/common.utils.js";import{validateOperationSettingsParams as n}from"../validation/operation-settings-validation.js";import{prepareGetBeneficiaryCall as t,getBeneficiary as r}from"./beneficiaries.api.js";import{serializeBeneficiary as a}from"./beneficiaries.serializer.js";import"../common/environment/environment-manager.js";import"../common/locale/locale-manager.js";import"../common/operation-settings/operation-settings.js";async function s({beneficiarySettings:s,operationSettings:m}){const c=i(s?.beneficiaryId),{proxyRequestFunction:p,accessToken:f,stagingToken:g}=n(m||{});if(p){const i=t({beneficiaryId:c}),o=await e({proxyFunction:p,networkCallDescriptor:i});return a(o.body.beneficiary)}{const i=f||o(),e=await r({beneficiaryId:c,accessToken:i,stagingToken:g});return a(e)}}export{s as getBeneficiary};
1
+ import{validateGetBeneficiaryParams as o}from"./beneficiaries.validate.js";import"../common/auth/auth.js";import{validatePresenceOfAuthToken as i}from"../common/auth/auth.validate.js";import{callProxyFunction as e}from"../common/common.utils.js";import{validateOperationSettingsParams as n}from"../validation/operation-settings-validation.js";import{prepareGetBeneficiaryCall as t,getBeneficiary as r}from"./beneficiaries.api.js";import{serializeBeneficiary as a}from"./beneficiaries.serializer.js";import"../common/environment/environment-manager.js";import"../common/locale/locale-manager.js";import"../common/operation-settings/operation-settings.js";async function s({beneficiarySettings:s,operationSettings:m}){const c=o(s?.beneficiaryId),{proxyRequestFunction:p,proxyEndpointDescriptor:f,accessToken:g,stagingToken:l}=n(m||{});if(p||f){const o=t({beneficiaryId:c}),i=await e({proxyFunction:p,proxyEndpointDescriptor:f,networkCallDescriptor:o});return a(i.body.beneficiary)}{const o=g||i(),e=await r({beneficiaryId:c,accessToken:o,stagingToken:l});return a(e)}}export{s as getBeneficiary};
@@ -1 +1 @@
1
- {"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../../src/transactions/transactions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAUnF,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EAEZ,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CACnC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC,uBAAuB,CAAC,GACjE,OAAO,CAAC,uBAAuB,CAAC,CAyClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CA0BlE"}
1
+ {"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../../src/transactions/transactions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAUnF,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EAEZ,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CACnC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC,uBAAuB,CAAC,GACjE,OAAO,CAAC,uBAAuB,CAAC,CA2ClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CA+BlE"}
@@ -1 +1 @@
1
- import{validateGetBeneficiaryParams as e,validateTrustBeneficiariesParams as n,validateUpdateBeneficiaryParams as i,validateAddBeneficiaryParams as t}from"./beneficiaries.validate.js";import{serializePaginationResponse as o}from"../common/api-pagination/api-pagination.js";import"../common/auth/auth.js";import{validatePresenceOfAuthToken as a}from"../common/auth/auth.validate.js";import{callProxyFunction as r}from"../common/common.utils.js";import{validateOperationSettingsParams as s}from"../validation/operation-settings-validation.js";import{prepareGetBeneficiariesCall as c,getBeneficiaries as m,prepareGetBeneficiaryCall as p,getBeneficiary as f,prepareUntrustBeneficiaryCall as y,untrustBeneficiaries as g,prepareUpdateBeneficiaryCall as u,updateBeneficiary as b,prepareAddBeneficiaryCall as d,addBeneficiary as k}from"./beneficiaries.api.js";import{serializeBeneficiary as l}from"./beneficiaries.serializer.js";import"../common/environment/environment-manager.js";import"../common/locale/locale-manager.js";import"../common/operation-settings/operation-settings.js";async function T(e){const{stagingToken:n,proxyRequestFunction:i,accessToken:t,paginationSettings:p}=s(e?.operationSettings||{});if(i){const e=c({paginationSettings:p}),n=await r({proxyFunction:i,networkCallDescriptor:e}),t=n.body.beneficiaries.map((e=>l(e))),a=o(n.body.meta);return{beneficiaries:t,...a?{meta:a}:{}}}{const e=t||a(),i=await m({accessToken:e,stagingToken:n,paginationSettings:p}),r=i.beneficiaries.map((e=>l(e))),s=o(i.meta);return{beneficiaries:r,...s?{meta:s}:{}}}}async function w({beneficiarySettings:n,operationSettings:i}){const t=e(n?.beneficiaryId),{proxyRequestFunction:o,accessToken:c,stagingToken:m}=s(i||{});if(o){const e=p({beneficiaryId:t}),n=await r({proxyFunction:o,networkCallDescriptor:e});return l(n.body.beneficiary)}{const e=c||a(),n=await f({beneficiaryId:t,accessToken:e,stagingToken:m});return l(n)}}async function S({beneficiarySettings:e,operationSettings:n}){const i=t(e),{proxyRequestFunction:o,accessToken:c,stagingToken:m,idempotencyKey:p}=s(n||{});if(o){const e=d({beneficiary:i,idempotencyKey:p}),n=await r({proxyFunction:o,networkCallDescriptor:e});return l(n.body.beneficiary)}{const e=c||a(),n=await k({beneficiary:i,accessToken:e,stagingToken:m,idempotencyKey:p});return l(n)}}async function j({beneficiarySettings:e,operationSettings:n}){const t=i(e),{stagingToken:o,idempotencyKey:c,mfaPreference:m,proxyRequestFunction:p}=s(n),f={beneficiaryParamsBeingEdited:t,idempotencyKey:c,mfaPreference:m};if(p){const e=u(f),n=await r({proxyFunction:p,networkCallDescriptor:e});return l(n.body.beneficiary)}{const e=n?.accessToken||a(),i=await b({...f,accessToken:e,stagingToken:o});return l(i)}}async function x({beneficiarySettings:e,operationSettings:i}){const t=n(e?.beneficiaryIds),{proxyRequestFunction:o,accessToken:c,stagingToken:m}=s(i||{});if(o){const e=y({beneficiaryIds:t});return(await r({proxyFunction:o,networkCallDescriptor:e})).body.beneficiaries.map(l)}{const e=c||a();return(await g({beneficiaryIds:t,accessToken:e,stagingToken:m})).map(l)}}export{S as addBeneficiary,T as getBeneficiaries,w as getBeneficiary,x as untrustBeneficiaries,j as updateBeneficiary};
1
+ import{validateGetBeneficiaryParams as e,validateTrustBeneficiariesParams as n,validateUpdateBeneficiaryParams as i,validateAddBeneficiaryParams as t}from"./beneficiaries.validate.js";import{serializePaginationResponse as o}from"../common/api-pagination/api-pagination.js";import"../common/auth/auth.js";import{validatePresenceOfAuthToken as r}from"../common/auth/auth.validate.js";import{callProxyFunction as a}from"../common/common.utils.js";import{validateOperationSettingsParams as s}from"../validation/operation-settings-validation.js";import{prepareGetBeneficiariesCall as c,getBeneficiaries as p,prepareGetBeneficiaryCall as y,getBeneficiary as m,prepareUntrustBeneficiaryCall as f,untrustBeneficiaries as g,prepareUpdateBeneficiaryCall as u,updateBeneficiary as d,prepareAddBeneficiaryCall as b,addBeneficiary as k}from"./beneficiaries.api.js";import{serializeBeneficiary as x}from"./beneficiaries.serializer.js";import"../common/environment/environment-manager.js";import"../common/locale/locale-manager.js";import"../common/operation-settings/operation-settings.js";async function l(e){const{stagingToken:n,proxyRequestFunction:i,proxyEndpointDescriptor:t,accessToken:y,paginationSettings:m}=s(e?.operationSettings||{});if(i||t){const e=c({paginationSettings:m}),n=await a({proxyFunction:i,proxyEndpointDescriptor:t,networkCallDescriptor:e}),r=n.body.beneficiaries.map((e=>x(e))),s=o(n.body.meta);return{beneficiaries:r,...s?{meta:s}:{}}}{const e=y||r(),i=await p({accessToken:e,stagingToken:n,paginationSettings:m}),t=i.beneficiaries.map((e=>x(e))),a=o(i.meta);return{beneficiaries:t,...a?{meta:a}:{}}}}async function T({beneficiarySettings:n,operationSettings:i}){const t=e(n?.beneficiaryId),{proxyRequestFunction:o,proxyEndpointDescriptor:c,accessToken:p,stagingToken:f}=s(i||{});if(o||c){const e=y({beneficiaryId:t}),n=await a({proxyFunction:o,proxyEndpointDescriptor:c,networkCallDescriptor:e});return x(n.body.beneficiary)}{const e=p||r(),n=await m({beneficiaryId:t,accessToken:e,stagingToken:f});return x(n)}}async function w({beneficiarySettings:e,operationSettings:n}){const i=t(e),{proxyRequestFunction:o,proxyEndpointDescriptor:c,accessToken:p,stagingToken:y,idempotencyKey:m}=s(n||{});if(o||c){const e=b({beneficiary:i,idempotencyKey:m}),n=await a({proxyFunction:o,proxyEndpointDescriptor:c,networkCallDescriptor:e});return x(n.body.beneficiary)}{const e=p||r(),n=await k({beneficiary:i,accessToken:e,stagingToken:y,idempotencyKey:m});return x(n)}}async function D({beneficiarySettings:e,operationSettings:n}){const t=i(e),{stagingToken:o,idempotencyKey:c,mfaPreference:p,proxyRequestFunction:y,proxyEndpointDescriptor:m}=s(n),f={beneficiaryParamsBeingEdited:t,idempotencyKey:c,mfaPreference:p};if(y||m){const e=u(f),n=await a({proxyFunction:y,proxyEndpointDescriptor:m,networkCallDescriptor:e});return x(n.body.beneficiary)}{const e=n?.accessToken||r(),i=await d({...f,accessToken:e,stagingToken:o});return x(i)}}async function S({beneficiarySettings:e,operationSettings:i}){const t=n(e?.beneficiaryIds),{proxyRequestFunction:o,proxyEndpointDescriptor:c,accessToken:p,stagingToken:y}=s(i||{});if(o||c){const e=f({beneficiaryIds:t});return(await a({proxyFunction:o,proxyEndpointDescriptor:c,networkCallDescriptor:e})).body.beneficiaries.map(x)}{const e=p||r();return(await g({beneficiaryIds:t,accessToken:e,stagingToken:y})).map(x)}}export{w as addBeneficiary,l as getBeneficiaries,T as getBeneficiary,S as untrustBeneficiaries,D as updateBeneficiary};
@@ -1 +1 @@
1
- import{serializePaginationResponse as t}from"../common/api-pagination/api-pagination.js";import"../common/auth/auth.js";import{validatePresenceOfAuthToken as n}from"../common/auth/auth.validate.js";import{callProxyFunction as a}from"../common/common.utils.js";import{validateGetTransactionParams as o}from"./transactions.validation.js";import{validateOperationSettingsParams as i}from"../validation/operation-settings-validation.js";import{prepareGetTransactionsCall as s,getTransactions as r,prepareGetTransactionCall as c,getTransaction as e}from"./transactions.api.js";import{serializeTransaction as m}from"./transactions.serializer.js";async function p(o){const{stagingToken:c,proxyRequestFunction:e,accessToken:p,paginationSettings:g}=i(o?.operationSettings||{}),u={...o?.transactionSettings||{},paginationSettings:g};if(e){const n=s(u),o=await a({proxyFunction:e,networkCallDescriptor:n});return{transactions:o.body.transactions.map(m),meta:t(o.body.meta)}}{const a=p||n(),o=await r({...u,accessToken:a,stagingToken:c});return{transactions:o.transactions.map(m),meta:t(o.meta)}}}async function g({transactionSettings:t,operationSettings:s}){const{proxyRequestFunction:r,accessToken:p,stagingToken:g}=i(s||{}),{transactionId:u}=o(t);if(r){const t=c({transactionId:u}),n=await a({proxyFunction:r,networkCallDescriptor:t});return m(n.body.transaction)}{const t=p||n(),a=await e({transactionId:u,accessToken:t,stagingToken:g});return m(a)}}export{g as getTransaction,p as getTransactions};
1
+ import{serializePaginationResponse as t}from"../common/api-pagination/api-pagination.js";import"../common/auth/auth.js";import{validatePresenceOfAuthToken as n}from"../common/auth/auth.validate.js";import{callProxyFunction as o}from"../common/common.utils.js";import{validateGetTransactionParams as a}from"./transactions.validation.js";import{validateOperationSettingsParams as i}from"../validation/operation-settings-validation.js";import{prepareGetTransactionsCall as s,getTransactions as r,prepareGetTransactionCall as c,getTransaction as e}from"./transactions.api.js";import{serializeTransaction as p}from"./transactions.serializer.js";async function m(a){const{stagingToken:c,proxyRequestFunction:e,proxyEndpointDescriptor:m,accessToken:g,paginationSettings:u}=i(a?.operationSettings||{}),d={...a?.transactionSettings||{},paginationSettings:u};if(e||m){const n=s(d),a=await o({proxyFunction:e,proxyEndpointDescriptor:m,networkCallDescriptor:n});return{transactions:a.body.transactions.map(p),meta:t(a.body.meta)}}{const o=g||n(),a=await r({...d,accessToken:o,stagingToken:c});return{transactions:a.transactions.map(p),meta:t(a.meta)}}}async function g({transactionSettings:t,operationSettings:s}){const{proxyRequestFunction:r,proxyEndpointDescriptor:m,accessToken:g,stagingToken:u}=i(s||{}),{transactionId:d}=a(t);if(r||m){const t=c({transactionId:d}),n=await o({proxyFunction:r,proxyEndpointDescriptor:m,networkCallDescriptor:t});return p(n.body.transaction)}{const t=g||n(),o=await e({transactionId:d,accessToken:t,stagingToken:u});return p(o)}}export{g as getTransaction,m as getTransactions};
@@ -1 +1 @@
1
- {"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../src/transactions/transactions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAUnF,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EAEZ,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CACnC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC,uBAAuB,CAAC,GACjE,OAAO,CAAC,uBAAuB,CAAC,CAyClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CA0BlE"}
1
+ {"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../src/transactions/transactions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAUnF,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EAEZ,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CACnC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC,uBAAuB,CAAC,GACjE,OAAO,CAAC,uBAAuB,CAAC,CA2ClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CA+BlE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qonto/embed-sdk",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "description": "Library to embed Qonto features in your application",
5
5
  "type": "module",
6
6
  "exports": {