@adyen/adyen-web 6.32.0 → 6.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -2
- package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
- package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js +1 -1
- package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
- package/dist/es/components/internal/Brand/Brand.js +1 -1
- package/dist/es/components/internal/Brand/Brand.js.map +1 -1
- package/dist/es/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es/components/internal/PayButton/utils.js +1 -1
- package/dist/es/components/internal/PayButton/utils.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/core.js.map +1 -1
- package/dist/es/index.d.ts +1 -2
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/Brand/Brand.js +1 -1
- package/dist/es-legacy/components/internal/Brand/Brand.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/package.json +6 -6
package/dist/cjs/index.d.cts
CHANGED
|
@@ -329,7 +329,6 @@ interface PayButtonProps extends ButtonProps {
|
|
|
329
329
|
status?: string;
|
|
330
330
|
disabled?: boolean;
|
|
331
331
|
icon?: string;
|
|
332
|
-
onClick?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;
|
|
333
332
|
}
|
|
334
333
|
|
|
335
334
|
type AchForm = {
|
|
@@ -7847,7 +7846,7 @@ declare class Core implements ICore {
|
|
|
7847
7846
|
* @param options - Can be used to avoid remounting the elements
|
|
7848
7847
|
* @returns this - the Core instance
|
|
7849
7848
|
*/
|
|
7850
|
-
update(props?: Partial<CoreConfiguration
|
|
7849
|
+
update(props?: Partial<Omit<CoreConfiguration, 'session'>>, { shouldReinitializeCheckout }?: {
|
|
7851
7850
|
shouldReinitializeCheckout?: boolean;
|
|
7852
7851
|
}): Promise<this>;
|
|
7853
7852
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../external/preact/dist/preact.js";import t from"./PaymentMethodIcon.js";import{useCoreContext as a}from"../../../../core/Context/CoreProvider.js";import
|
|
1
|
+
import{createElement as e}from"../../../../external/preact/dist/preact.js";import t from"./PaymentMethodIcon.js";import{useCoreContext as a}from"../../../../core/Context/CoreProvider.js";import n from"../../../../core/Context/useImage.js";const o=({order:o,orderStatus:r,onOrderCancel:d,brandLogoConfiguration:m})=>{const{i18n:c}=a(),u=n();return e("div",null,e("ul",{className:"adyen-checkout__order-payment-methods-list"},r?.paymentMethods?.map((a,n)=>e("li",{key:`${a.type}-${n}`,className:"adyen-checkout__order-payment-method"},e("div",{className:"adyen-checkout__order-payment-method__header"},e("div",{className:"adyen-checkout__payment-method__header__title"},e(t,{altDescription:a.name,type:a.type,src:m[a.type]||u()(a.type)}),a.label?`${a.label}`:`•••• ${a.lastFour}`),d&&e("button",{type:"button",className:"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link",onClick:()=>{d({order:o})}},c.get("storedPaymentMethod.disable.button"))),e("div",{className:"adyen-checkout__order-payment-method__details"},e("div",{className:"adyen-checkout__order-payment-method__deducted-amount"},e("span",{className:"adyen-checkout__order-payment-method__deducted-amount__label"},c.get("deductedBalance")),e("span",{className:"adyen-checkout__order-payment-method__deducted-amount__value"},c.amount(a.amount.value,a.amount.currency))))))),r.remainingAmount&&e("p",{className:"adyen-checkout__order-remaining-amount"},c.get("partialPayment.warning")," ",e("strong",null,c.amount(r.remainingAmount.value,r.remainingAmount.currency))))};export{o as OrderPaymentMethods,o as default};
|
|
2
2
|
//# sourceMappingURL=OrderPaymentMethods.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/OrderPaymentMethods.tsx"],"sourcesContent":["import { h } from 'preact';\nimport PaymentMethodIcon from './PaymentMethodIcon';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport './OrderPaymentMethods.scss';\nimport { Order, OrderStatus } from '../../../../types';\n\ntype OrderPaymentMethodsProps = {\n order: Order;\n orderStatus: OrderStatus;\n onOrderCancel: (order) => void;\n brandLogoConfiguration: any;\n};\n\nexport const OrderPaymentMethods = ({ order, orderStatus, onOrderCancel, brandLogoConfiguration }: Readonly<OrderPaymentMethodsProps>) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n return (\n <div>\n <ul className={'adyen-checkout__order-payment-methods-list'}>\n {orderStatus?.paymentMethods?.map((orderPaymentMethod, index) => (\n <li key={`${orderPaymentMethod.type}-${index}`} className=\"adyen-checkout__order-payment-method\">\n <div className=\"adyen-checkout__order-payment-method__header\">\n <div className=\"adyen-checkout__payment-method__header__title\">\n <PaymentMethodIcon\n altDescription={orderPaymentMethod.name}\n type={orderPaymentMethod.type}\n src={brandLogoConfiguration[orderPaymentMethod.type] || getImage()(orderPaymentMethod.type)}\n />\n {orderPaymentMethod.label ? `${orderPaymentMethod.label}` : `•••• ${orderPaymentMethod.lastFour}`}\n </div>\n\n {onOrderCancel && (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link\"\n onClick={() => {\n onOrderCancel({ order });\n }}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </button>\n )}\n </div>\n <div className=\"adyen-checkout__order-payment-method__details\">\n <div className=\"adyen-checkout__order-payment-method__deducted-amount\">\n <
|
|
1
|
+
{"version":3,"file":"OrderPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/OrderPaymentMethods.tsx"],"sourcesContent":["import { h } from 'preact';\nimport PaymentMethodIcon from './PaymentMethodIcon';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport './OrderPaymentMethods.scss';\nimport { Order, OrderStatus } from '../../../../types';\n\ntype OrderPaymentMethodsProps = {\n order: Order;\n orderStatus: OrderStatus;\n onOrderCancel: (order) => void;\n brandLogoConfiguration: any;\n};\n\nexport const OrderPaymentMethods = ({ order, orderStatus, onOrderCancel, brandLogoConfiguration }: Readonly<OrderPaymentMethodsProps>) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n return (\n <div>\n <ul className={'adyen-checkout__order-payment-methods-list'}>\n {orderStatus?.paymentMethods?.map((orderPaymentMethod, index) => (\n <li key={`${orderPaymentMethod.type}-${index}`} className=\"adyen-checkout__order-payment-method\">\n <div className=\"adyen-checkout__order-payment-method__header\">\n <div className=\"adyen-checkout__payment-method__header__title\">\n <PaymentMethodIcon\n altDescription={orderPaymentMethod.name}\n type={orderPaymentMethod.type}\n src={brandLogoConfiguration[orderPaymentMethod.type] || getImage()(orderPaymentMethod.type)}\n />\n {orderPaymentMethod.label ? `${orderPaymentMethod.label}` : `•••• ${orderPaymentMethod.lastFour}`}\n </div>\n\n {onOrderCancel && (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link\"\n onClick={() => {\n onOrderCancel({ order });\n }}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </button>\n )}\n </div>\n <div className=\"adyen-checkout__order-payment-method__details\">\n <div className=\"adyen-checkout__order-payment-method__deducted-amount\">\n <span className=\"adyen-checkout__order-payment-method__deducted-amount__label\">{i18n.get('deductedBalance')}</span>\n <span className=\"adyen-checkout__order-payment-method__deducted-amount__value\">\n {i18n.amount(orderPaymentMethod.amount.value, orderPaymentMethod.amount.currency)}\n </span>\n </div>\n </div>\n </li>\n ))}\n </ul>\n\n {orderStatus.remainingAmount && (\n <p className=\"adyen-checkout__order-remaining-amount\">\n {i18n.get('partialPayment.warning')}{' '}\n <strong>{i18n.amount(orderStatus.remainingAmount.value, orderStatus.remainingAmount.currency)}</strong>\n </p>\n )}\n </div>\n );\n};\n\nexport default OrderPaymentMethods;\n"],"names":["OrderPaymentMethods","order","orderStatus","onOrderCancel","brandLogoConfiguration","i18n","useCoreContext","getImage","useImage","h","div","ul","className","paymentMethods","map","orderPaymentMethod","index","li","key","type","PaymentMethodIcon","altDescription","name","src","label","lastFour","button","onClick","get","span","amount","value","currency","remainingAmount","p","strong"],"mappings":"+OAcO,MAAMA,EAAsB,EAAGC,QAAOC,cAAaC,gBAAeC,6BACrE,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IAEjB,OACIC,EAACC,WACGD,EAACE,KAAAA,CAAGC,UAAW,8CACVV,GAAaW,gBAAgBC,IAAI,CAACC,EAAoBC,IACnDP,EAACQ,KAAAA,CAAGC,IAAK,GAAGH,EAAmBI,QAAQH,IAASJ,UAAU,wCACtDH,EAACC,MAAAA,CAAIE,UAAU,gDACXH,EAACC,MAAAA,CAAIE,UAAU,iDACXH,EAACW,EAAAA,CACGC,eAAgBN,EAAmBO,KACnCH,KAAMJ,EAAmBI,KACzBI,IAAKnB,EAAuBW,EAAmBI,OAASZ,IAAWQ,EAAmBI,QAEzFJ,EAAmBS,MAAQ,GAAGT,EAAmBS,QAAU,QAAQT,EAAmBU,YAG1FtB,GACGM,EAACiB,SAAAA,CACGP,KAAK,SACLP,UAAU,qFACVe,QAAS,KACLxB,EAAc,CAAEF,YAGnBI,EAAKuB,IAAI,wCAItBnB,EAACC,MAAAA,CAAIE,UAAU,iDACXH,EAACC,MAAAA,CAAIE,UAAU,yDACXH,EAACoB,OAAAA,CAAKjB,UAAU,gEAAgEP,EAAKuB,IAAI,oBACzFnB,EAACoB,OAAAA,CAAKjB,UAAU,gEACXP,EAAKyB,OAAOf,EAAmBe,OAAOC,MAAOhB,EAAmBe,OAAOE,gBAQ/F9B,EAAY+B,iBACTxB,EAACyB,IAAAA,CAAEtB,UAAU,0CACRP,EAAKuB,IAAI,0BAA2B,IACrCnB,EAAC0B,cAAQ9B,EAAKyB,OAAO5B,EAAY+B,gBAAgBF,MAAO7B,EAAY+B,gBAAgBD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getUrlFromMap as n}from"../../../core/Environment/Environment.js";import{CDN_ENVIRONMENTS as e}from"../../../core/Environment/constants.js";import s from"../../../core/Errors/AdyenCheckoutError.js";import t from"../../../utils/Script.js";function r(n,e,s){return e in n?Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[e]=s,n}class i{isAvailable(){return null!=this.AdyenPasskey}async load(){if(this.isAvailable())return this.AdyenPasskey;try{const s=n(this.environment,e),r=new t({src:`${s}${i.PASSKEY_SDK_URL}`,component:"paybybank_pix",analytics:this.analytics});return await r.load(),this.AdyenPasskey=window.AdyenPasskey?.default,this.AdyenPasskey}catch(n){throw new s("SCRIPT_ERROR",`Unable to load script. Message: ${n instanceof Error?n.message:"Unknown error loading Passkey sdk"}`)}}constructor({analytics:n,environment:e}){r(this,"AdyenPasskey",void 0),r(this,"analytics",void 0),r(this,"environment",void 0),this.analytics=n,this.environment=e}}r(i,"PASSKEY_SDK_URL","js/adyenpasskey/1.
|
|
1
|
+
import{getUrlFromMap as n}from"../../../core/Environment/Environment.js";import{CDN_ENVIRONMENTS as e}from"../../../core/Environment/constants.js";import s from"../../../core/Errors/AdyenCheckoutError.js";import t from"../../../utils/Script.js";function r(n,e,s){return e in n?Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[e]=s,n}class i{isAvailable(){return null!=this.AdyenPasskey}async load(){if(this.isAvailable())return this.AdyenPasskey;try{const s=n(this.environment,e),r=new t({src:`${s}${i.PASSKEY_SDK_URL}`,component:"paybybank_pix",analytics:this.analytics});return await r.load(),this.AdyenPasskey=window.AdyenPasskey?.default,this.AdyenPasskey}catch(n){throw new s("SCRIPT_ERROR",`Unable to load script. Message: ${n instanceof Error?n.message:"Unknown error loading Passkey sdk"}`)}}constructor({analytics:n,environment:e}){r(this,"AdyenPasskey",void 0),r(this,"analytics",void 0),r(this,"environment",void 0),this.analytics=n,this.environment=e}}r(i,"PASSKEY_SDK_URL","js/adyenpasskey/1.2.0/adyen-passkey.js");export{i as PasskeySdkLoader};
|
|
2
2
|
//# sourceMappingURL=PasskeySdkLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasskeySdkLoader.js","sources":["../../../../../src/components/PayByBankPix/services/PasskeySdkLoader.ts"],"sourcesContent":["import { IAdyenPasskey } from './types';\nimport { getUrlFromMap } from '../../../core/Environment/Environment';\nimport type { CoreConfiguration } from '../../../core/types';\nimport { CDN_ENVIRONMENTS } from '../../../core/Environment/constants';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Script from '../../../utils/Script';\nimport { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport interface IPasskeySdkLoader {\n load(environment: CoreConfiguration['environment'], analytics: IAnalytics): Promise<IAdyenPasskey>;\n}\n\nclass PasskeySdkLoader implements IPasskeySdkLoader {\n
|
|
1
|
+
{"version":3,"file":"PasskeySdkLoader.js","sources":["../../../../../src/components/PayByBankPix/services/PasskeySdkLoader.ts"],"sourcesContent":["import { IAdyenPasskey } from './types';\nimport { getUrlFromMap } from '../../../core/Environment/Environment';\nimport type { CoreConfiguration } from '../../../core/types';\nimport { CDN_ENVIRONMENTS } from '../../../core/Environment/constants';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Script from '../../../utils/Script';\nimport { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport interface IPasskeySdkLoader {\n load(environment: CoreConfiguration['environment'], analytics: IAnalytics): Promise<IAdyenPasskey>;\n}\n\nclass PasskeySdkLoader implements IPasskeySdkLoader {\n public static readonly PASSKEY_SDK_URL = 'js/adyenpasskey/1.2.0/adyen-passkey.js';\n private AdyenPasskey: IAdyenPasskey;\n\n private readonly analytics: IAnalytics;\n private readonly environment: string;\n\n constructor({ analytics, environment }: { analytics: IAnalytics; environment: string }) {\n this.analytics = analytics;\n this.environment = environment;\n }\n\n private isAvailable(): boolean {\n return this.AdyenPasskey != null;\n }\n\n public async load(): Promise<IAdyenPasskey> {\n if (this.isAvailable()) {\n return this.AdyenPasskey;\n }\n\n try {\n const cdnUrl = getUrlFromMap(this.environment as CoreConfiguration['environment'], CDN_ENVIRONMENTS);\n const url = `${cdnUrl}${PasskeySdkLoader.PASSKEY_SDK_URL}`;\n\n const scriptElement = new Script({\n src: url,\n component: 'paybybank_pix',\n analytics: this.analytics\n });\n\n await scriptElement.load();\n this.AdyenPasskey = window.AdyenPasskey?.default;\n return this.AdyenPasskey;\n } catch (e: unknown) {\n throw new AdyenCheckoutError(\n 'SCRIPT_ERROR',\n `Unable to load script. Message: ${e instanceof Error ? e.message : 'Unknown error loading Passkey sdk'}`\n );\n }\n }\n}\n\nexport { PasskeySdkLoader };\n"],"names":["PasskeySdkLoader","isAvailable","this","AdyenPasskey","load","cdnUrl","getUrlFromMap","environment","CDN_ENVIRONMENTS","scriptElement","Script","src","PASSKEY_SDK_URL","component","analytics","window","default","e","AdyenCheckoutError","Error","message","constructor","_define_property"],"mappings":"6WAYA,MAAMA,EAYMC,WAAAA,GACJ,OAA4B,MAArBC,KAAKC,YAChB,CAEA,UAAaC,GACT,GAAIF,KAAKD,cACL,OAAOC,KAAKC,aAGhB,IACI,MAAME,EAASC,EAAcJ,KAAKK,YAAiDC,GAG7EC,EAAgB,IAAIC,EAAO,CAC7BC,IAHQ,GAAGN,IAASL,EAAiBY,kBAIrCC,UAAW,gBACXC,UAAWZ,KAAKY,YAKpB,aAFML,EAAcL,OACpBF,KAAKC,aAAeY,OAAOZ,cAAca,QAClCd,KAAKC,YAChB,CAAE,MAAOc,GACL,MAAM,IAAIC,EACN,eACA,mCAAmCD,aAAaE,MAAQF,EAAEG,QAAU,sCAE5E,CACJ,CAjCA,WAAAC,EAAYP,UAAEA,EAASP,YAAEA,IALzBe,EAAApB,KAAQC,uBAERmB,EAAApB,KAAiBY,oBACjBQ,EAAApB,KAAiBK,sBAGbL,KAAKY,UAAYA,EACjBZ,KAAKK,YAAcA,CACvB,EATAe,EADEtB,EACqBY,kBAAkB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as r}from"../../../external/preact/dist/preact.js";import{useState as a}from"../../../external/preact/hooks/dist/hooks.js";import e from"../../../_virtual/index.js";import
|
|
1
|
+
import{createElement as r}from"../../../external/preact/dist/preact.js";import{useState as a}from"../../../external/preact/hooks/dist/hooks.js";import e from"../../../_virtual/index.js";import t from"../Img/Img.js";const s=({url:s,alt:o,wrapperClassName:m="",imgClassName:p="",showOnError:n})=>{const[c,l]=a(!1),d=e("adyen-checkout-brand-wrapper",m,n?{}:{"adyen-checkout-brand-wrapper--error":c});return r("span",{className:d,"data-testid":"brand-image-wrapper"},r(t,{className:p,src:s,alt:o,onError:()=>l(!0)}))};export{s as default};
|
|
2
2
|
//# sourceMappingURL=Brand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Brand.js","sources":["../../../../../src/components/internal/Brand/Brand.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState } from 'preact/hooks';\nimport cx from 'classnames';\nimport Img from '../Img';\nimport './Brand.scss';\n\ninterface BrandProps {\n url: string;\n alt: string;\n wrapperClassName?: string;\n imgClassName?: string;\n showOnError?: boolean;\n}\n\nconst Brand = ({ url, alt, wrapperClassName = '', imgClassName = '', showOnError }: Readonly<BrandProps>) => {\n const [hasError, setHasError] = useState(false);\n const classesOnError = showOnError ? {} : { 'adyen-checkout-brand-wrapper--error': hasError };\n const classes = cx('adyen-checkout-brand-wrapper', wrapperClassName, classesOnError);\n\n return (\n <span className={classes}>\n <Img className={imgClassName} src={url} alt={alt} onError={() => setHasError(true)} />\n </span>\n );\n};\n\nexport default Brand;\n"],"names":["Brand","url","alt","wrapperClassName","imgClassName","showOnError","hasError","setHasError","useState","classes","cx","h","span","className","Img","src","onError"],"mappings":"uNAcA,MAAMA,EAAQ,EAAGC,MAAKC,MAAKC,mBAAmB,GAAIC,eAAe,GAAIC,kBACjE,MAAOC,EAAUC,GAAeC,GAAS,GAEnCC,EAAUC,EAAG,+BAAgCP,EAD5BE,EAAc,GAAK,CAAE,sCAAuCC,IAGnF,OACIK,EAACC,OAAAA,CAAKC,UAAWJ,
|
|
1
|
+
{"version":3,"file":"Brand.js","sources":["../../../../../src/components/internal/Brand/Brand.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState } from 'preact/hooks';\nimport cx from 'classnames';\nimport Img from '../Img';\nimport './Brand.scss';\n\ninterface BrandProps {\n url: string;\n alt: string;\n wrapperClassName?: string;\n imgClassName?: string;\n showOnError?: boolean;\n}\n\nconst Brand = ({ url, alt, wrapperClassName = '', imgClassName = '', showOnError }: Readonly<BrandProps>) => {\n const [hasError, setHasError] = useState(false);\n const classesOnError = showOnError ? {} : { 'adyen-checkout-brand-wrapper--error': hasError };\n const classes = cx('adyen-checkout-brand-wrapper', wrapperClassName, classesOnError);\n\n return (\n <span className={classes} data-testid=\"brand-image-wrapper\">\n <Img className={imgClassName} src={url} alt={alt} onError={() => setHasError(true)} />\n </span>\n );\n};\n\nexport default Brand;\n"],"names":["Brand","url","alt","wrapperClassName","imgClassName","showOnError","hasError","setHasError","useState","classes","cx","h","span","className","data-testid","Img","src","onError"],"mappings":"uNAcA,MAAMA,EAAQ,EAAGC,MAAKC,MAAKC,mBAAmB,GAAIC,eAAe,GAAIC,kBACjE,MAAOC,EAAUC,GAAeC,GAAS,GAEnCC,EAAUC,EAAG,+BAAgCP,EAD5BE,EAAc,GAAK,CAAE,sCAAuCC,IAGnF,OACIK,EAACC,OAAAA,CAAKC,UAAWJ,EAASK,cAAY,uBAClCH,EAACI,EAAAA,CAAIF,UAAWT,EAAcY,IAAKf,EAAKC,IAAKA,EAAKe,QAAS,IAAMV,GAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as o}from"../../../external/preact/dist/preact.js";import t from"../Button/Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{createButtonLabel as e,createSecondaryLabel as s}from"./utils.js";import a from"./components/SecondaryButtonLabel.js";import{useAmount as m,useSecondaryAmount as i}from"../../../core/Context/AmountProvider.js";import{isAmountValid as n}from"../../../utils/amount-util.js";const l=({customAmount:l,classNameModifiers:u=[],label:c,...d})=>{const{amount:p,isZeroAuth:f}=m(),{secondaryAmount:j}=i(),{i18n:b}=r(),x=e(b,c,p,f,l),A=s(b,j,n(p),f,c),y=d.disabled||"loading"===d.status;return o(t,{...d,disabled:y,classNameModifiers:[...u,"pay"],label:x},A&&o(a,{label:A}))};export{l as default};
|
|
1
|
+
import{createElement as o}from"../../../external/preact/dist/preact.js";import t from"../Button/Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{createButtonLabel as e,createSecondaryLabel as s}from"./utils.js";import a from"./components/SecondaryButtonLabel.js";import{useAmount as m,useSecondaryAmount as i}from"../../../core/Context/AmountProvider.js";import{isAmountValid as n}from"../../../utils/amount-util.js";const l=({customAmount:l,classNameModifiers:u=[],label:c,...d})=>{const{amount:p,isZeroAuth:f}=m(),{secondaryAmount:j}=i(),{i18n:b}=r(),x=e(b,c,p,f,l,j),A=s(b,j,n(p),f,c),y=d.disabled||"loading"===d.status;return o(t,{...d,disabled:y,classNameModifiers:[...u,"pay"],label:x},A&&o(a,{label:A}))};export{l as default};
|
|
2
2
|
//# sourceMappingURL=PayButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayButton.js","sources":["../../../../../src/components/internal/PayButton/PayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Button from '../Button';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps } from '../Button/types';\nimport { createButtonLabel, createSecondaryLabel } from './utils';\nimport SecondaryButtonLabel from './components/SecondaryButtonLabel';\nimport { useAmount, useSecondaryAmount } from '../../../core/Context/AmountProvider';\nimport type { PaymentAmount } from '../../../types';\nimport { isAmountValid } from '../../../utils/amount-util';\n\nexport interface PayButtonProps extends ButtonProps {\n /**\n * Class name modifiers will be used as: `adyen-checkout__image--${modifier}`\n */\n classNameModifiers?: string[];\n /**\n * Custom amount that can be passed to the button.\n * This is useful when the amount is not available in the amount provider, such as Giftcard scenario where\n * we need to display the remaining amount\n */\n customAmount?: PaymentAmount;\n label?: string;\n status?: string;\n disabled?: boolean;\n icon?: string;\n
|
|
1
|
+
{"version":3,"file":"PayButton.js","sources":["../../../../../src/components/internal/PayButton/PayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Button from '../Button';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps } from '../Button/types';\nimport { createButtonLabel, createSecondaryLabel } from './utils';\nimport SecondaryButtonLabel from './components/SecondaryButtonLabel';\nimport { useAmount, useSecondaryAmount } from '../../../core/Context/AmountProvider';\nimport type { PaymentAmount } from '../../../types';\nimport { isAmountValid } from '../../../utils/amount-util';\n\nexport interface PayButtonProps extends ButtonProps {\n /**\n * Class name modifiers will be used as: `adyen-checkout__image--${modifier}`\n */\n classNameModifiers?: string[];\n /**\n * Custom amount that can be passed to the button.\n * This is useful when the amount is not available in the amount provider, such as Giftcard scenario where\n * we need to display the remaining amount\n */\n customAmount?: PaymentAmount;\n label?: string;\n status?: string;\n disabled?: boolean;\n icon?: string;\n}\n\nconst PayButton = ({ customAmount, classNameModifiers = [], label, ...props }: Readonly<PayButtonProps>) => {\n const { amount, isZeroAuth } = useAmount();\n const { secondaryAmount } = useSecondaryAmount();\n const { i18n } = useCoreContext();\n\n const buttonLabel = createButtonLabel(i18n, label, amount, isZeroAuth, customAmount, secondaryAmount);\n const secondaryAmountLabel = createSecondaryLabel(i18n, secondaryAmount, isAmountValid(amount), isZeroAuth, label);\n\n const isDisabled = props.disabled || props.status === 'loading';\n\n return (\n <Button {...props} disabled={isDisabled} classNameModifiers={[...classNameModifiers, 'pay']} label={buttonLabel}>\n {secondaryAmountLabel && <SecondaryButtonLabel label={secondaryAmountLabel} />}\n </Button>\n );\n};\n\nexport default PayButton;\n"],"names":["PayButton","customAmount","classNameModifiers","label","props","amount","isZeroAuth","useAmount","secondaryAmount","useSecondaryAmount","i18n","useCoreContext","buttonLabel","createButtonLabel","secondaryAmountLabel","createSecondaryLabel","isAmountValid","isDisabled","disabled","status","h","Button","SecondaryButtonLabel"],"mappings":"ycA2BA,MAAMA,EAAY,EAAGC,eAAcC,qBAAqB,GAAIC,WAAUC,MAClE,MAAMC,OAAEA,EAAMC,WAAEA,GAAeC,KACzBC,gBAAEA,GAAoBC,KACtBC,KAAEA,GAASC,IAEXC,EAAcC,EAAkBH,EAAMP,EAAOE,EAAQC,EAAYL,EAAcO,GAC/EM,EAAuBC,EAAqBL,EAAMF,EAAiBQ,EAAcX,GAASC,EAAYH,GAEtGc,EAAab,EAAMc,UAA6B,YAAjBd,EAAMe,OAE3C,OACIC,EAACC,EAAAA,IAAWjB,EAAOc,SAAUD,EAAYf,mBAAoB,IAAIA,EAAoB,OAAQC,MAAOS,GAC/FE,GAAwBM,EAACE,EAAAA,CAAqBnB,MAAOW"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const r="/ ",n=(r,n)=>n?.value&&n?.currency?r.amount(n.value,n.currency,{currencyDisplay:n.currencyDisplay||"symbol"}):"",
|
|
1
|
+
const r="/ ",n=(r,n)=>n?.value&&n?.currency?r.amount(n.value,n.currency,{currencyDisplay:n.currencyDisplay||"symbol"}):"",t=r=>{const n=r.get("payAmountFormat"),t=n.indexOf("%@");return t>=0&&n.substring(t+2).trim().length>0},e=(r,e,c)=>{const o=n(r,e);if(!o)return r.get("payButton");if(c&&t(r)){const n=u(r,c);return r.get("payAmountFormat").replace("%@",`${o}${n}`)}return r.get("payAmountFormat").replace("%@",o)},u=(r,n)=>{const t=n&&n?.value&&n?.currency?r.amount(n.value,n.currency,{currencyDisplay:n.currencyDisplay||"symbol"}):"";return`${t.length?"/ ":""}${t}`};function c(r,n,t,u,c,o){return n||(c?e(r,c):u?r.get("confirmPreauthorization"):e(r,t,o))}function o(r,n,e,c,o){return c||o||!e||!n||t(r)?null:u(r,n)}export{r as PAY_BTN_DIVIDER,n as amountLabel,c as createButtonLabel,o as createSecondaryLabel,e as payAmountLabel};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/PayButton/utils.ts"],"sourcesContent":["import Language from '../../../language';\nimport type { PaymentAmount } from '../../../types/global-types';\n\nexport const PAY_BTN_DIVIDER = '/ ';\n\nconst amountLabel = (i18n, amount: PaymentAmount) =>\n !!amount?.value && !!amount?.currency ? i18n.amount(amount.value, amount.currency, { currencyDisplay: amount.currencyDisplay || 'symbol' }) : '';\n\nconst payAmountLabel = (i18n: Language, amount: PaymentAmount) =>
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/PayButton/utils.ts"],"sourcesContent":["import Language from '../../../language';\nimport type { PaymentAmount } from '../../../types/global-types';\n\nexport const PAY_BTN_DIVIDER = '/ ';\n\nconst amountLabel = (i18n, amount: PaymentAmount) =>\n !!amount?.value && !!amount?.currency ? i18n.amount(amount.value, amount.currency, { currencyDisplay: amount.currencyDisplay || 'symbol' }) : '';\n\nconst isAmountFirstFormat = (i18n: Language): boolean => {\n const format = i18n.get('payAmountFormat');\n const tokenIndex = format.indexOf('%@');\n return tokenIndex >= 0 && format.substring(tokenIndex + 2).trim().length > 0;\n};\n\nconst payAmountLabel = (i18n: Language, amount: PaymentAmount, secondaryAmount?: PaymentAmount) => {\n const amountLabelValue = amountLabel(i18n, amount);\n if (!amountLabelValue) {\n return i18n.get('payButton');\n }\n\n if (secondaryAmount && isAmountFirstFormat(i18n)) {\n const secondaryAmountValue = formatSecondaryAmountLabel(i18n, secondaryAmount);\n return i18n.get('payAmountFormat').replace('%@', `${amountLabelValue}${secondaryAmountValue}`);\n }\n\n return i18n.get('payAmountFormat').replace('%@', amountLabelValue);\n};\n\nconst formatSecondaryAmountLabel = (i18n: Language, secondaryAmount: PaymentAmount) => {\n const convertedSecondaryAmount =\n secondaryAmount && !!secondaryAmount?.value && !!secondaryAmount?.currency\n ? i18n.amount(secondaryAmount.value, secondaryAmount.currency, { currencyDisplay: secondaryAmount.currencyDisplay || 'symbol' })\n : '';\n\n const divider = convertedSecondaryAmount.length ? PAY_BTN_DIVIDER : '';\n\n return `${divider}${convertedSecondaryAmount}`;\n};\n\nfunction createButtonLabel(\n i18n: Language,\n customLabel: string,\n amount: PaymentAmount,\n isZeroAuth: boolean,\n customAmount?: PaymentAmount,\n secondaryAmount?: PaymentAmount\n): string {\n if (customLabel) {\n return customLabel;\n }\n\n if (customAmount) {\n return payAmountLabel(i18n, customAmount);\n }\n\n return isZeroAuth ? i18n.get('confirmPreauthorization') : payAmountLabel(i18n, amount, secondaryAmount);\n}\n\n/**\n * Show the secondaryLabel if:\n * - it's not zero auth, and\n * - we don't have a predefined label (i.e. redirect, qrcode, await based comps...), and\n * - we do have an amount object (merchant might not be passing this in order to not show the amount on the button), and\n * - we have a secondaryAmount object with some properties, and\n * - the payAmountFormat is not amount-first (e.g. \"%@ betalen\"), since in that case the secondary\n * amount is already embedded in the button label via createButtonLabel\n */\nfunction createSecondaryLabel(\n i18n: Language,\n secondaryAmount: PaymentAmount,\n isAmountValid: boolean,\n isZeroAuth: boolean,\n customLabel: string\n): string | null {\n if (isZeroAuth || customLabel || !isAmountValid || !secondaryAmount) {\n return null;\n }\n\n if (isAmountFirstFormat(i18n)) {\n return null;\n }\n\n return formatSecondaryAmountLabel(i18n, secondaryAmount);\n}\n\nexport { payAmountLabel, amountLabel, createButtonLabel, createSecondaryLabel };\n"],"names":["PAY_BTN_DIVIDER","amountLabel","i18n","amount","value","currency","currencyDisplay","isAmountFirstFormat","format","get","tokenIndex","indexOf","substring","trim","length","payAmountLabel","secondaryAmount","amountLabelValue","secondaryAmountValue","formatSecondaryAmountLabel","replace","convertedSecondaryAmount","createButtonLabel","customLabel","isZeroAuth","customAmount","createSecondaryLabel","isAmountValid"],"mappings":"AAGO,MAAMA,EAAkB,KAEzBC,EAAc,CAACC,EAAMC,IACrBA,GAAQC,OAAWD,GAAQE,SAAWH,EAAKC,OAAOA,EAAOC,MAAOD,EAAOE,SAAU,CAAEC,gBAAiBH,EAAOG,iBAAmB,WAAc,GAE5IC,EAAuBL,IACzB,MAAMM,EAASN,EAAKO,IAAI,mBAClBC,EAAaF,EAAOG,QAAQ,MAClC,OAAOD,GAAc,GAAKF,EAAOI,UAAUF,EAAa,GAAGG,OAAOC,OAAS,GAGzEC,EAAiB,CAACb,EAAgBC,EAAuBa,KAC3D,MAAMC,EAAmBhB,EAAYC,EAAMC,GAC3C,IAAKc,EACD,OAAOf,EAAKO,IAAI,aAGpB,GAAIO,GAAmBT,EAAoBL,GAAO,CAC9C,MAAMgB,EAAuBC,EAA2BjB,EAAMc,GAC9D,OAAOd,EAAKO,IAAI,mBAAmBW,QAAQ,KAAM,GAAGH,IAAmBC,IAC3E,CAEA,OAAOhB,EAAKO,IAAI,mBAAmBW,QAAQ,KAAMH,IAG/CE,EAA6B,CAACjB,EAAgBc,KAChD,MAAMK,EACFL,GAAqBA,GAAiBZ,OAAWY,GAAiBX,SAC5DH,EAAKC,OAAOa,EAAgBZ,MAAOY,EAAgBX,SAAU,CAAEC,gBAAiBU,EAAgBV,iBAAmB,WACnH,GAIV,MAAO,GAFSe,EAAyBP,OA/Bd,KA+ByC,KAEhDO,KAGxB,SAASC,EACLpB,EACAqB,EACApB,EACAqB,EACAC,EACAT,GAEA,OAAIO,IAIAE,EACOV,EAAeb,EAAMuB,GAGzBD,EAAatB,EAAKO,IAAI,2BAA6BM,EAAeb,EAAMC,EAAQa,GAC3F,CAWA,SAASU,EACLxB,EACAc,EACAW,EACAH,EACAD,GAEA,OAAIC,GAAcD,IAAgBI,IAAkBX,GAIhDT,EAAoBL,GAHb,KAOJiB,EAA2BjB,EAAMc,EAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { createRef, h, RefObject } from 'preact';\nimport { Resources } from '../../../core/Context/Resources';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\n\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventType } from '../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AnalyticsLogEvent, LogEventType } from '../../../core/Analytics/events/AnalyticsLogEvent';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\nimport type { AdditionalDetailsData, CoreConfiguration, ICore } from '../../../core/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentMethod\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { ComponentMethodsRef, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport './UIElement.scss';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { AmountProvider, AmountProviderRef } from '../../../core/Context/AmountProvider';\nimport { PayButtonProps } from '../PayButton/PayButton';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static readonly type = undefined;\n\n /**\n * Reference to the methods exposed by the AmountProvider context\n */\n protected amountProviderRef: RefObject<AmountProviderRef> = createRef();\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static readonly txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n this.core.register(this.constructor as NewableComponent);\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n this.updateAmount = this.updateAmount.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n\n this.onEnterKeyPressed = this.onEnterKeyPressed.bind(this);\n this.onActionHandled = this.onActionHandled.bind(this);\n\n this.createBeforeRenderHook(props);\n this.reportIntegrationFlavor();\n }\n\n /**\n * Creates a hook tied to render() method. This hook is called every time render() is invoked.\n * Currently useful for Analytics\n *\n * @param configSetByMerchant\n * @private\n */\n private createBeforeRenderHook(configSetByMerchant: P): void {\n const originalRender = this.render;\n\n this.render = (...args: any[]) => {\n this.beforeRender(configSetByMerchant);\n return originalRender.apply(this, args);\n };\n }\n\n protected beforeRender(configSetByMerchant?: P): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && { isStoredPaymentMethod: true })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n protected reportIntegrationFlavor(): void {\n void this.analytics.sendFlavor('components');\n }\n\n get analytics(): IAnalytics {\n return this.core.modules.analytics;\n }\n\n get srPanel(): SRPanel {\n return this.core.modules.srPanel;\n }\n\n protected getPaymentMethodConfigFromResponse(componentProps: P) {\n if (componentProps?.storedPaymentMethodId) return this.getStoredPaymentMethodDetails(componentProps.storedPaymentMethodId);\n return this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type, componentProps?.paymentMethodId);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n\n const paymentMethodFromResponse = this.getPaymentMethodConfigFromResponse(componentProps);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropinInstance = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropinInstance), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected getStoredPaymentMethodDetails(storedPaymentMethodId: string) {\n return this.core.paymentMethodsResponse.findStoredPaymentMethod(storedPaymentMethodId);\n }\n\n /**\n * Get the payment method from the paymentMethodsResponse\n *\n * @param type - The type of the payment method to get. (This prop is passed by Drop-in OR Standalone components containing the property 'type' as part of their configuration)\n * @param paymentMethodId - Unique internal payment method ID\n */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n /**\n * Updates the amount in the props and propagates it to the AmountProvider.\n * This allows children components to access the updated amount via context.\n *\n * @param amount - Primary payment amount object\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n public updateAmount(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n this.props = {\n ...this.props,\n ...(amount && { amount }),\n ...(secondaryAmount && { secondaryAmount })\n };\n this.amountProviderRef.current?.update(amount, secondaryAmount);\n }\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx\n */\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n /**\n * componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx\n */\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n protected override submitAnalytics(event: AbstractAnalyticsEvent) {\n this.analytics.sendAnalytics(event);\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) => {\n void this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject: () => reject(new CancelError('beforeSubmitRejected'))\n });\n })\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CNDBAjOa+B88wRoj/rLTieuWh/0leR88qkV24vtIkjsIsbJTDB78Pd8wX8MEDsXhaAdEIyX9E8eqxuQ3bwPbvLs1Dlgo1ZrfkQRzaNiuVM8ejRG0IWE1bGThJzY+sJvZZHvlDMXIlxhZcDoQvsMj/WwE6+nFJxBiC3oRzmvVn3AbkLQGtvwq16UUSfYbPzG9dXypJMtcrZAQYq2g/2+BSibCcmee9AXq/wij11BERrYmjbDt5NkkdUnDVgAB7pdqbnWX0A2sxBKeYtLSP2kxp+5LoU/Wty3fmcVA3VKVkHfgmIihkeL8lY++5hvHjnkzOE4tyx/sheiKS4zqoWE43TD6n8mpFskAzwMHq4G2o6vkXqvaKFEq7y/R2fVrCypenmRhkPASizpM265rKLU+L4E/C+LMHfN0LYKRMCrLr0gI2GAp+1PZLHgh0tCtiJC/zcJJtJs6sHNQxLUN+kxJuELUHOcuL3ivjG+mWteUnBENZu7KqOSZYetiWYRiyLOXDiBHqbxuQwTuO54L15VLkS/mYB20etibM1nn+fRmbo+1IJkCSalhwi5D7fSrpjbQTmAsOpJT1N8lC1MSNmAvAwG1kWL4JxYwXDKYyYASnsia2V5IjoiQUYwQUFBMTAzQ0E1MzdFQUVEODdDMjRERDUzOTA5QjgwQTc4QTkyM0UzODIzRDY4RE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zkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n this.handleAdditionalDetails(state);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (error.name === NETWORK_ERROR && error.options.code) {\n const event = new AnalyticsErrorEvent({\n component: this.type,\n errorType: ErrorEventType.apiError,\n code: error.options.code\n });\n\n this.submitAnalytics(event);\n }\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /details call', { cause: error }));\n\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session ? this.core.update({ order }) : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * Expected to be called after sanitizeResponse has been run on the raw payment response\n *\n * @param response -\n */\n protected handleResponse(response: PaymentResponseData): void {\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent) {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n\n this.onEnterKeyPressed(document?.activeElement, this);\n }\n }\n\n /**\n * Handle Enter key pressed from a UIElement (called via handleKeyPress)\n * @param obj\n */\n protected onEnterKeyPressed(activeElement: Element, component: UIElement) {\n if (this.props.onEnterKeyPressed) {\n this.props.onEnterKeyPressed(activeElement, component);\n } else {\n (activeElement as HTMLElement).blur();\n this.submit();\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protected _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonProps) => {\n return <PayButton {...props} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<void | PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return resolve();\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n\n protected abstract componentToRender(): h.JSX.Element;\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources} analytics={this.analytics}>\n <SRPanelProvider srPanel={this.srPanel}>\n <AmountProvider amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} providerRef={this.amountProviderRef}>\n {this.componentToRender()}\n </AmountProvider>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","createBeforeRenderHook","configSetByMerchant","originalRender","this","render","args","beforeRender","apply","originalAction","event","AnalyticsInfoEvent","type","InfoEventType","rendered","component","configData","showPayButton","props","oneClick","isStoredPaymentMethod","analytics","sendAnalytics","reportIntegrationFlavor","sendFlavor","core","modules","srPanel","getPaymentMethodConfigFromResponse","componentProps","storedPaymentMethodId","getStoredPaymentMethodDetails","getPaymentMethodFromPaymentMethodsResponse","paymentMethodId","buildElementProps","finalProps","getCorePropsForComponent","isDropinInstance","assertIsDropin","formatProps","constructor","getRegulatoryDefaults","options","countryCode","paymentMethodsResponse","findStoredPaymentMethod","findById","find","storeElementRefOnCore","isDropin","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","updateAmount","amount","secondaryAmount","amountProviderRef","current","update","setElementStatus","status","elementRef","setStatus","data","isValid","errors","valid","submitAnalytics","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","session","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","AnalyticsLogEvent","LogEventType","message","submitPayment","error","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","loadingContext","SRPanelProvider","AmountProvider","providerRef","componentToRender","checkout","super","_define_property","createRef","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","onClick","register","bind","undefined","txVariants"],"mappings":"soCAsCO,MAAeA,UAA6DC,EAyDvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,KAAKC,OAE5BD,KAAKC,OAAS,IAAIC,KACdF,KAAKG,aAAaL,GACXC,EAAeK,MAAMJ,KAA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B,yBACT,EAzCAsI,EAPkB9J,EAOKa,YAAOsK,GAU9BrB,EAjBkB9J,EAiBKoL,aAAuB"}
|
|
1
|
+
{"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { createRef, h, RefObject } from 'preact';\nimport { Resources } from '../../../core/Context/Resources';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\n\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventType } from '../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AnalyticsLogEvent, LogEventType } from '../../../core/Analytics/events/AnalyticsLogEvent';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\nimport type { AdditionalDetailsData, CoreConfiguration, ICore } from '../../../core/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentMethod\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { ComponentMethodsRef, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport './UIElement.scss';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { AmountProvider, AmountProviderRef } from '../../../core/Context/AmountProvider';\nimport { PayButtonProps } from '../PayButton/PayButton';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static readonly type = undefined;\n\n /**\n * Reference to the methods exposed by the AmountProvider context\n */\n protected amountProviderRef: RefObject<AmountProviderRef> = createRef();\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static readonly txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n this.core.register(this.constructor as NewableComponent);\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n this.updateAmount = this.updateAmount.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n\n this.onEnterKeyPressed = this.onEnterKeyPressed.bind(this);\n this.onActionHandled = this.onActionHandled.bind(this);\n\n this.createBeforeRenderHook(props);\n this.reportIntegrationFlavor();\n }\n\n /**\n * Creates a hook tied to render() method. This hook is called every time render() is invoked.\n * Currently useful for Analytics\n *\n * @param configSetByMerchant\n * @private\n */\n private createBeforeRenderHook(configSetByMerchant: P): void {\n const originalRender = this.render;\n\n this.render = (...args: any[]) => {\n this.beforeRender(configSetByMerchant);\n return originalRender.apply(this, args);\n };\n }\n\n protected beforeRender(configSetByMerchant?: P): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && { isStoredPaymentMethod: true })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n protected reportIntegrationFlavor(): void {\n void this.analytics.sendFlavor('components');\n }\n\n get analytics(): IAnalytics {\n return this.core.modules.analytics;\n }\n\n get srPanel(): SRPanel {\n return this.core.modules.srPanel;\n }\n\n protected getPaymentMethodConfigFromResponse(componentProps: P) {\n if (componentProps?.storedPaymentMethodId) return this.getStoredPaymentMethodDetails(componentProps.storedPaymentMethodId);\n return this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type, componentProps?.paymentMethodId);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n\n const paymentMethodFromResponse = this.getPaymentMethodConfigFromResponse(componentProps);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropinInstance = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropinInstance), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected getStoredPaymentMethodDetails(storedPaymentMethodId: string) {\n return this.core.paymentMethodsResponse.findStoredPaymentMethod(storedPaymentMethodId);\n }\n\n /**\n * Get the payment method from the paymentMethodsResponse\n *\n * @param type - The type of the payment method to get. (This prop is passed by Drop-in OR Standalone components containing the property 'type' as part of their configuration)\n * @param paymentMethodId - Unique internal payment method ID\n */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n /**\n * Updates the amount in the props and propagates it to the AmountProvider.\n * This allows children components to access the updated amount via context.\n *\n * @param amount - Primary payment amount object\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n public updateAmount(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n this.props = {\n ...this.props,\n ...(amount && { amount }),\n ...(secondaryAmount && { secondaryAmount })\n };\n this.amountProviderRef.current?.update(amount, secondaryAmount);\n }\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx\n */\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n /**\n * componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx\n */\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n protected override submitAnalytics(event: AbstractAnalyticsEvent) {\n this.analytics.sendAnalytics(event);\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) => {\n void this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject: () => reject(new CancelError('beforeSubmitRejected'))\n });\n })\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CNDBAjOa+B88wRoj/rLTieuWh/0leR88qkV24vtIkjsIsbJTD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C6o/DnshJ9mMW/8D3oWS30Z7BwRODqKGVahRD0YGRzwMbVnEe5JFRfNvJZdLGl35L9632DVmuFQ0lr/8WNL/NrAJNtI6PXrZMNiza0/omPwPfe5ZYuD1Jgq59TX4h9d+3fdkArcJYL7AdoMZON1YEiWY5EzazQwtHd9yzdty9ZHPxAfuOfCh4OhbhFNp+v5YQ+PzKZ+UpM1VxV863+9XgWEURPNvX7qq1cpUSRzrSGq01QBBM3MKzRh5mAgqIdXgtl7L0EXAep0MECc7QY0/o3tW3VR8eEJGsSzrNxpFItqj0SEaIWo25dRfkl5zuw47GQrN9Qzxl2WV3A38MQPUqFtIr/71Rjkphgg49ZGWEYCwgFmm8jJc2/5qTabSGk4bzwiETCTzeydq30bUGqCwglj8CrFViAuQeTJm7dp+PYKMkUNvQRpnSXMj6Kz7rvAMzhzJgK62ltN2idqKxLC7WtivCUgejuQUvNreCYBQCaKwTwP02lZsJpGF9yw8gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n this.handleAdditionalDetails(state);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (error.name === NETWORK_ERROR && error.options.code) {\n const event = new AnalyticsErrorEvent({\n component: this.type,\n errorType: ErrorEventType.apiError,\n code: error.options.code\n });\n\n this.submitAnalytics(event);\n }\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /details call', { cause: error }));\n\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session\n ? this.core.update({\n order\n })\n : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * Expected to be called after sanitizeResponse has been run on the raw payment response\n *\n * @param response -\n */\n protected handleResponse(response: PaymentResponseData): void {\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent) {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n\n this.onEnterKeyPressed(document?.activeElement, this);\n }\n }\n\n /**\n * Handle Enter key pressed from a UIElement (called via handleKeyPress)\n * @param obj\n */\n protected onEnterKeyPressed(activeElement: Element, component: UIElement) {\n if (this.props.onEnterKeyPressed) {\n this.props.onEnterKeyPressed(activeElement, component);\n } else {\n (activeElement as HTMLElement).blur();\n this.submit();\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protected _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonProps) => {\n return <PayButton {...props} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<void | PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return resolve();\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n\n protected abstract componentToRender(): h.JSX.Element;\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources} analytics={this.analytics}>\n <SRPanelProvider srPanel={this.srPanel}>\n <AmountProvider amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} providerRef={this.amountProviderRef}>\n {this.componentToRender()}\n </AmountProvider>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","createBeforeRenderHook","configSetByMerchant","originalRender","this","render","args","beforeRender","apply","originalAction","event","AnalyticsInfoEvent","type","InfoEventType","rendered","component","configData","showPayButton","props","oneClick","isStoredPaymentMethod","analytics","sendAnalytics","reportIntegrationFlavor","sendFlavor","core","modules","srPanel","getPaymentMethodConfigFromResponse","componentProps","storedPaymentMethodId","getStoredPaymentMethodDetails","getPaymentMethodFromPaymentMethodsResponse","paymentMethodId","buildElementProps","finalProps","getCorePropsForComponent","isDropinInstance","assertIsDropin","formatProps","constructor","getRegulatoryDefaults","options","countryCode","paymentMethodsResponse","findStoredPaymentMethod","findById","find","storeElementRefOnCore","isDropin","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","updateAmount","amount","secondaryAmount","amountProviderRef","current","update","setElementStatus","status","elementRef","setStatus","data","isValid","errors","valid","submitAnalytics","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","session","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","AnalyticsLogEvent","LogEventType","message","submitPayment","error","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","loadingContext","SRPanelProvider","AmountProvider","providerRef","componentToRender","checkout","super","_define_property","createRef","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","onClick","register","bind","undefined","txVariants"],"mappings":"soCAsCO,MAAeA,UAA6DC,EAyDvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,KAAKC,OAE5BD,KAAKC,OAAS,IAAIC,KACdF,KAAKG,aAAaL,GACXC,EAAeK,MAAMJ,KAAME,GAE1C,CAEUC,YAAAA,CAAaL,GAEnB,GAAIA,GAAqBO,eACrB,OAGJ,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,KAAMC,EAAcC,SACpBC,UAAWX,KAAKQ,KAChBI,WAAY,IAAKd,EAAqBe,cAAeb,KAAKc,MAAMD,kBAC5Df,GAAqBiB,UAAY,CAAEC,uBAAuB,KAGlEhB,KAAKiB,UAAUC,cAAcZ,EACjC,CAEUa,uBAAAA,GACDnB,KAAKiB,UAAUG,WAAW,aACnC,CAEA,aAAIH,GACA,OAAOjB,KAAKqB,KAAKC,QAAQL,SAC7B,CAEA,WAAIM,GACA,OAAOvB,KAAKqB,KAAKC,QAAQC,OAC7B,CAEUC,kCAAAA,CAAmCC,GACzC,OAAIA,GAAgBC,sBAA8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AK7K,MACzCA,KAAKgG,wBAA0BhG,KAAKgG,wBAAwB6E,KAAK7K,MACjEA,KAAK4E,eAAiB5E,KAAK4E,eAAeiG,KAAK7K,MAC/CA,KAAK8D,iBAAmB9D,KAAK8D,iBAAiB+G,KAAK7K,MACnDA,KAAKsE,gBAAkBtE,KAAKsE,gBAAgBuG,KAAK7K,MACjDA,KAAKwE,iBAAmBxE,KAAKwE,iBAAiBqG,KAAK7K,MACnDA,KAAKiG,0BAA4BjG,KAAKiG,0BAA0B4E,KAAK7K,MACrEA,KAAKsF,wBAA0BtF,KAAKsF,wBAAwBuF,KAAK7K,MACjEA,KAAKwD,aAAexD,KAAKwD,aAAaqH,KAAK7K,MAE3CA,KAAKgE,WAAclD,GAASA,EAAMkD,YAAehE,KACjDA,KAAKiI,UAAYjI,KAAKc,MAAMQ,QAAUtB,KAAKc,MAAMQ,QAAQ2G,eAAY6C,EAErE9K,KAAK4C,sBAAsB5C,KAAKc,OAEhCd,KAAK0H,kBAAoB1H,KAAK0H,kBAAkBmD,KAAK7K,MACrDA,KAAK8G,gBAAkB9G,KAAK8G,gBAAgB+D,KAAK7K,MAEjDA,KAAKH,uBAAuBiB,GAC5Bd,KAAKmB,yBACT,EAzCAsI,EAPkB9J,EAOKa,YAAOsK,GAU9BrB,EAjBkB9J,EAiBKoL,aAAuB"}
|
package/dist/es/core/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",n="6.32.
|
|
1
|
+
const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",n="6.32.1",o="esm",t=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],r=6e4;export{r as DEFAULT_HTTP_TIMEOUT,e as FALLBACK_CONTEXT,t as GENERIC_OPTIONS,o as LIBRARY_BUNDLE_TYPE,n as LIBRARY_VERSION};
|
|
2
2
|
//# sourceMappingURL=config.js.map
|
package/dist/es/core/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Language as t}from"../language/Language.js";import
|
|
1
|
+
import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import e from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import s from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as n,assertConfigurationPropertiesAreValid as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as c}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as h}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as m,verifyPaymentDidNotFail as d,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{THREEDS2_FULL as g}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as C}from"../language/constants.js";import A from"./Services/get-translations.js";import{defaultProps as v}from"./core.defaultProps.js";import{formatLocale as w,formatCustomTranslations as j}from"../language/utils.js";import{resolveEnvironments as b}from"./Environment/Environment.js";import{LIBRARY_BUNDLE_TYPE as E,LIBRARY_VERSION as P}from"./config.js";import{AnalyticsLogEvent as M,LogEventType as T}from"./Analytics/events/AnalyticsLogEvent.js";import R from"./Errors/CancelError.js";import{AnalyticsService as I}from"./Analytics/AnalyticsService.js";import{AnalyticsEventQueue as U}from"./Analytics/AnalyticsEventQueue.js";import{isAmountValid as x}from"../utils/amount-util.js";function k(t,o,e){return o in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}class D{static setBundleType(t){D.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),await this.requestAnalyticsAttemptId(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then(t=>{const{amount:o,shopperLocale:e,countryCode:s,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||e,countryCode:this.options.countryCode||s}),this.createPaymentMethodsList(i),this}).catch(t=>(this.options.onError&&this.options.onError(t),Promise.reject(t))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await A(this.cdnTranslationsUrl,D.metadata.version,this.options.locale)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:C}),this.options.locale=w(this.options.locale),this.options.translations=j(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise((o,e)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:e})})),this.session&&(o=this.session.submitDetails(t).catch(t=>(this.options.onError?.(t),Promise.reject(t)))),o?o.then(m).then(d).then(this.afterAdditionalDetails).then(t=>{u(t),this.options.onPaymentCompleted?.(t)}).catch(t=>{t instanceof R||(u(t),this.options.onPaymentFailed?.(t))}):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(c(t,"action")&&c(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const e=t.type===g?`${t.type}${t.subtype}`:t.paymentMethodType,i=new M({type:T.action,subType:M.getSubtypeFromActionType(t.type),message:`${e} action was handled by the SDK`,component:e});this.modules.analytics.sendAnalytics(i);const n={...this.getCorePropsForComponent(),...o};return s(this,p,t,n)}return this.handleCreateError()}update(t={},{shouldReinitializeCheckout:o=!0}={}){if(o)return this.setOptions(t),this.initialize().then(()=>(this.components.forEach(o=>{const e={...t.order?.remainingAmount?{amount:t.order.remainingAmount}:{amount:this.options.amount},...this.session&&{session:this.session},...t};o.update(e)}),this));const{amount:e,secondaryAmount:s}=t;return(e||s)&&this.triggerAmountUpdate(e,s),Promise.resolve(this)}triggerAmountUpdate(t,o){x(t)?!o||x(o)?(this.setOptions({amount:t,...o&&{secondaryAmount:o}}),this.components.forEach(e=>{e.updateAmount(t,o)})):console.warn("Core update(): Update canceled. Invalid secondary amount object"):console.warn("Core update(): Update canceled. Invalid amount object")}getCorePropsForComponent(){return{...n(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new e(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const e=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:new i({eventQueue:new U,service:new I({analyticsContext:this.analyticsContext,clientKey:this.options.clientKey}),enabled:this.options.analytics?.enabled,analyticsData:this.options.analytics?.analyticsData}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:e,customTranslations:this.options.translations}),srPanel:new h(this,{...this.options.srConfig})})}async requestAnalyticsAttemptId(){await this.modules.analytics.setUp({locale:this.options.locale,...this.session?.id&&{sessionId:this.session.id}})}constructor(t){k(this,"session",void 0),k(this,"paymentMethodsResponse",void 0),k(this,"modules",void 0),k(this,"options",void 0),k(this,"analyticsContext",void 0),k(this,"loadingContext",void 0),k(this,"cdnImagesUrl",void 0),k(this,"cdnTranslationsUrl",void 0),k(this,"components",[]),k(this,"afterAdditionalDetails",t=>{if(this.options.afterAdditionalDetails&&t?.action){const o=this.createFromAction(t.action);return this.options.afterAdditionalDetails(o),Promise.reject(new R("Handled by afterAdditionalDetails"))}return Promise.resolve(t)}),k(this,"remove",t=>(this.components=this.components.filter(o=>o._id!==t._id),t.unmount(),this)),k(this,"setOptions",t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale,environment:String.prototype.toLowerCase.apply(t?.environment||this.options?.environment)}}),a(t),this.createFromAction=this.createFromAction.bind(this),this.update=this.update.bind(this),this.setOptions({...v,...t});const{apiUrl:o,analyticsUrl:e,cdnImagesUrl:s,cdnTranslationsUrl:i}=b(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=e,this.cdnImagesUrl=s,this.cdnTranslationsUrl=i,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const n=this.options.clientKey?.substring(0,4);if(("test"===n||"live"===n)&&!this.loadingContext.includes(n))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${n} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===n&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=D.metadata)}}k(D,"metadata",{version:P,bundleType:E}),k(D,"registry",p);export{D as default};
|
|
2
2
|
//# sourceMappingURL=core.js.map
|
package/dist/es/core/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { DEFAULT_LOCALE } from '../language/constants';\nimport getTranslations from './Services/get-translations';\nimport { defaultProps } from './core.defaultProps';\nimport { formatCustomTranslations, formatLocale } from '../language/utils';\nimport { resolveEnvironments } from './Environment';\nimport { LIBRARY_BUNDLE_TYPE, LIBRARY_VERSION } from './config';\n\nimport type { PaymentAction, PaymentAmount, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData, CoreModules } from './types';\nimport type { Translations } from '../language/types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\nimport { AnalyticsLogEvent, LogEventType } from './Analytics/events/AnalyticsLogEvent';\nimport CancelError from './Errors/CancelError';\nimport { AnalyticsService } from './Analytics/AnalyticsService';\nimport { AnalyticsEventQueue } from './Analytics/AnalyticsEventQueue';\nimport { isAmountValid } from '../utils/amount-util';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: CoreModules;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: LIBRARY_VERSION,\n bundleType: LIBRARY_BUNDLE_TYPE\n };\n\n public static readonly registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n this.update = this.update.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n console.debug(\n `The value you are passing as your \"clientKey\" looks like an originKey (${this.options.clientKey?.substring(0, 12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n await this.createCoreModules();\n await this.requestAnalyticsAttemptId();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private async fetchLocaleTranslations(): Promise<Translations> {\n try {\n return await getTranslations(this.cdnTranslationsUrl, Core.metadata.version, this.options.locale);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.options.onError?.(error);\n else this.options.onError?.(new AdyenCheckoutError('ERROR', 'Failed to fetch translation', { cause: error }));\n }\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n this.options.locale = formatLocale(this.options.locale);\n this.options.translations = formatCustomTranslations(this.options.translations);\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.afterAdditionalDetails)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n return;\n }\n\n cleanupFinalResult(e as PaymentResponseData);\n this.options.onPaymentFailed?.(e as PaymentResponseData);\n });\n }\n\n private readonly afterAdditionalDetails = (response: PaymentResponseData): Promise<PaymentResponseData | Error> => {\n /**\n * After the user is redirected back, a request to `/details` or `/paymentDetails` will be made.\n * Typically, the response will not include an action object, except for the case of `paybybank_pix` payment method.\n * In terms of `paybybank_pix`, the action UIElement will be created and passed to the `afterAdditionalDetails` callback, allowing it to be mounted on the page.\n */\n if (this.options.afterAdditionalDetails && response?.action) {\n const actionEle = this.createFromAction(response.action);\n this.options.afterAdditionalDetails(actionEle);\n return Promise.reject(new CancelError('Handled by afterAdditionalDetails'));\n }\n return Promise.resolve(response);\n };\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n const event = new AnalyticsLogEvent({\n type: LogEventType.action,\n subType: AnalyticsLogEvent.getSubtypeFromActionType(action.type),\n message: `${component} action was handled by the SDK`,\n component\n });\n this.modules.analytics.sendAnalytics(event);\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param props - props to update\n * @param options - Can be used to avoid remounting the elements\n * @returns this - the Core instance\n */\n public update(props: Partial<CoreConfiguration> = {}, { shouldReinitializeCheckout = true } = {}): Promise<this> {\n if (shouldReinitializeCheckout) {\n this.setOptions(props);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...props,\n ...(this.session && { session: this.session })\n };\n component.update(newProps);\n });\n return this;\n });\n }\n\n const { amount, secondaryAmount } = props;\n\n if (amount || secondaryAmount) {\n this.triggerAmountUpdate(amount, secondaryAmount);\n }\n\n return Promise.resolve(this);\n }\n\n /**\n * Validates and propagates amount updates to all mounted components.\n *\n * @param amount - Primary payment amount object (required)\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n private triggerAmountUpdate(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n if (!isAmountValid(amount)) {\n console.warn('Core update(): Update canceled. Invalid amount object');\n return;\n }\n\n if (secondaryAmount && !isAmountValid(secondaryAmount)) {\n console.warn('Core update(): Update canceled. Invalid secondary amount object');\n return;\n }\n\n this.setOptions({\n amount,\n ...(secondaryAmount && { secondaryAmount })\n });\n\n this.components.forEach(component => {\n component.updateAmount(amount, secondaryAmount);\n });\n }\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale,\n // Make environment lowercase to ensure consistency\n environment: String.prototype.toLowerCase.apply(options?.environment || this.options?.environment)\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private async createCoreModules(): Promise<void> {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n const translations = await this.fetchLocaleTranslations();\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: new Analytics({\n eventQueue: new AnalyticsEventQueue(),\n service: new AnalyticsService({\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey\n }),\n enabled: this.options.analytics?.enabled,\n analyticsData: this.options.analytics?.analyticsData\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n translations,\n customTranslations: this.options.translations\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n\n private async requestAnalyticsAttemptId(): Promise<void> {\n await this.modules.analytics.setUp({\n locale: this.options.locale,\n ...(this.session?.id && { sessionId: this.session.id })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","setBundleType","type","metadata","bundleType","register","items","registry","add","getComponent","txVariant","initialize","this","initializeCore","validateCoreConfiguration","createCoreModules","requestAnalyticsAttemptId","session","setupSession","options","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","setOptions","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","fetchLocaleTranslations","getTranslations","cdnTranslationsUrl","version","AdyenCheckoutError","cause","paymentMethodsConfiguration","console","warn","IMPLEMENTATION_ERROR","DEFAULT_LOCALE","formatLocale","translations","formatCustomTranslations","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","afterAdditionalDetails","response","cleanupFinalResult","onPaymentCompleted","e","CancelError","onPaymentFailed","createFromAction","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","event","AnalyticsLogEvent","LogEventType","subType","getSubtypeFromActionType","message","modules","analytics","sendAnalytics","props","getCorePropsForComponent","getComponentForAction","handleCreateError","update","shouldReinitializeCheckout","components","forEach","newProps","secondaryAmount","triggerAmountUpdate","isAmountValid","updateAmount","processGlobalOptions","core","i18n","loadingContext","cdnContext","cdnImagesUrl","storeElementReference","element","push","paymentMethod","errorMessage","name","JSON","stringify","paymentMethodsResponse","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","eventQueue","AnalyticsEventQueue","service","AnalyticsService","analyticsContext","clientKey","enabled","analyticsData","resources","Resources","Language","customTranslations","srPanel","SRPanel","srConfig","setUp","id","sessionId","constructor","_define_property","actionEle","remove","filter","c","_id","unmount","environment","String","prototype","toLowerCase","apply","assertConfigurationPropertiesAreValid","bind","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","_environmentUrls","Session","clientKeyType","substring","includes","api","debug","exposeLibraryMetadata","window","LIBRARY_VERSION","LIBRARY_BUNDLE_TYPE"],"mappings":"iqDAgCA,MAAMA,EAoBF,oBAAcC,CAAcC,GACxBF,EAAKG,SAASC,WAAaF,CAC/B,CAEA,eAAcG,IAAYC,GACtBC,EAASC,OAAOF,EACpB,CAMA,QAAAD,IAAmBC,GACfC,EAASC,OAAOF,EACpB,CAEOG,YAAAA,CAAaC,GAChB,OAAOH,EAASE,aAAaC,EACjC,CAwCA,gBAAaC,GAKT,aAJMC,KAAKC,iBACXD,KAAKE,kCACCF,KAAKG,0BACLH,KAAKI,4BACJJ,IACX,CAEA,oBAAcC,GACV,OAAID,KAAKK,QACEL,KAAKK,QACPC,aAAaN,KAAKO,SAClBC,KAAKC,IACF,MAAMC,OAAEA,EAAMC,cAAEA,EAAaC,YAAEA,EAAWC,eAAEA,KAAmBC,GAASL,EAWxE,OATAT,KAAKe,WAAW,IACTD,EACHJ,OAAQV,KAAKO,QAAQS,MAAQhB,KAAKO,QAAQS,MAAMC,gBAAkBP,EAClEQ,OAAQlB,KAAKO,QAAQW,QAAUP,EAC/BC,YAAaZ,KAAKO,QAAQK,aAAeA,IAG7CZ,KAAKmB,yBAAyBN,GAEvBb,OAEVoB,MAAMC,IACCrB,KAAKO,QAAQe,SAAStB,KAAKO,QAAQe,QAAQD,GACxCE,QAAQC,OAAOH,MAIlCrB,KAAKmB,2BACEI,QAAQE,QAAQzB,MAC3B,CAEA,6BAAc0B,GACV,IACI,aAAaC,EAAgB3B,KAAK4B,mBAAoBxC,EAAKG,SAASsC,QAAS7B,KAAKO,QAAQW,OAC9F,CAAE,MAAOG,GACDA,aAAiBS,EAAoB9B,KAAKO,QAAQe,UAAUD,GAC3DrB,KAAKO,QAAQe,UAAU,IAAIQ,EAAmB,QAAS,8BAA+B,CAAEC,MAAOV,IACxG,CACJ,CAEQnB,yBAAAA,GAMJ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Ae2D,SAASF,GACxF,MAAM,IAAInH,EACN,uBACA,0BAA0BmH,2BAAuCjJ,KAAKO,QAAQwI,kBAAkBK,KAAOpJ,KAAKO,QAAQ6H,2BAGtG,SAAlBa,GACAhH,QAAQoH,MACJ,0EAA0ErJ,KAAKO,QAAQwG,WAAWmC,UAAU,EAAG,oQAInHlJ,KAAKO,QAAQ+I,wBACbC,OAAO,iBAAsBnK,EAAKG,SAE1C,EA/DAsI,EAbEzI,EAaqBG,WAAW,CAC9BsC,QAAS2H,EACThK,WAAYiK,IAGhB5B,EAlBEzI,EAkBqBO,WAAWA"}
|
|
1
|
+
{"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { DEFAULT_LOCALE } from '../language/constants';\nimport getTranslations from './Services/get-translations';\nimport { defaultProps } from './core.defaultProps';\nimport { formatCustomTranslations, formatLocale } from '../language/utils';\nimport { resolveEnvironments } from './Environment';\nimport { LIBRARY_BUNDLE_TYPE, LIBRARY_VERSION } from './config';\n\nimport type { PaymentAction, PaymentAmount, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData, CoreModules } from './types';\nimport type { Translations } from '../language/types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\nimport { AnalyticsLogEvent, LogEventType } from './Analytics/events/AnalyticsLogEvent';\nimport CancelError from './Errors/CancelError';\nimport { AnalyticsService } from './Analytics/AnalyticsService';\nimport { AnalyticsEventQueue } from './Analytics/AnalyticsEventQueue';\nimport { isAmountValid } from '../utils/amount-util';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: CoreModules;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: LIBRARY_VERSION,\n bundleType: LIBRARY_BUNDLE_TYPE\n };\n\n public static readonly registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n this.update = this.update.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n console.debug(\n `The value you are passing as your \"clientKey\" looks like an originKey (${this.options.clientKey?.substring(0, 12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n await this.createCoreModules();\n await this.requestAnalyticsAttemptId();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private async fetchLocaleTranslations(): Promise<Translations> {\n try {\n return await getTranslations(this.cdnTranslationsUrl, Core.metadata.version, this.options.locale);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.options.onError?.(error);\n else this.options.onError?.(new AdyenCheckoutError('ERROR', 'Failed to fetch translation', { cause: error }));\n }\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n this.options.locale = formatLocale(this.options.locale);\n this.options.translations = formatCustomTranslations(this.options.translations);\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.afterAdditionalDetails)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n return;\n }\n\n cleanupFinalResult(e as PaymentResponseData);\n this.options.onPaymentFailed?.(e as PaymentResponseData);\n });\n }\n\n private readonly afterAdditionalDetails = (response: PaymentResponseData): Promise<PaymentResponseData | Error> => {\n /**\n * After the user is redirected back, a request to `/details` or `/paymentDetails` will be made.\n * Typically, the response will not include an action object, except for the case of `paybybank_pix` payment method.\n * In terms of `paybybank_pix`, the action UIElement will be created and passed to the `afterAdditionalDetails` callback, allowing it to be mounted on the page.\n */\n if (this.options.afterAdditionalDetails && response?.action) {\n const actionEle = this.createFromAction(response.action);\n this.options.afterAdditionalDetails(actionEle);\n return Promise.reject(new CancelError('Handled by afterAdditionalDetails'));\n }\n return Promise.resolve(response);\n };\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n const event = new AnalyticsLogEvent({\n type: LogEventType.action,\n subType: AnalyticsLogEvent.getSubtypeFromActionType(action.type),\n message: `${component} action was handled by the SDK`,\n component\n });\n this.modules.analytics.sendAnalytics(event);\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param props - props to update\n * @param options - Can be used to avoid remounting the elements\n * @returns this - the Core instance\n */\n public update(props: Partial<Omit<CoreConfiguration, 'session'>> = {}, { shouldReinitializeCheckout = true } = {}): Promise<this> {\n if (shouldReinitializeCheckout) {\n this.setOptions(props);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...(props.order?.remainingAmount ? { amount: props.order.remainingAmount } : { amount: this.options.amount }),\n ...(this.session && { session: this.session }),\n ...props\n };\n component.update(newProps);\n });\n return this;\n });\n }\n\n const { amount, secondaryAmount } = props;\n\n if (amount || secondaryAmount) {\n this.triggerAmountUpdate(amount, secondaryAmount);\n }\n\n return Promise.resolve(this);\n }\n\n /**\n * Validates and propagates amount updates to all mounted components.\n *\n * @param amount - Primary payment amount object (required)\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n private triggerAmountUpdate(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n if (!isAmountValid(amount)) {\n console.warn('Core update(): Update canceled. Invalid amount object');\n return;\n }\n\n if (secondaryAmount && !isAmountValid(secondaryAmount)) {\n console.warn('Core update(): Update canceled. Invalid secondary amount object');\n return;\n }\n\n this.setOptions({\n amount,\n ...(secondaryAmount && { secondaryAmount })\n });\n\n this.components.forEach(component => {\n component.updateAmount(amount, secondaryAmount);\n });\n }\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale,\n // Make environment lowercase to ensure consistency\n environment: String.prototype.toLowerCase.apply(options?.environment || this.options?.environment)\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private async createCoreModules(): Promise<void> {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n const translations = await this.fetchLocaleTranslations();\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: new Analytics({\n eventQueue: new AnalyticsEventQueue(),\n service: new AnalyticsService({\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey\n }),\n enabled: this.options.analytics?.enabled,\n analyticsData: this.options.analytics?.analyticsData\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n translations,\n customTranslations: this.options.translations\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n\n private async requestAnalyticsAttemptId(): Promise<void> {\n await this.modules.analytics.setUp({\n locale: this.options.locale,\n ...(this.session?.id && { sessionId: this.session.id })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","setBundleType","type","metadata","bundleType","register","items","registry","add","getComponent","txVariant","initialize","this","initializeCore","validateCoreConfiguration","createCoreModules","requestAnalyticsAttemptId","session","setupSession","options","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","setOptions","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","fetchLocaleTranslations","getTranslations","cdnTranslationsUrl","version","AdyenCheckoutError","cause","paymentMethodsConfiguration","console","warn","IMPLEMENTATION_ERROR","DEFAULT_LOCALE","formatLocale","translations","formatCustomTranslations","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","afterAdditionalDetails","response","cleanupFinalResult","onPaymentCompleted","e","CancelError","onPaymentFailed","createFromAction","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","event","AnalyticsLogEvent","LogEventType","subType","getSubtypeFromActionType","message","modules","analytics","sendAnalytics","props","getCorePropsForComponent","getComponentForAction","handleCreateError","update","shouldReinitializeCheckout","components","forEach","newProps","secondaryAmount","triggerAmountUpdate","isAmountValid","updateAmount","processGlobalOptions","core","i18n","loadingContext","cdnContext","cdnImagesUrl","storeElementReference","element","push","paymentMethod","errorMessage","name","JSON","stringify","paymentMethodsResponse","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","eventQueue","AnalyticsEventQueue","service","AnalyticsService","analyticsContext","clientKey","enabled","analyticsData","resources","Resources","Language","customTranslations","srPanel","SRPanel","srConfig","setUp","id","sessionId","constructor","_define_property","actionEle","remove","filter","c","_id","unmount","environment","String","prototype","toLowerCase","apply","assertConfigurationPropertiesAreValid","bind","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","_environmentUrls","Session","clientKeyType","substring","includes","api","debug","exposeLibraryMetadata","window","LIBRARY_VERSION","LIBRARY_BUNDLE_TYPE"],"mappings":"iqDAgCA,MAAMA,EAoBF,oBAAcC,CAAcC,GACxBF,EAAKG,SAASC,WAAaF,CAC/B,CAEA,eAAcG,IAAYC,GACtBC,EAASC,OAAOF,EACpB,CAMA,QAAAD,IAAmBC,GACfC,EAASC,OAAOF,EACpB,CAEOG,YAAAA,CAAaC,GAChB,OAAOH,EAASE,aAAaC,EACjC,CAwCA,gBAAaC,GAKT,aAJMC,KAAKC,iBACXD,KAAKE,kCACCF,KAAKG,0BACLH,KAAKI,4BACJJ,IACX,CAEA,oBAAcC,GACV,OAAID,KAAKK,QACEL,KAAKK,QACPC,aAAaN,KAAKO,SAClBC,KAAKC,IACF,MAAMC,OAAEA,EAAMC,cAAEA,EAAaC,YAAEA,EAAWC,eAAEA,KAAmBC,GAASL,EAWxE,OATAT,KAAKe,WAAW,IACTD,EACHJ,OAAQV,KAAKO,QAAQS,MAAQhB,KAAKO,QAAQS,MAAMC,gBAAkBP,EAClEQ,OAAQlB,KAAKO,QAAQW,QAAUP,EAC/BC,YAAaZ,KAAKO,QAAQK,aAAeA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