@qonto/embed-sdk 0.42.0 → 0.44.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/errors/EmbedUIElementError.d.ts +11 -0
- package/dist/errors/EmbedUIElementError.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.umd.js +42 -10
- package/dist/organizations/organizations.types.d.ts +3 -1
- package/dist/organizations/organizations.types.d.ts.map +1 -1
- package/dist/src/errors/EmbedUIElementError.js +1 -0
- package/dist/src/index.js +1 -1
- package/dist/src/organizations/organizations.api.js +1 -1
- package/dist/src/organizations/organizations.js +1 -1
- package/dist/src/ui/customizable-components/skeleton-loader/qonto-skeleton-loader-line.js +8 -0
- package/dist/src/ui/customizable-components/skeleton-loader/qonto-skeleton-loader-line.styles.js +26 -0
- package/dist/src/ui/customizable-components/transfer-list/transfer-list.js +6 -6
- package/dist/src/ui/customizable-components/transfer-list/transfer-list.utils.js +1 -1
- package/dist/src/ui/index.js +1 -1
- package/dist/src/ui/ui-elements.js +1 -0
- package/dist/src/ui/ui-elements.public-api.js +1 -0
- package/dist/ui/customizable-components/transfer-list/transfer-list.d.ts.map +1 -1
- package/dist/ui/customizable-components/transfer-list/transfer-list.utils.d.ts +2 -1
- package/dist/ui/customizable-components/transfer-list/transfer-list.utils.d.ts.map +1 -1
- package/dist/ui/index.d.ts +15 -3
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/ui-elements.d.ts +19 -0
- package/dist/ui/ui-elements.d.ts.map +1 -0
- package/dist/ui/ui-elements.public-api.d.ts +4 -0
- package/dist/ui/ui-elements.public-api.d.ts.map +1 -0
- package/dist/ui/ui-elements.types.d.ts +39 -2
- package/dist/ui/ui-elements.types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { QontoEmbedSdkError } from './QontoEmbedSdkError';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when a UI element operation fails
|
|
4
|
+
*/
|
|
5
|
+
export declare class EmbedUIElementError extends QontoEmbedSdkError {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new EmbedUIElementError
|
|
8
|
+
*/
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=EmbedUIElementError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbedUIElementError.d.ts","sourceRoot":"","sources":["../../src/errors/EmbedUIElementError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,kBAAkB;IACzD;;OAEG;gBACS,OAAO,EAAE,MAAM;CAK5B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { paymentLinks } from '@payment-links';
|
|
|
6
6
|
import { organizations } from '@organizations';
|
|
7
7
|
import { transactions } from '@transactions';
|
|
8
8
|
import { authLinks } from '@auth-links';
|
|
9
|
+
import { ui } from '@ui';
|
|
9
10
|
import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, Transaction, Item, CreatePaymentLinkSettings, PaymentLinkParams, AuthLinkRequestParams, AuthLinkRequestResult, AuthLinkRequestSettings, PostAuthAction } from '@types';
|
|
10
|
-
|
|
11
|
-
export { initialize, logout, cards, sepaTransfers, beneficiaries, constants, paymentLinks, organizations, transactions, authLinks, createUIElement, };
|
|
11
|
+
export { initialize, logout, cards, sepaTransfers, beneficiaries, constants, paymentLinks, organizations, transactions, authLinks, ui, };
|
|
12
12
|
export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, Transaction, Item, CreatePaymentLinkSettings, PaymentLinkParams, AuthLinkRequestParams, AuthLinkRequestResult, AuthLinkRequestSettings, PostAuthAction, };
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACf,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,EAAE,EAAE,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACf,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,UAAU,EACV,MAAM,EACN,KAAK,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,SAAS,EACT,EAAE,GACH,CAAC;AACF,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,GACf,CAAC"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const n=t.getInstance();class a extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class r extends a{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function o(){if(!n.hasAccessToken())throw new r;return n.getAccessToken()}class i extends a{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}const s={READY:"qonto.ready"},c={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},l={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},u={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},g={PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled",FAILED:"failed",COMPLETED:"completed"},f={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},p=3e4,m={ACCEPT:"ACCEPT",REJECT:"REJECT"},h={CARD_DISPLAY:"display_card",PAYMENT_LINK_CREATE:"create_payment_link",SEPA_TRANSFER_CREATE:"create_sepa_transfer"};var b=Object.freeze({__proto__:null,ACTIONS:c,ACTIVITY_TAGS:{ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},AMOUNT_REQUIRING_ATTACHMENTS:p,AUTH_LINK_ACTIONS:h,BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:l,ENVIRONMENTS:d,IFRAME_EVENTS:s,LOCALES:u,MFA_METHODS:f,TRANSACTION_STATUSES:{PENDING:"pending",DECLINED:"declined",COMPLETED:"completed"},TRANSFER_DECLINE_REASONS:{BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},TRANSFER_STATUSES:g,VOP_CHECK_RESULTS:{MATCH_RESULT_MATCH:"MATCH_RESULT_MATCH",MATCH_RESULT_NO_MATCH:"MATCH_RESULT_NO_MATCH",MATCH_RESULT_CLOSE_MATCH:"MATCH_RESULT_CLOSE_MATCH",MATCH_RESULT_NOT_POSSIBLE:"MATCH_RESULT_NOT_POSSIBLE",MATCH_RESULT_UNSPECIFIED:"MATCH_RESULT_UNSPECIFIED"},VOP_DECISIONS:m});class y{constructor(){this.mfaPreference=f.PASSKEY,this.debugMode=!1}static getInstance(){return y.instance||(y.instance=new y),y.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=f.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}}const v=y.getInstance(),_="https://embed.qonto.com",w="https://embed-js{branch}.staging.qonto.co",T="https://embed.dev.qonto.co",k={[d.PRODUCTION]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:w,IFRAME_URL:`${w}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:T,IFRAME_URL:`${T}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class E{constructor(){this.environment=d.PRODUCTION,this.branch=l.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(d).includes(e)?e:d.PRODUCTION,this.branch=Object.values(l).includes(t)?t:l.SANDBOX}static getInstance(){return E.instance||(E.instance=new E),E.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===d.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=d.PRODUCTION,this.branch=l.MASTER}getEnvironmentUrls(){if(this.environment===d.PRODUCTION)return k.production;{const e=k[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const A=E.getInstance(),S={requiresUI:!1};function I(e,{requiresUI:t}=S){const n=e?.uiParentElementId||v.getUIParentElementId();if(t&&!n)throw new i("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");const a=e?.mfaPreference||v.getMFAPreference();if(a){const e=(r=Object.values(f),A.isProductionEnvironment()?r.filter((e=>e!==f.MOCK)):r);if(!e.includes(a))throw new i(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(A.isProductionEnvironment()&&a===f.MOCK)throw new i("operationSettings.mfaPreference cannot be set to mock in production environment.")}var r;const o=e?.debugMode||v.getDebugMode();if(void 0!==o&&"boolean"!=typeof o)throw new i("operationSettings.debugMode must be a boolean.");const s=e?.proxyRequestFunction||v.getProxyRequestFunction();if(s&&"function"!=typeof s)throw new i("operationSettings.proxyRequestFunction must be a function.");return{...e,uiParentElementId:n,mfaPreference:a,debugMode:o,proxyRequestFunction:s}}const $=Object.values(u);function R(e){if(!function(e){return $.includes(e)}(e))throw new i(`Unsupported locale: ${e}. The locale must be one of: ${$.join(", ")}.`);return e}function P(e){if(!e?.accessToken&&!e?.operationSettings?.proxyRequestFunction)throw new i("Either operationSettings.proxyRequestFunction or access token is required when calling initialize()");return e?.operationSettings&&I(e.operationSettings),function(e){if(e.environment){if(!["production","staging","local"].includes(e.environment))throw new i('If provided, environment must be either "production" or "staging"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.environment.PRODUCTION" or "constants.environment.STAGING"');if(e.branch&&!["master","sandbox","qa"].includes(e.branch))throw new i('If provided, branch must be either "master", "sandbox" or "qa"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.branch.MASTER" or "constants.environment.SANDBOX" and so on')}}(e),e.locale&&R(e.locale),e}class C{constructor(){this.currentLocale="en"}static getInstance(){return C.instance||(C.instance=new C),C.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const L=C.getInstance();const N={initialize:function(e){const{accessToken:t,stagingToken:a,operationSettings:r,environment:o,branch:i,locale:s}=P(e);t&&n.setAccessToken(t),a&&n.setStagingToken(a),s&&L.setLocale(s),r&&v.setSettings(r),o&&(A.setEnvironment(o),i&&A.setBranch(i))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),L.setDefaultLocale(),v.clearSettings()},constants:b},{initialize:q,logout:O,constants:D}=N;class U extends a{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function x(){return"undefined"!=typeof window&&"undefined"!=typeof document}function M(){return!x()}function z({accessToken:e,stagingToken:t,idempotencyKey:a,mfaPreference:r}){const o=new Headers;o.append("Authorization",`Bearer ${e}`);const i=t||n.getStagingToken();i&&o.append("X-Qonto-Staging-Token",i),a&&o.append("X-Qonto-Idempotency-Key",a);const s=r||v.getMFAPreference();return s&&o.append("X-Qonto-2fa-Preference",s),o.append("Content-Type","application/json"),o.append("Accept-Language",L.getLocale()),o}async function j({path:e,options:t}){const n=`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(n,{...t,headers:z(t.headers),body:t.body?JSON.stringify(t.body):void 0});if(204===a.status)return;const r=await a.json();if(!a.ok)throw r.errors?new U(r.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${r.code}: ${r.detail}`);return r}function F(e){const t={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},n=JSON.stringify(t);return a=n,M()?Buffer.from(a).toString("base64"):btoa(a);var a}function B(e){return JSON.parse((t=e,M()?Buffer.from(t,"base64").toString("utf-8"):atob(t)));var t}function H({accessToken:e,stagingToken:t,action:n,callbackUrl:a}){const r={post_authn_action:n};return a&&(r.callback_url=a),{path:"/v1/embed_auth_links",options:{method:"POST",headers:{accessToken:e,stagingToken:t},body:{embed_auth_link:r}}}}function G({membershipId:e,accessToken:t,stagingToken:n}){return{path:e?`/v2/cards?holder_ids[]=${e}`:"/v2/cards",options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function K({cardId:e,accessToken:t,stagingToken:n}){return{path:`/v2/cards?ids[]=${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function Y({accessToken:e,stagingToken:t}){return H({accessToken:e,stagingToken:t,action:h.CARD_DISPLAY})}var V;!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"}(V||(V={}));const W={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var Z,J;function Q(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:void 0===e[t.name])).map((e=>e.name));if(n.length>0)throw new i(n.map((e=>`Missing required parameter: ${e}`)))}function X(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function ee(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function te(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}(Z||(Z={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(J||(J={}));const ne=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],ae=[...ne,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function re(e){if(!e)throw new i("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return Q(e,ne),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:r,hasTransactionLimit:o,monthlyLimit:s,dailyLimit:c,transactionLimit:d,activeDays:l,categories:u,cardLevel:g}=e,f=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(g),p=X({membershipId:t,organizationId:n,bankAccountId:a}),m=ee({hasDailyLimit:r,hasTransactionLimit:o}),h=te({monthlyLimit:s,dailyLimit:c,transactionLimit:d}),b=oe(l),y=ie(u),v=[...f,...p,...m,...h,...b,...y];if(v.length>0)throw new i(v)}(e),e}(e):function(e){Q(e,ae),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:r,hasTransactionLimit:o,monthlyLimit:s,dailyLimit:c,transactionLimit:d,activeDays:l,categories:u,cardLevel:g,hasNfcOption:f,hasForeignPaymentOption:p,hasOnlinePaymentOption:m,shipToBusiness:h,hasAtmOption:b,hasAtmDailyLimit:y,atmDailyLimit:v,atmMonthlyLimit:_,address:w,cardDesign:T,typeOfPrint:k}=e,E=function(e){return Object.values(J).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(g),A=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(k),S=X({membershipId:t,organizationId:n,bankAccountId:a}),I=ee({hasDailyLimit:r,hasTransactionLimit:o,hasAtmOption:b,hasNfcOption:f,hasForeignPaymentOption:p,hasOnlinePaymentOption:m,hasAtmDailyLimit:y,shipToBusiness:h}),$=te({monthlyLimit:s,dailyLimit:c,transactionLimit:d,atmDailyLimit:v,atmMonthlyLimit:_}),R=oe(l),P=ie(u),C=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(T),L=function(e,t){if(t)return[];return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(w,h),N=[...E,...S,...I,...$,...R,...P,...A,...C,...L];if(N.length>0)throw new i(N)}(e)}(e)}function oe(e){const t=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function ie(e){const t=!Array.isArray(e)||e.some((e=>"string"!=typeof e));return void 0!==e&&t?["categories must be an array of strings"]:[]}class se extends a{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const ce=[];for(let e=0;e<256;++e)ce.push((e+256).toString(16).slice(1));let de;const le=new Uint8Array(16);var ue={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ge(e,t,n){if(ue.randomUUID&&!e)return ue.randomUUID();const a=(e=e||{}).random??e.rng?.()??function(){if(!de){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");de=crypto.getRandomValues.bind(crypto)}return de(le)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=15&a[6]|64,a[8]=63&a[8]|128,function(e,t=0){return(ce[e[t+0]]+ce[e[t+1]]+ce[e[t+2]]+ce[e[t+3]]+"-"+ce[e[t+4]]+ce[e[t+5]]+"-"+ce[e[t+6]]+ce[e[t+7]]+"-"+ce[e[t+8]]+ce[e[t+9]]+"-"+ce[e[t+10]]+ce[e[t+11]]+ce[e[t+12]]+ce[e[t+13]]+ce[e[t+14]]+ce[e[t+15]]).toLowerCase()}(a)}function fe({actionId:e,actionData:t}){const n=v.getMFAPreference();return{actionId:e,actionData:{...t,scaPreference:t.scaPreference||n,idempotencyKey:t.idempotencyKey||ge()}}}class pe{constructor(e){this.options=e,this.iframe=null,this.parentElement=null,this.messageListeners=new Map,this.defaultTimeout=3e4;const t=new URL(e.iframeUrl);this.targetOrigin=`${t.protocol}//${t.host}`}async initialize(){if(this.iframe)return this;if(this.parentElement=document.getElementById(this.options.parentElementId),!this.parentElement)throw new se(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,a=setTimeout((()=>{window.removeEventListener("message",r),t(new se(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),r=t=>{t.data.eventId===s.READY&&(clearTimeout(a),window.removeEventListener("message",r),e(this))};window.addEventListener("message",r),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){if(!this.iframe||!this.iframe.contentWindow)return Promise.reject(new se("Attempted to perform an Embed operation without having the authentication UI initialized."));const t=fe(e);return new Promise(((e,n)=>{const a=r=>{if(r.data?.actionId===t.actionId){if("error"===r.data.status)return this.removeMessageListener(t.actionId,a),n(new se(`An error occurred when performing the action ${t.actionId}.\n${JSON.stringify(r.data.payload)}`));this.removeMessageListener(t.actionId,a),e(r.data.payload)}};this.addMessageListener(t.actionId,a),this.iframe?.contentWindow?.postMessage(t,this.targetOrigin)}))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function me({accessToken:e,stagingToken:t,locale:n,debugMode:a}){const r=a||!1,o=n||L.getLocale(),i=A.getEnvironmentUrls().IFRAME_URL,s=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${i}?debug=${r}&lang=${encodeURIComponent(o)}#access_token=${encodeURIComponent(e)}${s}`}function he({parentElementId:e,iframeUrl:t}){return new pe({parentElementId:e,iframeUrl:t}).initialize()}function be(e){return"virtual"===e.cardLevel?function(e){const t=ve(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ge(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel}}}}}(e):function(e){const t=ve(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ge(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel,card_design:e.cardDesign,..."plus"===e.cardLevel&&{type_of_print:e.typeOfPrint},ship_to_business_address:e.shipToBusiness,atm_option:e.hasAtmOption,nfc_option:e.hasNfcOption,foreign_option:e.hasForeignPaymentOption,online_option:e.hasOnlinePaymentOption,atm_daily_limit:e.atmDailyLimit,atm_monthly_limit:e.atmMonthlyLimit,...!e.shipToBusiness&&{address:{contact_name:e.address?.contactName,first_line:e.address?.firstLine,second_line:e.address?.secondLine,third_line:e.address?.thirdLine,zipcode:e.address?.zipCode,city:e.address?.city,country:e.address?.country}}}}}}}(e)}function ye(e){return{id:e.id,nickname:e.nickname,embossedName:e.embossed_name,status:e.status,maskPan:e.mask_pan,expMonth:parseInt(e.exp_month,10),expYear:parseInt(e.exp_year,10),lastActivityAt:new Date(e.last_activity_at),lastDigits:e.last_digits,shipToBusiness:e.ship_to_business,atmOption:e.atm_option,atmDailyLimitOption:e.atm_daily_limit_option,nfcOption:e.nfc_option,onlineOption:e.online_option,foreignOption:e.foreign_option,atmMonthlyLimit:e.atm_monthly_limit,atmMonthlySpent:e.atm_monthly_spent,atmDailyLimit:e.atm_daily_limit,atmDailySpent:e.atm_daily_spent,paymentMonthlyLimit:e.payment_monthly_limit,paymentMonthlySpent:e.payment_monthly_spent,paymentDailyLimit:e.payment_daily_limit,paymentDailySpent:e.payment_daily_spent,paymentDailyLimitOption:e.payment_daily_limit_option,paymentTransactionLimit:e.payment_transaction_limit,paymentTransactionLimitOption:e.payment_transaction_limit_option,activeDays:e.active_days,holderId:e.holder_id,bankAccountId:e.bank_account_id,organizationId:e.organization_id,updatedAt:new Date(e.updated_at),createdAt:new Date(e.created_at),shippedAt:new Date(e.shipped_at),cardType:e.card_type,cardLevel:e.card_level,paymentLifespanLimit:e.payment_lifespan_limit,paymentLifespanSpent:e.payment_lifespan_spent,preExpiresAt:new Date(e.pre_expires_at),categories:e.categories,renewed:e.renewed,renewal:e.renewal,...e.parent_card_summary&&{parentCardSummary:{id:e.parent_card_summary.id,lastDigits:e.parent_card_summary.last_digits}},hadOperation:e.had_operation,hadPinOperation:e.had_pin_operation,cardDesign:e.card_design,typeOfPrint:e.type_of_print,upsold:e.upsold,upsell:e.upsell,discardOn:new Date(e.discard_on),reordered:e.reordered}}function ve(e){const t=Object.values(W);return(e||[]).filter((e=>t.includes(e)))}const _e="--qonto-embed";function we(e){return!e.href||e.href.startsWith(window.location.origin)}function Te(e){return"CSSStyleRule"===e.constructor.name}function ke(e=_e){return x()?function(e,t){return[...e].filter(we).reduce(((e,n)=>[...n.cssRules].filter(Te).reduce(((e,n)=>{if("style"in n){const a=[...n.style].map((e=>[e.trim(),n.style.getPropertyValue(e).trim()])).filter((([e])=>e.startsWith(t))).reduce(((e,[n,a])=>({...e,[n.replace(`${t}-`,"")]:a})),{});return{...e,...a}}return e}),e)),{})}(document.styleSheets,e):{}}async function Ee({decorationParams:e,operationSettings:t,cardIframeUrl:n}){const{cardId:a,allowPinReveal:r,allowBlocking:o}=e,{uiParentElementId:i,debugMode:s}=t,c=function(e,t){const n=new URL(e);n.searchParams.set("cardId",t.cardId),"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal.toString()),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking.toString()),!0===t.debugMode&&n.searchParams.set("debug",t.debugMode.toString());const a=ke(_e);return Object.keys(a).length>0&&n.searchParams.set("customization",JSON.stringify(a)),n.toString()}(n,{cardId:a,allowPinReveal:r,allowBlocking:o,debugMode:s}),d=await he({iframeUrl:c,parentElementId:i});return{destroyEmbedUI:()=>{d.destroy()}}}const Ae={getCards:async function(e){try{const t=e?.cardSettings?.membershipId;if(t&&"string"!=typeof t)throw new i("membershipId must be a string");const{proxyRequestFunction:n,stagingToken:a}=I(e?.operationSettings||{});if(n){const e=F(G({membershipId:t,stagingToken:a})),r=await n(e);return B(r).body.cards.map((e=>ye(e)))}{const n=e?.operationSettings?.accessToken||o(),r=await async function({membershipId:e,accessToken:t,stagingToken:n}){const a=G({membershipId:e,accessToken:t,stagingToken:n}),{cards:r}=await j(a);return r}({membershipId:t,accessToken:n,stagingToken:a});return r.map((e=>ye(e)))}}catch(e){return Promise.reject(e)}},getCard:async function({cardSettings:e,operationSettings:t}){try{!function(e){if(!e)throw new i("cardSettings parameter is required for the called function");if(!e.cardId)throw new i("cardId parameter is required for the called function");const t=X({cardId:e.cardId});if(t.length>0)throw new i(t)}(e);const n=e.cardId,{proxyRequestFunction:a,stagingToken:r}=I(t||{});if(a){const e=F(K({cardId:n,stagingToken:r})),t=await a(e),o=B(t).body.cards;if(Array.isArray(o)&&o.length>0)return ye(o[0]);throw new i("Unable to retrieve card data")}{const e=t?.accessToken||o(),a=await async function({cardId:e,accessToken:t,stagingToken:n}){const a=K({cardId:e,accessToken:t,stagingToken:n}),{cards:r}=await j(a);return r[0]}({cardId:n,accessToken:e,stagingToken:r});return ye(a)}}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=o(),{uiParentElementId:a,debugMode:r}=I(e.operationSettings,{requiresUI:!0});re(e.cardSettings);const i=me({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:r}),s=await he({iframeUrl:i,parentElementId:a}),c=be(e.cardSettings),d=await s.postMessage(c);return s.destroy(),ye(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=o(),{uiParentElementId:a,debugMode:r}=I(e.operationSettings,{requiresUI:!0});!function(e){if(!e)throw new i("cardSettings parameter is required for the called function");if(!e.cardId)throw new i("cardId is required for the called function");const t=X({cardId:e.cardId});if(t.length>0)throw new i(t)}(e.cardSettings);const s=me({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:r}),d=await he({iframeUrl:s,parentElementId:a}),l=function(e){return{actionId:c.CARD_UNLOCK,actionData:{body:{cardId:e.cardSettings.cardId}}}}(e),u=await d.postMessage(l);return d.destroy(),ye(u)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:t,accessToken:n,stagingToken:a,debugMode:r,mfaPreference:s,proxyRequestFunction:c}=I(e.operationSettings,{requiresUI:!0});if(function(e){if(!e)throw new i("cardSettings parameter is required for the called function");if(!e.cardId)throw new i("cardId is required for the called function");const t=X({cardId:e.cardId});if(t.length>0)throw new i(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const a=ee(n);if(a.length>0)throw new i(a)}(e.cardSettings),c){const n=F(Y({stagingToken:a})),o=await c(n),i=B(o).body;return Ee({decorationParams:e.cardSettings,operationSettings:{uiParentElementId:t,debugMode:r},cardIframeUrl:i.url})}{const i=n||o(),c=await async function(e){const t=Y(e),{embed_auth_link:n}=await j(t);return n}({...e.cardSettings,accessToken:i,stagingToken:a});return Ee({decorationParams:e.cardSettings,operationSettings:{uiParentElementId:t,debugMode:r,mfaPreference:s},cardIframeUrl:c.url})}}catch(e){return Promise.reject(e)}}},Se=Ae;function Ie(e){const t=new URLSearchParams;return e?.page&&t.append("page",e.page.toString()),e?.itemsPerPage&&t.append("per_page",e.itemsPerPage.toString()),t}function $e({endpointUrl:e,paginationSettings:t}){return function({url:e,searchParams:t}){const n=new URL(e.toString());for(const[e,a]of t.entries())n.searchParams.append(e,a);return n}({url:new URL(e),searchParams:Ie(t)})}function Re(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}function Pe(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 Ce(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const Le="/v2/sepa/beneficiaries";function Ne({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},r=Ie(e),o=r.size?`?${r.toString()}`:"";return{path:`${Le}${o}`,options:a}}function qe({beneficiaryId:e,accessToken:t,stagingToken:n}){return{path:`${Le}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}async function Oe({accessToken:e,stagingToken:t,beneficiaryId:n}){const a=qe({beneficiaryId:n,accessToken:e,stagingToken:t}),{beneficiary:r}=await j(a);return r}function De({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=ge()}){return{path:Le,options:{method:"POST",headers:{accessToken:t,stagingToken:n,idempotencyKey:a},body:{beneficiary:Ce(e)}}}}function Ue({beneficiaryIds:e,accessToken:t,stagingToken:n}){return{path:`${Le}/untrust`,options:{method:"PATCH",headers:{accessToken:t,stagingToken:n},body:{ids:e}}}}function xe({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:r}){const{name:o,email:i,activityTag:s}=e,c={method:"PATCH",headers:{accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:r},body:{beneficiary:{name:o,email:i,activity_tag:s}}};return{path:`${Le}/${e.id}`,options:c}}const Me=[{name:"name"},{name:"iban"}];const ze={getBeneficiaries:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:r}=I(e?.operationSettings||{});if(n){const e=F(Ne({paginationSettings:r})),t=B(await n(e)),a=t.body.beneficiaries.map((e=>Pe(e))),o=Re(t.body.meta);return{beneficiaries:a,...o?{meta:o}:{}}}{const e=a||o(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const a=Ne({paginationSettings:e,accessToken:t,stagingToken:n}),{beneficiaries:r,meta:o}=await j(a);return{beneficiaries:r,meta:o}}({accessToken:e,stagingToken:t,paginationSettings:r}),i=n.beneficiaries.map((e=>Pe(e))),s=Re(n.meta);return{beneficiaries:i,...s?{meta:s}:{}}}},getBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new i("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new i("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:a,accessToken:r,stagingToken:s}=I(t||{});if(a){const e=F(qe({beneficiaryId:n}));return Pe(B(await a(e)).body.beneficiary)}{const e=r||o();return Pe(await Oe({beneficiaryId:n,accessToken:e,stagingToken:s}))}},addBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new i("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new i("beneficiary must be an object");Q(e,Me);const t=X({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new i(t);return e}(e),{proxyRequestFunction:a,accessToken:r,stagingToken:s,idempotencyKey:c}=I(t||{});if(a){const e=F(De({beneficiary:n,idempotencyKey:c}));return Pe(B(await a(e)).body.beneficiary)}{const e=r||o(),t=await async function({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=ge()}){const r=De({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a}),{beneficiary:o}=await j(r);return o}({beneficiary:n,accessToken:e,stagingToken:s,idempotencyKey:c});return Pe(t)}},updateBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){const{id:t,name:n,email:a,activityTag:r}=e||{};if(!t)throw new i("Invalid parameters were passed to the function:\nA beneficiary ID is required for the called function");if(!n&&!a&&!r)throw new i("Invalid parameters were passed to the function:\nAt least one of the following properties must be provided: name, email, activityTag");const o=X({name:n,email:a,activityTag:r});if(o.length>0)throw new i(o);return{id:t,name:n,email:a,activityTag:r}}(e),{stagingToken:a,idempotencyKey:r,mfaPreference:s,proxyRequestFunction:c}=I(t),d={beneficiaryParamsBeingEdited:n,idempotencyKey:r,mfaPreference:s};if(c){const e=F(xe(d));return Pe(B(await c(e)).body.beneficiary)}{const e=t?.accessToken||o(),n=await async function({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:r}){const o=xe({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:r}),{beneficiary:i}=await j(o);return i}({...d,accessToken:e,stagingToken:a});return Pe(n)}},untrustBeneficiaries:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new i("beneficiaryIds parameter is required for the called function");if(!Array.isArray(e)||!e.every((e=>"string"==typeof e)))throw new i("beneficiaryIds must be an array of strings");return e}(e?.beneficiaryIds),{proxyRequestFunction:a,accessToken:r,stagingToken:s}=I(t||{});if(a){const e=F(Ue({beneficiaryIds:n}));return B(await a(e)).body.beneficiaries.map(Pe)}{const e=r||o(),t=await async function({beneficiaryIds:e,accessToken:t,stagingToken:n}){const a=Ue({beneficiaryIds:e,accessToken:t,stagingToken:n}),{beneficiaries:r}=await j(a);return r}({beneficiaryIds:n,accessToken:e,stagingToken:s});return t.map(Pe)}}},je=ze;function Fe(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 Be(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}function He(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function Ge(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}function Ke(e){return{name:e.name,iban:e.iban}}const Ye="/v2/sepa",Ve=`${Ye}/transfers`;function We({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},r=Ie(e),o=r.size?`?${r.toString()}`:"";return{path:`${Ve}${o}`,options:a}}function Ze({sepaTransferId:e,accessToken:t,stagingToken:n}){return{path:`${Ve}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function Je({sepaTransferId:e,accessToken:t,stagingToken:n}){return{path:`${Ve}/${e}/cancel`,options:{method:"POST",headers:{accessToken:t,stagingToken:n}}}}async function Qe({sepaPayee:e,accessToken:t,stagingToken:n}){const a=function({sepaPayee:e,accessToken:t,stagingToken:n}){return{path:`${Ye}/verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:t,stagingToken:n});return await j(a)}const Xe="/v2/sepa/bulk_transfers";async function et({sepaPayees:e,accessToken:t,stagingToken:n}){const a=function({sepaPayees:e,accessToken:t,stagingToken:n}){return{path:`${Ye}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{requests:e.map(Ke)}}}}({sepaPayees:e,accessToken:t,stagingToken:n});return await j(a)}function tt(e){if(!e)throw new i("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new i("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new i("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new i("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,t)=>{!function(e,t){if(!e)throw new i(`Invalid bulkTransfer at index ${t}: bulkTransfer object is required`);if(!e.beneficiary)throw new i(`Invalid bulkTransfer at index ${t}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new i(`Invalid bulkTransfer at index ${t}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new i(`Invalid bulkTransfer at index ${t}: Beneficiary name is required as part of the beneficiary details`);const n=X({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=te({amount:e.amount}),r=[...n,...a].flat();if(r.length>0)throw new i(r);if(e.amount>p&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new i(`Invalid bulkTransfer at index ${t}: Attachments are required for transfers over €30000`)}(e,t)})),e}const nt="browser",at="server";class rt extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case nt:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case at:this.message="This code is running in a server environment, but it is expected to run in a browser environment.";break;default:this.message="This code is not expected to run in this environment. Check if the function was server-only or browser-only."}}}const ot=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];function it(e,t){const n=t?.locale||L.getLocale(),a=new URL(e);return n&&a.searchParams.append("lang",n),t?.mfaPreference&&a.searchParams.append("mfaPreference",t.mfaPreference),t?.idempotencyKey&&a.searchParams.append("idempotencyKey",t.idempotencyKey),a.toString()}function st(e){return{url:e.url,postAuthAction:e.post_authn_action,callbackUrl:e.callback_url,expiresAt:e.expired_at,usedAt:e.used_at}}const ct={request:async function({requestSettings:e,operationSettings:t}){!function(e){if(!e||"object"!=typeof e)throw new i("requestSettings must be an object");const t=e,{action:n,callbackUrl:a}=e;Q(t,[{name:"action"}]);const r=X(t),o=Object.values(h);if(o.includes(n)||r.push(`action must be one of ${o.join(", ")}`),r.length>0)throw new i(r);if(void 0!==a&&""===a.trim())throw new i("callbackUrl cannot be empty")}(e);const{proxyRequestFunction:n,stagingToken:a}=I(t||{});if(n){const t=F(H({stagingToken:a,action:e.action,callbackUrl:e.callbackUrl}));return st(B(await n(t)).body)}{const n=t?.accessToken||o();return st(await async function(e){const t=H({accessToken:e.accessToken,stagingToken:e.stagingToken,action:e.action,callbackUrl:e.callbackUrl}),{embed_auth_link:n}=await j(t);return{url:n.url,post_authn_action:n.post_authn_action,callback_url:n.callback_url,expired_at:n.expired_at,used_at:n.used_at}}({accessToken:n,stagingToken:a,action:e.action,callbackUrl:e.callbackUrl}))}}};async function dt(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:r}=I(e?.operationSettings||{});if(n){const e=F(We({paginationSettings:r})),t=B(await n(e)),a=t.body.transfers.map(He),o=Re(t.body.meta);return{transfers:a,...o?{meta:o}:{}}}{const e=a||o(),n=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a=We({paginationSettings:n,accessToken:e,stagingToken:t}),{transfers:r,meta:o}=await j(a);return{transfers:r,meta:o}}({accessToken:e,stagingToken:t,paginationSettings:r}),i=n.transfers.map(He),s=Re(n.meta);return{transfers:i,...s?{meta:s}:{}}}}const lt={getSepaTransfers:dt,getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=function(e){if(!e)throw new i("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new i("sepaTransferId must be a string");return e}(e?.sepaTransferId),{proxyRequestFunction:a,accessToken:r,stagingToken:s}=I(t||{});if(a){const e=F(Ze({sepaTransferId:n}));return He(B(await a(e)).body.transfer)}{const e=r||o(),t=await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const a=Ze({sepaTransferId:n,accessToken:e,stagingToken:t}),{transfer:r}=await j(a);return r}({sepaTransferId:n,accessToken:e,stagingToken:s});return He(t)}},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:t}){const a=t?.accessToken||o(),r=t?.stagingToken||n.getStagingToken(),s=t?.idempotencyKey||ge();let d;!function(e){if(!e)throw new i("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new i("sepaTransferSettings must be an object");if(Q(e,ot),!e.beneficiaryId&&!e.beneficiary)throw new i("Either beneficiaryId or beneficiary must be provided");const t=[...X({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...te({amount:e.amount})].flat();if(t.length>0)throw new i(t);if(e.amount>p&&(!e.attachmentIds||0===e.attachmentIds.length))throw new i("Attachments are required for transfers over €30,000")}(e);const l=await async function({sepaTransferSettings:e,operationSettings:t}){return e?.beneficiary?e.beneficiary:Pe(await Oe({beneficiaryId:e?.beneficiaryId,accessToken:t?.accessToken,stagingToken:t?.stagingToken}))}({sepaTransferSettings:e,operationSettings:{accessToken:a,stagingToken:r||void 0}}),u={name:l.name,iban:l.iban},g=await Qe({sepaPayee:u,accessToken:a,stagingToken:r||void 0});var f;if((yield(f=g,{matchResult:f.match_result,matchedName:f.matched_name}))===m.REJECT)return;const h={...e,beneficiary:l};if(h.beneficiary?.trusted)d=await async function({transfer:e,vopProofToken:t,accessToken:n,stagingToken:a,idempotencyKey:r}){const o=Ge(e),i={method:"POST",headers:z({accessToken:n,stagingToken:a,idempotencyKey:r}),body:JSON.stringify({transfer:o,vop_proof_token:t})},s=`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ve}`,c=await fetch(s,i),d=await c.json();if(d.errors)throw new U(d.errors.map((e=>`${e.code}: ${e.detail}`)));return d.transfer}({transfer:h,vopProofToken:g.proof_token.token,accessToken:a,stagingToken:r||void 0,idempotencyKey:s});else{if(!x())throw new rt(nt);const{uiParentElementId:e,debugMode:n}=I(t,{requiresUI:!0});let o;try{const t=me({accessToken:a,stagingToken:r||void 0,debugMode:n});o=await he({iframeUrl:t,parentElementId:e});const i=Ge(h);d=await o.postMessage(fe({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...i}},idempotencyKey:s}}))}finally{o?.destroy()}}return He(d)},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=function(e){if(!e)throw new i("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new i("sepaTransferId must be a string");return e}(e?.sepaTransferId),{proxyRequestFunction:a,accessToken:r,stagingToken:s}=I(t||{});if(a){const e=F(Je({sepaTransferId:n}));B(await a(e))}else{const e=r||o();await async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const a=Je({sepaTransferId:e,accessToken:t,stagingToken:n});await j(a)}({sepaTransferId:n,accessToken:e,stagingToken:s})}},getSepaTransferCreationFlowLink:async function({sepaTransferSettings:e,operationSettings:t}){const n=function(e){if(!e||!e.callbackUrl)throw new i("callbackUrl parameter is required for the getSepaTransferCreationFlowLink function");if("string"!=typeof e.callbackUrl)throw new i("callbackUrl must be a string");return e.callbackUrl}(e),{proxyRequestFunction:a,stagingToken:r,accessToken:s}=I(t||{}),c=a?{proxyRequestFunction:a}:{stagingToken:r,accessToken:s||o()},d=await ct.request({requestSettings:{action:h.SEPA_TRANSFER_CREATE,callbackUrl:n},operationSettings:c});return{...d,url:it(d.url,t)}},bulkTransfers:{getBulkTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||o(),{stagingToken:a,paginationSettings:r}=I(t||{}),i=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a={method:"GET",headers:z({accessToken:e,stagingToken:t})},r=$e({endpointUrl:new URL(`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}${Xe}`),paginationSettings:n}),o=await fetch(r,a);if(!o.ok)throw new U("Failed to fetch SEPA bulk transfers");const i=await o.json();if(i.errors)throw new U(i.errors.map((e=>`${e.code}: ${e.detail}`)));return{bulkTransfers:i.bulk_transfers,meta:i.meta}}({accessToken:n,stagingToken:a,paginationSettings:r}),s=i.bulkTransfers?.map(Fe),c=Re(i.meta);return{bulkTransfers:s,...c?{meta:c}:{}}},getBulkTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||o(),{stagingToken:a}=I(t||{}),r=function(e){if(!e)throw new i("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new i("bulkTransferId must be a string.");return e}(e?.bulkTransferId);return Fe(await async function({accessToken:e,stagingToken:t,bulkTransferId:n}){const a={method:"GET",headers:z({accessToken:e,stagingToken:t})},r=new URL(`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}${Xe}/${n}`),o=await fetch(r,a),i=await o.json();if(i.errors)throw new U(i.errors.map((e=>`${e.code}: ${e.detail}`)));return i.bulk_transfer}({accessToken:n,stagingToken:a,bulkTransferId:r}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:t}){const a=t?.accessToken||o(),r=t?.stagingToken||n.getStagingToken(),i=t?.idempotencyKey||ge();tt(e);const{uiParentElementId:s,debugMode:d}=I(t,{requiresUI:!0});if(!x())throw new rt(nt);const l=new Map;for(const t of e.bulkTransfers){const e=t.beneficiary.iban;e&&!l.has(e)&&l.set(e,{name:t.beneficiary.name,iban:e})}const u=Array.from(l.values()),g=await et({sepaPayees:u,accessToken:a,stagingToken:r||void 0});if((yield g.requests.map(Be))===m.REJECT)return;let f,p;try{const t=me({accessToken:a,stagingToken:r||void 0,debugMode:d});p=await he({iframeUrl:t,parentElementId:s});const n={bankAccountId:e.bankAccountId,bulkTransfers:e.bulkTransfers.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))};f=await p.postMessage(fe({actionId:c.TRANSFER_BULK_CREATE,actionData:{body:n,idempotencyKey:i}}))}finally{p?.destroy()}return Fe(f)}}},ut={GOOD:"good",SERVICE:"service"},gt={AED:"AED",AUD:"AUD",BGN:"BGN",CAD:"CAD",CHF:"CHF",CNY:"CNY",CZK:"CZK",DKK:"DKK",EUR:"EUR",GBP:"GBP",GHS:"GHS",HKD:"HKD",HUF:"HUF",ILS:"ILS",INR:"INR",MXN:"MXN",NOK:"NOK",NZD:"NZD",PEN:"PEN",PLN:"PLN",RON:"RON",RSD:"RSD",SAR:"SAR",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",ZAR:"ZAR",ZMW:"ZMW"},ft=e=>{if(!(e=>Object.values(gt).includes(e))(e))throw new i(`currency ${e} is not valid, valid currencies are ${Object.values(gt).join(", ")}`)},pt={UNIT:"unit",HOUR:"hour",DAY:"day",MONTH:"month",GRAM:"gram",KILOGRAM:"kilogram",LITER:"liter",METER:"meter",SQUARE_METER:"square_meter",CUBIC_METER:"cubic_meter",AMPERE:"ampere",NUMBER_OF_ARTICLES:"number_of_articles",CENTIMETER:"centimeter",CUBIC_METER_PER_HOUR:"cubic_meter_per_hour",GIGAJOULE:"gigajoule",GIGAWATT:"gigawatt",GIGAWATT_HOUR:"gigawatt_hour",HALF_YEAR:"half_year",JOULE:"joule",KILOJOULE:"kilojoule",KILOVAR:"kilovar",KILOWATT:"kilowatt",KILOWATT_HOUR:"kilowatt_hour",MEGAJOULE:"megajoule",MEGAWATT:"megawatt",MEGAWATT_HOUR:"megawatt_hour",MILLIGRAM:"milligram",MILLILITER:"milliliter",MILLIMETER:"millimeter",MINUTE:"minute",PAIR:"pair",QUARTER:"quarter",SECOND:"second",SET:"set",TON:"ton",TWO_WEEK:"two_week",WATT_HOUR:"watt_hour",WEEK:"week",YEAR:"year"},mt=e=>{if(!(e=>Object.values(pt).includes(e))(e))throw new i(`unit ${e} is not valid, valid units are ${Object.values(pt).join(", ")}`)},ht=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],bt=[{name:"currency"},{name:"value"}];const yt=e=>{if(!Object.values(ut).includes(e))throw new i(`type ${e} is not valid, valid types are ${Object.values(ut).join(", ")}`)},vt={getPaymentLinkCreationFlowUrl:({paymentLinkSettings:e})=>{const{items:t,authUrl:n}=e;!function(e){if(!e)throw new i("authUrl is required for the called function");const t=X({authUrl:e});if(t.length>0)throw new i(t);try{new URL(e)}catch{throw new i("authUrl is not a valid URL")}}(n),function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{Q(e,ht),Q(e.unitPrice,bt);const t=[...X({id:e.id,title:e.title,vatRate:e.vatRate,currency:e.unitPrice.currency,measureUnit:e.measureUnit,unitPrice:e.unitPrice.value,...e.description?{description:e.description}:{}}),...te({quantity:e.quantity})].flat();if(t.length>0)throw new i(t);yt(e.type),ft(e.unitPrice.currency),mt(e.measureUnit)}))}(t);const a=new URLSearchParams({...t?{items:JSON.stringify(t)}:{}});return a.toString()?`${n}?${a.toString()}`:n}},_t=({accessToken:e,stagingToken:t})=>({path:"/v2/organizations/",options:{method:"GET",headers:{accessToken:e,stagingToken:t}}}),wt=e=>({slug:e.slug,iban:e.iban,bic:e.bic,currency:e.currency,balance:e.balance,balanceCents:e.balance_cents,authorizedBalance:e.authorized_balance,authorizedBalanceCents:e.authorized_balance_cents,name:e.name,updatedAt:new Date(e.updated_at),status:e.status,main:e.main}),Tt={getBankAccounts:async e=>{const{stagingToken:t,proxyRequestFunction:n}=I(e);if(n){const e=_t({stagingToken:t}),a=await n(F(e)),{body:r}=B(a);return r.bank_accounts.map(wt)}{const n=e.accessToken||o(),a=await(async({accessToken:e,stagingToken:t})=>{const n=_t({accessToken:e,stagingToken:t});return await j(n)})({accessToken:n,stagingToken:t});return a.bank_accounts.map(wt)}}},kt="/v2/transactions";function Et({bankAccountId:e,iban:t,status:n,updatedAtFrom:a,updatedAtTo:r,emittedAtFrom:o,emittedAtTo:i,settledAtFrom:s,settledAtTo:c,side:d,operationType:l,withAttachments:u,paginationSettings:g,accessToken:f,stagingToken:p}){const m={method:"GET",headers:{accessToken:f,stagingToken:p}},h=new URLSearchParams;e&&h.append("bank_account_id",e),t&&h.append("iban",t),n&&h.append("status",n),a&&h.append("updated_at_from",a),r&&h.append("updated_at_to",r),o&&h.append("emitted_at_from",o),i&&h.append("emitted_at_to",i),s&&h.append("settled_at_from",s),c&&h.append("settled_at_to",c),d&&h.append("side",d),l&&h.append("operation_type",l),void 0!==u&&h.append("with_attachments",String(u));const b=Ie(g);for(const[e,t]of b)h.append(e,t);const y=h.toString();return{path:`${kt}${y?`?${y}`:""}`,options:m}}function At({transactionId:e,accessToken:t,stagingToken:n}){return{path:`${kt}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function St(e){return{transactionId:e.transaction_id,amount:e.amount,amountCents:e.amount_cents,settledBalance:e.settled_balance,settledBalanceCents:e.settled_balance_cents,attachmentIds:e.attachment_ids,localAmount:e.local_amount,localAmountCents:e.local_amount_cents,side:e.side,operationType:e.operation_type,currency:e.currency,localCurrency:e.local_currency,label:e.label,settledAt:new Date(e.settled_at),emittedAt:new Date(e.emitted_at),updatedAt:new Date(e.updated_at),status:e.status,note:e.note,reference:e.reference,vatAmount:e.vat_amount,vatAmountCents:e.vat_amount_cents,vatRate:e.vat_rate,initiatorId:e.initiator_id,labelIds:e.label_ids,attachmentLost:e.attachment_lost,attachmentRequired:e.attachment_required,cardLastDigits:e.card_last_digits,category:e.category,cashflowCategory:{name:e.cashflow_category?.name||""},cashflowSubcategory:{name:e.cashflow_subcategory?.name||""},id:e.id,subjectType:e.subject_type,...e.transfer?{transfer:{counterpartyAccountNumber:e.transfer.counterparty_account_number,counterpartyName:e.transfer.counterparty_name,counterpartyBic:e.transfer.counterparty_bic,counterpartyIban:e.transfer.counterparty_iban}}:{}}}const It={getTransactions:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:r}=I(e?.operationSettings||{}),i={...e?.transactionSettings||{},paginationSettings:r};if(n){const e=F(Et(i)),t=B(await n(e));return{transactions:t.body.transactions.map(St),meta:t.body.meta}}{const e=a||o(),n=await async function(e){const t=Et(e),{transactions:n,meta:a}=await j(t);return{transactions:n,meta:a}}({...i,accessToken:e,stagingToken:t});return{transactions:n.transactions.map(St),meta:n.meta}}},getTransaction:async function({transactionSettings:e,operationSettings:t}){const{proxyRequestFunction:n,accessToken:a,stagingToken:r}=I(t||{}),{transactionId:s}=function(e){if(!e)throw new i("transactionSettings parameter is required for the called function");if(!e.transactionId)throw new i("transactionSettings.transactionId parameter is required for the called function");if(e.transactionId&&"string"!=typeof e.transactionId)throw new i("transactionSettings.transactionId must be a string.");return e}(e);if(n){const e=F(At({transactionId:s}));return St(B(await n(e)).body.transaction)}{const e=a||o();return St(await async function(e){const t=At(e),{transaction:n}=await j(t);return n}({transactionId:s,accessToken:e,stagingToken:r}))}}},$t=It;function Rt(e,t,n,a){var r,o=arguments.length,i=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(i=(o<3?r(i):o>3?r(t,n,i):r(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i}"function"==typeof SuppressedError&&SuppressedError;
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const n=t.getInstance();class a extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class r extends a{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function o(){if(!n.hasAccessToken())throw new r;return n.getAccessToken()}class i extends a{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}const s={READY:"qonto.ready"},c={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFER_SINGLE_CREATE:"transfer.single.create",TRANSFER_BULK_CREATE:"transfer.bulk.create",BENEFICIARIES_TRUST:"beneficiary.trust"},d={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},l={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},u={EN:"en",FR:"fr",DE:"de",ES:"es",IT:"it",PT:"pt"},g={PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled",FAILED:"failed",COMPLETED:"completed"},f={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},p=3e4,h={ACCEPT:"ACCEPT",REJECT:"REJECT"},m={CARD_DISPLAY:"display_card",PAYMENT_LINK_CREATE:"create_payment_link",SEPA_TRANSFER_CREATE:"create_sepa_transfer"};var b=Object.freeze({__proto__:null,ACTIONS:c,ACTIVITY_TAGS:{ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},AMOUNT_REQUIRING_ATTACHMENTS:p,AUTH_LINK_ACTIONS:m,BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:l,ENVIRONMENTS:d,IFRAME_EVENTS:s,LOCALES:u,MFA_METHODS:f,TRANSACTION_STATUSES:{PENDING:"pending",DECLINED:"declined",COMPLETED:"completed"},TRANSFER_DECLINE_REASONS:{BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},TRANSFER_STATUSES:g,VOP_CHECK_RESULTS:{MATCH_RESULT_MATCH:"MATCH_RESULT_MATCH",MATCH_RESULT_NO_MATCH:"MATCH_RESULT_NO_MATCH",MATCH_RESULT_CLOSE_MATCH:"MATCH_RESULT_CLOSE_MATCH",MATCH_RESULT_NOT_POSSIBLE:"MATCH_RESULT_NOT_POSSIBLE",MATCH_RESULT_UNSPECIFIED:"MATCH_RESULT_UNSPECIFIED"},VOP_DECISIONS:h});class y{constructor(){this.mfaPreference=f.PASSKEY,this.debugMode=!1}static getInstance(){return y.instance||(y.instance=new y),y.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=f.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}}const v=y.getInstance(),_="https://embed.qonto.com",w="https://embed-js{branch}.staging.qonto.co",T="https://embed.dev.qonto.co",k={[d.PRODUCTION]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[d.STAGING]:{IFRAME_BASE_URL:w,IFRAME_URL:`${w}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[d.LOCAL]:{IFRAME_BASE_URL:T,IFRAME_URL:`${T}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class E{constructor(){this.environment=d.PRODUCTION,this.branch=l.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(d).includes(e)?e:d.PRODUCTION,this.branch=Object.values(l).includes(t)?t:l.SANDBOX}static getInstance(){return E.instance||(E.instance=new E),E.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===d.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=d.PRODUCTION,this.branch=l.MASTER}getEnvironmentUrls(){if(this.environment===d.PRODUCTION)return k.production;{const e=k[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const A=E.getInstance(),S={requiresUI:!1};function I(e,{requiresUI:t}=S){const n=e?.uiParentElementId||v.getUIParentElementId();if(t&&!n)throw new i("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");const a=e?.mfaPreference||v.getMFAPreference();if(a){const e=(r=Object.values(f),A.isProductionEnvironment()?r.filter((e=>e!==f.MOCK)):r);if(!e.includes(a))throw new i(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(A.isProductionEnvironment()&&a===f.MOCK)throw new i("operationSettings.mfaPreference cannot be set to mock in production environment.")}var r;const o=e?.debugMode||v.getDebugMode();if(void 0!==o&&"boolean"!=typeof o)throw new i("operationSettings.debugMode must be a boolean.");const s=e?.proxyRequestFunction||v.getProxyRequestFunction();if(s&&"function"!=typeof s)throw new i("operationSettings.proxyRequestFunction must be a function.");return{...e,uiParentElementId:n,mfaPreference:a,debugMode:o,proxyRequestFunction:s}}const $=Object.values(u);function R(e){if(!function(e){return $.includes(e)}(e))throw new i(`Unsupported locale: ${e}. The locale must be one of: ${$.join(", ")}.`);return e}function P(e){if(!e?.accessToken&&!e?.operationSettings?.proxyRequestFunction)throw new i("Either operationSettings.proxyRequestFunction or access token is required when calling initialize()");return e?.operationSettings&&I(e.operationSettings),function(e){if(e.environment){if(!["production","staging","local"].includes(e.environment))throw new i('If provided, environment must be either "production" or "staging"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.environment.PRODUCTION" or "constants.environment.STAGING"');if(e.branch&&!["master","sandbox","qa"].includes(e.branch))throw new i('If provided, branch must be either "master", "sandbox" or "qa"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.branch.MASTER" or "constants.environment.SANDBOX" and so on')}}(e),e.locale&&R(e.locale),e}class C{constructor(){this.currentLocale="en"}static getInstance(){return C.instance||(C.instance=new C),C.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const L=C.getInstance();const N={initialize:function(e){const{accessToken:t,stagingToken:a,operationSettings:r,environment:o,branch:i,locale:s}=P(e);t&&n.setAccessToken(t),a&&n.setStagingToken(a),s&&L.setLocale(s),r&&v.setSettings(r),o&&(A.setEnvironment(o),i&&A.setBranch(i))},logout:function(){n.clearAccessToken(),n.clearStagingToken(),L.setDefaultLocale(),v.clearSettings()},constants:b},{initialize:q,logout:O,constants:D}=N;class U extends a{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function x(){return"undefined"!=typeof window&&"undefined"!=typeof document}function M(){return!x()}function z({accessToken:e,stagingToken:t,idempotencyKey:a,mfaPreference:r}){const o=new Headers;o.append("Authorization",`Bearer ${e}`);const i=t||n.getStagingToken();i&&o.append("X-Qonto-Staging-Token",i),a&&o.append("X-Qonto-Idempotency-Key",a);const s=r||v.getMFAPreference();return s&&o.append("X-Qonto-2fa-Preference",s),o.append("Content-Type","application/json"),o.append("Accept-Language",L.getLocale()),o}async function j({path:e,options:t}){const n=`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(n,{...t,headers:z(t.headers),body:t.body?JSON.stringify(t.body):void 0});if(204===a.status)return;const r=await a.json();if(!a.ok)throw r.errors?new U(r.errors.map((e=>`${e.code}: ${e.detail}`))):new U(`${r.code}: ${r.detail}`);return r}function F(e){const t={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},n=JSON.stringify(t);return a=n,M()?Buffer.from(a).toString("base64"):btoa(a);var a}function B(e){return JSON.parse((t=e,M()?Buffer.from(t,"base64").toString("utf-8"):atob(t)));var t}function H({accessToken:e,stagingToken:t,action:n,callbackUrl:a}){const r={post_authn_action:n};return a&&(r.callback_url=a),{path:"/v1/embed_auth_links",options:{method:"POST",headers:{accessToken:e,stagingToken:t},body:{embed_auth_link:r}}}}function G({membershipId:e,accessToken:t,stagingToken:n}){return{path:e?`/v2/cards?holder_ids[]=${e}`:"/v2/cards",options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function K({cardId:e,accessToken:t,stagingToken:n}){return{path:`/v2/cards?ids[]=${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function Y({accessToken:e,stagingToken:t}){return H({accessToken:e,stagingToken:t,action:m.CARD_DISPLAY})}var V;!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"}(V||(V={}));const W={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var Z,J;function Q(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:void 0===e[t.name])).map((e=>e.name));if(n.length>0)throw new i(n.map((e=>`Missing required parameter: ${e}`)))}function X(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function ee(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function te(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}(Z||(Z={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(J||(J={}));const ne=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],ae=[...ne,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function re(e){if(!e)throw new i("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return Q(e,ne),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:r,hasTransactionLimit:o,monthlyLimit:s,dailyLimit:c,transactionLimit:d,activeDays:l,categories:u,cardLevel:g}=e,f=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(g),p=X({membershipId:t,organizationId:n,bankAccountId:a}),h=ee({hasDailyLimit:r,hasTransactionLimit:o}),m=te({monthlyLimit:s,dailyLimit:c,transactionLimit:d}),b=oe(l),y=ie(u),v=[...f,...p,...h,...m,...b,...y];if(v.length>0)throw new i(v)}(e),e}(e):function(e){Q(e,ae),function(e){const{membershipId:t,organizationId:n,bankAccountId:a,hasDailyLimit:r,hasTransactionLimit:o,monthlyLimit:s,dailyLimit:c,transactionLimit:d,activeDays:l,categories:u,cardLevel:g,hasNfcOption:f,hasForeignPaymentOption:p,hasOnlinePaymentOption:h,shipToBusiness:m,hasAtmOption:b,hasAtmDailyLimit:y,atmDailyLimit:v,atmMonthlyLimit:_,address:w,cardDesign:T,typeOfPrint:k}=e,E=function(e){return Object.values(J).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(g),A=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(k),S=X({membershipId:t,organizationId:n,bankAccountId:a}),I=ee({hasDailyLimit:r,hasTransactionLimit:o,hasAtmOption:b,hasNfcOption:f,hasForeignPaymentOption:p,hasOnlinePaymentOption:h,hasAtmDailyLimit:y,shipToBusiness:m}),$=te({monthlyLimit:s,dailyLimit:c,transactionLimit:d,atmDailyLimit:v,atmMonthlyLimit:_}),R=oe(l),P=ie(u),C=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(T),L=function(e,t){if(t)return[];return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(w,m),N=[...E,...S,...I,...$,...R,...P,...A,...C,...L];if(N.length>0)throw new i(N)}(e)}(e)}function oe(e){const t=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function ie(e){const t=!Array.isArray(e)||e.some((e=>"string"!=typeof e));return void 0!==e&&t?["categories must be an array of strings"]:[]}class se extends a{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}const ce=[];for(let e=0;e<256;++e)ce.push((e+256).toString(16).slice(1));let de;const le=new Uint8Array(16);var ue={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ge(e,t,n){if(ue.randomUUID&&!e)return ue.randomUUID();const a=(e=e||{}).random??e.rng?.()??function(){if(!de){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");de=crypto.getRandomValues.bind(crypto)}return de(le)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=15&a[6]|64,a[8]=63&a[8]|128,function(e,t=0){return(ce[e[t+0]]+ce[e[t+1]]+ce[e[t+2]]+ce[e[t+3]]+"-"+ce[e[t+4]]+ce[e[t+5]]+"-"+ce[e[t+6]]+ce[e[t+7]]+"-"+ce[e[t+8]]+ce[e[t+9]]+"-"+ce[e[t+10]]+ce[e[t+11]]+ce[e[t+12]]+ce[e[t+13]]+ce[e[t+14]]+ce[e[t+15]]).toLowerCase()}(a)}function fe({actionId:e,actionData:t}){const n=v.getMFAPreference();return{actionId:e,actionData:{...t,scaPreference:t.scaPreference||n,idempotencyKey:t.idempotencyKey||ge()}}}class pe{constructor(e){this.options=e,this.iframe=null,this.parentElement=null,this.messageListeners=new Map,this.defaultTimeout=3e4;const t=new URL(e.iframeUrl);this.targetOrigin=`${t.protocol}//${t.host}`}async initialize(){if(this.iframe)return this;if(this.parentElement=document.getElementById(this.options.parentElementId),!this.parentElement)throw new se(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,a=setTimeout((()=>{window.removeEventListener("message",r),t(new se(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),r=t=>{t.data.eventId===s.READY&&(clearTimeout(a),window.removeEventListener("message",r),e(this))};window.addEventListener("message",r),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){if(!this.iframe||!this.iframe.contentWindow)return Promise.reject(new se("Attempted to perform an Embed operation without having the authentication UI initialized."));const t=fe(e);return new Promise(((e,n)=>{const a=r=>{if(r.data?.actionId===t.actionId){if("error"===r.data.status)return this.removeMessageListener(t.actionId,a),n(new se(`An error occurred when performing the action ${t.actionId}.\n${JSON.stringify(r.data.payload)}`));this.removeMessageListener(t.actionId,a),e(r.data.payload)}};this.addMessageListener(t.actionId,a),this.iframe?.contentWindow?.postMessage(t,this.targetOrigin)}))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function he({accessToken:e,stagingToken:t,locale:n,debugMode:a}){const r=a||!1,o=n||L.getLocale(),i=A.getEnvironmentUrls().IFRAME_URL,s=t?`;staging_token=${encodeURIComponent(t)}`:"";return`${i}?debug=${r}&lang=${encodeURIComponent(o)}#access_token=${encodeURIComponent(e)}${s}`}function me({parentElementId:e,iframeUrl:t}){return new pe({parentElementId:e,iframeUrl:t}).initialize()}function be(e){return"virtual"===e.cardLevel?function(e){const t=ve(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ge(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel}}}}}(e):function(e){const t=ve(e.categories);return{actionId:c.CARD_ORDER,actionData:{idempotencyKey:ge(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel,card_design:e.cardDesign,..."plus"===e.cardLevel&&{type_of_print:e.typeOfPrint},ship_to_business_address:e.shipToBusiness,atm_option:e.hasAtmOption,nfc_option:e.hasNfcOption,foreign_option:e.hasForeignPaymentOption,online_option:e.hasOnlinePaymentOption,atm_daily_limit:e.atmDailyLimit,atm_monthly_limit:e.atmMonthlyLimit,...!e.shipToBusiness&&{address:{contact_name:e.address?.contactName,first_line:e.address?.firstLine,second_line:e.address?.secondLine,third_line:e.address?.thirdLine,zipcode:e.address?.zipCode,city:e.address?.city,country:e.address?.country}}}}}}}(e)}function ye(e){return{id:e.id,nickname:e.nickname,embossedName:e.embossed_name,status:e.status,maskPan:e.mask_pan,expMonth:parseInt(e.exp_month,10),expYear:parseInt(e.exp_year,10),lastActivityAt:new Date(e.last_activity_at),lastDigits:e.last_digits,shipToBusiness:e.ship_to_business,atmOption:e.atm_option,atmDailyLimitOption:e.atm_daily_limit_option,nfcOption:e.nfc_option,onlineOption:e.online_option,foreignOption:e.foreign_option,atmMonthlyLimit:e.atm_monthly_limit,atmMonthlySpent:e.atm_monthly_spent,atmDailyLimit:e.atm_daily_limit,atmDailySpent:e.atm_daily_spent,paymentMonthlyLimit:e.payment_monthly_limit,paymentMonthlySpent:e.payment_monthly_spent,paymentDailyLimit:e.payment_daily_limit,paymentDailySpent:e.payment_daily_spent,paymentDailyLimitOption:e.payment_daily_limit_option,paymentTransactionLimit:e.payment_transaction_limit,paymentTransactionLimitOption:e.payment_transaction_limit_option,activeDays:e.active_days,holderId:e.holder_id,bankAccountId:e.bank_account_id,organizationId:e.organization_id,updatedAt:new Date(e.updated_at),createdAt:new Date(e.created_at),shippedAt:new Date(e.shipped_at),cardType:e.card_type,cardLevel:e.card_level,paymentLifespanLimit:e.payment_lifespan_limit,paymentLifespanSpent:e.payment_lifespan_spent,preExpiresAt:new Date(e.pre_expires_at),categories:e.categories,renewed:e.renewed,renewal:e.renewal,...e.parent_card_summary&&{parentCardSummary:{id:e.parent_card_summary.id,lastDigits:e.parent_card_summary.last_digits}},hadOperation:e.had_operation,hadPinOperation:e.had_pin_operation,cardDesign:e.card_design,typeOfPrint:e.type_of_print,upsold:e.upsold,upsell:e.upsell,discardOn:new Date(e.discard_on),reordered:e.reordered}}function ve(e){const t=Object.values(W);return(e||[]).filter((e=>t.includes(e)))}const _e="--qonto-embed";function we(e){return!e.href||e.href.startsWith(window.location.origin)}function Te(e){return"CSSStyleRule"===e.constructor.name}function ke(e=_e){return x()?function(e,t){return[...e].filter(we).reduce(((e,n)=>[...n.cssRules].filter(Te).reduce(((e,n)=>{if("style"in n){const a=[...n.style].map((e=>[e.trim(),n.style.getPropertyValue(e).trim()])).filter((([e])=>e.startsWith(t))).reduce(((e,[n,a])=>({...e,[n.replace(`${t}-`,"")]:a})),{});return{...e,...a}}return e}),e)),{})}(document.styleSheets,e):{}}async function Ee({decorationParams:e,operationSettings:t,cardIframeUrl:n}){const{cardId:a,allowPinReveal:r,allowBlocking:o}=e,{uiParentElementId:i,debugMode:s}=t,c=function(e,t){const n=new URL(e);n.searchParams.set("cardId",t.cardId),"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal.toString()),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking.toString()),!0===t.debugMode&&n.searchParams.set("debug",t.debugMode.toString());const a=ke(_e);return Object.keys(a).length>0&&n.searchParams.set("customization",JSON.stringify(a)),n.toString()}(n,{cardId:a,allowPinReveal:r,allowBlocking:o,debugMode:s}),d=await me({iframeUrl:c,parentElementId:i});return{destroyEmbedUI:()=>{d.destroy()}}}const Ae={getCards:async function(e){try{const t=e?.cardSettings?.membershipId;if(t&&"string"!=typeof t)throw new i("membershipId must be a string");const{proxyRequestFunction:n,stagingToken:a}=I(e?.operationSettings||{});if(n){const e=F(G({membershipId:t,stagingToken:a})),r=await n(e);return B(r).body.cards.map((e=>ye(e)))}{const n=e?.operationSettings?.accessToken||o(),r=await async function({membershipId:e,accessToken:t,stagingToken:n}){const a=G({membershipId:e,accessToken:t,stagingToken:n}),{cards:r}=await j(a);return r}({membershipId:t,accessToken:n,stagingToken:a});return r.map((e=>ye(e)))}}catch(e){return Promise.reject(e)}},getCard:async function({cardSettings:e,operationSettings:t}){try{!function(e){if(!e)throw new i("cardSettings parameter is required for the called function");if(!e.cardId)throw new i("cardId parameter is required for the called function");const t=X({cardId:e.cardId});if(t.length>0)throw new i(t)}(e);const n=e.cardId,{proxyRequestFunction:a,stagingToken:r}=I(t||{});if(a){const e=F(K({cardId:n,stagingToken:r})),t=await a(e),o=B(t).body.cards;if(Array.isArray(o)&&o.length>0)return ye(o[0]);throw new i("Unable to retrieve card data")}{const e=t?.accessToken||o(),a=await async function({cardId:e,accessToken:t,stagingToken:n}){const a=K({cardId:e,accessToken:t,stagingToken:n}),{cards:r}=await j(a);return r[0]}({cardId:n,accessToken:e,stagingToken:r});return ye(a)}}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=o(),{uiParentElementId:a,debugMode:r}=I(e.operationSettings,{requiresUI:!0});re(e.cardSettings);const i=he({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:r}),s=await me({iframeUrl:i,parentElementId:a}),c=be(e.cardSettings),d=await s.postMessage(c);return s.destroy(),ye(d)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=o(),{uiParentElementId:a,debugMode:r}=I(e.operationSettings,{requiresUI:!0});!function(e){if(!e)throw new i("cardSettings parameter is required for the called function");if(!e.cardId)throw new i("cardId is required for the called function");const t=X({cardId:e.cardId});if(t.length>0)throw new i(t)}(e.cardSettings);const s=he({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:r}),d=await me({iframeUrl:s,parentElementId:a}),l=function(e){return{actionId:c.CARD_UNLOCK,actionData:{body:{cardId:e.cardSettings.cardId}}}}(e),u=await d.postMessage(l);return d.destroy(),ye(u)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const{uiParentElementId:t,accessToken:n,stagingToken:a,debugMode:r,mfaPreference:s,proxyRequestFunction:c}=I(e.operationSettings,{requiresUI:!0});if(function(e){if(!e)throw new i("cardSettings parameter is required for the called function");if(!e.cardId)throw new i("cardId is required for the called function");const t=X({cardId:e.cardId});if(t.length>0)throw new i(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const a=ee(n);if(a.length>0)throw new i(a)}(e.cardSettings),c){const n=F(Y({stagingToken:a})),o=await c(n),i=B(o).body;return Ee({decorationParams:e.cardSettings,operationSettings:{uiParentElementId:t,debugMode:r},cardIframeUrl:i.url})}{const i=n||o(),c=await async function(e){const t=Y(e),{embed_auth_link:n}=await j(t);return n}({...e.cardSettings,accessToken:i,stagingToken:a});return Ee({decorationParams:e.cardSettings,operationSettings:{uiParentElementId:t,debugMode:r,mfaPreference:s},cardIframeUrl:c.url})}}catch(e){return Promise.reject(e)}}},Se=Ae;function Ie(e){const t=new URLSearchParams;return e?.page&&t.append("page",e.page.toString()),e?.itemsPerPage&&t.append("per_page",e.itemsPerPage.toString()),t}function $e({endpointUrl:e,paginationSettings:t}){return function({url:e,searchParams:t}){const n=new URL(e.toString());for(const[e,a]of t.entries())n.searchParams.append(e,a);return n}({url:new URL(e),searchParams:Ie(t)})}function Re(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}function Pe(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 Ce(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const Le="/v2/sepa/beneficiaries";function Ne({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},r=Ie(e),o=r.size?`?${r.toString()}`:"";return{path:`${Le}${o}`,options:a}}function qe({beneficiaryId:e,accessToken:t,stagingToken:n}){return{path:`${Le}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}async function Oe({accessToken:e,stagingToken:t,beneficiaryId:n}){const a=qe({beneficiaryId:n,accessToken:e,stagingToken:t}),{beneficiary:r}=await j(a);return r}function De({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=ge()}){return{path:Le,options:{method:"POST",headers:{accessToken:t,stagingToken:n,idempotencyKey:a},body:{beneficiary:Ce(e)}}}}function Ue({beneficiaryIds:e,accessToken:t,stagingToken:n}){return{path:`${Le}/untrust`,options:{method:"PATCH",headers:{accessToken:t,stagingToken:n},body:{ids:e}}}}function xe({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:r}){const{name:o,email:i,activityTag:s}=e,c={method:"PATCH",headers:{accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:r},body:{beneficiary:{name:o,email:i,activity_tag:s}}};return{path:`${Le}/${e.id}`,options:c}}const Me=[{name:"name"},{name:"iban"}];const ze={getBeneficiaries:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:r}=I(e?.operationSettings||{});if(n){const e=F(Ne({paginationSettings:r})),t=B(await n(e)),a=t.body.beneficiaries.map((e=>Pe(e))),o=Re(t.body.meta);return{beneficiaries:a,...o?{meta:o}:{}}}{const e=a||o(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const a=Ne({paginationSettings:e,accessToken:t,stagingToken:n}),{beneficiaries:r,meta:o}=await j(a);return{beneficiaries:r,meta:o}}({accessToken:e,stagingToken:t,paginationSettings:r}),i=n.beneficiaries.map((e=>Pe(e))),s=Re(n.meta);return{beneficiaries:i,...s?{meta:s}:{}}}},getBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new i("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new i("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:a,accessToken:r,stagingToken:s}=I(t||{});if(a){const e=F(qe({beneficiaryId:n}));return Pe(B(await a(e)).body.beneficiary)}{const e=r||o();return Pe(await Oe({beneficiaryId:n,accessToken:e,stagingToken:s}))}},addBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new i("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new i("beneficiary must be an object");Q(e,Me);const t=X({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new i(t);return e}(e),{proxyRequestFunction:a,accessToken:r,stagingToken:s,idempotencyKey:c}=I(t||{});if(a){const e=F(De({beneficiary:n,idempotencyKey:c}));return Pe(B(await a(e)).body.beneficiary)}{const e=r||o(),t=await async function({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a=ge()}){const r=De({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:a}),{beneficiary:o}=await j(r);return o}({beneficiary:n,accessToken:e,stagingToken:s,idempotencyKey:c});return Pe(t)}},updateBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){const{id:t,name:n,email:a,activityTag:r}=e||{};if(!t)throw new i("Invalid parameters were passed to the function:\nA beneficiary ID is required for the called function");if(!n&&!a&&!r)throw new i("Invalid parameters were passed to the function:\nAt least one of the following properties must be provided: name, email, activityTag");const o=X({name:n,email:a,activityTag:r});if(o.length>0)throw new i(o);return{id:t,name:n,email:a,activityTag:r}}(e),{stagingToken:a,idempotencyKey:r,mfaPreference:s,proxyRequestFunction:c}=I(t),d={beneficiaryParamsBeingEdited:n,idempotencyKey:r,mfaPreference:s};if(c){const e=F(xe(d));return Pe(B(await c(e)).body.beneficiary)}{const e=t?.accessToken||o(),n=await async function({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:r}){const o=xe({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:a,mfaPreference:r}),{beneficiary:i}=await j(o);return i}({...d,accessToken:e,stagingToken:a});return Pe(n)}},untrustBeneficiaries:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new i("beneficiaryIds parameter is required for the called function");if(!Array.isArray(e)||!e.every((e=>"string"==typeof e)))throw new i("beneficiaryIds must be an array of strings");return e}(e?.beneficiaryIds),{proxyRequestFunction:a,accessToken:r,stagingToken:s}=I(t||{});if(a){const e=F(Ue({beneficiaryIds:n}));return B(await a(e)).body.beneficiaries.map(Pe)}{const e=r||o(),t=await async function({beneficiaryIds:e,accessToken:t,stagingToken:n}){const a=Ue({beneficiaryIds:e,accessToken:t,stagingToken:n}),{beneficiaries:r}=await j(a);return r}({beneficiaryIds:n,accessToken:e,stagingToken:s});return t.map(Pe)}}},je=ze;function Fe(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 Be(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}function He(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function Ge(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}function Ke(e){return{name:e.name,iban:e.iban}}const Ye="/v2/sepa",Ve=`${Ye}/transfers`;function We({paginationSettings:e,accessToken:t,stagingToken:n}){const a={method:"GET",headers:{accessToken:t,stagingToken:n}},r=Ie(e),o=r.size?`?${r.toString()}`:"";return{path:`${Ve}${o}`,options:a}}function Ze({sepaTransferId:e,accessToken:t,stagingToken:n}){return{path:`${Ve}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function Je({sepaTransferId:e,accessToken:t,stagingToken:n}){return{path:`${Ve}/${e}/cancel`,options:{method:"POST",headers:{accessToken:t,stagingToken:n}}}}async function Qe({sepaPayee:e,accessToken:t,stagingToken:n}){const a=function({sepaPayee:e,accessToken:t,stagingToken:n}){return{path:`${Ye}/verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:t,stagingToken:n});return await j(a)}const Xe="/v2/sepa/bulk_transfers";async function et({sepaPayees:e,accessToken:t,stagingToken:n}){const a=function({sepaPayees:e,accessToken:t,stagingToken:n}){return{path:`${Ye}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{requests:e.map(Ke)}}}}({sepaPayees:e,accessToken:t,stagingToken:n});return await j(a)}function tt(e){if(!e)throw new i("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new i("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new i("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new i("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,t)=>{!function(e,t){if(!e)throw new i(`Invalid bulkTransfer at index ${t}: bulkTransfer object is required`);if(!e.beneficiary)throw new i(`Invalid bulkTransfer at index ${t}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new i(`Invalid bulkTransfer at index ${t}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new i(`Invalid bulkTransfer at index ${t}: Beneficiary name is required as part of the beneficiary details`);const n=X({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=te({amount:e.amount}),r=[...n,...a].flat();if(r.length>0)throw new i(r);if(e.amount>p&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new i(`Invalid bulkTransfer at index ${t}: Attachments are required for transfers over €30000`)}(e,t)})),e}const nt="browser",at="server";class rt extends Error{constructor(e){switch(super(),this.name="InvalidRuntimeError",e){case nt:this.message="This code is running in a browser environment, but it is expected to run in a server environment.";break;case at:this.message="This code is running in a server environment, but it is expected to run in a browser environment.";break;default:this.message="This code is not expected to run in this environment. Check if the function was server-only or browser-only."}}}const ot=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];function it(e,t){const n=t?.locale||L.getLocale(),a=new URL(e);return n&&a.searchParams.append("lang",n),t?.mfaPreference&&a.searchParams.append("mfaPreference",t.mfaPreference),t?.idempotencyKey&&a.searchParams.append("idempotencyKey",t.idempotencyKey),a.toString()}function st(e){return{url:e.url,postAuthAction:e.post_authn_action,callbackUrl:e.callback_url,expiresAt:e.expired_at,usedAt:e.used_at}}const ct={request:async function({requestSettings:e,operationSettings:t}){!function(e){if(!e||"object"!=typeof e)throw new i("requestSettings must be an object");const t=e,{action:n,callbackUrl:a}=e;Q(t,[{name:"action"}]);const r=X(t),o=Object.values(m);if(o.includes(n)||r.push(`action must be one of ${o.join(", ")}`),r.length>0)throw new i(r);if(void 0!==a&&""===a.trim())throw new i("callbackUrl cannot be empty")}(e);const{proxyRequestFunction:n,stagingToken:a}=I(t||{});if(n){const t=F(H({stagingToken:a,action:e.action,callbackUrl:e.callbackUrl}));return st(B(await n(t)).body)}{const n=t?.accessToken||o();return st(await async function(e){const t=H({accessToken:e.accessToken,stagingToken:e.stagingToken,action:e.action,callbackUrl:e.callbackUrl}),{embed_auth_link:n}=await j(t);return{url:n.url,post_authn_action:n.post_authn_action,callback_url:n.callback_url,expired_at:n.expired_at,used_at:n.used_at}}({accessToken:n,stagingToken:a,action:e.action,callbackUrl:e.callbackUrl}))}}};async function dt(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:r}=I(e?.operationSettings||{});if(n){const e=F(We({paginationSettings:r})),t=B(await n(e)),a=t.body.transfers.map(He),o=Re(t.body.meta);return{transfers:a,...o?{meta:o}:{}}}{const e=a||o(),n=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a=We({paginationSettings:n,accessToken:e,stagingToken:t}),{transfers:r,meta:o}=await j(a);return{transfers:r,meta:o}}({accessToken:e,stagingToken:t,paginationSettings:r}),i=n.transfers.map(He),s=Re(n.meta);return{transfers:i,...s?{meta:s}:{}}}}const lt={getSepaTransfers:dt,getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=function(e){if(!e)throw new i("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new i("sepaTransferId must be a string");return e}(e?.sepaTransferId),{proxyRequestFunction:a,accessToken:r,stagingToken:s}=I(t||{});if(a){const e=F(Ze({sepaTransferId:n}));return He(B(await a(e)).body.transfer)}{const e=r||o(),t=await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const a=Ze({sepaTransferId:n,accessToken:e,stagingToken:t}),{transfer:r}=await j(a);return r}({sepaTransferId:n,accessToken:e,stagingToken:s});return He(t)}},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:t}){const a=t?.accessToken||o(),r=t?.stagingToken||n.getStagingToken(),s=t?.idempotencyKey||ge();let d;!function(e){if(!e)throw new i("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new i("sepaTransferSettings must be an object");if(Q(e,ot),!e.beneficiaryId&&!e.beneficiary)throw new i("Either beneficiaryId or beneficiary must be provided");const t=[...X({beneficiaryId:e.beneficiaryId,bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...te({amount:e.amount})].flat();if(t.length>0)throw new i(t);if(e.amount>p&&(!e.attachmentIds||0===e.attachmentIds.length))throw new i("Attachments are required for transfers over €30,000")}(e);const l=await async function({sepaTransferSettings:e,operationSettings:t}){return e?.beneficiary?e.beneficiary:Pe(await Oe({beneficiaryId:e?.beneficiaryId,accessToken:t?.accessToken,stagingToken:t?.stagingToken}))}({sepaTransferSettings:e,operationSettings:{accessToken:a,stagingToken:r||void 0}}),u={name:l.name,iban:l.iban},g=await Qe({sepaPayee:u,accessToken:a,stagingToken:r||void 0});var f;if((yield(f=g,{matchResult:f.match_result,matchedName:f.matched_name}))===h.REJECT)return;const m={...e,beneficiary:l};if(m.beneficiary?.trusted)d=await async function({transfer:e,vopProofToken:t,accessToken:n,stagingToken:a,idempotencyKey:r}){const o=Ge(e),i={method:"POST",headers:z({accessToken:n,stagingToken:a,idempotencyKey:r}),body:JSON.stringify({transfer:o,vop_proof_token:t})},s=`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}${Ve}`,c=await fetch(s,i),d=await c.json();if(d.errors)throw new U(d.errors.map((e=>`${e.code}: ${e.detail}`)));return d.transfer}({transfer:m,vopProofToken:g.proof_token.token,accessToken:a,stagingToken:r||void 0,idempotencyKey:s});else{if(!x())throw new rt(nt);const{uiParentElementId:e,debugMode:n}=I(t,{requiresUI:!0});let o;try{const t=he({accessToken:a,stagingToken:r||void 0,debugMode:n});o=await me({iframeUrl:t,parentElementId:e});const i=Ge(m);d=await o.postMessage(fe({actionId:c.TRANSFER_SINGLE_CREATE,actionData:{body:{transfer:{...i}},idempotencyKey:s}}))}finally{o?.destroy()}}return He(d)},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=function(e){if(!e)throw new i("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new i("sepaTransferId must be a string");return e}(e?.sepaTransferId),{proxyRequestFunction:a,accessToken:r,stagingToken:s}=I(t||{});if(a){const e=F(Je({sepaTransferId:n}));B(await a(e))}else{const e=r||o();await async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const a=Je({sepaTransferId:e,accessToken:t,stagingToken:n});await j(a)}({sepaTransferId:n,accessToken:e,stagingToken:s})}},getSepaTransferCreationFlowLink:async function({sepaTransferSettings:e,operationSettings:t}){const n=function(e){if(!e||!e.callbackUrl)throw new i("callbackUrl parameter is required for the getSepaTransferCreationFlowLink function");if("string"!=typeof e.callbackUrl)throw new i("callbackUrl must be a string");return e.callbackUrl}(e),{proxyRequestFunction:a,stagingToken:r,accessToken:s}=I(t||{}),c=a?{proxyRequestFunction:a}:{stagingToken:r,accessToken:s||o()},d=await ct.request({requestSettings:{action:m.SEPA_TRANSFER_CREATE,callbackUrl:n},operationSettings:c});return{...d,url:it(d.url,t)}},bulkTransfers:{getBulkTransfers:async function(e){const{operationSettings:t}=e||{},n=t?.accessToken||o(),{stagingToken:a,paginationSettings:r}=I(t||{}),i=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const a={method:"GET",headers:z({accessToken:e,stagingToken:t})},r=$e({endpointUrl:new URL(`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}${Xe}`),paginationSettings:n}),o=await fetch(r,a);if(!o.ok)throw new U("Failed to fetch SEPA bulk transfers");const i=await o.json();if(i.errors)throw new U(i.errors.map((e=>`${e.code}: ${e.detail}`)));return{bulkTransfers:i.bulk_transfers,meta:i.meta}}({accessToken:n,stagingToken:a,paginationSettings:r}),s=i.bulkTransfers?.map(Fe),c=Re(i.meta);return{bulkTransfers:s,...c?{meta:c}:{}}},getBulkTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=t?.accessToken||o(),{stagingToken:a}=I(t||{}),r=function(e){if(!e)throw new i("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new i("bulkTransferId must be a string.");return e}(e?.bulkTransferId);return Fe(await async function({accessToken:e,stagingToken:t,bulkTransferId:n}){const a={method:"GET",headers:z({accessToken:e,stagingToken:t})},r=new URL(`${A.getEnvironmentUrls().THIRD_PARTY_API_URL}${Xe}/${n}`),o=await fetch(r,a),i=await o.json();if(i.errors)throw new U(i.errors.map((e=>`${e.code}: ${e.detail}`)));return i.bulk_transfer}({accessToken:n,stagingToken:a,bulkTransferId:r}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:t}){const a=t?.accessToken||o(),r=t?.stagingToken||n.getStagingToken(),i=t?.idempotencyKey||ge();tt(e);const{uiParentElementId:s,debugMode:d}=I(t,{requiresUI:!0});if(!x())throw new rt(nt);const l=new Map;for(const t of e.bulkTransfers){const e=t.beneficiary.iban;e&&!l.has(e)&&l.set(e,{name:t.beneficiary.name,iban:e})}const u=Array.from(l.values()),g=await et({sepaPayees:u,accessToken:a,stagingToken:r||void 0});if((yield g.requests.map(Be))===h.REJECT)return;let f,p;try{const t=he({accessToken:a,stagingToken:r||void 0,debugMode:d});p=await me({iframeUrl:t,parentElementId:s});const n={bankAccountId:e.bankAccountId,bulkTransfers:e.bulkTransfers.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))};f=await p.postMessage(fe({actionId:c.TRANSFER_BULK_CREATE,actionData:{body:n,idempotencyKey:i}}))}finally{p?.destroy()}return Fe(f)}}},ut={GOOD:"good",SERVICE:"service"},gt={AED:"AED",AUD:"AUD",BGN:"BGN",CAD:"CAD",CHF:"CHF",CNY:"CNY",CZK:"CZK",DKK:"DKK",EUR:"EUR",GBP:"GBP",GHS:"GHS",HKD:"HKD",HUF:"HUF",ILS:"ILS",INR:"INR",MXN:"MXN",NOK:"NOK",NZD:"NZD",PEN:"PEN",PLN:"PLN",RON:"RON",RSD:"RSD",SAR:"SAR",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",ZAR:"ZAR",ZMW:"ZMW"},ft=e=>{if(!(e=>Object.values(gt).includes(e))(e))throw new i(`currency ${e} is not valid, valid currencies are ${Object.values(gt).join(", ")}`)},pt={UNIT:"unit",HOUR:"hour",DAY:"day",MONTH:"month",GRAM:"gram",KILOGRAM:"kilogram",LITER:"liter",METER:"meter",SQUARE_METER:"square_meter",CUBIC_METER:"cubic_meter",AMPERE:"ampere",NUMBER_OF_ARTICLES:"number_of_articles",CENTIMETER:"centimeter",CUBIC_METER_PER_HOUR:"cubic_meter_per_hour",GIGAJOULE:"gigajoule",GIGAWATT:"gigawatt",GIGAWATT_HOUR:"gigawatt_hour",HALF_YEAR:"half_year",JOULE:"joule",KILOJOULE:"kilojoule",KILOVAR:"kilovar",KILOWATT:"kilowatt",KILOWATT_HOUR:"kilowatt_hour",MEGAJOULE:"megajoule",MEGAWATT:"megawatt",MEGAWATT_HOUR:"megawatt_hour",MILLIGRAM:"milligram",MILLILITER:"milliliter",MILLIMETER:"millimeter",MINUTE:"minute",PAIR:"pair",QUARTER:"quarter",SECOND:"second",SET:"set",TON:"ton",TWO_WEEK:"two_week",WATT_HOUR:"watt_hour",WEEK:"week",YEAR:"year"},ht=e=>{if(!(e=>Object.values(pt).includes(e))(e))throw new i(`unit ${e} is not valid, valid units are ${Object.values(pt).join(", ")}`)},mt=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],bt=[{name:"currency"},{name:"value"}];const yt=e=>{if(!Object.values(ut).includes(e))throw new i(`type ${e} is not valid, valid types are ${Object.values(ut).join(", ")}`)},vt={getPaymentLinkCreationFlowUrl:({paymentLinkSettings:e})=>{const{items:t,authUrl:n}=e;!function(e){if(!e)throw new i("authUrl is required for the called function");const t=X({authUrl:e});if(t.length>0)throw new i(t);try{new URL(e)}catch{throw new i("authUrl is not a valid URL")}}(n),function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{Q(e,mt),Q(e.unitPrice,bt);const t=[...X({id:e.id,title:e.title,vatRate:e.vatRate,currency:e.unitPrice.currency,measureUnit:e.measureUnit,unitPrice:e.unitPrice.value,...e.description?{description:e.description}:{}}),...te({quantity:e.quantity})].flat();if(t.length>0)throw new i(t);yt(e.type),ft(e.unitPrice.currency),ht(e.measureUnit)}))}(t);const a=new URLSearchParams({...t?{items:JSON.stringify(t)}:{}});return a.toString()?`${n}?${a.toString()}`:n}},_t=({accessToken:e,stagingToken:t})=>({path:"/v2/organization/",options:{method:"GET",headers:{accessToken:e,stagingToken:t}}}),wt=e=>({slug:e.slug,iban:e.iban,bic:e.bic,currency:e.currency,balance:e.balance,balanceCents:e.balance_cents,authorizedBalance:e.authorized_balance,authorizedBalanceCents:e.authorized_balance_cents,name:e.name,updatedAt:new Date(e.updated_at),status:e.status,main:e.main}),Tt={getBankAccounts:async e=>{const{stagingToken:t,proxyRequestFunction:n}=I(e);if(n){const e=_t({stagingToken:t}),a=await n(F(e)),{body:r}=B(a);return r.organization.bank_accounts.map(wt)}{const n=e.accessToken||o(),a=await(async({accessToken:e,stagingToken:t})=>{const n=_t({accessToken:e,stagingToken:t});return await j(n)})({accessToken:n,stagingToken:t});return a.organization.bank_accounts.map(wt)}}},kt="/v2/transactions";function Et({bankAccountId:e,iban:t,status:n,updatedAtFrom:a,updatedAtTo:r,emittedAtFrom:o,emittedAtTo:i,settledAtFrom:s,settledAtTo:c,side:d,operationType:l,withAttachments:u,paginationSettings:g,accessToken:f,stagingToken:p}){const h={method:"GET",headers:{accessToken:f,stagingToken:p}},m=new URLSearchParams;e&&m.append("bank_account_id",e),t&&m.append("iban",t),n&&m.append("status",n),a&&m.append("updated_at_from",a),r&&m.append("updated_at_to",r),o&&m.append("emitted_at_from",o),i&&m.append("emitted_at_to",i),s&&m.append("settled_at_from",s),c&&m.append("settled_at_to",c),d&&m.append("side",d),l&&m.append("operation_type",l),void 0!==u&&m.append("with_attachments",String(u));const b=Ie(g);for(const[e,t]of b)m.append(e,t);const y=m.toString();return{path:`${kt}${y?`?${y}`:""}`,options:h}}function At({transactionId:e,accessToken:t,stagingToken:n}){return{path:`${kt}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}function St(e){return{transactionId:e.transaction_id,amount:e.amount,amountCents:e.amount_cents,settledBalance:e.settled_balance,settledBalanceCents:e.settled_balance_cents,attachmentIds:e.attachment_ids,localAmount:e.local_amount,localAmountCents:e.local_amount_cents,side:e.side,operationType:e.operation_type,currency:e.currency,localCurrency:e.local_currency,label:e.label,settledAt:new Date(e.settled_at),emittedAt:new Date(e.emitted_at),updatedAt:new Date(e.updated_at),status:e.status,note:e.note,reference:e.reference,vatAmount:e.vat_amount,vatAmountCents:e.vat_amount_cents,vatRate:e.vat_rate,initiatorId:e.initiator_id,labelIds:e.label_ids,attachmentLost:e.attachment_lost,attachmentRequired:e.attachment_required,cardLastDigits:e.card_last_digits,category:e.category,cashflowCategory:{name:e.cashflow_category?.name||""},cashflowSubcategory:{name:e.cashflow_subcategory?.name||""},id:e.id,subjectType:e.subject_type,...e.transfer?{transfer:{counterpartyAccountNumber:e.transfer.counterparty_account_number,counterpartyName:e.transfer.counterparty_name,counterpartyBic:e.transfer.counterparty_bic,counterpartyIban:e.transfer.counterparty_iban}}:{}}}const It={getTransactions:async function(e){const{stagingToken:t,proxyRequestFunction:n,accessToken:a,paginationSettings:r}=I(e?.operationSettings||{}),i={...e?.transactionSettings||{},paginationSettings:r};if(n){const e=F(Et(i)),t=B(await n(e));return{transactions:t.body.transactions.map(St),meta:t.body.meta}}{const e=a||o(),n=await async function(e){const t=Et(e),{transactions:n,meta:a}=await j(t);return{transactions:n,meta:a}}({...i,accessToken:e,stagingToken:t});return{transactions:n.transactions.map(St),meta:n.meta}}},getTransaction:async function({transactionSettings:e,operationSettings:t}){const{proxyRequestFunction:n,accessToken:a,stagingToken:r}=I(t||{}),{transactionId:s}=function(e){if(!e)throw new i("transactionSettings parameter is required for the called function");if(!e.transactionId)throw new i("transactionSettings.transactionId parameter is required for the called function");if(e.transactionId&&"string"!=typeof e.transactionId)throw new i("transactionSettings.transactionId must be a string.");return e}(e);if(n){const e=F(At({transactionId:s}));return St(B(await n(e)).body.transaction)}{const e=a||o();return St(await async function(e){const t=At(e),{transaction:n}=await j(t);return n}({transactionId:s,accessToken:e,stagingToken:r}))}}},$t=It;function Rt(e,t,n,a){var r,o=arguments.length,i=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(i=(o<3?r(i):o>3?r(t,n,i):r(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i}"function"==typeof SuppressedError&&SuppressedError;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
@@ -15,7 +15,7 @@ const Pt=globalThis,Ct=Pt.ShadowRoot&&(void 0===Pt.ShadyCSS||Pt.ShadyCSS.nativeS
|
|
|
15
15
|
* Copyright 2017 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
17
|
*/
|
|
18
|
-
const Qt=globalThis,Xt=Qt.trustedTypes,en=Xt?Xt.createPolicy("lit-html",{createHTML:e=>e}):void 0,tn="$lit$",nn=`lit$${Math.random().toFixed(9).slice(2)}$`,an="?"+nn,rn=`<${an}>`,on=document,sn=()=>on.createComment(""),cn=e=>null===e||"object"!=typeof e&&"function"!=typeof e,dn=Array.isArray,ln="[ \t\n\f\r]",un=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gn=/-->/g,fn=/>/g,pn=RegExp(`>|${ln}(?:([^\\s"'>=/]+)(${ln}*=${ln}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
18
|
+
const Qt=globalThis,Xt=Qt.trustedTypes,en=Xt?Xt.createPolicy("lit-html",{createHTML:e=>e}):void 0,tn="$lit$",nn=`lit$${Math.random().toFixed(9).slice(2)}$`,an="?"+nn,rn=`<${an}>`,on=document,sn=()=>on.createComment(""),cn=e=>null===e||"object"!=typeof e&&"function"!=typeof e,dn=Array.isArray,ln="[ \t\n\f\r]",un=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gn=/-->/g,fn=/>/g,pn=RegExp(`>|${ln}(?:([^\\s"'>=/]+)(${ln}*=${ln}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),hn=/'/g,mn=/"/g,bn=/^(?:script|style|textarea|title)$/i,yn=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),vn=yn(1),_n=yn(2),wn=Symbol.for("lit-noChange"),Tn=Symbol.for("lit-nothing"),kn=new WeakMap,En=on.createTreeWalker(on,129);function An(e,t){if(!dn(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==en?en.createHTML(t):t}const Sn=(e,t)=>{const n=e.length-1,a=[];let r,o=2===t?"<svg>":3===t?"<math>":"",i=un;for(let t=0;t<n;t++){const n=e[t];let s,c,d=-1,l=0;for(;l<n.length&&(i.lastIndex=l,c=i.exec(n),null!==c);)l=i.lastIndex,i===un?"!--"===c[1]?i=gn:void 0!==c[1]?i=fn:void 0!==c[2]?(bn.test(c[2])&&(r=RegExp("</"+c[2],"g")),i=pn):void 0!==c[3]&&(i=pn):i===pn?">"===c[0]?(i=r??un,d=-1):void 0===c[1]?d=-2:(d=i.lastIndex-c[2].length,s=c[1],i=void 0===c[3]?pn:'"'===c[3]?mn:hn):i===mn||i===hn?i=pn:i===gn||i===fn?i=un:(i=pn,r=void 0);const u=i===pn&&e[t+1].startsWith("/>")?" ":"";o+=i===un?n+rn:d>=0?(a.push(s),n.slice(0,d)+tn+n.slice(d)+nn+u):n+nn+(-2===d?t:u)}return[An(e,o+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),a]};class In{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let r=0,o=0;const i=e.length-1,s=this.parts,[c,d]=Sn(e,t);if(this.el=In.createElement(c,n),En.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=En.nextNode())&&s.length<i;){if(1===a.nodeType){if(a.hasAttributes())for(const e of a.getAttributeNames())if(e.endsWith(tn)){const t=d[o++],n=a.getAttribute(e).split(nn),i=/([.?@])?(.*)/.exec(t);s.push({type:1,index:r,name:i[2],strings:n,ctor:"."===i[1]?Ln:"?"===i[1]?Nn:"@"===i[1]?qn:Cn}),a.removeAttribute(e)}else e.startsWith(nn)&&(s.push({type:6,index:r}),a.removeAttribute(e));if(bn.test(a.tagName)){const e=a.textContent.split(nn),t=e.length-1;if(t>0){a.textContent=Xt?Xt.emptyScript:"";for(let n=0;n<t;n++)a.append(e[n],sn()),En.nextNode(),s.push({type:2,index:++r});a.append(e[t],sn())}}}else if(8===a.nodeType)if(a.data===an)s.push({type:2,index:r});else{let e=-1;for(;-1!==(e=a.data.indexOf(nn,e+1));)s.push({type:7,index:r}),e+=nn.length-1}r++}}static createElement(e,t){const n=on.createElement("template");return n.innerHTML=e,n}}function $n(e,t,n=e,a){if(t===wn)return t;let r=void 0!==a?n._$Co?.[a]:n._$Cl;const o=cn(t)?void 0:t._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),void 0===o?r=void 0:(r=new o(e),r._$AT(e,n,a)),void 0!==a?(n._$Co??=[])[a]=r:n._$Cl=r),void 0!==r&&(t=$n(e,r._$AS(e,t.values),r,a)),t}class Rn{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,a=(e?.creationScope??on).importNode(t,!0);En.currentNode=a;let r=En.nextNode(),o=0,i=0,s=n[0];for(;void 0!==s;){if(o===s.index){let t;2===s.type?t=new Pn(r,r.nextSibling,this,e):1===s.type?t=new s.ctor(r,s.name,s.strings,this,e):6===s.type&&(t=new On(r,this,e)),this._$AV.push(t),s=n[++i]}o!==s?.index&&(r=En.nextNode(),o++)}return En.currentNode=on,a}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Pn{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,a){this.type=2,this._$AH=Tn,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=$n(this,e,t),cn(e)?e===Tn||null==e||""===e?(this._$AH!==Tn&&this._$AR(),this._$AH=Tn):e!==this._$AH&&e!==wn&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>dn(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Tn&&cn(this._$AH)?this._$AA.nextSibling.data=e:this.T(on.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=In.createElement(An(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new Rn(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=kn.get(e.strings);return void 0===t&&kn.set(e.strings,t=new In(e)),t}k(e){dn(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const r of e)a===t.length?t.push(n=new Pn(this.O(sn()),this.O(sn()),this,this.options)):n=t[a],n._$AI(r),a++;a<t.length&&(this._$AR(n&&n._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class Cn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,a,r){this.type=1,this._$AH=Tn,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Tn}_$AI(e,t=this,n,a){const r=this.strings;let o=!1;if(void 0===r)e=$n(this,e,t,0),o=!cn(e)||e!==this._$AH&&e!==wn,o&&(this._$AH=e);else{const a=e;let i,s;for(e=r[0],i=0;i<r.length-1;i++)s=$n(this,a[n+i],t,i),s===wn&&(s=this._$AH[i]),o||=!cn(s)||s!==this._$AH[i],s===Tn?e=Tn:e!==Tn&&(e+=(s??"")+r[i+1]),this._$AH[i]=s}o&&!a&&this.j(e)}j(e){e===Tn?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Ln extends Cn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Tn?void 0:e}}class Nn extends Cn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Tn)}}class qn extends Cn{constructor(e,t,n,a,r){super(e,t,n,a,r),this.type=5}_$AI(e,t=this){if((e=$n(this,e,t,0)??Tn)===wn)return;const n=this._$AH,a=e===Tn&&n!==Tn||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==Tn&&(n===Tn||a);a&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class On{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){$n(this,e)}}const Dn=Qt.litHtmlPolyfillSupport;Dn?.(In,Pn),(Qt.litHtmlVersions??=[]).push("3.3.1");const Un=globalThis;
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
@@ -78,7 +78,7 @@ class Xn{constructor(){this.settled=!1,this.promise=new Promise(((e,t)=>{this._r
|
|
|
78
78
|
* @license
|
|
79
79
|
* Copyright 2021 Google LLC
|
|
80
80
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
81
|
-
*/(t),r=e[a];if(r){if("string"==typeof r)return r;if("strTag"in r)return Yn(r.strings,t.values,r.values);{let e=na.get(r);return void 0===e&&(e=r.values,na.set(r,e)),{...r,values:e.map((e=>t.values[e]))}}}}return Vn(t)}function oa(e){window.dispatchEvent(new CustomEvent(Gn,{detail:e}))}let ia,sa,ca,da,la,ua="",ga=new Xn;ga.resolve();let fa=0;const pa=()=>ua,
|
|
81
|
+
*/(t),r=e[a];if(r){if("string"==typeof r)return r;if("strTag"in r)return Yn(r.strings,t.values,r.values);{let e=na.get(r);return void 0===e&&(e=r.values,na.set(r,e)),{...r,values:e.map((e=>t.values[e]))}}}}return Vn(t)}function oa(e){window.dispatchEvent(new CustomEvent(Gn,{detail:e}))}let ia,sa,ca,da,la,ua="",ga=new Xn;ga.resolve();let fa=0;const pa=()=>ua,ha=e=>{if(e===(ia??ua))return ga.promise;if(!ca||!da)throw new Error("Internal error");if(!ca.has(e))throw new Error("Invalid locale code");fa++;const t=fa;ia=e,ga.settled&&(ga=new Xn),oa({status:"loading",loadingLocale:e});return(e===sa?Promise.resolve({templates:void 0}):da(e)).then((n=>{fa===t&&(ua=e,ia=void 0,la=n.templates,oa({status:"ready",readyLocale:e}),ga.resolve())}),(n=>{fa===t&&(oa({status:"error",errorLocale:e,errorMessage:n.toString()}),ga.reject(n))})),ga.promise},ma=Ot`
|
|
82
82
|
:host {
|
|
83
83
|
--default-table-border: 1px solid var(--border-tertiary);
|
|
84
84
|
|
|
@@ -448,7 +448,39 @@ const Wa=2;class Za{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n)
|
|
|
448
448
|
* @license
|
|
449
449
|
* Copyright 2017 Google LLC
|
|
450
450
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
451
|
-
*/class Ja extends Za{constructor(e){if(super(e),this.it=Tn,e.type!==Wa)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Tn||null==e)return this._t=void 0,this.it=e;if(e===wn)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Ja.directiveName="unsafeHTML",Ja.resultType=1;const Qa=(e=>(...t)=>({_$litDirective$:e,values:t}))(Ja)
|
|
451
|
+
*/class Ja extends Za{constructor(e){if(super(e),this.it=Tn,e.type!==Wa)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Tn||null==e)return this._t=void 0,this.it=e;if(e===wn)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Ja.directiveName="unsafeHTML",Ja.resultType=1;const Qa=(e=>(...t)=>({_$litDirective$:e,values:t}))(Ja),Xa=Ot`
|
|
452
|
+
:host {
|
|
453
|
+
display: block;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.skeleton-line {
|
|
457
|
+
position: relative;
|
|
458
|
+
display: block;
|
|
459
|
+
width: 100%;
|
|
460
|
+
height: 8px;
|
|
461
|
+
overflow: hidden;
|
|
462
|
+
background: var(--background-placeholder);
|
|
463
|
+
background-size: 200% 100%;
|
|
464
|
+
border-radius: var(--qonto-embed-skeleton-border-radius, 50px);
|
|
465
|
+
animation: shimmer 1.5s linear infinite;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
@keyframes shimmer {
|
|
469
|
+
0% {
|
|
470
|
+
background-position: 200% 0;
|
|
471
|
+
}
|
|
472
|
+
100% {
|
|
473
|
+
background-position: -200% 0;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
`;let er=class extends xn{constructor(){super(...arguments),this.standalone=!1}render(){return vn`<div
|
|
477
|
+
class="skeleton-line"
|
|
478
|
+
style="
|
|
479
|
+
${this.width?`width: ${this.width};`:""}
|
|
480
|
+
${this.height?`height: ${this.height};`:""}
|
|
481
|
+
${this.borderRadius?`border-radius: ${this.borderRadius};`:""}
|
|
482
|
+
"
|
|
483
|
+
></div>`}};er.styles=Xa,Rt([Bn({type:String})],er.prototype,"width",void 0),Rt([Bn({type:String})],er.prototype,"height",void 0),Rt([Bn({type:String})],er.prototype,"borderRadius",void 0),Rt([Bn({type:Boolean})],er.prototype,"standalone",void 0),er=Rt([zn("qonto-skeleton-loader-line")],er);const tr=["de","es","fr","it","nl","pt"],nr={s09ca90bfc68e29fc:"Fecha prevista",s0fbf6dc6a1966408:"Siguiente",s12bda6ed4915b346:"En proceso",s270283cc22e1d66b:Kn`Mostrando página ${0} de ${1} (${2} elementos en total)`,s5033dab8c17f05f2:"Completado",s6686fcc6d2c8f0bd:"Nota",s78636b92c1a3909c:"Pendiente",s9b6901ac422f46a7:"Rechazado",sa30c4d3b566b6b1a:"Cancelado",sad3e3c8146fc920f:"Estado",sba98a7152d80b949:"Importe",sbf9c5c5a8e5efad4:"Fallido",sf3ff78cc329d3528:"Anterior",sfda3e4a519cfc5ba:"Liquidado",sfe88d270aa3e71da:"Referencia"};const ar={s09ca90bfc68e29fc:"Date prévue",s0fbf6dc6a1966408:"Suivant",s12bda6ed4915b346:"En cours",s270283cc22e1d66b:Kn`Affichage de la page ${0} sur ${1} (${2} éléments au total)`,s5033dab8c17f05f2:"Terminé",s6686fcc6d2c8f0bd:"Note",s78636b92c1a3909c:"En attente",s9b6901ac422f46a7:"Refusé",sa30c4d3b566b6b1a:"Annulé",sad3e3c8146fc920f:"Statut",sba98a7152d80b949:"Montant",sbf9c5c5a8e5efad4:"Échoué",sf3ff78cc329d3528:"Précédent",sfda3e4a519cfc5ba:"Réglé",sfe88d270aa3e71da:"Référence"};const rr={s09ca90bfc68e29fc:"Geplantes Datum",s0fbf6dc6a1966408:"Nächste",s12bda6ed4915b346:"In Bearbeitung",s270283cc22e1d66b:Kn`Seite ${0} von ${1} anzeigen (${2} Gesamtelemente)`,s5033dab8c17f05f2:"Abgeschlossen",s6686fcc6d2c8f0bd:"Notiz",s78636b92c1a3909c:"Ausstehend",s9b6901ac422f46a7:"Abgelehnt",sa30c4d3b566b6b1a:"Abgebrochen",sad3e3c8146fc920f:"Status",sba98a7152d80b949:"Betrag",sbf9c5c5a8e5efad4:"Fehlgeschlagen",sf3ff78cc329d3528:"Vorherige",sfda3e4a519cfc5ba:"Abgerechnet",sfe88d270aa3e71da:"Referenz"};const or={s09ca90bfc68e29fc:"Geplande datum",s0fbf6dc6a1966408:"Volgende",s12bda6ed4915b346:"Bezig met verwerken",s270283cc22e1d66b:Kn`Pagina ${0} van ${1} weergeven (${2} totaal aantal items)`,s5033dab8c17f05f2:"Voltooid",s6686fcc6d2c8f0bd:"Notitie",s78636b92c1a3909c:"In afwachting",s9b6901ac422f46a7:"Geweigerd",sa30c4d3b566b6b1a:"Geannuleerd",sad3e3c8146fc920f:"Status",sba98a7152d80b949:"Bedrag",sbf9c5c5a8e5efad4:"Mislukt",sf3ff78cc329d3528:"Vorige",sfda3e4a519cfc5ba:"Afgehandeld",sfe88d270aa3e71da:"Referentie"};const ir={s09ca90bfc68e29fc:"Data agendada",s0fbf6dc6a1966408:"Próximo",s12bda6ed4915b346:"Em processamento",s270283cc22e1d66b:Kn`Mostrando página ${0} de ${1} (${2} itens no total)`,s5033dab8c17f05f2:"Concluído",s6686fcc6d2c8f0bd:"Nota",s78636b92c1a3909c:"Pendente",s9b6901ac422f46a7:"Recusado",sa30c4d3b566b6b1a:"Cancelado",sad3e3c8146fc920f:"Estado",sba98a7152d80b949:"Quantidade",sbf9c5c5a8e5efad4:"Falhou",sf3ff78cc329d3528:"Anterior",sfda3e4a519cfc5ba:"Liquidado",sfe88d270aa3e71da:"Referência"};const sr={s09ca90bfc68e29fc:"Data programmata",s0fbf6dc6a1966408:"Successivo",s12bda6ed4915b346:"In elaborazione",s270283cc22e1d66b:Kn`Mostra pagina ${0} di ${1} (${2} elementi totali)`,s5033dab8c17f05f2:"Completato",s6686fcc6d2c8f0bd:"Nota",s78636b92c1a3909c:"In sospeso",s9b6901ac422f46a7:"Rifiutato",sa30c4d3b566b6b1a:"Annullato",sad3e3c8146fc920f:"Stato",sba98a7152d80b949:"Importo",sbf9c5c5a8e5efad4:"Non riuscito",sf3ff78cc329d3528:"Precedente",sfda3e4a519cfc5ba:"Regolato",sfe88d270aa3e71da:"Causale"};const cr={es:Object.freeze({__proto__:null,templates:nr}),fr:Object.freeze({__proto__:null,templates:ar}),de:Object.freeze({__proto__:null,templates:rr}),nl:Object.freeze({__proto__:null,templates:or}),pt:Object.freeze({__proto__:null,templates:ir}),it:Object.freeze({__proto__:null,templates:sr})},{getLocale:dr,setLocale:lr}=(ur={sourceLocale:"en",targetLocales:tr,loadLocale:(e="en")=>new Promise((t=>t(cr[e])))},function(e){if(Zn)throw new Error("lit-localize can only be configured once");Wn=e,Zn=!0}(((e,t)=>ra(la,e,t))),ua=sa=ur.sourceLocale,ca=new Set(ur.targetLocales),ca.add(ur.sourceLocale),da=ur.loadLocale,{getLocale:pa,setLocale:ha});var ur;const gr=Ot`
|
|
452
484
|
button {
|
|
453
485
|
--focus-outline-color: var(--border-accent-low);
|
|
454
486
|
--bg-color: var(--qonto-embed-color-primary, var(--background-primary));
|
|
@@ -600,12 +632,12 @@ const Wa=2;class Za{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n)
|
|
|
600
632
|
}
|
|
601
633
|
}
|
|
602
634
|
}
|
|
603
|
-
`;let
|
|
635
|
+
`;let fr=class extends xn{constructor(){super(...arguments),this.variant="primary",this.disabled=!1}render(){return vn`<button
|
|
604
636
|
data-variant="${this.variant}"
|
|
605
637
|
.disabled=${this.disabled}
|
|
606
638
|
>
|
|
607
639
|
<slot></slot>
|
|
608
|
-
</button>`}};
|
|
640
|
+
</button>`}};fr.styles=gr,Rt([Bn({type:String})],fr.prototype,"variant",void 0),Rt([Bn({type:Boolean})],fr.prototype,"disabled",void 0),fr=Rt([zn("qonto-button")],fr);let pr=class extends xn{constructor(){super(...arguments),this.locale="en",this.isLoading=!1}connectedCallback(){super.connectedCallback(),lr(this.locale),this.fetchTransfers()}updated(e){e.has("locale")&&lr(this.locale)}async fetchTransfers(e){if(this.operationSettings){this.isLoading=!0,this.error=void 0;try{const{paginationSettings:t={}}=this.operationSettings,n=await dt({operationSettings:{...this.operationSettings,paginationSettings:{page:e??t.page??1,itemsPerPage:t.itemsPerPage??20}}});this.transfers=n.transfers,this.paginationState=n.meta}catch(e){console.error("Failed to load SEPA transfers:",e),this.error="Failed to load transfers. Please try again."}finally{this.isLoading=!1}}else console.error("operationSettings is required to fetch transfers")}handleRowClick(e){this.dispatchEvent(new Na({transfer:e}))}handlePreviousPage(){this.paginationState?.previousPage&&(this.transfers=void 0,this.fetchTransfers(this.paginationState.previousPage))}handleNextPage(){this.paginationState?.nextPage&&(this.transfers=void 0,this.fetchTransfers(this.paginationState.nextPage))}render(){return this.error?vn`<div data-error>${this.error}</div>`:vn`
|
|
609
641
|
<table>
|
|
610
642
|
<thead>
|
|
611
643
|
<tr>
|
|
@@ -617,11 +649,11 @@ const Wa=2;class Za{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n)
|
|
|
617
649
|
</tr>
|
|
618
650
|
</thead>
|
|
619
651
|
<tbody>
|
|
620
|
-
${this.isLoading||!this.transfers?function(){const
|
|
652
|
+
${this.isLoading||!this.transfers?function(e=3){const t=Array.from({length:e},(()=>'\n <tr>\n <td><qonto-skeleton-loader-line width="80px"></qonto-skeleton-loader-line></td>\n <td><qonto-skeleton-loader-line width="120px"></qonto-skeleton-loader-line></td>\n <td><qonto-skeleton-loader-line width="150px"></qonto-skeleton-loader-line></td>\n <td><qonto-skeleton-loader-line width="100px"></qonto-skeleton-loader-line></td>\n <td><qonto-skeleton-loader-line width="60px"></qonto-skeleton-loader-line></td>\n </tr>\n ')).join("");return Qa(t)}(this.paginationState?.itemsPerPage):""}
|
|
621
653
|
${0===this.transfers?.length?"There are no transfers yet":this.transfers?.map((e=>vn`
|
|
622
654
|
<tr @click=${()=>this.handleRowClick(e)}>
|
|
623
655
|
<td>
|
|
624
|
-
${wa({date:e.scheduledDate,locale:
|
|
656
|
+
${wa({date:e.scheduledDate,locale:dr(),token:"date-year-s"})}
|
|
625
657
|
</td>
|
|
626
658
|
<td>${e.reference}</td>
|
|
627
659
|
<td>${e.note}</td>
|
|
@@ -632,7 +664,7 @@ const Wa=2;class Za{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n)
|
|
|
632
664
|
>
|
|
633
665
|
</td>
|
|
634
666
|
<td>
|
|
635
|
-
${La({amount:e.amount,currency:e.amountCurrency,locale:
|
|
667
|
+
${La({amount:e.amount,currency:e.amountCurrency,locale:dr(),token:"money-iso-sign-decimal"})}
|
|
636
668
|
</td>
|
|
637
669
|
</tr>
|
|
638
670
|
`))}
|
|
@@ -655,4 +687,4 @@ const Wa=2;class Za{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n)
|
|
|
655
687
|
>${Wn("Next")}</qonto-button
|
|
656
688
|
</div>
|
|
657
689
|
</div>`:""}
|
|
658
|
-
`}};
|
|
690
|
+
`}};pr.styles=ma,Rt([Bn({type:Object})],pr.prototype,"operationSettings",void 0),Rt([Bn({type:String})],pr.prototype,"locale",void 0),Rt([Hn()],pr.prototype,"transfers",void 0),Rt([Hn()],pr.prototype,"paginationState",void 0),Rt([Hn()],pr.prototype,"isLoading",void 0),Rt([Hn()],pr.prototype,"error",void 0),pr=Rt([(e,t)=>(e.addInitializer(Qn),e),zn("qonto-transfer-list")],pr);const hr={TRANSFER_LIST:"transfer-list"};class mr extends a{constructor(e){super(),this.name="EmbedUIElementError",this.message=e}}const br={createUIElement:async e=>{if(M())return;const{uiElementSettings:t,operationSettings:n={}}=e,{uiElementName:a}=function(e){if(!e?.uiElementName)throw new i("uiElementSettings.uiElementName is required when calling createUIElement");const t=Object.values(hr);if(!t.includes(e?.uiElementName))throw new i(`uiElementSettings.uiElementName must be one of ${t.join(", ")}`);return{uiElementName:e.uiElementName}}(t),{uiParentElementId:r}=I(n,{requiresUI:!0}),o=document.getElementById(r);if(!o)throw new mr(`Could not find container element with id: ${r}`);if(a===hr.TRANSFER_LIST)return void function({containerElement:e,uiElementSettings:t,operationSettings:n}){const a=document.createElement("qonto-transfer-list");a.operationSettings=n,a.locale=n?.locale||L.getLocale(),a.addEventListener("transfer-selected",(e=>{t?.uiElementEventListener?.({eventName:"transfer-selected",eventDetail:e.detail})})),e.appendChild(a)}({containerElement:o,uiElementSettings:t,operationSettings:n});const s=document.createElement(`qonto-${a}`);o.appendChild(s)}};e.authLinks=ct,e.beneficiaries=je,e.cards=Se,e.constants=D,e.initialize=q,e.logout=O,e.organizations=Tt,e.paymentLinks=vt,e.sepaTransfers=lt,e.transactions=$t,e.ui=br}));
|
|
@@ -69,6 +69,8 @@ export declare const ACCOUNT_STATUS: {
|
|
|
69
69
|
readonly PENDING: "pending";
|
|
70
70
|
};
|
|
71
71
|
export type OrganizationDataObject = {
|
|
72
|
-
|
|
72
|
+
organization: {
|
|
73
|
+
bank_accounts: BankAccountDataObject[];
|
|
74
|
+
};
|
|
73
75
|
};
|
|
74
76
|
//# sourceMappingURL=organizations.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizations.types.d.ts","sourceRoot":"","sources":["../../src/organizations/organizations.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wBAAwB,EAAE,MAAM,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,IAAI,CAAC;IACjB,MAAM,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;IAC7D,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;IAC7D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,qBAAqB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"organizations.types.d.ts","sourceRoot":"","sources":["../../src/organizations/organizations.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wBAAwB,EAAE,MAAM,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,IAAI,CAAC;IACjB,MAAM,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;IAC7D,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;IAC7D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE;QACZ,aAAa,EAAE,qBAAqB,EAAE,CAAC;KACxC,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{QontoEmbedSdkError as r}from"./QontoEmbedSdkError.js";class e extends r{constructor(r){super(),this.name="EmbedUIElementError",this.message=r}}export{e as EmbedUIElementError};
|
package/dist/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{constants,initialize,logout}from"./common/index.js";export{cards}from"./cards/index.js";export{beneficiaries}from"./beneficiaries/index.js";export{sepaTransfers}from"./sepa-transfers/index.js";export{paymentLinks}from"./payment-links/index.js";export{organizations}from"./organizations/index.js";export{transactions}from"./transactions/index.js";export{authLinks}from"./auth-links/index.js";export{
|
|
1
|
+
export{constants,initialize,logout}from"./common/index.js";export{cards}from"./cards/index.js";export{beneficiaries}from"./beneficiaries/index.js";export{sepaTransfers}from"./sepa-transfers/index.js";export{paymentLinks}from"./payment-links/index.js";export{organizations}from"./organizations/index.js";export{transactions}from"./transactions/index.js";export{authLinks}from"./auth-links/index.js";export{ui}from"./ui/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeNetworkCall as n}from"../common/network/network.js";const o=({accessToken:n,stagingToken:o})=>({path:"/v2/
|
|
1
|
+
import{makeNetworkCall as n}from"../common/network/network.js";const o=({accessToken:n,stagingToken:o})=>({path:"/v2/organization/",options:{method:"GET",headers:{accessToken:n,stagingToken:o}}}),e=async({accessToken:e,stagingToken:s})=>{const t=o({accessToken:e,stagingToken:s});return await n(t)};export{e as getOrganization,o as prepareGetOrganization};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../common/auth/auth.js";import{validatePresenceOfAuthToken as o}from"../common/auth/auth.validate.js";import{prepareGetOrganization as
|
|
1
|
+
import"../common/auth/auth.js";import{validatePresenceOfAuthToken as o}from"../common/auth/auth.validate.js";import{prepareGetOrganization as n,getOrganization as t}from"./organizations.api.js";import{serializeBankAccount as a}from"./organizations.serializer.js";import{validateOperationSettingsParams as i}from"../validation/operation-settings-validation.js";import{encodeNetworkCall as r,decodeNetworkResponse as s}from"../common/network/network.js";const e=async e=>{const{stagingToken:m,proxyRequestFunction:c}=i(e);if(c){const o=n({stagingToken:m}),t=await c(r(o)),{body:i}=s(t);return i.organization.bank_accounts.map(a)}{const n=e.accessToken||o();return(await t({accessToken:n,stagingToken:m})).organization.bank_accounts.map(a)}};export{e as getBankAccounts};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{__decorate as e}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.39.0_tslib@2.8.1_typescript@5.8.3/node_modules/tslib/tslib.es6.js";import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";import{html as t}from"../../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";import{LitElement as o}from"../../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";import{customElement as l}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as s}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";import{qontoSkeletonLoaderLineStyles as i}from"./qonto-skeleton-loader-line.styles.js";import"../styles/styles.css.js";let r=class extends o{constructor(){super(...arguments),this.standalone=!1}render(){return t`<div
|
|
2
|
+
class="skeleton-line"
|
|
3
|
+
style="
|
|
4
|
+
${this.width?`width: ${this.width};`:""}
|
|
5
|
+
${this.height?`height: ${this.height};`:""}
|
|
6
|
+
${this.borderRadius?`border-radius: ${this.borderRadius};`:""}
|
|
7
|
+
"
|
|
8
|
+
></div>`}};r.styles=i,e([s({type:String})],r.prototype,"width",void 0),e([s({type:String})],r.prototype,"height",void 0),e([s({type:String})],r.prototype,"borderRadius",void 0),e([s({type:Boolean})],r.prototype,"standalone",void 0),r=e([l("qonto-skeleton-loader-line")],r);export{r as QontoSkeletonLoaderLine};
|
package/dist/src/ui/customizable-components/skeleton-loader/qonto-skeleton-loader-line.styles.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";import"../../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";import"../../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";import{css as e}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js";const o=e`
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.skeleton-line {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: block;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 8px;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
background: var(--background-placeholder);
|
|
13
|
+
background-size: 200% 100%;
|
|
14
|
+
border-radius: var(--qonto-embed-skeleton-border-radius, 50px);
|
|
15
|
+
animation: shimmer 1.5s linear infinite;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@keyframes shimmer {
|
|
19
|
+
0% {
|
|
20
|
+
background-position: 200% 0;
|
|
21
|
+
}
|
|
22
|
+
100% {
|
|
23
|
+
background-position: -200% 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`;export{o as qontoSkeletonLoaderLineStyles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as t}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.39.0_tslib@2.8.1_typescript@5.8.3/node_modules/tslib/tslib.es6.js";import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";import{html as e}from"../../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";import{LitElement as o}from"../../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";import{customElement as i}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as s}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";import{state as a}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";import{str as n}from"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/str-tag.js";import{msg as r}from"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/install.js";import{localized as l}from"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/localized-decorator.js";import"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/runtime.js";import{transferListStyles as d}from"./transfer-list.styles.js";import"../styles/styles.css.js";import{formatDate as m}from"../utils/format-date.js";import{formatMoney as p}from"../utils/format-money.js";import{TransferSelectedEvent as c}from"./transfer-list.events.js";import{renderLoadingTableRowsMarkup as
|
|
1
|
+
import{__decorate as t}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.39.0_tslib@2.8.1_typescript@5.8.3/node_modules/tslib/tslib.es6.js";import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";import{html as e}from"../../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";import{LitElement as o}from"../../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";import{customElement as i}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as s}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";import{state as a}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";import{str as n}from"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/str-tag.js";import{msg as r}from"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/install.js";import{localized as l}from"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/localized-decorator.js";import"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/runtime.js";import{transferListStyles as d}from"./transfer-list.styles.js";import"../styles/styles.css.js";import{formatDate as m}from"../utils/format-date.js";import{formatMoney as p}from"../utils/format-money.js";import{TransferSelectedEvent as c}from"./transfer-list.events.js";import{renderLoadingTableRowsMarkup as h,mapTransferStatusToBadgeLevel as u}from"./transfer-list.utils.js";import{getSepaTransfers as g}from"../../../sepa-transfers/sepa-transfers.js";import{setLocale as f,getLocale as v}from"../localize/configure-localization.js";import"../button/qonto-button.js";import{TRANSFER_STATUSES as _}from"../../../common/constants.js";let y=class extends o{constructor(){super(...arguments),this.locale="en",this.isLoading=!1}connectedCallback(){super.connectedCallback(),f(this.locale),this.fetchTransfers()}updated(t){t.has("locale")&&f(this.locale)}async fetchTransfers(t){if(this.operationSettings){this.isLoading=!0,this.error=void 0;try{const{paginationSettings:e={}}=this.operationSettings,o=await g({operationSettings:{...this.operationSettings,paginationSettings:{page:t??e.page??1,itemsPerPage:e.itemsPerPage??20}}});this.transfers=o.transfers,this.paginationState=o.meta}catch(t){console.error("Failed to load SEPA transfers:",t),this.error="Failed to load transfers. Please try again."}finally{this.isLoading=!1}}else console.error("operationSettings is required to fetch transfers")}handleRowClick(t){this.dispatchEvent(new c({transfer:t}))}handlePreviousPage(){this.paginationState?.previousPage&&(this.transfers=void 0,this.fetchTransfers(this.paginationState.previousPage))}handleNextPage(){this.paginationState?.nextPage&&(this.transfers=void 0,this.fetchTransfers(this.paginationState.nextPage))}render(){return this.error?e`<div data-error>${this.error}</div>`:e`
|
|
2
2
|
<table>
|
|
3
3
|
<thead>
|
|
4
4
|
<tr>
|
|
@@ -10,22 +10,22 @@ import{__decorate as t}from"../../../../node_modules/.pnpm/@rollup_plugin-typesc
|
|
|
10
10
|
</tr>
|
|
11
11
|
</thead>
|
|
12
12
|
<tbody>
|
|
13
|
-
${this.isLoading||!this.transfers?
|
|
13
|
+
${this.isLoading||!this.transfers?h(this.paginationState?.itemsPerPage):""}
|
|
14
14
|
${0===this.transfers?.length?"There are no transfers yet":this.transfers?.map((t=>e`
|
|
15
15
|
<tr @click=${()=>this.handleRowClick(t)}>
|
|
16
16
|
<td>
|
|
17
|
-
${m({date:t.scheduledDate,locale:
|
|
17
|
+
${m({date:t.scheduledDate,locale:v(),token:"date-year-s"})}
|
|
18
18
|
</td>
|
|
19
19
|
<td>${t.reference}</td>
|
|
20
20
|
<td>${t.note}</td>
|
|
21
21
|
<td>
|
|
22
22
|
<qonto-badge-status
|
|
23
|
-
level="${
|
|
24
|
-
>${function(t){switch(t){case
|
|
23
|
+
level="${u(t.status)}"
|
|
24
|
+
>${function(t){switch(t){case _.PENDING:return r("Pending");case _.PROCESSING:return r("Processing");case _.CANCELED:return r("Canceled");case _.DECLINED:return r("Declined");case _.SETTLED:return r("Settled");case _.FAILED:return r("Failed");case _.COMPLETED:return r("Completed");default:return t}}(t.status)}</qonto-badge-status
|
|
25
25
|
>
|
|
26
26
|
</td>
|
|
27
27
|
<td>
|
|
28
|
-
${p({amount:t.amount,currency:t.amountCurrency,locale:
|
|
28
|
+
${p({amount:t.amount,currency:t.amountCurrency,locale:v(),token:"money-iso-sign-decimal"})}
|
|
29
29
|
</td>
|
|
30
30
|
</tr>
|
|
31
31
|
`))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BADGE_LEVELS as
|
|
1
|
+
import{BADGE_LEVELS as e}from"../badge-status/qonto-badge-status.js";import{TRANSFER_STATUSES as t}from"../../../common/constants.js";import{unsafeHTML as o}from"../../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/unsafe-html.js";import"../skeleton-loader/qonto-skeleton-loader-line.js";function n(o){switch(o){case t.SETTLED:return e.VALIDATED;case t.DECLINED:return e.DECLINED;case t.PENDING:return e.WAITING;case t.PROCESSING:return e.IN_PROGRESS;case t.CANCELED:return e.ERROR;default:return e.INACTIVE}}function l(e=3){const t=Array.from({length:e},(()=>'\n <tr>\n <td><qonto-skeleton-loader-line width="80px"></qonto-skeleton-loader-line></td>\n <td><qonto-skeleton-loader-line width="120px"></qonto-skeleton-loader-line></td>\n <td><qonto-skeleton-loader-line width="150px"></qonto-skeleton-loader-line></td>\n <td><qonto-skeleton-loader-line width="100px"></qonto-skeleton-loader-line></td>\n <td><qonto-skeleton-loader-line width="60px"></qonto-skeleton-loader-line></td>\n </tr>\n ')).join("");return o(t)}export{n as mapTransferStatusToBadgeLevel,l as renderLoadingTableRowsMarkup};
|
package/dist/src/ui/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{ui as i}from"./ui-elements.public-api.js";const e=i;export{e as ui};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./customizable-components/transfer-list/transfer-list.js";import{isRunningInServer as t}from"../common/runtime/runtime.validation.js";import{validateCreateUIElementParams as e}from"./ui-elements.validation.js";import{validateOperationSettingsParams as n}from"../validation/operation-settings-validation.js";import{UI_ELEMENT_NAMES as i}from"./ui-elements.constants.js";import{createTransferListElement as o}from"./ui-elements/transfer-list.js";import{EmbedUIElementError as r}from"../errors/EmbedUIElementError.js";const m=async m=>{if(t())return;const{uiElementSettings:s,operationSettings:a={}}=m,{uiElementName:l}=e(s),{uiParentElementId:u}=n(a,{requiresUI:!0}),d=document.getElementById(u);if(!d)throw new r(`Could not find container element with id: ${u}`);if(l===i.TRANSFER_LIST)return void o({containerElement:d,uiElementSettings:s,operationSettings:a});const p=document.createElement(`qonto-${l}`);d.appendChild(p)};export{m as createUIElement};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createUIElement as e}from"./ui-elements.js";const t={createUIElement:e};export{t as ui};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-list.d.ts","sourceRoot":"","sources":["../../../../src/ui/customizable-components/transfer-list/transfer-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAMvC,OAAO,sBAAsB,CAAC;AAU9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAInF,OAAO,2BAA2B,CAAC;AA6BnC,qBAEa,YAAa,SAAQ,UAAU;IAC1C,MAAM,CAAC,MAAM,0BAAsB;IAGnC,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAGjD,MAAM,EAAE,MAAM,CAAQ;IAGtB,OAAO,CAAC,SAAS,CAA6B;IAG9C,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,cAAc;
|
|
1
|
+
{"version":3,"file":"transfer-list.d.ts","sourceRoot":"","sources":["../../../../src/ui/customizable-components/transfer-list/transfer-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAMvC,OAAO,sBAAsB,CAAC;AAU9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAInF,OAAO,2BAA2B,CAAC;AA6BnC,qBAEa,YAAa,SAAQ,UAAU;IAC1C,MAAM,CAAC,MAAM,0BAAsB;IAGnC,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAGjD,MAAM,EAAE,MAAM,CAAQ;IAGtB,OAAO,CAAC,SAAS,CAA6B;IAG9C,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,cAAc;IA8B5B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,cAAc;IAOtB,MAAM;CA8EP"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SepaTransferStatus } from '@types';
|
|
2
2
|
import { type Level } from '../badge-status/qonto-badge-status.ts';
|
|
3
|
+
import '../skeleton-loader/qonto-skeleton-loader-line.ts';
|
|
3
4
|
import type { DirectiveResult } from 'lit/directive.js';
|
|
4
5
|
export declare function mapTransferStatusToBadgeLevel(transferStatus: SepaTransferStatus): Level;
|
|
5
|
-
export declare function renderLoadingTableRowsMarkup(): DirectiveResult;
|
|
6
|
+
export declare function renderLoadingTableRowsMarkup(amountOfRows?: number): DirectiveResult;
|
|
6
7
|
//# sourceMappingURL=transfer-list.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-list.utils.d.ts","sourceRoot":"","sources":["../../../../src/ui/customizable-components/transfer-list/transfer-list.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAEL,KAAK,KAAK,EACX,MAAM,uCAAuC,CAAC;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,wBAAgB,6BAA6B,CAC3C,cAAc,EAAE,kBAAkB,GACjC,KAAK,CAeP;AAED,wBAAgB,4BAA4B,
|
|
1
|
+
{"version":3,"file":"transfer-list.utils.d.ts","sourceRoot":"","sources":["../../../../src/ui/customizable-components/transfer-list/transfer-list.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAEL,KAAK,KAAK,EACX,MAAM,uCAAuC,CAAC;AAG/C,OAAO,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,wBAAgB,6BAA6B,CAC3C,cAAc,EAAE,kBAAkB,GACjC,KAAK,CAeP;AAED,wBAAgB,4BAA4B,CAC1C,YAAY,GAAE,MAAU,GACvB,eAAe,CAcjB"}
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The ui namespace contains all the functions related to UI Elements.
|
|
3
|
+
* It can be accessed like this:
|
|
4
|
+
* ```ts
|
|
5
|
+
* import { ui } from '@qonto/embed-sdk/ui';
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Then, the ui object contains the functions to perform UI Element operations:
|
|
9
|
+
* ```ts
|
|
10
|
+
* await ui.createUIElement(/* params here *\/);
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare const ui: {
|
|
14
|
+
createUIElement: (createUIElementParams: import("./ui-elements.types").UIElementParams<unknown>) => Promise<void>;
|
|
15
|
+
};
|
|
4
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,EAAE;;CAAyB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './customizable-components';
|
|
2
|
+
import type { UIElementParams } from '@ui/ui-elements.types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a UI element based on the provided settings and appends it to the specified parent container.
|
|
5
|
+
* As the bare minimum, the `uiElementSettings` must include the `uiElementName`, and the `operationSettings`
|
|
6
|
+
* must include the `uiParentElementId` where the new element will be appended. This function requires
|
|
7
|
+
* authentication, which can be passed via the {@link OperationSettings} object.
|
|
8
|
+
* @param createUIElementParams - Parameters for creating the UI element, including settings for the element
|
|
9
|
+
* and operation:
|
|
10
|
+
* - `uiElementSettings` - Settings for the UI element to be created. Must include `uiElementName`, which
|
|
11
|
+
* determines the type of element to create. Example: `{ uiElementName: 'transfer-list' }`.
|
|
12
|
+
* - `operationSettings` - Settings for the operation, including the `uiParentElementId` where the new element
|
|
13
|
+
* will be appended. Must also include authentication details if required.
|
|
14
|
+
* @throws InvalidParametersError - Thrown if required parameters are missing or invalid in `uiElementSettings`
|
|
15
|
+
* or `operationSettings`.
|
|
16
|
+
* @throws EmbedUIElementError - Thrown if the specified parent container element cannot be found in the DOM.
|
|
17
|
+
*/
|
|
18
|
+
export declare const createUIElement: (createUIElementParams: UIElementParams<unknown>) => Promise<void>;
|
|
19
|
+
//# sourceMappingURL=ui-elements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-elements.d.ts","sourceRoot":"","sources":["../../src/ui/ui-elements.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,uBAAuB,CAAC;AAMhF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,GAC1B,uBAAuB,eAAe,CAAC,OAAO,CAAC,KAC9C,OAAO,CAAC,IAAI,CA8Bd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-elements.public-api.d.ts","sourceRoot":"","sources":["../../src/ui/ui-elements.public-api.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,EAAE;;CAEd,CAAC"}
|
|
@@ -1,15 +1,52 @@
|
|
|
1
1
|
import type { OperationSettings } from '@validation/operation-settings-validation';
|
|
2
2
|
import { UI_ELEMENT_NAMES } from '@ui/ui-elements.constants';
|
|
3
|
+
/**
|
|
4
|
+
* Type representing the valid names of UI elements.
|
|
5
|
+
*/
|
|
3
6
|
type UIElementNames = (typeof UI_ELEMENT_NAMES)[keyof typeof UI_ELEMENT_NAMES];
|
|
7
|
+
/**
|
|
8
|
+
* Common event format for UI elements. Consists of two properties:
|
|
9
|
+
* `eventName` and optional `eventDetail`.
|
|
10
|
+
* The `eventName` property is a string that identifies the type of event
|
|
11
|
+
* emitted by the UI element.
|
|
12
|
+
* The `eventDetail` property is an optional object that contains additional
|
|
13
|
+
* information about the event. The structure of this object will depend on
|
|
14
|
+
* the specific event being emitted.
|
|
15
|
+
*/
|
|
4
16
|
interface UIElementEvent {
|
|
5
17
|
eventName: string;
|
|
6
18
|
eventDetail?: Record<string, unknown>;
|
|
7
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Common settings format for UI elements. Consists of three properties:
|
|
22
|
+
* `uiElementName`, `uiElementParams`, and `uiElementEventListener`.
|
|
23
|
+
* The `uiElementName` property is required and specifies the type of UI element
|
|
24
|
+
* to render.
|
|
25
|
+
* The `uiElementParams` property is a generic object that holds parameters that
|
|
26
|
+
* will depend on the specific UI element being created.
|
|
27
|
+
* The `uiElementEventListener` property is a callback function that will be
|
|
28
|
+
* invoked when the UI element emits events. It receives an event object
|
|
29
|
+
* containing the event name and optional event details. Each UI element
|
|
30
|
+
* will define its own set of events that can be listened to.
|
|
31
|
+
*/
|
|
8
32
|
export interface UIElementSettings<T> {
|
|
9
33
|
uiElementName: UIElementNames;
|
|
10
|
-
uiElementParams
|
|
11
|
-
uiElementEventListener
|
|
34
|
+
uiElementParams?: T;
|
|
35
|
+
uiElementEventListener?: (event: UIElementEvent) => void;
|
|
12
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Common parameter format for UI element operations. Consists of an object with
|
|
39
|
+
* two properties: `uiElementSettings` and `operationSettings`.
|
|
40
|
+
* The `uiElementSettings` property is required and contains settings specific
|
|
41
|
+
* to the UI element being operated on. As the bare minimum, it must include
|
|
42
|
+
* the `uiElementName` to identify the type of UI element to be rendered.
|
|
43
|
+
* The `operationSettings` property is optional (if it has been passed to the
|
|
44
|
+
* initialize function previously) and contains settings related
|
|
45
|
+
* to the overall operation. For UI elements, it has to include at least the
|
|
46
|
+
* `uiParentElementId`, which specifies the DOM element where the UI element
|
|
47
|
+
* will be appended. In addition, it may include authentication details, in which
|
|
48
|
+
* the preferred method is to provide a `proxyRequestFunction`.
|
|
49
|
+
*/
|
|
13
50
|
export interface UIElementParams<T> {
|
|
14
51
|
uiElementSettings: UIElementSettings<T>;
|
|
15
52
|
operationSettings?: OperationSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-elements.types.d.ts","sourceRoot":"","sources":["../../src/ui/ui-elements.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,KAAK,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE/E,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,aAAa,EAAE,cAAc,CAAC;IAC9B,eAAe,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ui-elements.types.d.ts","sourceRoot":"","sources":["../../src/ui/ui-elements.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;GAEG;AACH,KAAK,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,aAAa,EAAE,cAAc,CAAC;IAC9B,eAAe,CAAC,EAAE,CAAC,CAAC;IACpB,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CAC1D;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACxC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC;;OAEG;IACH,gBAAgB,EAAE,WAAW,CAAC;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACzC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC"}
|