@qonto/embed-sdk 0.61.0 → 0.63.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/cards/{cards.d.ts → client/cards.client.d.ts} +64 -89
- package/dist/cards/client/cards.client.d.ts.map +1 -0
- package/dist/cards/client/cards.client.test.d.ts +2 -0
- package/dist/cards/client/cards.client.test.d.ts.map +1 -0
- package/dist/cards/index.d.ts +40 -10
- package/dist/cards/index.d.ts.map +1 -1
- package/dist/cards/index.server.d.ts +41 -0
- package/dist/cards/index.server.d.ts.map +1 -0
- package/dist/cards/server/cards.server.d.ts +60 -0
- package/dist/cards/server/cards.server.d.ts.map +1 -0
- package/dist/cards/server/cards.server.test.d.ts +2 -0
- package/dist/cards/server/cards.server.test.d.ts.map +1 -0
- package/dist/cards/shared/cards.api.d.ts.map +1 -0
- package/dist/cards/shared/cards.constants.d.ts +11 -0
- package/dist/cards/shared/cards.constants.d.ts.map +1 -0
- package/dist/cards/{cards.helper.d.ts → shared/cards.helper.d.ts} +2 -0
- package/dist/cards/shared/cards.helper.d.ts.map +1 -0
- package/dist/cards/shared/cards.serializer.d.ts +35 -0
- package/dist/cards/shared/cards.serializer.d.ts.map +1 -0
- package/dist/cards/shared/cards.shared.test.d.ts +2 -0
- package/dist/cards/shared/cards.shared.test.d.ts.map +1 -0
- package/dist/cards/{cards.types.d.ts → shared/cards.types.d.ts} +3 -8
- package/dist/cards/shared/cards.types.d.ts.map +1 -0
- package/dist/cards/{cards.validate.d.ts → shared/cards.validate.d.ts} +1 -1
- package/dist/cards/shared/cards.validate.d.ts.map +1 -0
- package/dist/common/operation-settings/operation-settings.d.ts.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/mocks/handlers.d.ts +2 -2
- package/dist/mocks/handlers.d.ts.map +1 -1
- package/dist/server/cards/{cards.d.ts → client/cards.client.d.ts} +64 -89
- package/dist/server/cards/client/cards.client.d.ts.map +1 -0
- package/dist/server/cards/client/cards.client.test.d.ts +2 -0
- package/dist/server/cards/client/cards.client.test.d.ts.map +1 -0
- package/dist/server/cards/index.d.ts +40 -10
- package/dist/server/cards/index.d.ts.map +1 -1
- package/dist/server/cards/index.server.d.ts +41 -0
- package/dist/server/cards/index.server.d.ts.map +1 -0
- package/dist/server/cards/server/cards.server.d.ts +60 -0
- package/dist/server/cards/server/cards.server.d.ts.map +1 -0
- package/dist/server/cards/server/cards.server.test.d.ts +2 -0
- package/dist/server/cards/server/cards.server.test.d.ts.map +1 -0
- package/dist/server/cards/shared/cards.api.d.ts.map +1 -0
- package/dist/server/cards/shared/cards.constants.d.ts +11 -0
- package/dist/server/cards/shared/cards.constants.d.ts.map +1 -0
- package/dist/server/cards/{cards.helper.d.ts → shared/cards.helper.d.ts} +2 -0
- package/dist/server/cards/shared/cards.helper.d.ts.map +1 -0
- package/dist/server/cards/shared/cards.serializer.d.ts +35 -0
- package/dist/server/cards/shared/cards.serializer.d.ts.map +1 -0
- package/dist/server/cards/shared/cards.shared.test.d.ts +2 -0
- package/dist/server/cards/shared/cards.shared.test.d.ts.map +1 -0
- package/dist/server/cards/{cards.types.d.ts → shared/cards.types.d.ts} +3 -8
- package/dist/{cards → server/cards/shared}/cards.types.d.ts.map +1 -1
- package/dist/server/cards/{cards.validate.d.ts → shared/cards.validate.d.ts} +1 -1
- package/dist/server/cards/shared/cards.validate.d.ts.map +1 -0
- package/dist/server/common/operation-settings/operation-settings.d.ts.map +1 -1
- package/dist/server/index.server.umd.js +1 -1
- package/dist/server/mocks/handlers.d.ts +2 -2
- package/dist/server/mocks/handlers.d.ts.map +1 -1
- package/dist/server/src/common/operation-settings/operation-settings.js +1 -1
- package/dist/{transactions/transactions.d.ts → server/transactions/client/transactions.client.d.ts} +33 -17
- package/dist/server/transactions/client/transactions.client.d.ts.map +1 -0
- package/dist/server/transactions/client/transactions.client.test.d.ts +2 -0
- package/dist/server/transactions/client/transactions.client.test.d.ts.map +1 -0
- package/dist/server/transactions/index.d.ts +14 -16
- package/dist/server/transactions/index.d.ts.map +1 -1
- package/dist/server/transactions/index.server.d.ts +45 -0
- package/dist/server/transactions/index.server.d.ts.map +1 -0
- package/dist/server/transactions/server/transactions.server.d.ts +70 -0
- package/dist/server/transactions/server/transactions.server.d.ts.map +1 -0
- package/dist/server/transactions/server/transactions.server.test.d.ts +2 -0
- package/dist/server/transactions/server/transactions.server.test.d.ts.map +1 -0
- package/dist/server/transactions/shared/transactions.api.d.ts.map +1 -0
- package/dist/server/transactions/shared/transactions.serializer.d.ts.map +1 -0
- package/dist/server/transactions/shared/transactions.shared.test.d.ts +2 -0
- package/dist/server/transactions/shared/transactions.shared.test.d.ts.map +1 -0
- package/dist/server/transactions/shared/transactions.types.d.ts.map +1 -0
- package/dist/server/transactions/shared/transactions.validation.d.ts +3 -0
- package/dist/server/transactions/shared/transactions.validation.d.ts.map +1 -0
- package/dist/server/types/types.public-api.d.ts +2 -2
- package/dist/server/types/types.public-api.d.ts.map +1 -1
- package/dist/server/ui/ui-elements/transaction-list/create-transaction-list-element.d.ts +1 -1
- package/dist/server/ui/ui-elements/transaction-list/create-transaction-list-element.d.ts.map +1 -1
- package/dist/server/ui/ui-elements/transaction-list/transaction-list.d.ts.map +1 -1
- package/dist/src/cards/client/cards.client.js +1 -0
- package/dist/src/cards/index.js +1 -1
- package/dist/src/cards/shared/cards.api.js +1 -0
- package/dist/src/cards/shared/cards.constants.js +1 -0
- package/dist/src/cards/shared/cards.helper.js +1 -0
- package/dist/src/cards/shared/cards.serializer.js +1 -0
- package/dist/src/cards/{cards.types.js → shared/cards.types.js} +1 -1
- package/dist/src/cards/shared/cards.validate.js +1 -0
- package/dist/src/common/operation-settings/operation-settings.js +1 -1
- package/dist/src/transactions/client/transactions.client.js +1 -0
- package/dist/src/transactions/index.js +1 -1
- package/dist/src/transactions/shared/transactions.api.js +1 -0
- package/dist/src/transactions/shared/transactions.validation.js +1 -0
- package/dist/src/ui/ui-elements/transaction-list/transaction-list.js +2 -2
- package/dist/{server/transactions/transactions.d.ts → transactions/client/transactions.client.d.ts} +33 -17
- package/dist/transactions/client/transactions.client.d.ts.map +1 -0
- package/dist/transactions/client/transactions.client.test.d.ts +2 -0
- package/dist/transactions/client/transactions.client.test.d.ts.map +1 -0
- package/dist/transactions/index.d.ts +14 -16
- package/dist/transactions/index.d.ts.map +1 -1
- package/dist/transactions/index.server.d.ts +45 -0
- package/dist/transactions/index.server.d.ts.map +1 -0
- package/dist/transactions/server/transactions.server.d.ts +70 -0
- package/dist/transactions/server/transactions.server.d.ts.map +1 -0
- package/dist/transactions/server/transactions.server.test.d.ts +2 -0
- package/dist/transactions/server/transactions.server.test.d.ts.map +1 -0
- package/dist/transactions/shared/transactions.api.d.ts.map +1 -0
- package/dist/transactions/shared/transactions.serializer.d.ts.map +1 -0
- package/dist/transactions/shared/transactions.shared.test.d.ts +2 -0
- package/dist/transactions/shared/transactions.shared.test.d.ts.map +1 -0
- package/dist/transactions/shared/transactions.types.d.ts.map +1 -0
- package/dist/transactions/shared/transactions.validation.d.ts +3 -0
- package/dist/transactions/shared/transactions.validation.d.ts.map +1 -0
- package/dist/types/types.public-api.d.ts +2 -2
- package/dist/types/types.public-api.d.ts.map +1 -1
- package/dist/ui/ui-elements/transaction-list/create-transaction-list-element.d.ts +1 -1
- package/dist/ui/ui-elements/transaction-list/create-transaction-list-element.d.ts.map +1 -1
- package/dist/ui/ui-elements/transaction-list/transaction-list.d.ts.map +1 -1
- package/package.json +9 -1
- package/dist/cards/cards.api.d.ts.map +0 -1
- package/dist/cards/cards.d.ts.map +0 -1
- package/dist/cards/cards.helper.d.ts.map +0 -1
- package/dist/cards/cards.public-api.d.ts +0 -10
- package/dist/cards/cards.public-api.d.ts.map +0 -1
- package/dist/cards/cards.serializer.d.ts +0 -72
- package/dist/cards/cards.serializer.d.ts.map +0 -1
- package/dist/cards/cards.test.d.ts +0 -2
- package/dist/cards/cards.test.d.ts.map +0 -1
- package/dist/cards/cards.validate.d.ts.map +0 -1
- package/dist/server/cards/cards.api.d.ts.map +0 -1
- package/dist/server/cards/cards.d.ts.map +0 -1
- package/dist/server/cards/cards.helper.d.ts.map +0 -1
- package/dist/server/cards/cards.public-api.d.ts +0 -10
- package/dist/server/cards/cards.public-api.d.ts.map +0 -1
- package/dist/server/cards/cards.serializer.d.ts +0 -72
- package/dist/server/cards/cards.serializer.d.ts.map +0 -1
- package/dist/server/cards/cards.test.d.ts +0 -2
- package/dist/server/cards/cards.test.d.ts.map +0 -1
- package/dist/server/cards/cards.types.d.ts.map +0 -1
- package/dist/server/cards/cards.validate.d.ts.map +0 -1
- package/dist/server/transactions/transactions.api.d.ts.map +0 -1
- package/dist/server/transactions/transactions.d.ts.map +0 -1
- package/dist/server/transactions/transactions.public-api.d.ts +0 -8
- package/dist/server/transactions/transactions.public-api.d.ts.map +0 -1
- package/dist/server/transactions/transactions.serializer.d.ts.map +0 -1
- package/dist/server/transactions/transactions.test.d.ts +0 -2
- package/dist/server/transactions/transactions.test.d.ts.map +0 -1
- package/dist/server/transactions/transactions.types.d.ts.map +0 -1
- package/dist/server/transactions/transactions.validation.d.ts +0 -3
- package/dist/server/transactions/transactions.validation.d.ts.map +0 -1
- package/dist/src/cards/cards.api.js +0 -1
- package/dist/src/cards/cards.helper.js +0 -1
- package/dist/src/cards/cards.js +0 -1
- package/dist/src/cards/cards.public-api.js +0 -1
- package/dist/src/cards/cards.serializer.js +0 -1
- package/dist/src/cards/cards.validate.js +0 -1
- package/dist/src/transactions/transactions.api.js +0 -1
- package/dist/src/transactions/transactions.js +0 -1
- package/dist/src/transactions/transactions.public-api.js +0 -1
- package/dist/src/transactions/transactions.validation.js +0 -1
- package/dist/transactions/transactions.api.d.ts.map +0 -1
- package/dist/transactions/transactions.d.ts.map +0 -1
- package/dist/transactions/transactions.public-api.d.ts +0 -8
- package/dist/transactions/transactions.public-api.d.ts.map +0 -1
- package/dist/transactions/transactions.serializer.d.ts.map +0 -1
- package/dist/transactions/transactions.test.d.ts +0 -2
- package/dist/transactions/transactions.test.d.ts.map +0 -1
- package/dist/transactions/transactions.types.d.ts.map +0 -1
- package/dist/transactions/transactions.validation.d.ts +0 -3
- package/dist/transactions/transactions.validation.d.ts.map +0 -1
- /package/dist/cards/{cards.api.d.ts → shared/cards.api.d.ts} +0 -0
- /package/dist/server/cards/{cards.api.d.ts → shared/cards.api.d.ts} +0 -0
- /package/dist/server/transactions/{transactions.api.d.ts → shared/transactions.api.d.ts} +0 -0
- /package/dist/server/transactions/{transactions.serializer.d.ts → shared/transactions.serializer.d.ts} +0 -0
- /package/dist/server/transactions/{transactions.types.d.ts → shared/transactions.types.d.ts} +0 -0
- /package/dist/src/transactions/{transactions.serializer.js → shared/transactions.serializer.js} +0 -0
- /package/dist/transactions/{transactions.api.d.ts → shared/transactions.api.d.ts} +0 -0
- /package/dist/transactions/{transactions.serializer.d.ts → shared/transactions.serializer.d.ts} +0 -0
- /package/dist/transactions/{transactions.types.d.ts → shared/transactions.types.d.ts} +0 -0
|
@@ -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 D=v.getInstance();class R 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||D.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 R({code:a.status,message:r.errors.map((e=>`${e.code}: ${e.detail}`))}):new R({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 $(e){return JSON.parse((n=e,P()?Buffer.from(n,"base64").toString("utf-8"):atob(n)));var n}function q(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 R({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=$(await r.text());if(!r.ok)throw new R({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 $(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||D.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||D.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||D.getDebugMode();if(void 0!==s&&"boolean"!=typeof s)throw new J("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||D.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new J("operationSettings.proxyRequestFunction must be a function.");const i=e?.proxyEndpointDescriptor||D.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}}async function ce({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,proxyEndpointDescriptor:a,stagingToken:r}=se(n||{});if(t||a){const n=oe({stagingToken:r,action:e.action,callbackUrl:e.callbackUrl});return ie((await ae({proxyFunction:t,proxyEndpointDescriptor:a,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:r,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(q),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 q(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:q(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({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"},h=3e4,m="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,this.proxyEndpointDescriptor=void 0}getSettings(){return{uiParentElementId:this.uiParentElementId,mfaPreference:this.mfaPreference,debugMode:this.debugMode,proxyRequestFunction:this.proxyRequestFunction}}}const D=v.getInstance();class R 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||D.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 R({code:a.status,message:r.errors.map((e=>`${e.code}: ${e.detail}`))}):new R({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 $(e){return JSON.parse((n=e,P()?Buffer.from(n,"base64").toString("utf-8"):atob(n)));var n}function q(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>h&&(!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))===m)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 R({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=$(await r.text());if(!r.ok)throw new R({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 $(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||D.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||D.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||D.getDebugMode();if(void 0!==s&&"boolean"!=typeof s)throw new J("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||D.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new J("operationSettings.proxyRequestFunction must be a function.");const i=e?.proxyEndpointDescriptor||D.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}}async function ce({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,proxyEndpointDescriptor:a,stagingToken:r}=se(n||{});if(t||a){const n=oe({stagingToken:r,action:e.action,callbackUrl:e.callbackUrl});return ie((await ae({proxyFunction:t,proxyEndpointDescriptor:a,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:r,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(q),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 q(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===m)return}else{if(g.vopDecision===m)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>h&&(!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:q(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({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,9 +1,9 @@
|
|
|
1
1
|
import type { Beneficiary, BeneficiaryDataObject } from '@beneficiaries/shared/beneficiaries.types';
|
|
2
|
-
import type { CardDataObject } from '@cards/cards.types';
|
|
2
|
+
import type { CardDataObject } from '@cards/shared/cards.types';
|
|
3
3
|
import type { BankAccountDataObject, OrganizationDataObject } from '@organizations/shared/organizations.types';
|
|
4
4
|
import type { BulkTransferDataObject, BulkTransferSettings, NewBulkTransfer, NewBulkTransferWithBeneficiary } from '@sepa-transfers/bulk-transfers/shared/bulk-transfers.types';
|
|
5
5
|
import type { SepaTransferDataObject } from '@sepa-transfers/shared/sepa-transfers.types';
|
|
6
|
-
import type { TransactionDataObject } from '@transactions/transactions.types';
|
|
6
|
+
import type { TransactionDataObject } from '@transactions/shared/transactions.types';
|
|
7
7
|
export declare const INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN";
|
|
8
8
|
export declare const mockedBankAccountsList: BankAccountDataObject[];
|
|
9
9
|
export declare const mockedOrganization: OrganizationDataObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,2CAA2C,CAAC;AAInD,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EAEpB,eAAe,EAEf,8BAA8B,EAC/B,MAAM,4DAA4D,CAAC;AAEpE,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAIrF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA+BzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,sBAchC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAqBrE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,sBAqBxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAoBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,iEAC2B,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,cAuD1B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,qBA2CzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA8EzD,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,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,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD,eAAO,MAAM,eAAe;;;;;CAKlB,CAAC;AAEX,eAAO,MAAM,WAAW,6BA26BvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MFA_METHODS as e}from"../constants.js";class t{constructor(){this.mfaPreference=e.PASSKEY,this.debugMode=!1}static getInstance(){return t.instance||(t.instance=new t),t.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=e.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}getSettings(){return{uiParentElementId:this.uiParentElementId,mfaPreference:this.mfaPreference,debugMode:this.debugMode,proxyRequestFunction:this.proxyRequestFunction}}}const n=t.getInstance();export{t as OperationSettingsManager,n as operationSettingsManager};
|
|
1
|
+
import{MFA_METHODS as e}from"../constants.js";class t{constructor(){this.mfaPreference=e.PASSKEY,this.debugMode=!1}static getInstance(){return t.instance||(t.instance=new t),t.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=e.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0,this.proxyEndpointDescriptor=void 0}getSettings(){return{uiParentElementId:this.uiParentElementId,mfaPreference:this.mfaPreference,debugMode:this.debugMode,proxyRequestFunction:this.proxyRequestFunction}}}const n=t.getInstance();export{t as OperationSettingsManager,n as operationSettingsManager};
|
package/dist/{transactions/transactions.d.ts → server/transactions/client/transactions.client.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { GetTransactionSettings, GetTransactionsResponse, GetTransactionsSettings, Transaction } from '
|
|
1
|
+
import { type ClientOperationSettings } from '@validation/operation-settings-validation';
|
|
2
|
+
import type { GetTransactionSettings, GetTransactionsResponse, GetTransactionsSettings, Transaction } from '../shared/transactions.types';
|
|
3
3
|
/**
|
|
4
4
|
* This is the common parameter format all the transaction functions expect
|
|
5
5
|
* as their only parameter. It consists of a `transactionSettings` object and an
|
|
@@ -7,6 +7,11 @@ import type { GetTransactionSettings, GetTransactionsResponse, GetTransactionsSe
|
|
|
7
7
|
* properties will be different depending on the function being called. Read the
|
|
8
8
|
* docs of each transaction related function to see the expected properties of
|
|
9
9
|
* the `transactionSettings` object.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This is the client-side implementation that uses the proxy endpoint mechanism.
|
|
13
|
+
* For security, never expose access tokens in the browser.
|
|
14
|
+
* Use "\@qonto/embed-sdk/transactions/server" only in server-side/backend environments.
|
|
10
15
|
*/
|
|
11
16
|
export interface TransactionParams<T> {
|
|
12
17
|
/**
|
|
@@ -15,42 +20,53 @@ export interface TransactionParams<T> {
|
|
|
15
20
|
* this object.
|
|
16
21
|
*/
|
|
17
22
|
transactionSettings?: T;
|
|
18
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Client-side operation settings. Must include `proxyEndpointDescriptor`.
|
|
25
|
+
*/
|
|
26
|
+
operationSettings?: ClientOperationSettings;
|
|
19
27
|
}
|
|
20
28
|
/**
|
|
21
29
|
* Fetches the list of transactions for the current user with optional filtering.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* This is the client-side implementation that requires `proxyEndpointDescriptor`.
|
|
33
|
+
* For security, never expose access tokens in the browser.
|
|
34
|
+
* Use "\@qonto/embed-sdk/transactions/server" only in server-side/backend environments.
|
|
35
|
+
*
|
|
22
36
|
* @param getTransactionsParams - An object containing:
|
|
23
37
|
* - `transactionSettings`: An object with optional filtering parameters such as
|
|
24
38
|
* `bankAccountId`, `iban`, `status`, `side`, `operationType`, date ranges, and
|
|
25
39
|
* attachment filters.
|
|
26
|
-
* - `operationSettings`: An object with operation-level settings
|
|
27
|
-
* `
|
|
28
|
-
* `
|
|
29
|
-
*
|
|
30
|
-
* `paginationSettings` property under `operationSettings`, which accepts an
|
|
31
|
-
* object with the page and itemsPerPage properties. See {@link TransactionParams}.
|
|
40
|
+
* - `operationSettings`: An object with operation-level settings including
|
|
41
|
+
* `proxyEndpointDescriptor` (required), and optional
|
|
42
|
+
* `paginationSettings` for managing pagination (accepts an object with `page`
|
|
43
|
+
* and `itemsPerPage` properties). See {@link TransactionParams}.
|
|
32
44
|
* @returns A promise that resolves to an array of transactions and a `meta`
|
|
33
45
|
* object containing pagination state.
|
|
34
46
|
* @throws `InvalidParametersError` If any of the values provided under
|
|
35
47
|
* operationSettings or transactionSettings is invalid.
|
|
36
|
-
* @throws `AuthenticationError` If
|
|
37
|
-
* `
|
|
48
|
+
* @throws `AuthenticationError` If
|
|
49
|
+
* `proxyEndpointDescriptor` is missing within `operationSettings`.
|
|
38
50
|
* @throws `EmbedApiError` If the API request fails or returns an error.
|
|
39
51
|
*/
|
|
40
52
|
export declare function getTransactions(getTransactionsParams?: TransactionParams<GetTransactionsSettings>): Promise<GetTransactionsResponse>;
|
|
41
53
|
/**
|
|
42
54
|
* Fetches a single transaction of the current user by ID.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* This is the client-side implementation that requires `proxyEndpointDescriptor`.
|
|
58
|
+
* For security, never expose access tokens in the browser.
|
|
59
|
+
* Use "\@qonto/embed-sdk/transactions/server" only in server-side/backend environments.
|
|
60
|
+
*
|
|
43
61
|
* @param getTransactionParams - An object containing:
|
|
44
62
|
* - `transactionSettings`: An object with the `transactionId` property (string).
|
|
45
|
-
* - `operationSettings`: An object with operation-level settings
|
|
46
|
-
* `
|
|
47
|
-
* `accessToken`, `stagingToken`, `mfaPreference`, and other optional parameters.
|
|
63
|
+
* - `operationSettings`: An object with operation-level settings including
|
|
64
|
+
* `proxyEndpointDescriptor` (required).
|
|
48
65
|
* See {@link TransactionParams}.
|
|
49
66
|
* @returns A promise that resolves to a transaction.
|
|
50
67
|
* @throws `InvalidParametersError` If the `transactionId` parameter is not a string or is missing.
|
|
51
|
-
* @throws `AuthenticationError` If
|
|
52
|
-
* `operationSettings`.
|
|
68
|
+
* @throws `AuthenticationError` If `proxyEndpointDescriptor` is missing within `operationSettings`.
|
|
53
69
|
* @throws `EmbedApiError` If the API request fails or returns an error.
|
|
54
70
|
*/
|
|
55
71
|
export declare function getTransaction({ transactionSettings, operationSettings, }: TransactionParams<GetTransactionSettings>): Promise<Transaction>;
|
|
56
|
-
//# sourceMappingURL=transactions.d.ts.map
|
|
72
|
+
//# sourceMappingURL=transactions.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.client.d.ts","sourceRoot":"","sources":["../../../../src/transactions/client/transactions.client.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,2CAA2C,CAAC;AAOnD,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EAEZ,MAAM,8BAA8B,CAAC;AAGtC;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB;;OAEG;IACH,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CACnC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC,uBAAuB,CAAC,GACjE,OAAO,CAAC,uBAAuB,CAAC,CA6BlC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAwBlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.client.test.d.ts","sourceRoot":"","sources":["../../../../src/transactions/client/transactions.client.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { getTransaction, getTransactions } from './client/transactions.client';
|
|
1
2
|
/**
|
|
2
|
-
* The transactions namespace contains all the functions related to transaction operations.
|
|
3
|
-
*
|
|
3
|
+
* The transactions namespace contains all the client-side functions related to transaction operations.
|
|
4
|
+
* This version uses proxy-based authentication (proxyEndpointDescriptor)
|
|
5
|
+
* and is designed for browser environments.
|
|
6
|
+
*
|
|
7
|
+
* For server-side operations using access tokens, import from '\@qonto/embed-sdk/server/transactions'.
|
|
4
8
|
*
|
|
5
9
|
* It can be accessed like this:
|
|
6
10
|
* ```ts
|
|
@@ -17,12 +21,9 @@
|
|
|
17
21
|
* bankAccountId: 'account_123'
|
|
18
22
|
* },
|
|
19
23
|
* operationSettings: {
|
|
20
|
-
* // For client side authentication, you
|
|
21
|
-
* //
|
|
22
|
-
* //
|
|
23
|
-
* proxyRequestFunction: async (payload: string) => {}
|
|
24
|
-
* // Or, for server side authentication, you can provide an access token directly
|
|
25
|
-
* accessToken: 'your_token'
|
|
24
|
+
* // For client side authentication, you must provide a proxy endpoint descriptor (recommended for
|
|
25
|
+
* // security reasons). Read more in the Proxy endpoint descriptor implementation documentation.
|
|
26
|
+
* // proxyEndpointDescriptor: { path: '/v2/transactions', method: 'GET' }
|
|
26
27
|
* }
|
|
27
28
|
* });
|
|
28
29
|
*
|
|
@@ -30,18 +31,15 @@
|
|
|
30
31
|
* const transaction = await transactions.getTransaction({
|
|
31
32
|
* transactionSettings: { transactionId: 'txn_123' },
|
|
32
33
|
* operationSettings: {
|
|
33
|
-
*
|
|
34
|
-
* // security reasons). Read more in <a href="https://docs.qonto.com/api-reference/sdk-libraries/doc-pages/proxy-endpoint-implementation">Proxy request implementation</a>
|
|
35
|
-
* // article.
|
|
36
|
-
* proxyRequestFunction: async (payload: string) => {}
|
|
37
|
-
* // Or, for server side authentication, you can provide an access token directly
|
|
38
|
-
* accessToken: 'your_token'
|
|
34
|
+
* proxyEndpointDescriptor: { path: '/v2/transactions/:transactionId', method: 'GET' }
|
|
39
35
|
* }
|
|
40
36
|
* });
|
|
41
37
|
* ```
|
|
42
38
|
*/
|
|
43
39
|
export declare const transactions: {
|
|
44
|
-
getTransactions: typeof
|
|
45
|
-
getTransaction: typeof
|
|
40
|
+
getTransactions: typeof getTransactions;
|
|
41
|
+
getTransaction: typeof getTransaction;
|
|
46
42
|
};
|
|
43
|
+
export type * from './shared/transactions.types';
|
|
44
|
+
export type { ClientOperationSettings, ClientOperationSettingsWithUI, } from '@validation/operation-settings-validation';
|
|
47
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transactions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAGF,mBAAmB,6BAA6B,CAAC;AACjD,YAAY,EACV,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getTransaction, getTransactions } from './server/transactions.server';
|
|
2
|
+
/**
|
|
3
|
+
* The transactions namespace contains all the server-side functions related to transaction operations.
|
|
4
|
+
* This version uses access token-based authentication and is designed for server environments.
|
|
5
|
+
*
|
|
6
|
+
* For client-side operations using proxy functions, import from '\@qonto/embed-sdk/transactions'.
|
|
7
|
+
*
|
|
8
|
+
* It can be accessed like this:
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { transactions } from '@qonto/embed-sdk/server/transactions';
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Then, the transactions object contains the functions to perform transaction operations:
|
|
14
|
+
* ```ts
|
|
15
|
+
* // Fetch all transactions with optional filtering
|
|
16
|
+
* const { transactions: txns, meta } = await transactions.getTransactions({
|
|
17
|
+
* transactionSettings: {
|
|
18
|
+
* status: 'completed',
|
|
19
|
+
* side: 'debit',
|
|
20
|
+
* bankAccountId: 'account_123'
|
|
21
|
+
* },
|
|
22
|
+
* operationSettings: {
|
|
23
|
+
* // For server side authentication, you can provide an access token directly
|
|
24
|
+
* accessToken: 'your_token',
|
|
25
|
+
* // Optional staging token for testing
|
|
26
|
+
* stagingToken: 'staging_token'
|
|
27
|
+
* }
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // Fetch a specific transaction by ID
|
|
31
|
+
* const transaction = await transactions.getTransaction({
|
|
32
|
+
* transactionSettings: { transactionId: 'txn_123' },
|
|
33
|
+
* operationSettings: {
|
|
34
|
+
* accessToken: 'your_token'
|
|
35
|
+
* }
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const transactions: {
|
|
40
|
+
getTransactions: typeof getTransactions;
|
|
41
|
+
getTransaction: typeof getTransaction;
|
|
42
|
+
};
|
|
43
|
+
export type * from './shared/transactions.types';
|
|
44
|
+
export type { ServerOperationSettings } from '@validation/operation-settings-validation';
|
|
45
|
+
//# sourceMappingURL=index.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../../src/transactions/index.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAGF,mBAAmB,6BAA6B,CAAC;AACjD,YAAY,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ServerOperationSettings } from '@validation/operation-settings-validation';
|
|
2
|
+
import type { GetTransactionSettings, GetTransactionsResponse, GetTransactionsSettings, Transaction } from '../shared/transactions.types';
|
|
3
|
+
/**
|
|
4
|
+
* This is the common parameter format all the transaction functions expect
|
|
5
|
+
* as their only parameter. It consists of a `transactionSettings` object and an
|
|
6
|
+
* optional `operationSettings` object. The `transactionSettings` object's
|
|
7
|
+
* properties will be different depending on the function being called. Read the
|
|
8
|
+
* docs of each transaction related function to see the expected properties of
|
|
9
|
+
* the `transactionSettings` object.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This is the server-side implementation that uses the access token flow.
|
|
13
|
+
* For client-side usage with proxy functions, import from '\@qonto/embed-sdk/transactions'.
|
|
14
|
+
*/
|
|
15
|
+
export interface TransactionParams<T> {
|
|
16
|
+
/**
|
|
17
|
+
* An object with the parameters relevant to different transaction operations.
|
|
18
|
+
* Read the documentation of each function to see the expected properties of
|
|
19
|
+
* this object.
|
|
20
|
+
*/
|
|
21
|
+
transactionSettings?: T;
|
|
22
|
+
/**
|
|
23
|
+
* Server-side operation settings. Can include `accessToken` and `stagingToken`.
|
|
24
|
+
* If not provided, falls back to globally configured authentication.
|
|
25
|
+
*/
|
|
26
|
+
operationSettings?: ServerOperationSettings;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Fetches the list of transactions for the current user with optional filtering.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* This is the server-side implementation that uses access tokens. For client-side
|
|
33
|
+
* usage with proxy functions, import from '\@qonto/embed-sdk/transactions'.
|
|
34
|
+
*
|
|
35
|
+
* @param getTransactionsParams - An object containing:
|
|
36
|
+
* - `transactionSettings`: An object with optional filtering parameters such as
|
|
37
|
+
* `bankAccountId`, `iban`, `status`, `side`, `operationType`, date ranges, and
|
|
38
|
+
* attachment filters.
|
|
39
|
+
* - `operationSettings`: An object with operation-level settings including optional
|
|
40
|
+
* `accessToken` and `stagingToken`. Also allows managing pagination by passing the
|
|
41
|
+
* `paginationSettings` property, which accepts an object with `page` and
|
|
42
|
+
* `itemsPerPage` properties. See {@link TransactionParams}.
|
|
43
|
+
* @returns A promise that resolves to an array of transactions and a `meta`
|
|
44
|
+
* object containing pagination state.
|
|
45
|
+
* @throws `InvalidParametersError` If any of the values provided under
|
|
46
|
+
* operationSettings or transactionSettings is invalid.
|
|
47
|
+
* @throws `AuthenticationError` If no valid access token is available (neither in
|
|
48
|
+
* `operationSettings` nor globally configured).
|
|
49
|
+
* @throws `EmbedApiError` If the API request fails or returns an error.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getTransactions(getTransactionsParams?: TransactionParams<GetTransactionsSettings>): Promise<GetTransactionsResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Fetches a single transaction of the current user by ID.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* This is the server-side implementation that uses access tokens. For client-side
|
|
57
|
+
* usage with proxy functions, import from '\@qonto/embed-sdk/transactions'.
|
|
58
|
+
*
|
|
59
|
+
* @param getTransactionParams - An object containing:
|
|
60
|
+
* - `transactionSettings`: An object with the `transactionId` property (string).
|
|
61
|
+
* - `operationSettings`: An object with operation-level settings including optional
|
|
62
|
+
* `accessToken` and `stagingToken`. See {@link TransactionParams}.
|
|
63
|
+
* @returns A promise that resolves to a transaction.
|
|
64
|
+
* @throws `InvalidParametersError` If the `transactionId` parameter is not a string or is missing.
|
|
65
|
+
* @throws `AuthenticationError` If no valid access token is available (neither in
|
|
66
|
+
* `operationSettings` nor globally configured).
|
|
67
|
+
* @throws `EmbedApiError` If the API request fails or returns an error.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getTransaction({ transactionSettings, operationSettings, }: TransactionParams<GetTransactionSettings>): Promise<Transaction>;
|
|
70
|
+
//# sourceMappingURL=transactions.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.server.d.ts","sourceRoot":"","sources":["../../../../src/transactions/server/transactions.server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAOzF,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAGtC;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,eAAe,CACnC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC,uBAAuB,CAAC,GACjE,OAAO,CAAC,uBAAuB,CAAC,CAqBlC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAalE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.server.test.d.ts","sourceRoot":"","sources":["../../../../src/transactions/server/transactions.server.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.api.d.ts","sourceRoot":"","sources":["../../../../src/transactions/shared/transactions.api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,UAAU,qBAAsB,SAAQ,uBAAuB;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,oBAAqB,SAAQ,sBAAsB;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,0BAA0B;IAClC,YAAY,EAAE,qBAAqB,EAAE,CAAC;IACtC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,KAAK,yBAAyB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;AAI3E,wBAAgB,0BAA0B,CAAC,EACzC,aAAa,EACb,IAAI,EACJ,MAAM,EACN,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,IAAI,EACJ,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,YAAY,GACb,EAAE,yBAAyB,GAAG,qBAAqB,CAqCnD;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,0BAA0B,CAAC,CAYrC;AAED,wBAAgB,yBAAyB,CAAC,EACxC,aAAa,EACb,WAAW,EACX,YAAY,GACb,EAAE,oBAAoB,GAAG,qBAAqB,CAW9C;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,qBAAqB,CAAC,CAQhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.serializer.d.ts","sourceRoot":"","sources":["../../../../src/transactions/shared/transactions.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,qBAAqB,GACrC,WAAW,CAkDb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.shared.test.d.ts","sourceRoot":"","sources":["../../../../src/transactions/shared/transactions.shared.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.types.d.ts","sourceRoot":"","sources":["../../../../src/transactions/shared/transactions.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,oBAAoB,EAAE;QACpB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,2BAA2B,EAAE,MAAM,CAAC;QACpC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,gBAAgB,EAAE,MAAM,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,iBAAiB,CAAC;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,gBAAgB,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF;;OAEG;IACH,mBAAmB,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,yBAAyB,EAAE,MAAM,CAAC;QAClC,gBAAgB,EAAE,MAAM,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,8CAA8C;IAC9C,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,2FAA2F;IAC3F,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,wDAAwD;IACxD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.validation.d.ts","sourceRoot":"","sources":["../../../../src/transactions/shared/transactions.validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAGnE,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,sBAAsB,GAAG,SAAS,GACzC,sBAAsB,CAiBxB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { AuthLinkRequestParams, AuthLinkRequestResult, AuthLinkRequestSettings, PostAuthAction } from '@auth-links/shared/auth-links.types';
|
|
2
2
|
import type { Beneficiary, GetBeneficiariesResponse } from '@beneficiaries/shared/beneficiaries.types';
|
|
3
|
-
import type { Card, CardOrderSettings, PhysicalCardOrderSettings, VirtualCardOrderSettings } from '@cards/cards.types';
|
|
3
|
+
import type { Card, CardOrderSettings, PhysicalCardOrderSettings, VirtualCardOrderSettings } from '@cards/shared/cards.types';
|
|
4
4
|
import type { PaginationState } from '@common/api-pagination/api-pagination.types';
|
|
5
5
|
import type { Locale } from '@common/locale/locale.types';
|
|
6
6
|
import type { ACCOUNT_STATUS, BankAccount } from '@organizations/shared/organizations.types';
|
|
7
7
|
import type { CreatePaymentLinkSettings, Item, PaymentLinkParams } from '@payment-links/payment-links.types';
|
|
8
8
|
import type { CreateSepaTransferResponse, GetSepaTransfersResponse, NewSepaTransfer, SepaTransfer, SepaTransferStatus, VopCheckResult, VopVerificationResult } from '@sepa-transfers/shared/sepa-transfers.types';
|
|
9
|
-
import type { GetTransactionSettings, GetTransactionsResponse, GetTransactionsSettings, Transaction, TransactionDataObject } from '@transactions/transactions.types';
|
|
9
|
+
import type { GetTransactionSettings, GetTransactionsResponse, GetTransactionsSettings, Transaction, TransactionDataObject } from '@transactions/shared/transactions.types';
|
|
10
10
|
export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, SepaTransferStatus, NewSepaTransfer, GetSepaTransfersResponse, CreateSepaTransferResponse, Transaction, TransactionDataObject, GetTransactionsResponse, GetTransactionsSettings, GetTransactionSettings, VopVerificationResult, VopCheckResult, PaginationState, Locale, BankAccount, ACCOUNT_STATUS, Item, CreatePaymentLinkSettings, PaymentLinkParams, AuthLinkRequestParams, AuthLinkRequestResult, AuthLinkRequestSettings, PostAuthAction, };
|
|
11
11
|
//# sourceMappingURL=types.public-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.public-api.d.ts","sourceRoot":"","sources":["../../../src/types/types.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACf,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACzB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EACV,IAAI,EACJ,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,
|
|
1
|
+
{"version":3,"file":"types.public-api.d.ts","sourceRoot":"","sources":["../../../src/types/types.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACf,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACzB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EACV,IAAI,EACJ,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACZ,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EACV,yBAAyB,EACzB,IAAI,EACJ,iBAAiB,EAClB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,KAAK,EACV,0BAA0B,EAC1B,wBAAwB,EACxB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACtB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EACX,qBAAqB,EACtB,MAAM,yCAAyC,CAAC;AAEjD,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,0BAA0B,EAC1B,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,MAAM,EACN,WAAW,EACX,cAAc,EACd,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,GACf,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './transaction-list';
|
|
2
|
-
import type { GetTransactionsSettings } from '@transactions/transactions.types';
|
|
2
|
+
import type { GetTransactionsSettings } from '@transactions/shared/transactions.types';
|
|
3
3
|
import type { UIElementCreatorParams } from '@ui/ui-elements.types';
|
|
4
4
|
/**
|
|
5
5
|
* Creates and renders a transaction list UI element.
|
package/dist/server/ui/ui-elements/transaction-list/create-transaction-list-element.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-transaction-list-element.d.ts","sourceRoot":"","sources":["../../../../../src/ui/ui-elements/transaction-list/create-transaction-list-element.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"create-transaction-list-element.d.ts","sourceRoot":"","sources":["../../../../../src/ui/ui-elements/transaction-list/create-transaction-list-element.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAIpE;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,GAClB,EAAE,sBAAsB,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAyBxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-list.d.ts","sourceRoot":"","sources":["../../../../../src/ui/ui-elements/transaction-list/transaction-list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction-list.d.ts","sourceRoot":"","sources":["../../../../../src/ui/ui-elements/transaction-list/transaction-list.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAKvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAMnF,OAAO,iDAAiD,CAAC;AACzD,OAAO,sDAAsD,CAAC;AAC9D,OAAO,uDAAuD,CAAC;AAE/D,qBAEa,eAAgB,SAAQ,UAAU;IAC7C,MAAM,CAAC,MAAM,0BAAe;IAG5B,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAGjD,mBAAmB,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAGzD,OAAO,CAAC,YAAY,CAA4B;IAGhD,OAAO,CAAC,eAAe,CAA8B;IAGrD,OAAO,CAAC,SAAS,CAAkB;IAGnC,OAAO,CAAC,KAAK,CAAqB;IAElC,iBAAiB;IAMjB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;YAMjC,iBAAiB;IAkC/B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,cAAc;IAOtB,MAAM;CAsEP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{VIRTUAL_CARD_LEVEL as e}from"../shared/cards.constants.js";import{tracker as r}from"../../common/analytics/analytics-tracker.js";import{authManager as t}from"../../common/auth/auth.js";import{validatePresenceOfAuthToken as n}from"../../common/auth/auth.validate.js";import{callProxyFunction as o}from"../../common/common.utils.js";import{validateClientOperationSettings as i}from"../../validation/operation-settings-validation.js";import{InvalidParametersError as s}from"../../errors/InvalidParametersError.js";import{buildIframeUrl as a,createIframe as d}from"../../iframe/iframe-manager.js";import{prepareGetCardIframeUrl as c,prepareGetCardCall as p,prepareGetCardsCall as m}from"../shared/cards.api.js";import{createEmbedUI as g}from"../shared/cards.helper.js";import{serializeUnlockCardPayload as u,serializeCard as l,serializeOrderCardPayload as y}from"../shared/cards.serializer.js";import{validateDisplayCardParams as f,validateUnlockCardParams as h,validateOrderCardParams as k,validateGetCardParams as w}from"../shared/cards.validate.js";async function b(e){r.cardsList();const t=e?.cardSettings?.membershipId;if(t&&"string"!=typeof t)throw new s("membershipId must be a string");const{proxyRequestFunction:n,proxyEndpointDescriptor:a,stagingToken:d}=i(e?.operationSettings,'Client-side card operations require either proxyEndpointDescriptor or proxyRequestFunction. For security, never expose access tokens in the browser. Use "@qonto/embed-sdk/sepa-transfers/server" only in server-side/backend environments.'),c=m({membershipId:t,stagingToken:d});return(await o({proxyFunction:n,proxyEndpointDescriptor:a,networkCallDescriptor:c})).body.cards.map((e=>l(e)))}async function I({cardSettings:e,operationSettings:r}){w(e);const t=e.cardId,{proxyRequestFunction:n,proxyEndpointDescriptor:a,stagingToken:d}=i(r,'Client-side card operations require either proxyRequestFunction or proxyEndpointDescriptor. For security, never expose access tokens in the browser. Use "@qonto/embed-sdk/sepa-transfers/server" only in server-side/backend environments.'),c=p({cardId:t,stagingToken:d}),m=(await o({proxyFunction:n,proxyEndpointDescriptor:a,networkCallDescriptor:c})).body.cards;if(Array.isArray(m)&&m.length>0)return l(m[0]);throw new s("Unable to retrieve card data")}async function x(o){const i=n(),{uiParentElementId:c,debugMode:p}=o.operationSettings;if(!c)throw new s("uiParentElementId is required");k(o.cardSettings);const m=o.cardSettings.cardLevel===e.VIRTUAL,g=a({accessToken:i,stagingToken:t.getStagingToken()||void 0,debugMode:p}),u=await d({iframeUrl:g,parentElementId:c}),f=y(o.cardSettings),h=await u.postMessage(f);return u.destroy(),m?r.cardsOrderVirtual():r.cardsOrderPhysical(),l(h)}async function E(e){const r=n(),{uiParentElementId:o,debugMode:i}=e.operationSettings;if(!o)throw new s("uiParentElementId is required");h(e.cardSettings);const c=a({accessToken:r,stagingToken:t.getStagingToken()||void 0,debugMode:i}),p=await d({iframeUrl:c,parentElementId:o}),m=u(e),g=await p.postMessage(m);return p.destroy(),l(g)}async function S(e){const{uiParentElementId:r,accessToken:t,stagingToken:i,debugMode:a,mfaPreference:d,proxyRequestFunction:p,proxyEndpointDescriptor:m}=e.operationSettings;if(!r)throw new s("uiParentElementId is required");if(f(e.cardSettings),p||m){const t=c({stagingToken:i}),n=(await o({proxyFunction:p,proxyEndpointDescriptor:m,networkCallDescriptor:t})).body.embed_auth_link;return g({decorationParams:e.cardSettings,operationSettings:{uiParentElementId:r,debugMode:a},cardIframeUrl:n.url})}{const o=t||n(),{getCardIframeURL:s}=await import("../shared/cards.api.js"),d=await s({...e.cardSettings,accessToken:o,stagingToken:i});return g({decorationParams:e.cardSettings,operationSettings:{uiParentElementId:r,debugMode:a},cardIframeUrl:d.url})}}export{S as displayCard,I as getCard,b as getCards,x as orderCard,E as unlockCard};
|
package/dist/src/cards/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{displayCard as r,unlockCard as d,orderCard as a,getCard as t,getCards as e}from"./client/cards.client.js";const o={getCards:e,getCard:t,orderCard:a,unlockCard:d,displayCard:r};export{o as cards};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{prepareAuthLinkRequest as n}from"../../auth-links/shared/auth-links.api.js";import{AUTH_LINK_ACTIONS as o}from"../../common/constants.js";import{makeNetworkCall as s}from"../../common/network/network.js";function e({membershipId:n,accessToken:o,stagingToken:s}){return{path:n?`/v2/cards?holder_ids[]=${n}`:"/v2/cards",options:{method:"GET",headers:{accessToken:o,stagingToken:s}}}}function t({cardId:n,accessToken:o,stagingToken:s}){return{path:`/v2/cards?ids[]=${n}`,options:{method:"GET",headers:{accessToken:o,stagingToken:s}}}}function a({accessToken:s,stagingToken:e}){return n({accessToken:s,stagingToken:e,action:o.CARD_DISPLAY})}async function c(n){const o=a(n),{embed_auth_link:e}=await s(o);return e}export{c as getCardIframeURL,t as prepareGetCardCall,a as prepareGetCardIframeUrl,e as prepareGetCardsCall};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={VIRTUAL:"virtual"},a={METAL:"metal",PLUS:"plus",STANDARD:"standard"};export{a as PHYSICAL_CARD_LEVEL,t as VIRTUAL_CARD_LEVEL};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{VIRTUAL_CARD_LEVEL as a}from"./cards.constants.js";import{gatherQontoEmbedCssVariables as e}from"../../customization/customization.js";import{CUSTOM_PROP_PREFIX as o}from"../../customization/customization.constants.js";import{createIframe as t}from"../../iframe/iframe-manager.js";function r(a,t){const r=new URL(a);r.searchParams.set("cardId",t.cardId),"boolean"==typeof t.allowPinReveal&&r.searchParams.set("canSeePin",t.allowPinReveal.toString()),"boolean"==typeof t.allowBlocking&&r.searchParams.set("canBlock",t.allowBlocking.toString()),!0===t.debugMode&&r.searchParams.set("debug",t.debugMode.toString());const n=e(o);return Object.keys(n).length>0&&r.searchParams.set("customization",JSON.stringify(n)),r.toString()}async function n({decorationParams:a,operationSettings:e,cardIframeUrl:o}){const{cardId:n,allowPinReveal:i,allowBlocking:s}=a,{uiParentElementId:c,debugMode:l}=e,m=r(o,{cardId:n,allowPinReveal:i,allowBlocking:s,debugMode:l}),d=await t({iframeUrl:m,parentElementId:c});return{destroyEmbedUI:()=>{d.destroy()}}}function i(e){return e.cardLevel===a.VIRTUAL}export{n as createEmbedUI,r as getPopulatedIframeURL,i as isVirtualCardOrderSettings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isVirtualCardOrderSettings as t}from"./cards.helper.js";import{ACTIONS as i}from"../../common/constants.js";import{CardCategories as a}from"./cards.types.js";import n from"../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js";function e(a){return t(a)?function(t){const a=s(t.categories);return{actionId:i.CARD_ORDER,actionData:{idempotencyKey:n(),body:{card:{payment_monthly_limit:t.monthlyLimit,payment_daily_limit:t.dailyLimit,payment_daily_limit_option:t.hasDailyLimit,payment_transaction_limit:t.transactionLimit,payment_transaction_limit_option:t.hasTransactionLimit,active_days:t.activeDays||[],holder_id:t.membershipId,organization_id:t.organizationId,bank_account_id:t.bankAccountId,categories:a,card_level:t.cardLevel}}}}}(a):function(t){const a=s(t.categories);return{actionId:i.CARD_ORDER,actionData:{idempotencyKey:n(),body:{card:{payment_monthly_limit:t.monthlyLimit,payment_daily_limit:t.dailyLimit,payment_daily_limit_option:t.hasDailyLimit,payment_transaction_limit:t.transactionLimit,payment_transaction_limit_option:t.hasTransactionLimit,active_days:t.activeDays||[],holder_id:t.membershipId,organization_id:t.organizationId,bank_account_id:t.bankAccountId,categories:a,card_level:t.cardLevel,card_design:t.cardDesign,..."plus"===t.cardLevel&&{type_of_print:t.typeOfPrint},ship_to_business_address:t.shipToBusiness,atm_option:t.hasAtmOption,nfc_option:t.hasNfcOption,foreign_option:t.hasForeignPaymentOption,online_option:t.hasOnlinePaymentOption,atm_daily_limit:t.atmDailyLimit,atm_monthly_limit:t.atmMonthlyLimit,...!t.shipToBusiness&&{address:{contact_name:t.address?.contactName,first_line:t.address?.firstLine,second_line:t.address?.secondLine,third_line:t.address?.thirdLine,zipcode:t.address?.zipCode,city:t.address?.city,country:t.address?.country}}}}}}}(a)}function o(t){return{id:t.id,nickname:t.nickname,embossedName:t.embossed_name,status:t.status,maskPan:t.mask_pan,expMonth:parseInt(t.exp_month,10),expYear:parseInt(t.exp_year,10),lastActivityAt:new Date(t.last_activity_at),lastDigits:t.last_digits,shipToBusiness:t.ship_to_business,atmOption:t.atm_option,atmDailyLimitOption:t.atm_daily_limit_option,nfcOption:t.nfc_option,onlineOption:t.online_option,foreignOption:t.foreign_option,atmMonthlyLimit:t.atm_monthly_limit,atmMonthlySpent:t.atm_monthly_spent,atmDailyLimit:t.atm_daily_limit,atmDailySpent:t.atm_daily_spent,paymentMonthlyLimit:t.payment_monthly_limit,paymentMonthlySpent:t.payment_monthly_spent,paymentDailyLimit:t.payment_daily_limit,paymentDailySpent:t.payment_daily_spent,paymentDailyLimitOption:t.payment_daily_limit_option,paymentTransactionLimit:t.payment_transaction_limit,paymentTransactionLimitOption:t.payment_transaction_limit_option,activeDays:t.active_days,holderId:t.holder_id,bankAccountId:t.bank_account_id,organizationId:t.organization_id,updatedAt:new Date(t.updated_at),createdAt:new Date(t.created_at),shippedAt:new Date(t.shipped_at),cardType:t.card_type,cardLevel:t.card_level,paymentLifespanLimit:t.payment_lifespan_limit,paymentLifespanSpent:t.payment_lifespan_spent,preExpiresAt:new Date(t.pre_expires_at),categories:t.categories,renewed:t.renewed,renewal:t.renewal,...t.parent_card_summary&&{parentCardSummary:{id:t.parent_card_summary.id,lastDigits:t.parent_card_summary.last_digits}},hadOperation:t.had_operation,hadPinOperation:t.had_pin_operation,cardDesign:t.card_design,typeOfPrint:t.type_of_print,upsold:t.upsold,upsell:t.upsell,discardOn:new Date(t.discard_on),reordered:t.reordered}}function s(t){const i=Object.values(a);return(t||[]).filter((t=>i.includes(t)))}function d(t){return{actionId:i.CARD_UNLOCK,actionData:{body:{cardId:t.cardSettings.cardId}}}}export{s as filterValidCategories,o as serializeCard,e as serializeOrderCardPayload,d as serializeUnlockCardPayload};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e;!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"}(e||(e={}));const
|
|
1
|
+
var e;!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"}(e||(e={}));const _={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};export{_ as CardCategories,e as CardStatus};
|