@adyen/adyen-web 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adyen.css +1 -1
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +21 -4
- package/dist/es/adyen.css +1 -1
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/ApplePay/ApplePayService.js +1 -1
- package/dist/es/components/ApplePay/ApplePayService.js.map +1 -1
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/defaultProps.js +1 -1
- package/dist/es/components/Card/components/CardInput/defaultProps.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es/components/Dropin/elements/createElements.js +1 -1
- package/dist/es/components/Dropin/elements/createElements.js.map +1 -1
- package/dist/es/components/Dropin/elements/filters.js +1 -1
- package/dist/es/components/Dropin/elements/filters.js.map +1 -1
- package/dist/es/components/components-name-map.js +1 -1
- package/dist/es/components/components-name-map.js.map +1 -1
- package/dist/es/components/internal/Address/validate.js +1 -1
- package/dist/es/components/internal/Address/validate.js.map +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/Button/Button.js +1 -1
- package/dist/es/components/internal/Button/Button.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es/core/Analytics/Analytics.js +1 -1
- package/dist/es/core/Analytics/Analytics.js.map +1 -1
- package/dist/es/core/Analytics/constants.js +1 -1
- package/dist/es/core/Analytics/constants.js.map +1 -1
- package/dist/es/core/Analytics/utils.js +1 -1
- package/dist/es/core/Analytics/utils.js.map +1 -1
- package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
- package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
- package/dist/es/core/Services/analytics/collect-id.js +1 -1
- package/dist/es/core/Services/sessions/setup-session.js +1 -1
- package/dist/es/core/Services/sessions/setup-session.js.map +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/index.d.ts +21 -4
- package/dist/es-legacy/adyen.css +1 -1
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePayService.js +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePayService.js.map +1 -1
- package/dist/es-legacy/components/Card/Card.js +1 -1
- package/dist/es-legacy/components/Card/Card.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es-legacy/components/Dropin/elements/createElements.js +1 -1
- package/dist/es-legacy/components/Dropin/elements/createElements.js.map +1 -1
- package/dist/es-legacy/components/Dropin/elements/filters.js +1 -1
- package/dist/es-legacy/components/Dropin/elements/filters.js.map +1 -1
- package/dist/es-legacy/components/components-name-map.js +1 -1
- package/dist/es-legacy/components/components-name-map.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/validate.js +1 -1
- package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
- package/dist/es-legacy/core/Analytics/constants.js +1 -1
- package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js +1 -1
- package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
- package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js +1 -1
- package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
- package/dist/es-legacy/core/Services/sessions/setup-session.js +1 -1
- package/dist/es-legacy/core/Services/sessions/setup-session.js.map +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/package.json +3 -2
- package/styles/adyen.css +84 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class e{session;options;constructor(e,t){this.options=t,this.session=new ApplePaySession(t.version,e),this.session.onvalidatemerchant=e=>this.onvalidatemerchant(e,t.onValidateMerchant),this.session.onpaymentauthorized=e=>this.onpaymentauthorized(e,t.onPaymentAuthorized),this.session.oncancel=e=>this.oncancel(e,t.onCancel),"function"==typeof t.onPaymentMethodSelected&&(this.session.onpaymentmethodselected=e=>this.onpaymentmethodselected(e,t.onPaymentMethodSelected)),"function"==typeof t.onShippingContactSelected&&(this.session.onshippingcontactselected=e=>this.onshippingcontactselected(e,t.onShippingContactSelected)),"function"==typeof t.onShippingMethodSelected&&(this.session.onshippingmethodselected=e=>this.onshippingmethodselected(e,t.onShippingMethodSelected))}begin(){return this.session.begin()}onvalidatemerchant(e,t){return new Promise(((n,o)=>t(n,o,e.validationURL))).then((e=>{this.session.completeMerchantValidation(e)})).catch((e=>{console.error(e),this.session.abort(),this.options.onError(e)}))}onpaymentauthorized(e,t){return new Promise(((n,o)=>t(n,o,e))).then((e=>{this.session.completePayment(e)})).catch((e=>{this.session.completePayment(e)}))}onpaymentmethodselected(e,t){return new Promise(((n,o)=>t(n,o,e))).then((e=>{this.session.completePaymentMethodSelection(e)})).catch((e=>{this.session.completePaymentMethodSelection(e)}))}onshippingcontactselected(e,t){return new Promise(((n,o)=>t(n,o,e))).then((e=>{this.session.completeShippingContactSelection(e)})).catch((e=>{this.session.completeShippingContactSelection(e)}))}onshippingmethodselected(e,t){return new Promise(((n,o)=>t(n,o,e))).then((e=>{this.session.completeShippingMethodSelection(e)})).catch((e=>{this.session.completeShippingMethodSelection(e)}))}oncancel(e,t){t(e)}}export{e as default};
|
|
1
|
+
class e{session;options;constructor(e,t){this.options=t,this.session=new ApplePaySession(t.version,e),this.session.onvalidatemerchant=e=>{this.onvalidatemerchant(e,t.onValidateMerchant)},this.session.onpaymentauthorized=e=>{this.onpaymentauthorized(e,t.onPaymentAuthorized)},this.session.oncancel=e=>{this.oncancel(e,t.onCancel)},"function"==typeof t.onPaymentMethodSelected&&(this.session.onpaymentmethodselected=e=>{this.onpaymentmethodselected(e,t.onPaymentMethodSelected)}),"function"==typeof t.onShippingContactSelected&&(this.session.onshippingcontactselected=e=>{this.onshippingcontactselected(e,t.onShippingContactSelected)}),"function"==typeof t.onShippingMethodSelected&&(this.session.onshippingmethodselected=e=>{this.onshippingmethodselected(e,t.onShippingMethodSelected)})}begin(){return this.session.begin()}onvalidatemerchant(e,t){return new Promise(((n,o)=>t(n,o,e.validationURL))).then((e=>{this.session.completeMerchantValidation(e)})).catch((e=>{console.error(e),this.session.abort(),this.options.onError(e)}))}onpaymentauthorized(e,t){return new Promise(((n,o)=>t(n,o,e))).then((e=>{this.session.completePayment(e)})).catch((e=>{this.session.completePayment(e)}))}onpaymentmethodselected(e,t){return new Promise(((n,o)=>t(n,o,e))).then((e=>{this.session.completePaymentMethodSelection(e)})).catch((e=>{this.session.completePaymentMethodSelection(e)}))}onshippingcontactselected(e,t){return new Promise(((n,o)=>t(n,o,e))).then((e=>{this.session.completeShippingContactSelection(e)})).catch((e=>{this.session.completeShippingContactSelection(e)}))}onshippingmethodselected(e,t){return new Promise(((n,o)=>t(n,o,e))).then((e=>{this.session.completeShippingMethodSelection(e)})).catch((e=>{this.session.completeShippingMethodSelection(e)}))}oncancel(e,t){t(e)}}export{e as default};
|
|
2
2
|
//# sourceMappingURL=ApplePayService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplePayService.js","sources":["../../../../src/components/ApplePay/ApplePayService.ts"],"sourcesContent":["import { ApplePayPaymentAuthorizationResult } from './types';\n\ninterface ApplePayServiceOptions {\n version: number;\n onValidateMerchant: (resolve, reject, url) => void;\n onError: (error?: unknown) => void;\n onCancel?: (event: ApplePayJS.Event) => void;\n onPaymentMethodSelected?: (resolve, reject, event: ApplePayJS.ApplePayPaymentMethodSelectedEvent) => void;\n onShippingMethodSelected?: (resolve, reject, event: ApplePayJS.ApplePayShippingMethodSelectedEvent) => void;\n onShippingContactSelected?: (resolve, reject, event: ApplePayJS.ApplePayShippingContactSelectedEvent) => void;\n onPaymentAuthorized: (\n resolve: (result: ApplePayPaymentAuthorizationResult) => void,\n reject: (result: ApplePayPaymentAuthorizationResult) => void,\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent\n ) => void;\n}\n\nclass ApplePayService {\n private session: ApplePaySession;\n private readonly options: ApplePayServiceOptions;\n\n constructor(paymentRequest: ApplePayJS.ApplePayPaymentRequest, options: ApplePayServiceOptions) {\n this.options = options;\n\n this.session = new ApplePaySession(options.version, paymentRequest);\n /* eslint-disable @typescript-eslint/no-misused-promises */\n this.session.onvalidatemerchant = event => this.onvalidatemerchant(event, options.onValidateMerchant);\n this.session.onpaymentauthorized = event => this.onpaymentauthorized(event, options.onPaymentAuthorized);\n this.session.oncancel = event => this.oncancel(event, options.onCancel);\n\n if (typeof options.onPaymentMethodSelected === 'function') {\n this.session.onpaymentmethodselected = event => this.onpaymentmethodselected(event, options.onPaymentMethodSelected);\n }\n\n if (typeof options.onShippingContactSelected === 'function') {\n this.session.onshippingcontactselected = event => this.onshippingcontactselected(event, options.onShippingContactSelected);\n }\n\n if (typeof options.onShippingMethodSelected === 'function') {\n this.session.onshippingmethodselected = event => this.onshippingmethodselected(event, options.onShippingMethodSelected);\n }\n /* eslint-enable @typescript-eslint/no-misused-promises */\n }\n\n /**\n * Begins the merchant validation process.\n * When this method is called, the payment sheet is presented and the merchant validation process is initiated.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778001-begin}\n */\n begin() {\n return this.session.begin();\n }\n\n /**\n * An event handler that is called when the payment sheet is displayed.\n * Use this attribute to request and return a merchant session.\n * @param event - An ApplePayValidateMerchantEvent object (contains validationURL)\n * @param onValidateMerchant - A promise implemented by the merchant that will resolve with the merchantSession\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/providing_merchant_validation}\n */\n onvalidatemerchant(event: ApplePayJS.ApplePayValidateMerchantEvent, onValidateMerchant) {\n return new Promise((resolve, reject) => onValidateMerchant(resolve, reject, event.validationURL))\n .then(response => {\n this.session.completeMerchantValidation(response);\n })\n .catch(error => {\n console.error(error);\n this.session.abort();\n this.options.onError(error);\n });\n }\n\n /**\n * An event handler that is called when the user has authorized the Apple Pay payment with Touch ID, Face ID, or passcode.\n * The onpaymentauthorized function must complete the payment and respond by calling completePayment before the 30 second timeout.\n *\n * @param event - The event parameter contains the payment (ApplePayPayment) attribute.\n * @param onPaymentAuthorized - A promise that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778020-onpaymentauthorized}\n */\n onpaymentauthorized(\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent,\n onPaymentAuthorized: ApplePayServiceOptions['onPaymentAuthorized']\n ): Promise<void> {\n return new Promise((resolve, reject) => onPaymentAuthorized(resolve, reject, event))\n .then((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n })\n .catch((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n *\n * @param event - The event parameter contains the payment (ApplePayPayment) attribute.\n * @param onPaymentMethodSelected - A promise that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778013-onpaymentmethodselected}\n */\n onpaymentmethodselected(event: ApplePayJS.ApplePayPaymentMethodSelectedEvent, onPaymentMethodSelected) {\n return new Promise((resolve, reject) => onPaymentMethodSelected(resolve, reject, event))\n .then((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n })\n .catch((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n * @param event - The event parameter contains the shippingContact attribute.\n * @param onShippingContactSelected - A promise that will complete the selection of a shipping contact with an update.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778009-onshippingcontactselected}\n */\n onshippingcontactselected(event: ApplePayJS.ApplePayShippingContactSelectedEvent, onShippingContactSelected) {\n return new Promise((resolve, reject) => onShippingContactSelected(resolve, reject, event))\n .then((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n })\n .catch((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n * @param event - The event parameter contains the shippingMethod attribute.\n * @param onShippingMethodSelected - A promise that will complete the selection of a shipping method with an update.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778009-onshippingcontactselected}\n */\n onshippingmethodselected(event: ApplePayJS.ApplePayShippingMethodSelectedEvent, onShippingMethodSelected) {\n return new Promise((resolve, reject) => onShippingMethodSelected(resolve, reject, event))\n .then((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n })\n .catch((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n });\n }\n\n /**\n * An event handler that is automatically called when the payment UI is dismissed.\n * This function can be called even after an onpaymentauthorized event has been dispatched.\n * @param event -\n * @param onCancel -\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778029-oncancel}\n */\n oncancel(event: ApplePayJS.Event, onCancel): void {\n onCancel(event);\n }\n}\n\nexport default ApplePayService;\n"],"names":["ApplePayService","session","options","constructor","paymentRequest","this","ApplePaySession","version","onvalidatemerchant","event","onValidateMerchant","onpaymentauthorized","onPaymentAuthorized","oncancel","onCancel","onPaymentMethodSelected","onpaymentmethodselected","onShippingContactSelected","onshippingcontactselected","onShippingMethodSelected","onshippingmethodselected","begin","Promise","resolve","reject","validationURL","then","response","completeMerchantValidation","catch","error","console","abort","onError","result","completePayment","paymentMethodUpdate","completePaymentMethodSelection","shippingContactUpdate","completeShippingContactSelection","shippingMethodUpdate","completeShippingMethodSelection"],"mappings":"AAiBA,MAAMA,EACMC,QACSC,QAEjBC,WAAAA,CAAYC,EAAmDF,GAC3DG,KAAKH,QAAUA,EAEfG,KAAKJ,QAAU,IAAIK,gBAAgBJ,EAAQK,QAASH,GAEpDC,KAAKJ,QAAQO,mBAAqBC,GAASJ,KAAKG,mBAAmBC,E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yBAAAA,CAA0BT,EAAwDQ,GAC9E,OAAO,IAAIK,SAAQ,CAACC,EAASC,IAAWP,EAA0BM,EAASC,EAAQf,KAC9EiB,MAAMY,IACHjC,KAAKJ,QAAQsC,iCAAiCD,EAAAA,IAEjDT,OAAOS,IACJjC,KAAKJ,QAAQsC,iCAAiCD,EAAAA,GAE1D,CASAlB,wBAAAA,CAAyBX,EAAuDU,GAC5E,OAAO,IAAIG,SAAQ,CAACC,EAASC,IAAWL,EAAyBI,EAASC,EAAQf,KAC7EiB,MAAMc,IACHnC,KAAKJ,QAAQwC,gCAAgCD,EAAAA,IAEhDX,OAAOW,IACJnC,KAAKJ,QAAQwC,gCAAgCD,EAAAA,GAEzD,CASA3B,QAAAA,CAASJ,EAAyBK,GAC9BA,EAASL,EACb"}
|
|
1
|
+
{"version":3,"file":"ApplePayService.js","sources":["../../../../src/components/ApplePay/ApplePayService.ts"],"sourcesContent":["import { ApplePayPaymentAuthorizationResult } from './types';\n\ninterface ApplePayServiceOptions {\n version: number;\n onValidateMerchant: (resolve, reject, url) => void;\n onError: (error?: unknown) => void;\n onCancel?: (event: ApplePayJS.Event) => void;\n onPaymentMethodSelected?: (resolve, reject, event: ApplePayJS.ApplePayPaymentMethodSelectedEvent) => void;\n onShippingMethodSelected?: (resolve, reject, event: ApplePayJS.ApplePayShippingMethodSelectedEvent) => void;\n onShippingContactSelected?: (resolve, reject, event: ApplePayJS.ApplePayShippingContactSelectedEvent) => void;\n onPaymentAuthorized: (\n resolve: (result: ApplePayPaymentAuthorizationResult) => void,\n reject: (result: ApplePayPaymentAuthorizationResult) => void,\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent\n ) => void;\n}\n\nclass ApplePayService {\n private session: ApplePaySession;\n private readonly options: ApplePayServiceOptions;\n\n constructor(paymentRequest: ApplePayJS.ApplePayPaymentRequest, options: ApplePayServiceOptions) {\n this.options = options;\n\n this.session = new ApplePaySession(options.version, paymentRequest);\n this.session.onvalidatemerchant = event => {\n void this.onvalidatemerchant(event, options.onValidateMerchant);\n };\n this.session.onpaymentauthorized = event => {\n void this.onpaymentauthorized(event, options.onPaymentAuthorized);\n };\n\n this.session.oncancel = event => {\n this.oncancel(event, options.onCancel);\n };\n\n if (typeof options.onPaymentMethodSelected === 'function') {\n this.session.onpaymentmethodselected = event => {\n void this.onpaymentmethodselected(event, options.onPaymentMethodSelected);\n };\n }\n\n if (typeof options.onShippingContactSelected === 'function') {\n this.session.onshippingcontactselected = event => {\n void this.onshippingcontactselected(event, options.onShippingContactSelected);\n };\n }\n\n if (typeof options.onShippingMethodSelected === 'function') {\n this.session.onshippingmethodselected = event => {\n void this.onshippingmethodselected(event, options.onShippingMethodSelected);\n };\n }\n }\n\n /**\n * Begins the merchant validation process.\n * When this method is called, the payment sheet is presented and the merchant validation process is initiated.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778001-begin}\n */\n begin() {\n return this.session.begin();\n }\n\n /**\n * An event handler that is called when the payment sheet is displayed.\n * Use this attribute to request and return a merchant session.\n * @param event - An ApplePayValidateMerchantEvent object (contains validationURL)\n * @param onValidateMerchant - A promise implemented by the merchant that will resolve with the merchantSession\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/providing_merchant_validation}\n */\n onvalidatemerchant(event: ApplePayJS.ApplePayValidateMerchantEvent, onValidateMerchant) {\n return new Promise((resolve, reject) => onValidateMerchant(resolve, reject, event.validationURL))\n .then(response => {\n this.session.completeMerchantValidation(response);\n })\n .catch(error => {\n console.error(error);\n this.session.abort();\n this.options.onError(error);\n });\n }\n\n /**\n * An event handler that is called when the user has authorized the Apple Pay payment with Touch ID, Face ID, or passcode.\n * The onpaymentauthorized function must complete the payment and respond by calling completePayment before the 30 second timeout.\n *\n * @param event - The event parameter contains the payment (ApplePayPayment) attribute.\n * @param onPaymentAuthorized - A promise that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778020-onpaymentauthorized}\n */\n onpaymentauthorized(\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent,\n onPaymentAuthorized: ApplePayServiceOptions['onPaymentAuthorized']\n ): Promise<void> {\n return new Promise((resolve, reject) => onPaymentAuthorized(resolve, reject, event))\n .then((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n })\n .catch((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n *\n * @param event - The event parameter contains the payment (ApplePayPayment) attribute.\n * @param onPaymentMethodSelected - A promise that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778013-onpaymentmethodselected}\n */\n onpaymentmethodselected(event: ApplePayJS.ApplePayPaymentMethodSelectedEvent, onPaymentMethodSelected) {\n return new Promise((resolve, reject) => onPaymentMethodSelected(resolve, reject, event))\n .then((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n })\n .catch((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n * @param event - The event parameter contains the shippingContact attribute.\n * @param onShippingContactSelected - A promise that will complete the selection of a shipping contact with an update.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778009-onshippingcontactselected}\n */\n onshippingcontactselected(event: ApplePayJS.ApplePayShippingContactSelectedEvent, onShippingContactSelected) {\n return new Promise((resolve, reject) => onShippingContactSelected(resolve, reject, event))\n .then((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n })\n .catch((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n * @param event - The event parameter contains the shippingMethod attribute.\n * @param onShippingMethodSelected - A promise that will complete the selection of a shipping method with an update.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778009-onshippingcontactselected}\n */\n onshippingmethodselected(event: ApplePayJS.ApplePayShippingMethodSelectedEvent, onShippingMethodSelected) {\n return new Promise((resolve, reject) => onShippingMethodSelected(resolve, reject, event))\n .then((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n })\n .catch((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n });\n }\n\n /**\n * An event handler that is automatically called when the payment UI is dismissed.\n * This function can be called even after an onpaymentauthorized event has been dispatched.\n * @param event -\n * @param onCancel -\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778029-oncancel}\n */\n oncancel(event: ApplePayJS.Event, onCancel): void {\n onCancel(event);\n }\n}\n\nexport default ApplePayService;\n"],"names":["ApplePayService","session","options","constructor","paymentRequest","this","ApplePaySession","version","onvalidatemerchant","event","onValidateMerchant","onpaymentauthorized","onPaymentAuthorized","oncancel","onCancel","onPaymentMethodSelected","onpaymentmethodselected","onShippingContactSelected","onshippingcontactselected","onShippingMethodSelected","onshippingmethodselected","begin","Promise","resolve","reject","validationURL","then","response","completeMerchantValidation","catch","error","console","abort","onError","result","completePayment","paymentMethodUpdate","completePaymentMethodSelection","shippingContactUpdate","completeShippingContactSelection","shippingMethodUpdate","completeShippingMethodSelection"],"mappings":"AAiBA,MAAMA,EACMC,QACSC,QAEjBC,WAAAA,CAAYC,EAAmDF,GAC3DG,KAAKH,QAAUA,EAEfG,KAAKJ,QAAU,IAAIK,gBAAgBJ,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C5EiB,MAAMU,IACH/B,KAAKJ,QAAQoC,+BAA+BD,EAAAA,IAE/CP,OAAOO,IACJ/B,KAAKJ,QAAQoC,+BAA+BD,EAAAA,GAExD,CASAlB,yBAAAA,CAA0BT,EAAwDQ,GAC9E,OAAO,IAAIK,SAAQ,CAACC,EAASC,IAAWP,EAA0BM,EAASC,EAAQf,KAC9EiB,MAAMY,IACHjC,KAAKJ,QAAQsC,iCAAiCD,EAAAA,IAEjDT,OAAOS,IACJjC,KAAKJ,QAAQsC,iCAAiCD,EAAAA,GAE1D,CASAlB,wBAAAA,CAAyBX,EAAuDU,GAC5E,OAAO,IAAIG,SAAQ,CAACC,EAASC,IAAWL,EAAyBI,EAASC,EAAQf,KAC7EiB,MAAMc,IACHnC,KAAKJ,QAAQwC,gCAAgCD,EAAAA,IAEhDX,OAAOW,IACJnC,KAAKJ,QAAQwC,gCAAgCD,EAAAA,GAEzD,CASA3B,QAAAA,CAASJ,EAAyBK,GAC9BA,EAASL,EACb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as t}from"../../external/preact/dist/preact.js";import o from"./components/CardInput/CardInput.js";import{CoreProvider as e}from"../../core/Context/CoreProvider.js";import s from"../../utils/browserInfo.js";import r from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{fieldTypeToSnakeCase as i}from"../internal/SecuredFields/utils.js";import{reject as n}from"../../utils/commonUtils.js";import{hasValidInstallmentsObject as a}from"./components/CardInput/utils.js";import p from"../internal/ClickToPay/services/create-clicktopay-service.js";import c from"./components/ClickToPayWrapper.js";import l from"../../core/Errors/SRPanelProvider.js";import{TxVariants as d}from"../tx-variants.js";import{UIElement as u}from"../internal/UIElement/UIElement.js";import h from"../internal/PayButton/PayButton.js";import{ANALYTICS_RENDERED_STR as m,ANALYTICS_CONFIGURED_STR as y,ANALYTICS_FOCUS_STR as f,ANALYTICS_UNFOCUS_STR as b,ANALYTICS_VALIDATION_ERROR_STR as g}from"../../core/Analytics/constants.js";import{ALL_SECURED_FIELDS as C}from"../internal/SecuredFields/lib/constants.js";import{hasOwnProperty as P}from"../../utils/hasOwnProperty.js";import S,{IMPLEMENTATION_ERROR as k}from"../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as T}from"../../core/Errors/utils.js";import{SF_ErrorCodes as R}from"../../core/Errors/constants.js";import B from"./components/CardInput/defaultProps.js";class I extends u{static type=d.scheme;clickToPayService;clickToPayRef=null;constructor(t,o){super(t,o),o&&!o._disableClickToPay&&(this.clickToPayService=p(this.props.configuration,this.props.clickToPayConfiguration,this.props.environment),this.clickToPayService?.initialize())}static defaultProps={showFormInstruction:!0,_disableClickToPay:!1,doBinLookup:!0,...n(["type","setComponentRef"]).from(B)};setStatus(t,o){return this.componentRef?.setStatus&&this.componentRef.setStatus(t,o),this.clickToPayRef?.setStatus&&this.clickToPayRef.setStatus(t,o),this}setClickToPayRef=t=>{this.clickToPayRef=t};formatProps(t){const o=t.session?.configuration?.enableStoreDetails??t.enableStoreDetails,e=!(0===t.amount?.value)&&o,s=t.storedPaymentMethodId||t.id,r=s&&t?.supportedShopperInteractions?.includes("Ecommerce");if(s&&!r)throw new S(k,"You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions");return{...t,holderNameRequired:!!t.hasHolderName&&t.holderNameRequired,hasCVC:!(t.brand&&"bcmc"===t.brand||t.hideCVC),billingAddressRequired:!t.storedPaymentMethodId&&t.billingAddressRequired,billingAddressMode:t.onAddressLookup?B.billingAddressMode:t.billingAddressMode,brand:t.brand??d.card,countryCode:t.countryCode?t.countryCode.toLowerCase():null,configuration:{...t.configuration,socialSecurityNumberMode:t.configuration?.socialSecurityNumberMode??"auto"},brandsConfiguration:t.brandsConfiguration||t.configuration?.brandsConfiguration||{},icon:t.icon||t.configuration?.icon,installmentOptions:t.session?.configuration?.installmentOptions||t.installmentOptions,enableStoreDetails:o,showStoreDetailsCheckbox:e,clickToPayConfiguration:{...t.clickToPayConfiguration,disableOtpAutoFocus:t.clickToPayConfiguration?.disableOtpAutoFocus||!1,shopperEmail:t.clickToPayConfiguration?.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:t.clickToPayConfiguration?.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:t.clickToPayConfiguration?.locale||t.i18n?.locale?.replace("-","_")},...s&&{storedPaymentMethodId:s}}}formatData(){const t=this.state.selectedBrandValue;return{paymentMethod:{type:I.type,...this.state.data,...this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId,holderName:this.props.holderName??""},...t&&{brand:t},...this.props.fundingSource&&{fundingSource:this.props.fundingSource}},...this.state.billingAddress&&{billingAddress:this.state.billingAddress},...this.state.socialSecurityNumber&&{socialSecurityNumber:this.state.socialSecurityNumber},...this.storePaymentMethodPayload,...a(this.state.installments)&&{installments:this.state.installments},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}updateStyles(t){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(t),this}setFocusOn(t){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(t),this}onBrand=t=>{this.props.onBrand?.(t)};processBinLookupResponse(t,o=!1){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(t,o),this}handleUnsupportedCard(t){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(t),this}handleClickToPaySubmit=t=>{this.setState({data:{...t},valid:{},errors:{},isValid:!0}),this.submit()};onBinLookup(t){if(!t.isReset){const o=n("supportedBrandsRaw").from(t);this.props.onBinLookup(o)}}submitAnalytics(t){const{type:o}=t;o!==m&&o!==y||"scheme"===this.constructor.type&&P(this.props,"supportedShopperInteractions")&&(t.isStoredPaymentMethod=!0,t.brand=this.props.brand),super.submitAnalytics(t,this.props)}onConfigSuccess=t=>{this.submitAnalytics({type:y}),this.props.onConfigSuccess?.(t)};onFocus=t=>{this.submitAnalytics({type:f,target:i(t.fieldType)}),C.includes(t.fieldType)?this.props.onFocus?.(t.event):this.props.onFocus?.(t)};onBlur=t=>{this.submitAnalytics({type:b,target:i(t.fieldType)}),C.includes(t.fieldType)?this.props.onBlur?.(t.event):this.props.onBlur?.(t)};onValidationErrorAnalytics=t=>{this.submitAnalytics({type:g,target:i(t.fieldType),validationErrorCode:t.errorCode,validationErrorMessage:T(t.errorCode,R)})};onBinValue=r(this);get storePaymentMethodPayload(){if(this.props.storedPaymentMethodId?.length>0)return{};if(0===this.props.amount?.value)return this.props.enableStoreDetails?{storePaymentMethod:!0}:{};return this.props.showStoreDetailsCheckbox&&void 0!==this.state.storePaymentMethod?{storePaymentMethod:Boolean(this.state.storePaymentMethod)}:{}}get isValid(){return!!this.state.isValid}get icon(){return this.props.icon??this.resources.getImage()(this.props.brand)}get brands(){const{brands:t,brandsConfiguration:o}=this.props;return t?t.map((t=>({icon:o[t]?.icon??this.props.modules.resources.getImage()(t),name:t}))):[]}get displayName(){return this.props.storedPaymentMethodId?`•••• ${this.props.lastFour}`:this.props.name||I.type}get accessibleName(){return(this.props.name||I.type)+(this.props.storedPaymentMethodId?" "+this.props.i18n.get("creditCard.storedCard.description.ariaLabel").replace("%@",this.props.lastFour):"")}get browserInfo(){return s()}payButton=o=>{const e=0===this.props.amount?.value,s=this.props.storedPaymentMethodId?.length>0;return t(h,{...o,amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,label:e&&!s?this.props.i18n.get("payButton.saveDetails"):"",onClick:this.submit})};renderCardInput(e=!0){return t(o,{setComponentRef:this.setComponentRef,...this.props,...this.state,onChange:this.setState,onSubmit:this.submit,handleKeyPress:this.handleKeyPress,payButton:this.payButton,onBrand:this.onBrand,onBinValue:this.onBinValue,brand:this.props.brand,brandsIcons:this.brands,isPayButtonPrimaryVariant:e,resources:this.resources,onFocus:this.onFocus,onBlur:this.onBlur,onValidationErrorAnalytics:this.onValidationErrorAnalytics,onConfigSuccess:this.onConfigSuccess})}render(){return t(e,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(l,{srPanel:this.props.modules.srPanel},t(c,{amount:this.props.amount,configuration:this.props.clickToPayConfiguration,clickToPayService:this.clickToPayService,isStandaloneComponent:!1,setClickToPayRef:this.setClickToPayRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},(t=>this.renderCardInput(t)))))}}export{I as CardElement,I as default};
|
|
1
|
+
import{createElement as t}from"../../external/preact/dist/preact.js";import o from"./components/CardInput/CardInput.js";import{CoreProvider as e}from"../../core/Context/CoreProvider.js";import s from"../../utils/browserInfo.js";import r from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{fieldTypeToSnakeCase as i}from"../internal/SecuredFields/utils.js";import{reject as n}from"../../utils/commonUtils.js";import{hasValidInstallmentsObject as a}from"./components/CardInput/utils.js";import p from"../internal/ClickToPay/services/create-clicktopay-service.js";import c from"./components/ClickToPayWrapper.js";import l from"../../core/Errors/SRPanelProvider.js";import{TxVariants as d}from"../tx-variants.js";import{UIElement as u}from"../internal/UIElement/UIElement.js";import h from"../internal/PayButton/PayButton.js";import{ANALYTICS_RENDERED_STR as m,ANALYTICS_CONFIGURED_STR as y,ANALYTICS_FOCUS_STR as f,ANALYTICS_UNFOCUS_STR as b,ANALYTICS_VALIDATION_ERROR_STR as g}from"../../core/Analytics/constants.js";import{ALL_SECURED_FIELDS as C}from"../internal/SecuredFields/lib/constants.js";import{hasOwnProperty as P}from"../../utils/hasOwnProperty.js";import S,{IMPLEMENTATION_ERROR as k}from"../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as T}from"../../core/Errors/utils.js";import{SF_ErrorCodes as R}from"../../core/Errors/constants.js";import B from"./components/CardInput/defaultProps.js";class I extends u{static type=d.scheme;clickToPayService;clickToPayRef=null;constructor(t,o){super(t,o),o&&!o._disableClickToPay&&(this.clickToPayService=p(this.props.configuration,this.props.clickToPayConfiguration,this.props.environment),this.clickToPayService?.initialize())}static defaultProps={showFormInstruction:!0,_disableClickToPay:!1,doBinLookup:!0,...n(["type","setComponentRef"]).from(B)};setStatus(t,o){return this.componentRef?.setStatus&&this.componentRef.setStatus(t,o),this.clickToPayRef?.setStatus&&this.clickToPayRef.setStatus(t,o),this}setClickToPayRef=t=>{this.clickToPayRef=t};formatProps(t){const o=t.session?.configuration?.enableStoreDetails??t.enableStoreDetails,e=!(0===t.amount?.value)&&o,s=t.storedPaymentMethodId||t.id,r=s&&t?.supportedShopperInteractions?.includes("Ecommerce");if(s&&!r)throw new S(k,"You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions");return{...t,holderNameRequired:!!t.hasHolderName&&t.holderNameRequired,hasCVC:!(t.brand&&"bcmc"===t.brand||t.hideCVC),billingAddressRequired:!t.storedPaymentMethodId&&t.billingAddressRequired,billingAddressMode:t.onAddressLookup?B.billingAddressMode:t.billingAddressMode,brand:t.brand??d.card,countryCode:t.countryCode?t.countryCode.toLowerCase():null,configuration:{...t.configuration,socialSecurityNumberMode:t.configuration?.socialSecurityNumberMode??"auto"},brandsConfiguration:t.brandsConfiguration||t.configuration?.brandsConfiguration||{},icon:t.icon||t.configuration?.icon,installmentOptions:t.session?.configuration?.installmentOptions||t.installmentOptions,enableStoreDetails:o,showStoreDetailsCheckbox:e,clickToPayConfiguration:{...t.clickToPayConfiguration,disableOtpAutoFocus:t.clickToPayConfiguration?.disableOtpAutoFocus||!1,shopperEmail:t.clickToPayConfiguration?.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:t.clickToPayConfiguration?.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:t.clickToPayConfiguration?.locale||t.i18n?.locale?.replace("-","_")},...s&&{storedPaymentMethodId:s}}}formatData(){const t=this.state.selectedBrandValue;return{paymentMethod:{type:I.type,...this.state.data,...this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId,holderName:this.props.holderName??""},...t&&{brand:t},...this.props.fundingSource&&{fundingSource:this.props.fundingSource}},...this.state.billingAddress&&{billingAddress:this.state.billingAddress},...this.state.socialSecurityNumber&&{socialSecurityNumber:this.state.socialSecurityNumber},...this.storePaymentMethodPayload,...a(this.state.installments)&&{installments:this.state.installments},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}updateStyles(t){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(t),this}setFocusOn(t){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(t),this}onBrand=t=>{this.props.onBrand?.(t)};processBinLookupResponse(t,o=!1){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(t,o),this}handleUnsupportedCard(t){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(t),this}handleClickToPaySubmit=t=>{this.setState({data:{...t},valid:{},errors:{},isValid:!0}),this.submit()};onBinLookup(t){if(!t.isReset){const o=n("supportedBrandsRaw").from(t);this.props.onBinLookup?.(o)}}submitAnalytics(t){const{type:o}=t;o!==m&&o!==y||"scheme"===this.constructor.type&&P(this.props,"supportedShopperInteractions")&&(t.isStoredPaymentMethod=!0,t.brand=this.props.brand),super.submitAnalytics(t,this.props)}onConfigSuccess=t=>{this.submitAnalytics({type:y}),this.props.onConfigSuccess?.(t)};onFocus=t=>{this.submitAnalytics({type:f,target:i(t.fieldType)}),C.includes(t.fieldType)?this.props.onFocus?.(t.event):this.props.onFocus?.(t)};onBlur=t=>{this.submitAnalytics({type:b,target:i(t.fieldType)}),C.includes(t.fieldType)?this.props.onBlur?.(t.event):this.props.onBlur?.(t)};onValidationErrorAnalytics=t=>{this.submitAnalytics({type:g,target:i(t.fieldType),validationErrorCode:t.errorCode,validationErrorMessage:T(t.errorCode,R)})};onBinValue=r(this);get storePaymentMethodPayload(){if(this.props.storedPaymentMethodId?.length>0)return{};if(0===this.props.amount?.value)return this.props.enableStoreDetails?{storePaymentMethod:!0}:{};return this.props.showStoreDetailsCheckbox&&void 0!==this.state.storePaymentMethod?{storePaymentMethod:Boolean(this.state.storePaymentMethod)}:{}}get isValid(){return!!this.state.isValid}get icon(){return this.props.icon??this.resources.getImage()(this.props.brand)}get brands(){const{brands:t,brandsConfiguration:o}=this.props;return t?t.map((t=>({icon:o[t]?.icon??this.props.modules.resources.getImage()(t),name:t}))):[]}get displayName(){return this.props.storedPaymentMethodId?`•••• ${this.props.lastFour}`:this.props.name||I.type}get accessibleName(){return(this.props.name||I.type)+(this.props.storedPaymentMethodId?" "+this.props.i18n.get("creditCard.storedCard.description.ariaLabel").replace("%@",this.props.lastFour):"")}get browserInfo(){return s()}payButton=o=>{const e=0===this.props.amount?.value,s=this.props.storedPaymentMethodId?.length>0;return t(h,{...o,amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,label:e&&!s?this.props.i18n.get("payButton.saveDetails"):"",onClick:this.submit})};renderCardInput(e=!0){return t(o,{setComponentRef:this.setComponentRef,...this.props,...this.state,onChange:this.setState,onSubmit:this.submit,handleKeyPress:this.handleKeyPress,payButton:this.payButton,onBrand:this.onBrand,onBinValue:this.onBinValue,brand:this.props.brand,brandsIcons:this.brands,isPayButtonPrimaryVariant:e,resources:this.resources,onFocus:this.onFocus,onBlur:this.onBlur,onValidationErrorAnalytics:this.onValidationErrorAnalytics,onConfigSuccess:this.onConfigSuccess})}render(){return t(e,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(l,{srPanel:this.props.modules.srPanel},t(c,{amount:this.props.amount,configuration:this.props.clickToPayConfiguration,clickToPayService:this.clickToPayService,isStandaloneComponent:!1,setClickToPayRef:this.setClickToPayRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},(t=>this.renderCardInput(t)))))}}export{I as CardElement,I as default};
|
|
2
2
|
//# sourceMappingURL=Card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardInput from './components/CardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { BinLookupResponse, CardElementData, CardConfiguration } from './types';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnConfigSuccess, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { reject } from '../../utils/commonUtils';\nimport { hasValidInstallmentsObject } from './components/CardInput/utils';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport ClickToPayWrapper from './components/ClickToPayWrapper';\nimport { ComponentFocusObject } from '../../types/global-types';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport type { PayButtonFunctionProps, UIElementStatus } from '../internal/UIElement/types';\nimport UIElement from '../internal/UIElement';\nimport PayButton from '../internal/PayButton';\nimport type { ICore } from '../../core/types';\nimport {\n ANALYTICS_FOCUS_STR,\n ANALYTICS_CONFIGURED_STR,\n ANALYTICS_UNFOCUS_STR,\n ANALYTICS_VALIDATION_ERROR_STR,\n ANALYTICS_RENDERED_STR\n} from '../../core/Analytics/constants';\nimport { ALL_SECURED_FIELDS } from '../internal/SecuredFields/lib/constants';\nimport { FieldErrorAnalyticsObject, SendAnalyticsObject } from '../../core/Analytics/types';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { getErrorMessageFromCode } from '../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../core/Errors/constants';\nimport CardInputDefaultProps from './components/CardInput/defaultProps';\n\nexport class CardElement extends UIElement<CardConfiguration> {\n public static type = TxVariants.scheme;\n\n private readonly clickToPayService: IClickToPayService | null;\n\n /**\n * Reference to the 'ClickToPayComponent'\n */\n private clickToPayRef = null;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n\n if (props && !props._disableClickToPay) {\n this.clickToPayService = createClickToPayService(this.props.configuration, this.props.clickToPayConfiguration, this.props.environment);\n void this.clickToPayService?.initialize();\n }\n }\n\n protected static defaultProps = {\n showFormInstruction: true,\n _disableClickToPay: false,\n doBinLookup: true,\n // Merge most of CardInput's defaultProps\n ...reject(['type', 'setComponentRef']).from(CardInputDefaultProps)\n };\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n if (this.clickToPayRef?.setStatus) {\n this.clickToPayRef.setStatus(status, props);\n }\n return this;\n }\n\n private setClickToPayRef = ref => {\n this.clickToPayRef = ref;\n };\n\n formatProps(props: CardConfiguration): CardConfiguration {\n // The value from a session should be used, before falling back to the merchant configuration\n const enableStoreDetails = props.session?.configuration?.enableStoreDetails ?? props.enableStoreDetails;\n\n const isZeroAuth = props.amount?.value === 0;\n const showStoreDetailsCheckbox = isZeroAuth ? false : enableStoreDetails;\n\n const storedCardID = props.storedPaymentMethodId || props.id; // check if we've been passed a (checkout) processed storedCard or one that merchant has pulled from the PMs response\n const isEcommerceStoredCard = storedCardID && props?.supportedShopperInteractions?.includes('Ecommerce'); // If we have a storedCard does it support Ecommerce (it might not if the merchant has pulled it from the PMs response)\n\n // If we have a storedPM but it doesn't support Ecommerce - we can't make a storedCard component from it\n if (storedCardID && !isEcommerceStoredCard) {\n // TODO - Decide if an error is too severe? Would a console.warning suffice?\n throw new AdyenCheckoutError(\n IMPLEMENTATION_ERROR,\n 'You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions'\n );\n }\n\n return {\n ...props,\n // Mismatch between hasHolderName & holderNameRequired which can mean card can never be valid\n holderNameRequired: !props.hasHolderName ? false : props.holderNameRequired,\n // False for *stored* BCMC cards & if merchant explicitly wants to hide the CVC field\n hasCVC: !((props.brand && props.brand === 'bcmc') || props.hideCVC),\n // billingAddressRequired only available for non-stored cards\n billingAddressRequired: props.storedPaymentMethodId ? false : props.billingAddressRequired,\n // edge case where merchant has defined both an onAddressLookup callback AND set billingAddressMode: 'partial' - which leads to some strange behaviour in the address UI\n billingAddressMode: props.onAddressLookup ? CardInputDefaultProps.billingAddressMode : props.billingAddressMode,\n /** props.brand will be specified in the case of a StoredCard or a Bancontact component, for a regular Card we default it to 'card' */\n brand: props.brand ?? TxVariants.card,\n countryCode: props.countryCode ? props.countryCode.toLowerCase() : null,\n // Required for transition period (until configuration object becomes the norm)\n // - if merchant has defined value directly in props, use this instead\n configuration: {\n ...props.configuration,\n socialSecurityNumberMode: props.configuration?.socialSecurityNumberMode ?? 'auto'\n },\n brandsConfiguration: props.brandsConfiguration || props.configuration?.brandsConfiguration || {},\n icon: props.icon || props.configuration?.icon,\n // installmentOptions of a session should be used before falling back to the merchant configuration\n installmentOptions: props.session?.configuration?.installmentOptions || props.installmentOptions,\n enableStoreDetails,\n showStoreDetailsCheckbox,\n /**\n * Click to Pay configuration\n * - If email is set explicitly in the configuration, then it can override the one used in the session creation\n */\n clickToPayConfiguration: {\n ...props.clickToPayConfiguration,\n disableOtpAutoFocus: props.clickToPayConfiguration?.disableOtpAutoFocus || false,\n shopperEmail: props.clickToPayConfiguration?.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.clickToPayConfiguration?.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.clickToPayConfiguration?.locale || props.i18n?.locale?.replace('-', '_')\n },\n ...(storedCardID && { storedPaymentMethodId: storedCardID })\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): CardElementData {\n /**\n * this.state.selectedBrandValue will be set when:\n * - /binLookup detects a single brand,\n * - when /binLookup detects a dual-branded card and the shopper makes a brand selection\n * - or, in the case of a storedCard\n */\n const cardBrand = this.state.selectedBrandValue;\n\n return {\n paymentMethod: {\n type: CardElement.type,\n ...this.state.data,\n ...(this.props.storedPaymentMethodId && {\n storedPaymentMethodId: this.props.storedPaymentMethodId,\n holderName: this.props.holderName ?? ''\n }),\n ...(cardBrand && { brand: cardBrand }),\n ...(this.props.fundingSource && { fundingSource: this.props.fundingSource })\n },\n ...(this.state.billingAddress && { billingAddress: this.state.billingAddress }),\n ...(this.state.socialSecurityNumber && { socialSecurityNumber: this.state.socialSecurityNumber }),\n ...this.storePaymentMethodPayload,\n ...(hasValidInstallmentsObject(this.state.installments) && { installments: this.state.installments }),\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(fieldName) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(fieldName);\n return this;\n }\n\n public onBrand = event => {\n this.props.onBrand?.(event);\n };\n\n processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset = false) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse, isReset);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n onBinLookup(obj: CbObjOnBinLookup) {\n // Handler for regular card comp doesn't need this 'raw' data or to know about 'resets'\n if (!obj.isReset) {\n const nuObj = reject('supportedBrandsRaw').from(obj);\n this.props.onBinLookup(nuObj);\n }\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n const { type } = analyticsObj;\n\n if (type === ANALYTICS_RENDERED_STR || type === ANALYTICS_CONFIGURED_STR) {\n // Check if it's a storedCard\n if (this.constructor['type'] === 'scheme') {\n if (hasOwnProperty(this.props, 'supportedShopperInteractions')) {\n analyticsObj.isStoredPaymentMethod = true;\n analyticsObj.brand = this.props.brand;\n }\n }\n }\n\n super.submitAnalytics(analyticsObj, this.props);\n }\n\n private onConfigSuccess = (obj: CbObjOnConfigSuccess) => {\n this.submitAnalytics({\n type: ANALYTICS_CONFIGURED_STR\n });\n\n this.props.onConfigSuccess?.(obj);\n };\n\n private onFocus = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_FOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onFocus?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onFocus?.(obj);\n }\n };\n\n private onBlur = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onBlur?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onBlur?.(obj);\n }\n };\n\n private onValidationErrorAnalytics = (obj: FieldErrorAnalyticsObject) => {\n this.submitAnalytics({\n type: ANALYTICS_VALIDATION_ERROR_STR,\n target: fieldTypeToSnakeCase(obj.fieldType),\n validationErrorCode: obj.errorCode,\n validationErrorMessage: getErrorMessageFromCode(obj.errorCode, SF_ErrorCodes)\n });\n };\n\n public onBinValue = triggerBinLookUp(this);\n\n get storePaymentMethodPayload() {\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n if (isStoredCard) {\n return {};\n }\n\n /**\n * For regular card, zero auth payments, we store the payment method, *if* the configuration says we should:\n * - For sessions, this means if the session has been created with storePaymentMethodMode: 'askForConsent'\n * - For the advanced flow, this means if the merchant has still set enableStoreDetails: true\n *\n * What we are doing is.. if for a normal payment we would show the \"Save for my next payment\" checkbox,\n * for a zero-auth payment we effectively click the checkbox on behalf of the shopper.\n */\n const isZeroAuth = this.props.amount?.value === 0;\n if (isZeroAuth) {\n return this.props.enableStoreDetails ? { storePaymentMethod: true } : {};\n }\n\n // For regular card, non-zero auth payments, we store the payment method based on the checkbox value.\n // const includeStorePaymentMethod = this.props.enableStoreDetails && typeof this.state.storePaymentMethod !== 'undefined';\n const includeStorePaymentMethod = this.props.showStoreDetailsCheckbox && typeof this.state.storePaymentMethod !== 'undefined';\n return includeStorePaymentMethod ? { storePaymentMethod: Boolean(this.state.storePaymentMethod) } : {};\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get icon() {\n return this.props.icon ?? this.resources.getImage()(this.props.brand);\n }\n\n get brands(): { icon: any; name: string }[] {\n const { brands, brandsConfiguration } = this.props;\n if (brands) {\n return brands.map(brand => {\n const brandIcon = brandsConfiguration[brand]?.icon ?? this.props.modules.resources.getImage()(brand);\n return { icon: brandIcon, name: brand };\n });\n }\n\n return [];\n }\n\n get displayName(): string {\n if (this.props.storedPaymentMethodId) {\n return `•••• ${this.props.lastFour}`;\n }\n\n return this.props.name || CardElement.type;\n }\n\n get accessibleName(): string {\n // Use display name, unless it's a stored payment method, there inform user\n return (\n (this.props.name || CardElement.type) +\n (this.props.storedPaymentMethodId\n ? ' ' + this.props.i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', this.props.lastFour)\n : '')\n );\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n protected override payButton = (props: PayButtonFunctionProps) => {\n const isZeroAuth = this.props.amount?.value === 0;\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n return (\n <PayButton\n {...props}\n amount={this.props.amount}\n secondaryAmount={this.props.secondaryAmount}\n label={isZeroAuth && !isStoredCard ? this.props.i18n.get('payButton.saveDetails') : ''}\n onClick={this.submit}\n />\n );\n };\n\n private renderCardInput(isCardPrimaryInput = true): h.JSX.Element {\n return (\n <CardInput\n setComponentRef={this.setComponentRef}\n {...this.props}\n {...this.state}\n onChange={this.setState}\n onSubmit={this.submit}\n handleKeyPress={this.handleKeyPress}\n payButton={this.payButton}\n onBrand={this.onBrand}\n onBinValue={this.onBinValue}\n brand={this.props.brand}\n brandsIcons={this.brands}\n isPayButtonPrimaryVariant={isCardPrimaryInput}\n resources={this.resources}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onValidationErrorAnalytics={this.onValidationErrorAnalytics}\n onConfigSuccess={this.onConfigSuccess}\n />\n );\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <ClickToPayWrapper\n amount={this.props.amount}\n configuration={this.props.clickToPayConfiguration}\n clickToPayService={this.clickToPayService}\n isStandaloneComponent={false}\n setClickToPayRef={this.setClickToPayRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n {isCardPrimaryInput => this.renderCardInput(isCardPrimaryInput)}\n </ClickToPayWrapper>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default CardElement;\n"],"names":["CardElement","UIElement","static","TxVariants","scheme","clickToPayService","clickToPayRef","constructor","checkout","props","super","_disableClickToPay","this","createClickToPayService","configuration","clickToPayConfiguration","environment","initialize","showFormInstruction","doBinLookup","reject","from","CardInputDefaultProps","setStatus","status","componentRef","setClickToPayRef","ref","formatProps","enableStoreDetails","session","showStoreDetailsCheckbox","amount","value","storedCardID","storedPaymentMethodId","id","isEcommerceStoredCard","supportedShopperInteractions","includes","AdyenCheckoutError","IMPLEMENTATION_ERROR","holderNameRequired","hasHolderName","hasCVC","brand","hideCVC","billingAddressRequired","billingAddressMode","onAddressLookup","card","countryCode","toLowerCase","socialSecurityNumberMode","brandsConfiguration","icon","installmentOptions","disableOtpAutoFocus","shopperEmail","core","options","telephoneNumber","locale","i18n","replace","formatData","cardBrand","state","selectedBrandValue","paymentMethod","type","data","holderName","fundingSource","billingAddress","socialSecurityNumber","storePaymentMethodPayload","hasValidInstallmentsObject","installments","browserInfo","origin","window","location","updateStyles","stylesObj","setFocusOn","fieldName","onBrand","event","processBinLookupResponse","binLookupResponse","isReset","handleUnsupportedCard","errObj","handleClickToPaySubmit","payload","setState","valid","errors","isValid","submit","onBinLookup","obj","nuObj","submitAnalytics","analyticsObj","ANALYTICS_RENDERED_STR","ANALYTICS_CONFIGURED_STR","hasOwnProperty","isStoredPaymentMethod","onConfigSuccess","onFocus","ANALYTICS_FOCUS_STR","target","fieldTypeToSnakeCase","fieldType","ALL_SECURED_FIELDS","onBlur","ANALYTICS_UNFOCUS_STR","onValidationErrorAnalytics","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","onBinValue","triggerBinLookUp","length","storePaymentMethod","Boolean","resources","getImage","brands","map","modules","name","displayName","lastFour","accessibleName","get","collectBrowserInfo","payButton","isZeroAuth","isStoredCard","h","PayButton","secondaryAmount","label","onClick","renderCardInput","isCardPrimaryInput","CardInput","setComponentRef","onChange","onSubmit","handleKeyPress","brandsIcons","isPayButtonPrimaryVariant","render","CoreProvider","loadingContext","SRPanelProvider","srPanel","ClickToPayWrapper","isStandaloneComponent","onSetStatus","setElementStatus","onError","handleError"],"mappings":"m6CAmCO,MAAMA,UAAoBC,EAC7BC,YAAqBC,EAAWC,OAEfC,kBAKTC,cAAgB,KAExBC,WAAAA,CAAYC,EAAiBC,GACzBC,MAAMF,EAAUC,GAEZA,IAAUA,EAAME,qBAChBC,KAAKP,kBAAoBQ,EAAwBD,KAAKH,MAAMK,cAAeF,KAAKH,MAAMM,wBAAyBH,KAAKH,MAAMO,aACrHJ,KAAKP,mBAAmBY,aAErC,CAEAf,oBAAgC,CAC5BgB,qBAAqB,EACrBP,oBAAoB,EACpBQ,aAAa,KAEVC,EAAO,CAAC,OAAQ,oBAAoBC,KAAKC,IAGzCC,SAAAA,CAAUC,EAAyBf,GAOtC,OANIG,KAAKa,cAAcF,WACnBX,KAAKa,aAAaF,UAAUC,EAAQf,GAEpCG,KAAKN,eAAeiB,WACpBX,KAAKN,cAAciB,UAAUC,EAAQf,GAElCG,IACX,CAEQc,iBAAmBC,IACvBf,KAAKN,cAAgBqB,CAAAA,EAGzBC,WAAAA,CAAYnB,GAER,MAAMoB,EAAqBpB,EAAMqB,SAAShB,eAAee,oBAAsBpB,EAAMoB,mBA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,MACTuF,SAAU9I,KAAKoF,SACf2D,SAAU/I,KAAKwF,OACfwD,eAAgBhJ,KAAKgJ,eACrBd,UAAWlI,KAAKkI,UAChBvD,QAAS3E,KAAK2E,QACduC,WAAYlH,KAAKkH,WACjBjF,MAAOjC,KAAKH,MAAMoC,MAClBgH,YAAajJ,KAAKyH,OAClByB,0BAA2BP,EAC3BpB,UAAWvH,KAAKuH,UAChBpB,QAASnG,KAAKmG,QACdM,OAAQzG,KAAKyG,OACbE,2BAA4B3G,KAAK2G,2BACjCT,gBAAiBlG,KAAKkG,iBAGlC,CAEAiD,MAAAA,GACI,OACId,EAACe,EAAAA,CAAajG,KAAMnD,KAAKH,MAAMsD,KAAMkG,eAAgBrJ,KAAKH,MAAMwJ,eAAgB9B,UAAWvH,KAAKuH,WAC5Fc,EAACiB,EAAAA,CAAgBC,QAASvJ,KAAKH,MAAM8H,QAAQ4B,SACzClB,EAACmB,EAAAA,CACGpI,OAAQpB,KAAKH,MAAMuB,OACnBlB,cAAeF,KAAKH,MAAMM,wBAC1BV,kBAAmBO,KAAKP,kBACxBgK,uBAAuB,EACvB3I,iBAAkBd,KAAKc,iBACvB4I,YAAa1J,KAAK2J,iBAClBZ,SAAU/I,KAAKkF,uBACf0E,QAAS5J,KAAK6J,cAEblB,GAAsB3I,KAAK0I,gBAAgBC,MAKhE"}
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardInput from './components/CardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { BinLookupResponse, CardElementData, CardConfiguration } from './types';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnConfigSuccess, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { reject } from '../../utils/commonUtils';\nimport { hasValidInstallmentsObject } from './components/CardInput/utils';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport ClickToPayWrapper from './components/ClickToPayWrapper';\nimport { ComponentFocusObject } from '../../types/global-types';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport type { PayButtonFunctionProps, UIElementStatus } from '../internal/UIElement/types';\nimport UIElement from '../internal/UIElement';\nimport PayButton from '../internal/PayButton';\nimport type { ICore } from '../../core/types';\nimport {\n ANALYTICS_FOCUS_STR,\n ANALYTICS_CONFIGURED_STR,\n ANALYTICS_UNFOCUS_STR,\n ANALYTICS_VALIDATION_ERROR_STR,\n ANALYTICS_RENDERED_STR\n} from '../../core/Analytics/constants';\nimport { ALL_SECURED_FIELDS } from '../internal/SecuredFields/lib/constants';\nimport { FieldErrorAnalyticsObject, SendAnalyticsObject } from '../../core/Analytics/types';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { getErrorMessageFromCode } from '../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../core/Errors/constants';\nimport CardInputDefaultProps from './components/CardInput/defaultProps';\n\nexport class CardElement extends UIElement<CardConfiguration> {\n public static type = TxVariants.scheme;\n\n private readonly clickToPayService: IClickToPayService | null;\n\n /**\n * Reference to the 'ClickToPayComponent'\n */\n private clickToPayRef = null;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n\n if (props && !props._disableClickToPay) {\n this.clickToPayService = createClickToPayService(this.props.configuration, this.props.clickToPayConfiguration, this.props.environment);\n void this.clickToPayService?.initialize();\n }\n }\n\n protected static defaultProps = {\n showFormInstruction: true,\n _disableClickToPay: false,\n doBinLookup: true,\n // Merge most of CardInput's defaultProps\n ...reject(['type', 'setComponentRef']).from(CardInputDefaultProps)\n };\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n if (this.clickToPayRef?.setStatus) {\n this.clickToPayRef.setStatus(status, props);\n }\n return this;\n }\n\n private setClickToPayRef = ref => {\n this.clickToPayRef = ref;\n };\n\n formatProps(props: CardConfiguration): CardConfiguration {\n // The value from a session should be used, before falling back to the merchant configuration\n const enableStoreDetails = props.session?.configuration?.enableStoreDetails ?? props.enableStoreDetails;\n\n const isZeroAuth = props.amount?.value === 0;\n const showStoreDetailsCheckbox = isZeroAuth ? false : enableStoreDetails;\n\n const storedCardID = props.storedPaymentMethodId || props.id; // check if we've been passed a (checkout) processed storedCard or one that merchant has pulled from the PMs response\n const isEcommerceStoredCard = storedCardID && props?.supportedShopperInteractions?.includes('Ecommerce'); // If we have a storedCard does it support Ecommerce (it might not if the merchant has pulled it from the PMs response)\n\n // If we have a storedPM but it doesn't support Ecommerce - we can't make a storedCard component from it\n if (storedCardID && !isEcommerceStoredCard) {\n // TODO - Decide if an error is too severe? Would a console.warning suffice?\n throw new AdyenCheckoutError(\n IMPLEMENTATION_ERROR,\n 'You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions'\n );\n }\n\n return {\n ...props,\n // Mismatch between hasHolderName & holderNameRequired which can mean card can never be valid\n holderNameRequired: !props.hasHolderName ? false : props.holderNameRequired,\n // False for *stored* BCMC cards & if merchant explicitly wants to hide the CVC field\n hasCVC: !((props.brand && props.brand === 'bcmc') || props.hideCVC),\n // billingAddressRequired only available for non-stored cards\n billingAddressRequired: props.storedPaymentMethodId ? false : props.billingAddressRequired,\n // edge case where merchant has defined both an onAddressLookup callback AND set billingAddressMode: 'partial' - which leads to some strange behaviour in the address UI\n billingAddressMode: props.onAddressLookup ? CardInputDefaultProps.billingAddressMode : props.billingAddressMode,\n /** props.brand will be specified in the case of a StoredCard or a Bancontact component, for a regular Card we default it to 'card' */\n brand: props.brand ?? TxVariants.card,\n countryCode: props.countryCode ? props.countryCode.toLowerCase() : null,\n // Required for transition period (until configuration object becomes the norm)\n // - if merchant has defined value directly in props, use this instead\n configuration: {\n ...props.configuration,\n socialSecurityNumberMode: props.configuration?.socialSecurityNumberMode ?? 'auto'\n },\n brandsConfiguration: props.brandsConfiguration || props.configuration?.brandsConfiguration || {},\n icon: props.icon || props.configuration?.icon,\n // installmentOptions of a session should be used before falling back to the merchant configuration\n installmentOptions: props.session?.configuration?.installmentOptions || props.installmentOptions,\n enableStoreDetails,\n showStoreDetailsCheckbox,\n /**\n * Click to Pay configuration\n * - If email is set explicitly in the configuration, then it can override the one used in the session creation\n */\n clickToPayConfiguration: {\n ...props.clickToPayConfiguration,\n disableOtpAutoFocus: props.clickToPayConfiguration?.disableOtpAutoFocus || false,\n shopperEmail: props.clickToPayConfiguration?.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.clickToPayConfiguration?.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.clickToPayConfiguration?.locale || props.i18n?.locale?.replace('-', '_')\n },\n ...(storedCardID && { storedPaymentMethodId: storedCardID })\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): CardElementData {\n /**\n * this.state.selectedBrandValue will be set when:\n * - /binLookup detects a single brand,\n * - when /binLookup detects a dual-branded card and the shopper makes a brand selection\n * - or, in the case of a storedCard\n */\n const cardBrand = this.state.selectedBrandValue;\n\n return {\n paymentMethod: {\n type: CardElement.type,\n ...this.state.data,\n ...(this.props.storedPaymentMethodId && {\n storedPaymentMethodId: this.props.storedPaymentMethodId,\n holderName: this.props.holderName ?? ''\n }),\n ...(cardBrand && { brand: cardBrand }),\n ...(this.props.fundingSource && { fundingSource: this.props.fundingSource })\n },\n ...(this.state.billingAddress && { billingAddress: this.state.billingAddress }),\n ...(this.state.socialSecurityNumber && { socialSecurityNumber: this.state.socialSecurityNumber }),\n ...this.storePaymentMethodPayload,\n ...(hasValidInstallmentsObject(this.state.installments) && { installments: this.state.installments }),\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(fieldName) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(fieldName);\n return this;\n }\n\n public onBrand = event => {\n this.props.onBrand?.(event);\n };\n\n processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset = false) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse, isReset);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n onBinLookup(obj: CbObjOnBinLookup) {\n // Handler for regular card comp doesn't need this 'raw' data or to know about 'resets'\n if (!obj.isReset) {\n const nuObj = reject('supportedBrandsRaw').from(obj);\n this.props.onBinLookup?.(nuObj);\n }\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n const { type } = analyticsObj;\n\n if (type === ANALYTICS_RENDERED_STR || type === ANALYTICS_CONFIGURED_STR) {\n // Check if it's a storedCard\n if (this.constructor['type'] === 'scheme') {\n if (hasOwnProperty(this.props, 'supportedShopperInteractions')) {\n analyticsObj.isStoredPaymentMethod = true;\n analyticsObj.brand = this.props.brand;\n }\n }\n }\n\n super.submitAnalytics(analyticsObj, this.props);\n }\n\n private onConfigSuccess = (obj: CbObjOnConfigSuccess) => {\n this.submitAnalytics({\n type: ANALYTICS_CONFIGURED_STR\n });\n\n this.props.onConfigSuccess?.(obj);\n };\n\n private onFocus = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_FOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onFocus?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onFocus?.(obj);\n }\n };\n\n private onBlur = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onBlur?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onBlur?.(obj);\n }\n };\n\n private onValidationErrorAnalytics = (obj: FieldErrorAnalyticsObject) => {\n this.submitAnalytics({\n type: ANALYTICS_VALIDATION_ERROR_STR,\n target: fieldTypeToSnakeCase(obj.fieldType),\n validationErrorCode: obj.errorCode,\n validationErrorMessage: getErrorMessageFromCode(obj.errorCode, SF_ErrorCodes)\n });\n };\n\n public onBinValue = triggerBinLookUp(this);\n\n get storePaymentMethodPayload() {\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n if (isStoredCard) {\n return {};\n }\n\n /**\n * For regular card, zero auth payments, we store the payment method, *if* the configuration says we should:\n * - For sessions, this means if the session has been created with storePaymentMethodMode: 'askForConsent'\n * - For the advanced flow, this means if the merchant has still set enableStoreDetails: true\n *\n * What we are doing is.. if for a normal payment we would show the \"Save for my next payment\" checkbox,\n * for a zero-auth payment we effectively click the checkbox on behalf of the shopper.\n */\n const isZeroAuth = this.props.amount?.value === 0;\n if (isZeroAuth) {\n return this.props.enableStoreDetails ? { storePaymentMethod: true } : {};\n }\n\n // For regular card, non-zero auth payments, we store the payment method based on the checkbox value.\n // const includeStorePaymentMethod = this.props.enableStoreDetails && typeof this.state.storePaymentMethod !== 'undefined';\n const includeStorePaymentMethod = this.props.showStoreDetailsCheckbox && typeof this.state.storePaymentMethod !== 'undefined';\n return includeStorePaymentMethod ? { storePaymentMethod: Boolean(this.state.storePaymentMethod) } : {};\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get icon() {\n return this.props.icon ?? this.resources.getImage()(this.props.brand);\n }\n\n get brands(): { icon: any; name: string }[] {\n const { brands, brandsConfiguration } = this.props;\n if (brands) {\n return brands.map(brand => {\n const brandIcon = brandsConfiguration[brand]?.icon ?? this.props.modules.resources.getImage()(brand);\n return { icon: brandIcon, name: brand };\n });\n }\n\n return [];\n }\n\n get displayName(): string {\n if (this.props.storedPaymentMethodId) {\n return `•••• ${this.props.lastFour}`;\n }\n\n return this.props.name || CardElement.type;\n }\n\n get accessibleName(): string {\n // Use display name, unless it's a stored payment method, there inform user\n return (\n (this.props.name || CardElement.type) +\n (this.props.storedPaymentMethodId\n ? ' ' + this.props.i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', this.props.lastFour)\n : '')\n );\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n protected override payButton = (props: PayButtonFunctionProps) => {\n const isZeroAuth = this.props.amount?.value === 0;\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n return (\n <PayButton\n {...props}\n amount={this.props.amount}\n secondaryAmount={this.props.secondaryAmount}\n label={isZeroAuth && !isStoredCard ? this.props.i18n.get('payButton.saveDetails') : ''}\n onClick={this.submit}\n />\n );\n };\n\n private renderCardInput(isCardPrimaryInput = true): h.JSX.Element {\n return (\n <CardInput\n setComponentRef={this.setComponentRef}\n {...this.props}\n {...this.state}\n onChange={this.setState}\n onSubmit={this.submit}\n handleKeyPress={this.handleKeyPress}\n payButton={this.payButton}\n onBrand={this.onBrand}\n onBinValue={this.onBinValue}\n brand={this.props.brand}\n brandsIcons={this.brands}\n isPayButtonPrimaryVariant={isCardPrimaryInput}\n resources={this.resources}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onValidationErrorAnalytics={this.onValidationErrorAnalytics}\n onConfigSuccess={this.onConfigSuccess}\n />\n );\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <ClickToPayWrapper\n amount={this.props.amount}\n configuration={this.props.clickToPayConfiguration}\n clickToPayService={this.clickToPayService}\n isStandaloneComponent={false}\n setClickToPayRef={this.setClickToPayRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n {isCardPrimaryInput => this.renderCardInput(isCardPrimaryInput)}\n </ClickToPayWrapper>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default CardElement;\n"],"names":["CardElement","UIElement","static","TxVariants","scheme","clickToPayService","clickToPayRef","constructor","checkout","props","super","_disableClickToPay","this","createClickToPayService","configuration","clickToPayConfiguration","environment","initialize","showFormInstruction","doBinLookup","reject","from","CardInputDefaultProps","setStatus","status","componentRef","setClickToPayRef","ref","formatProps","enableStoreDetails","session","showStoreDetailsCheckbox","amount","value","storedCardID","storedPaymentMethodId","id","isEcommerceStoredCard","supportedShopperInteractions","includes","AdyenCheckoutError","IMPLEMENTATION_ERROR","holderNameRequired","hasHolderName","hasCVC","brand","hideCVC","billingAddressRequired","billingAddressMode","onAddressLookup","card","countryCode","toLowerCase","socialSecurityNumberMode","brandsConfiguration","icon","installmentOptions","disableOtpAutoFocus","shopperEmail","core","options","telephoneNumber","locale","i18n","replace","formatData","cardBrand","state","selectedBrandValue","paymentMethod","type","data","holderName","fundingSource","billingAddress","socialSecurityNumber","storePaymentMethodPayload","hasValidInstallmentsObject","installments","browserInfo","origin","window","location","updateStyles","stylesObj","setFocusOn","fieldName","onBrand","event","processBinLookupResponse","binLookupResponse","isReset","handleUnsupportedCard","errObj","handleClickToPaySubmit","payload","setState","valid","errors","isValid","submit","onBinLookup","obj","nuObj","submitAnalytics","analyticsObj","ANALYTICS_RENDERED_STR","ANALYTICS_CONFIGURED_STR","hasOwnProperty","isStoredPaymentMethod","onConfigSuccess","onFocus","ANALYTICS_FOCUS_STR","target","fieldTypeToSnakeCase","fieldType","ALL_SECURED_FIELDS","onBlur","ANALYTICS_UNFOCUS_STR","onValidationErrorAnalytics","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","onBinValue","triggerBinLookUp","length","storePaymentMethod","Boolean","resources","getImage","brands","map","modules","name","displayName","lastFour","accessibleName","get","collectBrowserInfo","payButton","isZeroAuth","isStoredCard","h","PayButton","secondaryAmount","label","onClick","renderCardInput","isCardPrimaryInput","CardInput","setComponentRef","onChange","onSubmit","handleKeyPress","brandsIcons","isPayButtonPrimaryVariant","render","CoreProvider","loadingContext","SRPanelProvider","srPanel","ClickToPayWrapper","isStandaloneComponent","onSetStatus","setElementStatus","onError","handleError"],"mappings":"m6CAmCO,MAAMA,UAAoBC,EAC7BC,YAAqBC,EAAWC,OAEfC,kBAKTC,cAAgB,KAExBC,WAAAA,CAAYC,EAAiBC,GACzBC,MAAMF,EAAUC,GAEZA,IAAUA,EAAME,qBAChBC,KAAKP,kBAAoBQ,EAAwBD,KAAKH,MAAMK,cAAeF,KAAKH,MAAMM,wBAAyBH,KAAKH,MAAMO,aACrHJ,KAAKP,mBAAmBY,aAErC,CAEAf,oBAAgC,CAC5BgB,qBAAqB,EACrBP,oBAAoB,EACpBQ,aAAa,KAEVC,EAAO,CAAC,OAAQ,oBAAoBC,KAAKC,IAGzCC,SAAAA,CAAUC,EAAyBf,GAOtC,OANIG,KAAKa,cAAcF,WACnBX,KAAKa,aAAaF,UAAUC,EAAQf,GAEpCG,KAAKN,eAAeiB,WACpBX,KAAKN,cAAciB,UAAUC,EAAQf,GAElCG,IACX,CAEQc,iBAAmBC,IACvBf,KAAKN,cAAgBqB,CAAAA,EAGzBC,WAAAA,CAAYnB,GAER,MAAMoB,EAAqBpB,EAAMqB,SAAShB,eAAee,oBAAsBpB,EAAMoB,mBAG/EE,IADqC,IAAxBtB,EAAMuB,QAAQC,QACqBJ,EAEhDK,EAAezB,EAAM0B,uBAAyB1B,EAAM2B,GACpDC,EAAwBH,GAAgBzB,GAAO6B,8BAA8BC,SAAS,aAG5F,GAAIL,IAAiBG,EAEjB,MAA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,MAAMoC,MAClBgH,YAAajJ,KAAKyH,OAClByB,0BAA2BP,EAC3BpB,UAAWvH,KAAKuH,UAChBpB,QAASnG,KAAKmG,QACdM,OAAQzG,KAAKyG,OACbE,2BAA4B3G,KAAK2G,2BACjCT,gBAAiBlG,KAAKkG,iBAGlC,CAEAiD,MAAAA,GACI,OACId,EAACe,EAAAA,CAAajG,KAAMnD,KAAKH,MAAMsD,KAAMkG,eAAgBrJ,KAAKH,MAAMwJ,eAAgB9B,UAAWvH,KAAKuH,WAC5Fc,EAACiB,EAAAA,CAAgBC,QAASvJ,KAAKH,MAAM8H,QAAQ4B,SACzClB,EAACmB,EAAAA,CACGpI,OAAQpB,KAAKH,MAAMuB,OACnBlB,cAAeF,KAAKH,MAAMM,wBAC1BV,kBAAmBO,KAAKP,kBACxBgK,uBAAuB,EACvB3I,iBAAkBd,KAAKc,iBACvB4I,YAAa1J,KAAK2J,iBAClBZ,SAAU/I,KAAKkF,uBACf0E,QAAS5J,KAAK6J,cAEblB,GAAsB3I,KAAK0I,gBAAgBC,MAKhE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{AddressModeOptions as e}from"./types.js";var o={type:"scheme",setComponentRef:()=>{},autoFocus:!0,billingAddressAllowedCountries:[],billingAddressMode:e.full,billingAddressRequired:!1,billingAddressRequiredFields:["street","houseNumberOrName","postalCode","city","stateOrProvince","country"],configuration:{koreanAuthenticationRequired:!1,socialSecurityNumberMode:"auto"},data:{billingAddress:{}},disableIOSArrowKeys:!1,enableStoreDetails:!1,exposeExpiryDate:!1,forceCompat:!1,hasHolderName:!1,holderNameRequired:!1,hasCVC:!0,hideCVC:!1,installmentOptions:{},keypadFix:!0,legacyInputMode:!1,maskSecurityCode:!1,minimumExpiryDate:null,name:null,placeholders:{},positionHolderNameOnTop:!1,showBrandIcon:!0,showInstallmentAmounts:null,styles:{},isPayButtonPrimaryVariant:!0,showContextualElement:!0,onLoad:()=>{},onConfigSuccess:()=>{},onAllValid:()=>{},onFieldValid:()=>{},onBrand:()=>{},onError:()=>{},onBinValue:()=>{},onBlur:()=>{},onFocus:()=>{},onChange:()=>{}
|
|
1
|
+
import{AddressModeOptions as e}from"./types.js";var o={type:"scheme",setComponentRef:()=>{},autoFocus:!0,billingAddressAllowedCountries:[],billingAddressMode:e.full,billingAddressRequired:!1,billingAddressRequiredFields:["street","houseNumberOrName","postalCode","city","stateOrProvince","country"],configuration:{koreanAuthenticationRequired:!1,socialSecurityNumberMode:"auto"},data:{billingAddress:{}},disableIOSArrowKeys:!1,enableStoreDetails:!1,exposeExpiryDate:!1,forceCompat:!1,hasHolderName:!1,holderNameRequired:!1,hasCVC:!0,hideCVC:!1,installmentOptions:{},keypadFix:!0,legacyInputMode:!1,maskSecurityCode:!1,minimumExpiryDate:null,name:null,placeholders:{},positionHolderNameOnTop:!1,showBrandIcon:!0,showInstallmentAmounts:null,styles:{},isPayButtonPrimaryVariant:!0,showContextualElement:!0,onLoad:()=>{},onConfigSuccess:()=>{},onAllValid:()=>{},onFieldValid:()=>{},onBrand:()=>{},onError:()=>{},onBinValue:()=>{},onBlur:()=>{},onFocus:()=>{},onChange:()=>{}};export{o as default};
|
|
2
2
|
//# sourceMappingURL=defaultProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultProps.js","sources":["../../../../../../src/components/Card/components/CardInput/defaultProps.ts"],"sourcesContent":["import { SocialSecurityMode } from '../../types';\nimport { AddressModeOptions } from './types';\n\nexport default {\n type: 'scheme',\n\n setComponentRef: () => {},\n\n // Settings\n autoFocus: true,\n billingAddressAllowedCountries: [],\n billingAddressMode: AddressModeOptions.full,\n billingAddressRequired: false,\n billingAddressRequiredFields: ['street', 'houseNumberOrName', 'postalCode', 'city', 'stateOrProvince', 'country'],\n\n configuration: { koreanAuthenticationRequired: false, socialSecurityNumberMode: 'auto' as SocialSecurityMode },\n data: {\n billingAddress: {}\n },\n disableIOSArrowKeys: false,\n enableStoreDetails: false,\n exposeExpiryDate: false,\n forceCompat: false,\n hasHolderName: false,\n holderNameRequired: false,\n hasCVC: true,\n hideCVC: false,\n installmentOptions: {},\n keypadFix: true,\n legacyInputMode: false,\n maskSecurityCode: false,\n minimumExpiryDate: null,\n name: null, // Affects Dropin only, the name displayed in the PMList item\n placeholders: {},\n positionHolderNameOnTop: false,\n showBrandIcon: true,\n showInstallmentAmounts: null,\n styles: {},\n\n isPayButtonPrimaryVariant: true,\n showContextualElement: true,\n\n // Events\n onLoad: (): any => {},\n onConfigSuccess: (): any => {},\n onAllValid: (): any => {},\n onFieldValid: (): any => {},\n onBrand: (): any => {},\n onError: (): any => {},\n onBinValue: (): any => {},\n onBlur: (): any => {},\n onFocus: (): any => {},\n onChange: (): any => {}
|
|
1
|
+
{"version":3,"file":"defaultProps.js","sources":["../../../../../../src/components/Card/components/CardInput/defaultProps.ts"],"sourcesContent":["import { SocialSecurityMode } from '../../types';\nimport { AddressModeOptions } from './types';\n\nexport default {\n type: 'scheme',\n\n setComponentRef: () => {},\n\n // Settings\n autoFocus: true,\n billingAddressAllowedCountries: [],\n billingAddressMode: AddressModeOptions.full,\n billingAddressRequired: false,\n billingAddressRequiredFields: ['street', 'houseNumberOrName', 'postalCode', 'city', 'stateOrProvince', 'country'],\n\n configuration: { koreanAuthenticationRequired: false, socialSecurityNumberMode: 'auto' as SocialSecurityMode },\n data: {\n billingAddress: {}\n },\n disableIOSArrowKeys: false,\n enableStoreDetails: false,\n exposeExpiryDate: false,\n forceCompat: false,\n hasHolderName: false,\n holderNameRequired: false,\n hasCVC: true,\n hideCVC: false,\n installmentOptions: {},\n keypadFix: true,\n legacyInputMode: false,\n maskSecurityCode: false,\n minimumExpiryDate: null,\n name: null, // Affects Dropin only, the name displayed in the PMList item\n placeholders: {},\n positionHolderNameOnTop: false,\n showBrandIcon: true,\n showInstallmentAmounts: null,\n styles: {},\n\n isPayButtonPrimaryVariant: true,\n showContextualElement: true,\n\n // Events\n onLoad: (): any => {},\n onConfigSuccess: (): any => {},\n onAllValid: (): any => {},\n onFieldValid: (): any => {},\n onBrand: (): any => {},\n onError: (): any => {},\n onBinValue: (): any => {},\n onBlur: (): any => {},\n onFocus: (): any => {},\n onChange: (): any => {}\n};\n"],"names":["CardInputDefaultProps","type","setComponentRef","autoFocus","billingAddressAllowedCountries","billingAddressMode","AddressModeOptions","full","billingAddressRequired","billingAddressRequiredFields","configuration","koreanAuthenticationRequired","socialSecurityNumberMode","data","billingAddress","disableIOSArrowKeys","enableStoreDetails","exposeExpiryDate","forceCompat","hasHolderName","holderNameRequired","hasCVC","hideCVC","installmentOptions","keypadFix","legacyInputMode","maskSecurityCode","minimumExpiryDate","name","placeholders","positionHolderNameOnTop","showBrandIcon","showInstallmentAmounts","styles","isPayButtonPrimaryVariant","showContextualElement","onLoad","onConfigSuccess","onAllValid","onFieldValid","onBrand","onError","onBinValue","onBlur","onFocus","onChange"],"mappings":"gDAGA,IAAeA,EAAA,CACXC,KAAM,SAENC,gBAAiB,OAGjBC,WAAW,EACXC,+BAAgC,GAChCC,mBAAoBC,EAAmBC,KACvCC,wBAAwB,EACxBC,6BAA8B,CAAC,SAAU,oBAAqB,aAAc,OAAQ,kBAAmB,WAEvGC,cAAe,CAAEC,8BAA8B,EAAOC,yBAA0B,QAChFC,KAAM,CACFC,eAAgB,CAAC,GAErBC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB,EAClBC,aAAa,EACbC,eAAe,EACfC,oBAAoB,EACpBC,QAAQ,EACRC,SAAS,EACTC,mBAAoB,CAAC,EACrBC,WAAW,EACXC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAmB,KACnBC,KAAM,KACNC,aAAc,CAAC,EACfC,yBAAyB,EACzBC,eAAe,EACfC,uBAAwB,KACxBC,OAAQ,CAAC,EAETC,2BAA2B,EAC3BC,uBAAuB,EAGvBC,OAAQ,OACRC,gBAAiB,OACjBC,WAAY,OACZC,aAAc,OACdC,QAAS,OACTC,QAAS,OACTC,WAAY,OACZC,OAAQ,OACRC,QAAS,OACTC,SAAU"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import s from"./CustomCardInput/CustomCardInput.js";import{CoreProvider as o}from"../../core/Context/CoreProvider.js";import n from"../../utils/browserInfo.js";import r from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{getCardImageUrl as i,fieldTypeToSnakeCase as a}from"../internal/SecuredFields/utils.js";import{TxVariants as p}from"../tx-variants.js";import{ANALYTICS_FOCUS_STR as d,ANALYTICS_UNFOCUS_STR as u}from"../../core/Analytics/constants.js";class c extends e{static type=p.customCard;static analyticsType="custom-scheme";static defaultProps={onBinLookup:()=>{},brandsConfiguration:{}};formatProps(t){return{...t,type:p.customCard,brand:p.card}}formatData(){const t=this.state.selectedBrandValue;return{paymentMethod:{type:"scheme",...this.state.data,...t&&{brand:t}},browserInfo:this.browserInfo}}submitAnalytics(t){super.submitAnalytics(t,this.props)}updateStyles(t){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(t),this}setFocusOn(t){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(t),this}processBinLookupResponse(t){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(t),this}dualBrandingChangeHandler(t){return this.componentRef?.dualBrandingChangeHandler&&this.componentRef.dualBrandingChangeHandler(t),this}handleUnsupportedCard(t){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(t),this}onBinLookup(t){const e={...t};e.rootNode=this._node,e.isReset||(e.supportedBrandsRaw=t.supportedBrandsRaw?.map((t=>(t.brandImageUrl=this.props.brandsConfiguration[t.brand]?.icon??i(t.brand,this.resources),t)))),this.props.onBinLookup(e)}onBinValue=r(this);get isValid(){return!!this.state.isValid}get browserInfo(){return n()}onFocus=t=>{this.submitAnalytics({type:!0===t.focus?d:u,target:a(t.fieldType)}),this.props.onFocus?.(t)};onEnterKeyPressed=(t,e)=>{this.props.onEnterKeyPressed?.(t,e)};render(){return t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(s,{ref:t=>{this.componentRef=t},...this.props,...this.state,handleKeyPress:this.handleKeyPress,rootNode:this._node,onChange:this.setState,onBinValue:this.onBinValue,implementationType:"custom",resources:this.resources,brand:this.props.brand,onFocus:this.onFocus}))}}export{c as CustomCard,c as default};
|
|
1
|
+
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import s from"./CustomCardInput/CustomCardInput.js";import{CoreProvider as o}from"../../core/Context/CoreProvider.js";import n from"../../utils/browserInfo.js";import r from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{getCardImageUrl as i,fieldTypeToSnakeCase as a}from"../internal/SecuredFields/utils.js";import{TxVariants as p}from"../tx-variants.js";import{ANALYTICS_FOCUS_STR as d,ANALYTICS_UNFOCUS_STR as u}from"../../core/Analytics/constants.js";class c extends e{static type=p.customCard;static analyticsType="custom-scheme";static defaultProps={onBinLookup:()=>{},brandsConfiguration:{}};formatProps(t){return{...t,type:p.customCard,brand:p.card}}formatData(){const t=this.state.selectedBrandValue;return{paymentMethod:{type:"scheme",...this.state.data,...t&&{brand:t}},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}submitAnalytics(t){super.submitAnalytics(t,this.props)}updateStyles(t){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(t),this}setFocusOn(t){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(t),this}processBinLookupResponse(t){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(t),this}dualBrandingChangeHandler(t){return this.componentRef?.dualBrandingChangeHandler&&this.componentRef.dualBrandingChangeHandler(t),this}handleUnsupportedCard(t){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(t),this}onBinLookup(t){const e={...t};e.rootNode=this._node,e.isReset||(e.supportedBrandsRaw=t.supportedBrandsRaw?.map((t=>(t.brandImageUrl=this.props.brandsConfiguration[t.brand]?.icon??i(t.brand,this.resources),t)))),this.props.onBinLookup(e)}onBinValue=r(this);get isValid(){return!!this.state.isValid}get browserInfo(){return n()}onFocus=t=>{this.submitAnalytics({type:!0===t.focus?d:u,target:a(t.fieldType)}),this.props.onFocus?.(t)};onEnterKeyPressed=(t,e)=>{this.props.onEnterKeyPressed?.(t,e)};render(){return t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(s,{ref:t=>{this.componentRef=t},...this.props,...this.state,handleKeyPress:this.handleKeyPress,rootNode:this._node,onChange:this.setState,onBinValue:this.onBinValue,implementationType:"custom",resources:this.resources,brand:this.props.brand,onFocus:this.onFocus}))}}export{c as CustomCard,c as default};
|
|
2
2
|
//# sourceMappingURL=CustomCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport {
|
|
1
|
+
{"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { ANALYTICS_FOCUS_STR, ANALYTICS_UNFOCUS_STR } from '../../core/Analytics/constants';\nimport { SendAnalyticsObject } from '../../core/Analytics/types';\n\n// TODO questions about\n// brand - does a merchant ever make a custom stored card?\n// type\n// countryCode\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static type = TxVariants.customCard;\n\n public static analyticsType = 'custom-scheme';\n\n protected static defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard,\n brand: TxVariants.card\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n return {\n paymentMethod: {\n type: 'scheme',\n ...this.state.data,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n super.submitAnalytics(analyticsObj, this.props);\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CbObjOnBinLookup) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private onFocus = (obj: CbObjOnFocus) => {\n this.submitAnalytics({\n type: obj.focus === true ? ANALYTICS_FOCUS_STR : ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyPress={this.handleKeyPress}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.props.brand}\n onFocus={this.onFocus}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","static","TxVariants","customCard","onBinLookup","brandsConfiguration","formatProps","props","type","brand","card","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","browserInfo","origin","window","location","submitAnalytics","analyticsObj","super","updateStyles","stylesObj","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","brandImageUrl","icon","getCardImageUrl","resources","onBinValue","triggerBinLookUp","isValid","collectBrowserInfo","onFocus","focus","ANALYTICS_FOCUS_STR","ANALYTICS_UNFOCUS_STR","target","fieldTypeToSnakeCase","fieldType","onEnterKeyPressed","activeElement","component","render","h","CoreProvider","i18n","loadingContext","CustomCardInput","ref","handleKeyPress","onChange","setState","implementationType"],"mappings":"4lBAmBO,MAAMA,UAAmBC,EAC5BC,YAAqBC,EAAWC,WAEhCF,qBAA8B,gBAE9BA,oBAAgC,CAC5BG,YAAa,OACbC,oBAAqB,CAAC,GAG1BC,WAAAA,CAAYC,GACR,MAAO,IACAA,EACHC,KAAMN,EAAWC,WACjBM,MAAOP,EAAWQ,KAE1B,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAC3B,MAAO,CACHC,cAAe,CACXR,KAAM,YACHK,KAAKC,MAAMG,QACVL,GAAW,CAAEH,MAAOG,IAE5BM,YAAaL,KAAKK,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEUG,eAAAA,CAAgBC,GACtBC,MAAMF,gBAAgBC,EAAcV,KAAKN,MAC7C,CAEAkB,YAAAA,CAAaC,GAET,OADIb,KAAKc,cAAcF,cAAcZ,KAAKc,aAAaF,aAAaC,GAC7Db,IACX,CAEAe,UAAAA,CAAWC,GAEP,OADIhB,KAAKc,cAAcC,YAAYf,KAAKc,aAAaC,WAAWC,GACzDhB,IACX,CAEAiB,wBAAAA,CAAyBC,GAErB,OADIlB,KAAKc,cAAcG,0BAA0BjB,KAAKc,aAAaG,yBAAyBC,GACrFlB,IACX,CAEAmB,yBAAAA,CAA0BC,GAEtB,OADIpB,KAAKc,cAAcK,2BAA2BnB,KAAKc,aAAaK,0BAA0BC,GACvFpB,IACX,CAEAqB,qBAAAA,CAAsBC,GAElB,OADItB,KAAKc,cAAcO,uBAAuBrB,KAAKc,aAAaO,sBAAsBC,GAC/EtB,IACX,CAEAT,WAAAA,CAAYgC,GACR,MAAMC,EAAQ,IAAKD,GACnBC,EAAMC,SAAWzB,KAAK0B,MAEjBF,EAAMG,UAEPH,EAAMI,mBAAqBL,EAAIK,oBAAoBC,KAAKC,IACpDA,EAAKC,cAAgB/B,KAAKN,MAAMF,oBAAoBsC,EAAKlC,QAAQoC,MAAQC,EAAgBH,EAAKlC,MAAOI,KAAKkC,WACnGJ,MAIf9B,KAAKN,MAAMH,YAAYiC,EAC3B,CAEOW,WAAaC,EAAiBpC,MAErC,WAAIqC,GACA,QAASrC,KAAKC,MAAMoC,OACxB,CAEA,eAAIhC,GACA,OAAOiC,GACX,CAEQC,QAAWhB,IACfvB,KAAKS,gBAAgB,CACjBd,MAAoB,IAAd4B,EAAIiB,MAAiBC,EAAsBC,EACjDC,OAAQC,EAAqBrB,EAAIsB,aAIrC7C,KAAKN,MAAM6C,UAAUhB,EAAAA,EAGfuB,kBAAoB,CAACC,EAAwBC,KACnDhD,KAAKN,MAAMoD,oBAAoBC,EAAeC,EAAAA,EAGlDC,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMpD,KAAKN,MAAM0D,KAAMC,eAAgBrD,KAAKN,MAAM2D,eAAgBnB,UAAWlC,KAAKkC,WAC5FgB,EAACI,EAAAA,CACGC,IAAKA,IACDvD,KAAKc,aAAeyC,CAAAA,KAEpBvD,KAAKN,SACLM,KAAKC,MACTuD,eAAgBxD,KAAKwD,eACrB/B,SAAUzB,KAAK0B,MACf+B,SAAUzD,KAAK0D,SACfvB,WAAYnC,KAAKmC,WACjBwB,mBAAoB,SACpBzB,UAAWlC,KAAKkC,UAChBtC,MAAOI,KAAKN,MAAME,MAClB2C,QAASvC,KAAKuC,UAI9B"}
|
package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as e,createElement as t}from"../../../../../external/preact/dist/preact.js";import o from"../../../../../external/classnames/index.js";import n from"../PaymentMethodDetails.js";import a from"../PaymentMethodIcon.js";import i from"../DisableOneClickConfirmation.js";import s from"../PaymentMethodBrands/PaymentMethodBrands.js";import{BRAND_ICON_UI_EXCLUSION_LIST as d}from"../../../../internal/SecuredFields/lib/constants.js";import r from"../PaymentMethodName.js";import{useCoreContext as m}from"../../../../../core/Context/CoreProvider.js";import h from"../../../../internal/ExpandButton/ExpandButton.js";class l extends e{static defaultProps={paymentMethod:null,isSelected:!1,isLoaded:!1,isLoading:!1,showDisableStoredPaymentMethodConfirmation:!1,showRadioButton:!1};state={showDisableStoredPaymentMethodConfirmation:!1};toggleDisableConfirmation=()=>{this.setState({showDisableStoredPaymentMethodConfirmation:!this.state.showDisableStoredPaymentMethodConfirmation})};onDisableStoredPaymentMethod=()=>{this.props.onDisableStoredPaymentMethod(this.props.paymentMethod),this.toggleDisableConfirmation()};handleOnListItemClick=()=>{const{onSelect:e,paymentMethod:t}=this.props;e(t)};render({paymentMethod:e,isSelected:l,isDisablingPaymentMethod:c,isLoaded:p,isLoading:y,standalone:u,showRadioButton:_}){const{i18n:b}=m();if(!e)return null;const f="card"===e.props.type||"scheme"===e.props.type,C=o({"adyen-checkout__payment-method":!0,[`adyen-checkout__payment-method--${e.props.type}`]:!0,...f&&{[`adyen-checkout__payment-method--${e.props.fundingSource??"credit"}`]:!0},"adyen-checkout__payment-method--selected":l,"adyen-checkout__payment-method--loading":y,"adyen-checkout__payment-method--disabling":c,"adyen-checkout__payment-method--confirming":this.state.showDisableStoredPaymentMethodConfirmation,"adyen-checkout__payment-method--standalone":u,[e._id]:!0,[this.props.className]:!0}),k=this.props.showRemovePaymentMethodButton&&e.props.oneClick&&l,M=`remove-${e._id}`,P=`container-${e._id}`,D=`button-${e._id}`,S=!e.props.oneClick&&e.brands&&e.brands.length>0;return t("div",{key:e._id,className:C,onClick:this.handleOnListItemClick},t("div",{className:"adyen-checkout__payment-method__header"},t(h,{buttonId:D,showRadioButton:_,isSelected:l,expandContentId:P},t(a,{...e.props.oneClick&&{altDescription:e.props.name},type:e.type,src:e.icon}),t(r,{displayName:e.displayName,isSelected:l,additionalInfo:e.additionalInfo})),k&&t("button",{type:"button",className:"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link",onClick:this.toggleDisableConfirmation,"aria-expanded":this.state.showDisableStoredPaymentMethodConfirmation,"aria-controls":M},b.get("storedPaymentMethod.disable.button")),S&&t(s,{brands:e.brands,excludedUIBrands:d,isPaymentMethodSelected:l})),t("div",{className:"adyen-checkout-pm-details-wrapper","aria-hidden":!l},t("div",{className:"adyen-checkout__payment-method__details",id:P
|
|
1
|
+
import{Component as e,createElement as t}from"../../../../../external/preact/dist/preact.js";import o from"../../../../../external/classnames/index.js";import n from"../PaymentMethodDetails.js";import a from"../PaymentMethodIcon.js";import i from"../DisableOneClickConfirmation.js";import s from"../PaymentMethodBrands/PaymentMethodBrands.js";import{BRAND_ICON_UI_EXCLUSION_LIST as d}from"../../../../internal/SecuredFields/lib/constants.js";import r from"../PaymentMethodName.js";import{useCoreContext as m}from"../../../../../core/Context/CoreProvider.js";import h from"../../../../internal/ExpandButton/ExpandButton.js";class l extends e{static defaultProps={paymentMethod:null,isSelected:!1,isLoaded:!1,isLoading:!1,showDisableStoredPaymentMethodConfirmation:!1,showRadioButton:!1};state={showDisableStoredPaymentMethodConfirmation:!1};toggleDisableConfirmation=()=>{this.setState({showDisableStoredPaymentMethodConfirmation:!this.state.showDisableStoredPaymentMethodConfirmation})};onDisableStoredPaymentMethod=()=>{this.props.onDisableStoredPaymentMethod(this.props.paymentMethod),this.toggleDisableConfirmation()};handleOnListItemClick=()=>{const{onSelect:e,paymentMethod:t}=this.props;e(t)};render({paymentMethod:e,isSelected:l,isDisablingPaymentMethod:c,isLoaded:p,isLoading:y,standalone:u,showRadioButton:_}){const{i18n:b}=m();if(!e)return null;const f="card"===e.props.type||"scheme"===e.props.type,C=o({"adyen-checkout__payment-method":!0,[`adyen-checkout__payment-method--${e.props.type}`]:!0,...f&&{[`adyen-checkout__payment-method--${e.props.fundingSource??"credit"}`]:!0},"adyen-checkout__payment-method--selected":l,"adyen-checkout__payment-method--loading":y,"adyen-checkout__payment-method--disabling":c,"adyen-checkout__payment-method--confirming":this.state.showDisableStoredPaymentMethodConfirmation,"adyen-checkout__payment-method--standalone":u,[e._id]:!0,[this.props.className]:!0}),k=this.props.showRemovePaymentMethodButton&&e.props.oneClick&&l,M=`remove-${e._id}`,P=`container-${e._id}`,D=`button-${e._id}`,S=!e.props.oneClick&&e.brands&&e.brands.length>0;return t("div",{key:e._id,className:C,onClick:this.handleOnListItemClick},t("div",{className:"adyen-checkout__payment-method__header"},t(h,{buttonId:D,showRadioButton:_,isSelected:l,expandContentId:P},t(a,{...e.props.oneClick&&{altDescription:e.props.name},type:e.type,src:e.icon}),t(r,{displayName:e.displayName,isSelected:l,additionalInfo:e.additionalInfo})),k&&t("button",{type:"button",className:"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link",onClick:this.toggleDisableConfirmation,"aria-expanded":this.state.showDisableStoredPaymentMethodConfirmation,"aria-controls":M},b.get("storedPaymentMethod.disable.button")),S&&t(s,{brands:e.brands,excludedUIBrands:d,isPaymentMethodSelected:l})),t("div",{className:"adyen-checkout-pm-details-wrapper","aria-hidden":!l},t("div",{className:"adyen-checkout__payment-method__details",id:P},k&&t(i,{id:M,open:this.state.showDisableStoredPaymentMethodConfirmation,onDisable:this.onDisableStoredPaymentMethod,onCancel:this.toggleDisableConfirmation}),t(n,{paymentMethodComponent:e.render(),isLoaded:p}))))}}export{l as default};
|
|
2
2
|
//# sourceMappingURL=PaymentMethodItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentMethodItem.js","sources":["../../../../../../../src/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport PaymentMethodDetails from '../PaymentMethodDetails';\nimport PaymentMethodIcon from '../PaymentMethodIcon';\nimport DisableOneClickConfirmation from '../DisableOneClickConfirmation';\nimport './PaymentMethodItem.scss';\nimport UIElement from '../../../../internal/UIElement/UIElement';\nimport PaymentMethodBrands from '../PaymentMethodBrands/PaymentMethodBrands';\nimport { BRAND_ICON_UI_EXCLUSION_LIST } from '../../../../internal/SecuredFields/lib/constants';\nimport PaymentMethodName from '../PaymentMethodName';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport ExpandButton from '../../../../internal/ExpandButton';\n\nexport interface PaymentMethodItemProps {\n paymentMethod: UIElement;\n isSelected?: boolean;\n isLoaded?: boolean;\n isLoading?: boolean;\n isDisablingPaymentMethod: boolean;\n showRemovePaymentMethodButton: boolean;\n onDisableStoredPaymentMethod: (paymentMethod) => void;\n onSelect: (paymentMethod: UIElement) => void;\n standalone: boolean;\n className?: string;\n showRadioButton?: boolean;\n}\n\nclass PaymentMethodItem extends Component<PaymentMethodItemProps> {\n public static defaultProps = {\n paymentMethod: null,\n isSelected: false,\n isLoaded: false,\n isLoading: false,\n showDisableStoredPaymentMethodConfirmation: false,\n showRadioButton: false\n };\n\n public state = {\n showDisableStoredPaymentMethodConfirmation: false\n };\n\n public toggleDisableConfirmation = () => {\n this.setState({ showDisableStoredPaymentMethodConfirmation: !this.state.showDisableStoredPaymentMethodConfirmation });\n };\n\n public onDisableStoredPaymentMethod = () => {\n this.props.onDisableStoredPaymentMethod(this.props.paymentMethod);\n this.toggleDisableConfirmation();\n };\n\n private handleOnListItemClick = (): void => {\n const { onSelect, paymentMethod } = this.props;\n onSelect(paymentMethod);\n };\n\n // @ts-ignore need to refine the type for paymentMethod\n render({ paymentMethod, isSelected, isDisablingPaymentMethod, isLoaded, isLoading, standalone, showRadioButton }) {\n const { i18n } = useCoreContext();\n\n if (!paymentMethod) {\n return null;\n }\n\n const isCard = paymentMethod.props.type === 'card' || paymentMethod.props.type === 'scheme';\n\n const paymentMethodClassnames = classNames({\n 'adyen-checkout__payment-method': true,\n [`adyen-checkout__payment-method--${paymentMethod.props.type}`]: true,\n ...(isCard && { [`adyen-checkout__payment-method--${paymentMethod.props.fundingSource ?? 'credit'}`]: true }),\n 'adyen-checkout__payment-method--selected': isSelected,\n 'adyen-checkout__payment-method--loading': isLoading,\n 'adyen-checkout__payment-method--disabling': isDisablingPaymentMethod,\n 'adyen-checkout__payment-method--confirming': this.state.showDisableStoredPaymentMethodConfirmation,\n 'adyen-checkout__payment-method--standalone': standalone,\n [paymentMethod._id]: true,\n [this.props.className]: true\n });\n\n const showRemovePaymentMethodButton = this.props.showRemovePaymentMethodButton && paymentMethod.props.oneClick && isSelected;\n const disableConfirmationId = `remove-${paymentMethod._id}`;\n const containerId = `container-${paymentMethod._id}`;\n const buttonId = `button-${paymentMethod._id}`;\n\n const showBrands = !paymentMethod.props.oneClick && paymentMethod.brands && paymentMethod.brands.length > 0;\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div key={paymentMethod._id} className={paymentMethodClassnames} onClick={this.handleOnListItemClick}>\n <div className=\"adyen-checkout__payment-method__header\">\n <ExpandButton buttonId={buttonId} showRadioButton={showRadioButton} isSelected={isSelected} expandContentId={containerId}>\n <PaymentMethodIcon\n // Only add alt attribute to storedPaymentMethods (to avoid SR reading the PM name twice)\n {...(paymentMethod.props.oneClick && { altDescription: paymentMethod.props.name })}\n type={paymentMethod.type}\n src={paymentMethod.icon}\n />\n\n <PaymentMethodName\n displayName={paymentMethod.displayName}\n isSelected={isSelected}\n additionalInfo={paymentMethod.additionalInfo}\n />\n </ExpandButton>\n\n {showRemovePaymentMethodButton && (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link\"\n onClick={this.toggleDisableConfirmation}\n aria-expanded={this.state.showDisableStoredPaymentMethodConfirmation}\n aria-controls={disableConfirmationId}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </button>\n )}\n\n {showBrands && (\n <PaymentMethodBrands\n brands={paymentMethod.brands}\n excludedUIBrands={BRAND_ICON_UI_EXCLUSION_LIST}\n isPaymentMethodSelected={isSelected}\n />\n )}\n </div>\n\n <div className=\"adyen-checkout-pm-details-wrapper\" aria-hidden={!isSelected}>\n <div className=\"adyen-checkout__payment-method__details\" id={containerId} role=\"region\">\n {showRemovePaymentMethodButton && (\n <DisableOneClickConfirmation\n id={disableConfirmationId}\n open={this.state.showDisableStoredPaymentMethodConfirmation}\n onDisable={this.onDisableStoredPaymentMethod}\n onCancel={this.toggleDisableConfirmation}\n />\n )}\n\n <PaymentMethodDetails paymentMethodComponent={paymentMethod.render()} isLoaded={isLoaded} />\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default PaymentMethodItem;\n"],"names":["PaymentMethodItem","Component","static","paymentMethod","isSelected","isLoaded","isLoading","showDisableStoredPaymentMethodConfirmation","showRadioButton","state","toggleDisableConfirmation","this","setState","onDisableStoredPaymentMethod","props","handleOnListItemClick","onSelect","render","isDisablingPaymentMethod","standalone","i18n","useCoreContext","isCard","type","paymentMethodClassnames","classNames","fundingSource","_id","className","showRemovePaymentMethodButton","oneClick","disableConfirmationId","containerId","buttonId","showBrands","brands","length","h","div","key","onClick","ExpandButton","expandContentId","PaymentMethodIcon","altDescription","name","src","icon","PaymentMethodName","displayName","additionalInfo","button","aria-expanded","aria-controls","get","PaymentMethodBrands","excludedUIBrands","BRAND_ICON_UI_EXCLUSION_LIST","isPaymentMethodSelected","aria-hidden","id","role","DisableOneClickConfirmation","open","onDisable","onCancel","PaymentMethodDetails","paymentMethodComponent"],"mappings":"+mBA2BA,MAAMA,UAA0BC,EAC5BC,oBAA6B,CACzBC,cAAe,KACfC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,4CAA4C,EAC5CC,iBAAiB,GAGdC,MAAQ,CACXF,4CAA4C,GAGzCG,0BAA4B,KAC/BC,KAAKC,SAAS,CAAEL,4CAA6CI,KAAKF,MAAMF,4CAA2C,EAGhHM,6BAA+B,KAClCF,KAAKG,MAAMD,6BAA6BF,KAAKG,MAAMX,eACnDQ,KAAKD,2BAAyB,EAG1BK,sBAAwB,KAC5B,MAAMC,SAAEA,EAAQb,cAAEA,GAAkBQ,KAAKG,MAC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8C,eAAgB/C,EAAc+C,kBAIrCrB,GACGQ,EAACc,SAAAA,CACG5B,KAAK,SACLK,UAAU,qFACVY,QAAS7B,KAAKD,0BACd0C,gBAAezC,KAAKF,MAAMF,2CAC1B8C,gBAAetB,GAEdX,EAAKkC,IAAI,uCAIjBpB,GACGG,EAACkB,EAAAA,CACGpB,OAAQhC,EAAcgC,OACtBqB,iBAAkBC,EAClBC,wBAAyBtD,KAKrCiC,EAACC,MAAAA,CAAIV,UAAU,oCAAoC+B,eAAcvD,GAC7DiC,EAACC,MAAAA,CAAIV,UAAU,0CAA0CgC,GAAI5B,EAAa6B,KAAK,UAC1EhC,GACGQ,EAACyB,EAAAA,CACGF,GAAI7B,EACJgC,KAAMpD,KAAKF,MAAMF,2CACjByD,UAAWrD,KAAKE,6BAChBoD,SAAUtD,KAAKD,4BAIvB2B,EAAC6B,EAAAA,CAAqBC,uBAAwBhE,EAAcc,SAAUZ,SAAUA,MAKpG"}
|
|
1
|
+
{"version":3,"file":"PaymentMethodItem.js","sources":["../../../../../../../src/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport PaymentMethodDetails from '../PaymentMethodDetails';\nimport PaymentMethodIcon from '../PaymentMethodIcon';\nimport DisableOneClickConfirmation from '../DisableOneClickConfirmation';\nimport './PaymentMethodItem.scss';\nimport UIElement from '../../../../internal/UIElement/UIElement';\nimport PaymentMethodBrands from '../PaymentMethodBrands/PaymentMethodBrands';\nimport { BRAND_ICON_UI_EXCLUSION_LIST } from '../../../../internal/SecuredFields/lib/constants';\nimport PaymentMethodName from '../PaymentMethodName';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport ExpandButton from '../../../../internal/ExpandButton';\n\nexport interface PaymentMethodItemProps {\n paymentMethod: UIElement;\n isSelected?: boolean;\n isLoaded?: boolean;\n isLoading?: boolean;\n isDisablingPaymentMethod: boolean;\n showRemovePaymentMethodButton: boolean;\n onDisableStoredPaymentMethod: (paymentMethod) => void;\n onSelect: (paymentMethod: UIElement) => void;\n standalone: boolean;\n className?: string;\n showRadioButton?: boolean;\n}\n\nclass PaymentMethodItem extends Component<PaymentMethodItemProps> {\n public static defaultProps = {\n paymentMethod: null,\n isSelected: false,\n isLoaded: false,\n isLoading: false,\n showDisableStoredPaymentMethodConfirmation: false,\n showRadioButton: false\n };\n\n public state = {\n showDisableStoredPaymentMethodConfirmation: false\n };\n\n public toggleDisableConfirmation = () => {\n this.setState({ showDisableStoredPaymentMethodConfirmation: !this.state.showDisableStoredPaymentMethodConfirmation });\n };\n\n public onDisableStoredPaymentMethod = () => {\n this.props.onDisableStoredPaymentMethod(this.props.paymentMethod);\n this.toggleDisableConfirmation();\n };\n\n private handleOnListItemClick = (): void => {\n const { onSelect, paymentMethod } = this.props;\n onSelect(paymentMethod);\n };\n\n // @ts-ignore need to refine the type for paymentMethod\n render({ paymentMethod, isSelected, isDisablingPaymentMethod, isLoaded, isLoading, standalone, showRadioButton }) {\n const { i18n } = useCoreContext();\n\n if (!paymentMethod) {\n return null;\n }\n\n const isCard = paymentMethod.props.type === 'card' || paymentMethod.props.type === 'scheme';\n\n const paymentMethodClassnames = classNames({\n 'adyen-checkout__payment-method': true,\n [`adyen-checkout__payment-method--${paymentMethod.props.type}`]: true,\n ...(isCard && { [`adyen-checkout__payment-method--${paymentMethod.props.fundingSource ?? 'credit'}`]: true }),\n 'adyen-checkout__payment-method--selected': isSelected,\n 'adyen-checkout__payment-method--loading': isLoading,\n 'adyen-checkout__payment-method--disabling': isDisablingPaymentMethod,\n 'adyen-checkout__payment-method--confirming': this.state.showDisableStoredPaymentMethodConfirmation,\n 'adyen-checkout__payment-method--standalone': standalone,\n [paymentMethod._id]: true,\n [this.props.className]: true\n });\n\n const showRemovePaymentMethodButton = this.props.showRemovePaymentMethodButton && paymentMethod.props.oneClick && isSelected;\n const disableConfirmationId = `remove-${paymentMethod._id}`;\n const containerId = `container-${paymentMethod._id}`;\n const buttonId = `button-${paymentMethod._id}`;\n\n const showBrands = !paymentMethod.props.oneClick && paymentMethod.brands && paymentMethod.brands.length > 0;\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div key={paymentMethod._id} className={paymentMethodClassnames} onClick={this.handleOnListItemClick}>\n <div className=\"adyen-checkout__payment-method__header\">\n <ExpandButton buttonId={buttonId} showRadioButton={showRadioButton} isSelected={isSelected} expandContentId={containerId}>\n <PaymentMethodIcon\n // Only add alt attribute to storedPaymentMethods (to avoid SR reading the PM name twice)\n {...(paymentMethod.props.oneClick && { altDescription: paymentMethod.props.name })}\n type={paymentMethod.type}\n src={paymentMethod.icon}\n />\n\n <PaymentMethodName\n displayName={paymentMethod.displayName}\n isSelected={isSelected}\n additionalInfo={paymentMethod.additionalInfo}\n />\n </ExpandButton>\n\n {showRemovePaymentMethodButton && (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link\"\n onClick={this.toggleDisableConfirmation}\n aria-expanded={this.state.showDisableStoredPaymentMethodConfirmation}\n aria-controls={disableConfirmationId}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </button>\n )}\n\n {showBrands && (\n <PaymentMethodBrands\n brands={paymentMethod.brands}\n excludedUIBrands={BRAND_ICON_UI_EXCLUSION_LIST}\n isPaymentMethodSelected={isSelected}\n />\n )}\n </div>\n\n <div className=\"adyen-checkout-pm-details-wrapper\" aria-hidden={!isSelected}>\n <div className=\"adyen-checkout__payment-method__details\" id={containerId}>\n {showRemovePaymentMethodButton && (\n <DisableOneClickConfirmation\n id={disableConfirmationId}\n open={this.state.showDisableStoredPaymentMethodConfirmation}\n onDisable={this.onDisableStoredPaymentMethod}\n onCancel={this.toggleDisableConfirmation}\n />\n )}\n\n <PaymentMethodDetails paymentMethodComponent={paymentMethod.render()} isLoaded={isLoaded} />\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default PaymentMethodItem;\n"],"names":["PaymentMethodItem","Component","static","paymentMethod","isSelected","isLoaded","isLoading","showDisableStoredPaymentMethodConfirmation","showRadioButton","state","toggleDisableConfirmation","this","setState","onDisableStoredPaymentMethod","props","handleOnListItemClick","onSelect","render","isDisablingPaymentMethod","standalone","i18n","useCoreContext","isCard","type","paymentMethodClassnames","classNames","fundingSource","_id","className","showRemovePaymentMethodButton","oneClick","disableConfirmationId","containerId","buttonId","showBrands","brands","length","h","div","key","onClick","ExpandButton","expandContentId","PaymentMethodIcon","altDescription","name","src","icon","PaymentMethodName","displayName","additionalInfo","button","aria-expanded","aria-controls","get","PaymentMethodBrands","excludedUIBrands","BRAND_ICON_UI_EXCLUSION_LIST","isPaymentMethodSelected","aria-hidden","id","DisableOneClickConfirmation","open","onDisable","onCancel","PaymentMethodDetails","paymentMethodComponent"],"mappings":"+mBA2BA,MAAMA,UAA0BC,EAC5BC,oBAA6B,CACzBC,cAAe,KACfC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,4CAA4C,EAC5CC,iBAAiB,GAGdC,MAAQ,CACXF,4CAA4C,GAGzCG,0BAA4B,KAC/BC,KAAKC,SAAS,CAAEL,4CAA6CI,KAAKF,MAAMF,4CAA2C,EAGhHM,6BAA+B,KAClCF,KAAKG,MAAMD,6BAA6BF,KAAKG,MAAMX,eACnDQ,KAAKD,2BAAyB,EAG1BK,sBAAwB,KAC5B,MAAMC,SAAEA,EAAQb,cAAEA,GAAkBQ,KAAKG,MACzCE,EAASb,EAAAA,EAIbc,MAAAA,EAAOd,cAAEA,EAAaC,WAAEA,EAAUc,yBAAEA,EAAwBb,SAAEA,EAAQC,UAAEA,EAASa,WAAEA,EAAUX,gBAAEA,IAC3F,MAAMY,KAAEA,GAASC,IAEjB,IAAKlB,EACD,OAAO,KAGX,MAAMmB,EAAsC,SAA7BnB,EAAcW,MAAMS,MAAgD,WAA7BpB,EAAcW,MAAMS,KAEpEC,EAA0BC,EAAW,CACvC,kCAAkC,EAClC,CAAC,mCA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GAC7DiC,EAACC,MAAAA,CAAIV,UAAU,0CAA0CgC,GAAI5B,GACxDH,GACGQ,EAACwB,EAAAA,CACGD,GAAI7B,EACJ+B,KAAMnD,KAAKF,MAAMF,2CACjBwD,UAAWpD,KAAKE,6BAChBmD,SAAUrD,KAAKD,4BAIvB2B,EAAC4B,EAAAA,CAAqBC,uBAAwB/D,EAAcc,SAAUZ,SAAUA,MAKpG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{optionallyFilterUpiSubTxVariants as t,
|
|
1
|
+
import{optionallyFilterUpiSubTxVariants as t,filterUnsupportedPaymentMethod as e,filterPresent as o,filterAvailable as n}from"./filters.js";import{getComponentConfiguration as r}from"./getComponentConfiguration.js";import p from"../../components-name-map.js";const s=(s,i,m,a)=>{const f=t(s).filter(e).map((t=>{const e="isStoredPaymentMethod"in t&&t.isStoredPaymentMethod,o=r(t.type,i,e),n=a.getComponent(t.type);if(!n)return console.warn(`\nDropin: You support the payment method '${t.type}' but this component has not been configured. Make sure to import the Class '${p(t.type)}' and then pass it in the Dropin's 'paymentMethodComponents' config property if you wish to offer this payment method.`),null;const s={...t,...m,...o};return new n(a,s)})).filter(o);return n(f)};export{s as default};
|
|
2
2
|
//# sourceMappingURL=createElements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createElements.js","sources":["../../../../../src/components/Dropin/elements/createElements.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"createElements.js","sources":["../../../../../src/components/Dropin/elements/createElements.ts"],"sourcesContent":["import { filterUnsupportedPaymentMethod, filterPresent, filterAvailable, optionallyFilterUpiSubTxVariants } from './filters';\nimport { getComponentConfiguration } from './getComponentConfiguration';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport UIElement from '../../internal/UIElement';\nimport type { PaymentMethod, StoredPaymentMethod } from '../../../types/global-types';\nimport type { PaymentMethodsConfiguration } from '../types';\nimport type { ICore } from '../../../core/types';\n\n/**\n * Returns a filtered (available) list of component Elements\n *\n * @param paymentMethods - Array of PaymentMethod objects from the /paymentMethods response\n * @param paymentMethodsConfiguration - Dropin paymentMethodsConfiguration object\n * @param commonProps - High level props to be passed through to every component\n * @param core - Reference to the checkout core object\n */\nconst createElements = (\n paymentMethods: PaymentMethod[] | StoredPaymentMethod[],\n paymentMethodsConfiguration: PaymentMethodsConfiguration,\n commonProps,\n core: ICore\n): Promise<UIElement[]> => {\n const elements = optionallyFilterUpiSubTxVariants(paymentMethods)\n .filter(filterUnsupportedPaymentMethod)\n .map(paymentMethod => {\n const isStoredPaymentMethod = 'isStoredPaymentMethod' in paymentMethod && paymentMethod.isStoredPaymentMethod;\n const paymentMethodConfigurationProps = getComponentConfiguration(paymentMethod.type, paymentMethodsConfiguration, isStoredPaymentMethod);\n const PaymentMethodElement = core.getComponent(paymentMethod.type);\n\n if (!PaymentMethodElement) {\n console.warn(\n `\\nDropin: You support the payment method '${\n paymentMethod.type\n }' but this component has not been configured. Make sure to import the Class '${getComponentNameOfPaymentType(\n paymentMethod.type\n )}' and then pass it in the Dropin's 'paymentMethodComponents' config property if you wish to offer this payment method.`\n );\n return null;\n }\n\n const elementProps = { ...paymentMethod, ...commonProps, ...paymentMethodConfigurationProps };\n\n return new PaymentMethodElement(core, elementProps);\n })\n .filter(filterPresent);\n\n return filterAvailable(elements);\n};\n\nexport default createElements;\n"],"names":["createElements","paymentMethods","paymentMethodsConfiguration","commonProps","core","elements","optionallyFilterUpiSubTxVariants","filter","filterUnsupportedPaymentMethod","map","paymentMethod","isStoredPaymentMethod","paymentMethodConfigurationProps","getComponentConfiguration","type","PaymentMethodElement","getComponent","console","warn","getComponentNameOfPaymentType","elementProps","filterPresent","filterAvailable"],"mappings":"mQAgBMA,MAAAA,EAAiB,CACnBC,EACAC,EACAC,EACAC,KAEA,MAAMC,EAAWC,EAAiCL,GAC7CM,OAAOC,GACPC,KAAIC,IACD,MAAMC,EAAwB,0BAA2BD,GAAiBA,EAAcC,sBAClFC,EAAkCC,EAA0BH,EAAcI,KAAMZ,EAA6BS,GAC7GI,EAAuBX,EAAKY,aAAaN,EAAcI,MAE7D,IAAKC,EAQD,OAPAE,QAAQC,KACJ,6CACIR,EAAcI,qFAC+DK,EAC7ET,EAAcI,+HAGf,KAGX,MAAMM,EAAe,IAAKV,KAAkBP,KAAgBS,GAE5D,OAAO,IAAIG,EAAqBX,EAAMgB,EAAAA,IAEzCb,OAAOc,GAEZ,OAAOC,EAAgBjB,EAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"../../../utils/promiseTimeout.js";const e=["androidpay","samsungpay","clicktopay"],i=t=>!e.includes(t.
|
|
1
|
+
import t from"../../../utils/promiseTimeout.js";const e=["androidpay","samsungpay","clicktopay"],i=t=>!e.includes(t.type),r=t=>!!t,s=e=>{const i=e.map((e=>{const{promise:i}=t(5e3,e.isAvailable(),{});return i}));return Promise.allSettled(i).then((t=>e.filter(((e,i)=>"fulfilled"===t[i].status))))},l=t=>{if(!t.some((t=>"upi"===t?.type)))return t;const e=["upi_qr","upi_collect","upi_intent"];return t.filter((t=>!e.includes(t?.type)))};export{e as UNSUPPORTED_PAYMENT_METHODS,s as filterAvailable,r as filterPresent,i as filterUnsupportedPaymentMethod,l as optionallyFilterUpiSubTxVariants};
|
|
2
2
|
//# sourceMappingURL=filters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.js","sources":["../../../../../src/components/Dropin/elements/filters.ts"],"sourcesContent":["import promiseTimeout from '../../../utils/promiseTimeout';\nimport type { PaymentMethod, StoredPaymentMethod, UIElement } from '../../../types';\n\nexport const UNSUPPORTED_PAYMENT_METHODS = ['androidpay', 'samsungpay', 'clicktopay'];\n\n
|
|
1
|
+
{"version":3,"file":"filters.js","sources":["../../../../../src/components/Dropin/elements/filters.ts"],"sourcesContent":["import promiseTimeout from '../../../utils/promiseTimeout';\nimport type { PaymentMethod, StoredPaymentMethod, UIElement } from '../../../types';\n\nexport const UNSUPPORTED_PAYMENT_METHODS = ['androidpay', 'samsungpay', 'clicktopay'];\n\n/**\n * Filter out payment methods that are not supported by Drop-in\n * @param paymentMethod - Payment method object from /paymentMethods response\n */\nexport const filterUnsupportedPaymentMethod = (paymentMethod: PaymentMethod | StoredPaymentMethod) =>\n !UNSUPPORTED_PAYMENT_METHODS.includes(paymentMethod.type);\n\n// filter payment methods that we support (that are in the paymentMethods/index dictionary)\nexport const filterPresent = paymentMethod => !!paymentMethod;\n\n// filter payment methods that are available to the user\nexport const filterAvailable = (elements: UIElement[]) => {\n const elementIsAvailablePromises = elements.map(element => {\n const { promise } = promiseTimeout(5000, element.isAvailable(), {});\n return promise;\n });\n\n return Promise.allSettled(elementIsAvailablePromises).then(promiseResults => {\n return elements.filter((element, i) => promiseResults[i].status === 'fulfilled');\n });\n};\n\nexport const optionallyFilterUpiSubTxVariants = (paymentMethods: Array<PaymentMethod | StoredPaymentMethod>) => {\n const hasUpiParent = paymentMethods.some(pm => pm?.type === 'upi');\n // If we don't get the 'upi' parent, we render multiple upi components\n if (!hasUpiParent) return paymentMethods;\n\n // If we get the 'upi' parent, we remove upi sub tx_variant components\n const UPI_SUB_TX_VARIANTS = ['upi_qr', 'upi_collect', 'upi_intent'];\n return paymentMethods.filter(pm => !UPI_SUB_TX_VARIANTS.includes(pm?.type));\n};\n"],"names":["UNSUPPORTED_PAYMENT_METHODS","filterUnsupportedPaymentMethod","paymentMethod","includes","type","filterPresent","filterAvailable","elements","elementIsAvailablePromises","map","element","promise","promiseTimeout","isAvailable","Promise","allSettled","then","promiseResults","filter","i","status","optionallyFilterUpiSubTxVariants","paymentMethods","some","pm","UPI_SUB_TX_VARIANTS"],"mappings":"sDAGaA,EAA8B,CAAC,aAAc,aAAc,cAM3DC,EAAkCC,IAC1CF,EAA4BG,SAASD,EAAcE,MAG3CC,EAAgBH,KAAmBA,EAGnCI,EAAmBC,IAC5B,MAAMC,EAA6BD,EAASE,KAAIC,IAC5C,MAAMC,QAAEA,GAAYC,EAAe,IAAMF,EAAQG,cAAe,CAAA,GAChE,OAAOF,CAAAA,IAGX,OAAOG,QAAQC,WAAWP,GAA4BQ,MAAKC,GAChDV,EAASW,QAAO,CAACR,EAASS,IAAmC,cAA7BF,EAAeE,GAAGC,UAC7D,EAGSC,EAAoCC,IAG7C,IAFqBA,EAAeC,MAAKC,GAAmB,QAAbA,GAAIpB,OAEhC,OAAOkB,EAG1B,MAAMG,EAAsB,CAAC,SAAU,cAAe,cACtD,OAAOH,EAAeJ,QAAOM,IAAOC,EAAoBtB,SAASqB,GAAIpB,OAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{TxVariants as a}from"./tx-variants.js";const o={[a.address]:"Address",[a.bankTransfer_IBAN]:"BankTransfer",[a.donation]:"Donation",[a.personal_details]:"PersonalDetails",[a.bcmc]:"Bancontact",[a.card]:"Card",[a.scheme]:"Card",[a.storedCard]:"Card",[a.customCard]:"CustomCard",[a.ach]:"Ach",[a.directdebit_GB]:"
|
|
1
|
+
import{TxVariants as a}from"./tx-variants.js";const o={[a.address]:"Address",[a.bankTransfer_IBAN]:"BankTransfer",[a.donation]:"Donation",[a.personal_details]:"PersonalDetails",[a.bcmc]:"Bancontact",[a.card]:"Card",[a.scheme]:"Card",[a.storedCard]:"Card",[a.customCard]:"CustomCard",[a.ach]:"Ach",[a.directdebit_GB]:"BacsDirectDebit",[a.sepadirectdebit]:"Sepa",[a.affirm]:"Affirm",[a.afterpay]:"AfterPay",[a.afterpay_default]:"AfterPay",[a.afterpay_b2b]:"AfterPayB2B",[a.atome]:"Atome",[a.facilypay_3x]:"FacilyPay3x",[a.facilypay_4x]:"FacilyPay4x",[a.facilypay_6x]:"FacilyPay6x",[a.facilypay_10x]:"FacilyPay10x",[a.facilypay_12x]:"FacilyPay12x",[a.ratepay]:"RatePay",[a.ratepay_directdebit]:"RatePayDirectDebit",[a.riverty]:"Riverty",[a.amazonpay]:"AmazonPay",[a.applepay]:"ApplePay",[a.cashapp]:"CashAppPay",[a.clicktopay]:"ClickToPay",[a.googlepay]:"GooglePay",[a.paypal]:"PayPal",[a.paywithgoogle]:"GooglePay",[a.boletobancario]:"Boleto",[a.boletobancario_itau]:"Boleto",[a.boletobancario_santander]:"Boleto",[a.doku]:"Doku",[a.doku_alfamart]:"Doku",[a.doku_permata_lite_atm]:"Doku",[a.doku_indomaret]:"Doku",[a.doku_atm_mandiri_va]:"Doku",[a.doku_sinarmas_va]:"Doku",[a.doku_mandiri_va]:"Doku",[a.doku_cimb_va]:"Doku",[a.doku_danamon_va]:"Doku",[a.doku_bri_va]:"Doku",[a.doku_bni_va]:"Doku",[a.doku_bca_va]:"Doku",[a.doku_wallet]:"Doku",[a.oxxo]:"Oxxo",[a.primeiropay_boleto]:"Boleto",[a.billdesk_online]:"BillDeskOnline",[a.billdesk_wallet]:"BillDeskWallet",[a.dotpay]:"Dotpay",[a.eps]:"Eps",[a.molpay_ebanking_fpx_MY]:"MolPayEBankingMY",[a.molpay_ebanking_TH]:"MolPayEBankingTH",[a.molpay_ebanking_VN]:"MolPayEBankingVN",[a.onlineBanking_CZ]:"OnlineBankingCZ",[a.onlinebanking_IN]:"OnlineBankingIN",[a.onlineBanking_PL]:"OnlineBankingPL",[a.onlineBanking_SK]:"OnlineBankingSK",[a.paybybank]:"PayByBank",[a.payu_IN_cashcard]:"PayuCashcard",[a.payu_IN_nb]:"PayuNetBanking",[a.wallet_IN]:"WalletINElement",[a.dragonpay_ebanking]:"Dragonpay",[a.dragonpay_otc_banking]:"Dragonpay",[a.dragonpay_otc_non_banking]:"Dragonpay",[a.dragonpay_otc_philippines]:"Dragonpay",[a.econtext_atm]:"Econtext",[a.econtext_online]:"Econtext",[a.econtext_seven_eleven]:"Econtext",[a.econtext_stores]:"Econtext",[a.giropay]:"Giropay",[a.multibanco]:"Multibanco",[a.redirect]:"Redirect",[a.twint]:"Twint",[a.vipps]:"Vipps",[a.trustly]:"Trustly",[a.klarna]:"Klarna",[a.klarna_account]:"Klarna",[a.klarna_paynow]:"Klarna",[a.klarna_b2b]:"Klarna",[a.bcmc_mobile]:"BcmcMobile",[a.bcmc_mobile_QR]:"BcmcMobile",[a.pix]:"Pix",[a.swish]:"Swish",[a.wechatpay]:"WeChat",[a.wechatpayQR]:"WeChat",[a.promptpay]:"PromptPay",[a.paynow]:"PayNow",[a.duitnow]:"Duitnow",[a.blik]:"Blik",[a.mbway]:"MBWay",[a.ancv]:"ANCV",[a.upi]:"UPI",[a.upi_qr]:"UPI",[a.upi_collect]:"UPI",[a.upi_intent]:"UPI",[a.giftcard]:"Giftcard",[a.mealVoucher_FR_natixis]:"MealVoucherFR",[a.mealVoucher_FR_sodexo]:"MealVoucherFR",[a.mealVoucher_FR_groupeup]:"MealVoucherFR"};function e(a){return o[a]}export{e as default};
|
|
2
2
|
//# sourceMappingURL=components-name-map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-name-map.js","sources":["../../../src/components/components-name-map.ts"],"sourcesContent":["import { TxVariants } from './tx-variants';\n\n/**\n * Maps each payment type with the string name of its Component element.\n *\n * It is used to give nicer error messages when creating components using Drop-in.\n * Example: paymentMethods response contains blik, but Blik component is not configured. So it warns that 'Blik' must be imported and added to the Drop-in configuration.\n */\nconst ComponentsNameMap = {\n /** internal */\n [TxVariants.address]: 'Address',\n [TxVariants.bankTransfer_IBAN]: 'BankTransfer',\n [TxVariants.donation]: 'Donation',\n [TxVariants.personal_details]: 'PersonalDetails',\n /** internal */\n\n /** Card */\n [TxVariants.bcmc]: 'Bancontact',\n [TxVariants.card]: 'Card',\n [TxVariants.scheme]: 'Card',\n [TxVariants.storedCard]: 'Card',\n [TxVariants.customCard]: 'CustomCard',\n /** Card */\n\n /** Direct debit */\n [TxVariants.ach]: 'Ach',\n [TxVariants.directdebit_GB]: 'BacsDD',\n [TxVariants.sepadirectdebit]: 'Sepa',\n /** Direct debit */\n\n /** Open Invoice */\n [TxVariants.affirm]: 'Affirm',\n [TxVariants.afterpay]: 'AfterPay',\n [TxVariants.afterpay_default]: 'AfterPay',\n [TxVariants.afterpay_b2b]: 'AfterPayB2B',\n [TxVariants.atome]: 'Atome',\n [TxVariants.facilypay_3x]: 'FacilyPay3x',\n [TxVariants.facilypay_4x]: 'FacilyPay4x',\n [TxVariants.facilypay_6x]: 'FacilyPay6x',\n [TxVariants.facilypay_10x]: 'FacilyPay10x',\n [TxVariants.facilypay_12x]: 'FacilyPay12x',\n [TxVariants.ratepay]: 'RatePay',\n [TxVariants.ratepay_directdebit]: 'RatePayDirectDebit',\n [TxVariants.riverty]: 'Riverty',\n /** Open Invoice */\n\n /** Wallets */\n [TxVariants.amazonpay]: 'AmazonPay',\n [TxVariants.applepay]: 'ApplePay',\n [TxVariants.cashapp]: 'CashAppPay',\n [TxVariants.clicktopay]: 'ClickToPay',\n [TxVariants.googlepay]: 'GooglePay',\n [TxVariants.paypal]: 'PayPal',\n [TxVariants.paywithgoogle]: 'GooglePay',\n /** Wallets */\n\n /** Voucher */\n [TxVariants.boletobancario]: 'Boleto',\n [TxVariants.boletobancario_itau]: 'Boleto',\n [TxVariants.boletobancario_santander]: 'Boleto',\n [TxVariants.doku]: 'Doku',\n [TxVariants.doku_alfamart]: 'Doku',\n [TxVariants.doku_permata_lite_atm]: 'Doku',\n [TxVariants.doku_indomaret]: 'Doku',\n [TxVariants.doku_atm_mandiri_va]: 'Doku',\n [TxVariants.doku_sinarmas_va]: 'Doku',\n [TxVariants.doku_mandiri_va]: 'Doku',\n [TxVariants.doku_cimb_va]: 'Doku',\n [TxVariants.doku_danamon_va]: 'Doku',\n [TxVariants.doku_bri_va]: 'Doku',\n [TxVariants.doku_bni_va]: 'Doku',\n [TxVariants.doku_bca_va]: 'Doku',\n [TxVariants.doku_wallet]: 'Doku',\n [TxVariants.oxxo]: 'Oxxo',\n [TxVariants.primeiropay_boleto]: 'Boleto',\n /** Voucher */\n\n /** issuerList */\n [TxVariants.billdesk_online]: 'BillDeskOnline',\n [TxVariants.billdesk_wallet]: 'BillDeskWallet',\n [TxVariants.dotpay]: 'Dotpay',\n [TxVariants.eps]: 'Eps',\n [TxVariants.molpay_ebanking_fpx_MY]: 'MolPayEBankingMY',\n [TxVariants.molpay_ebanking_TH]: 'MolPayEBankingTH',\n [TxVariants.molpay_ebanking_VN]: 'MolPayEBankingVN',\n [TxVariants.onlineBanking_CZ]: 'OnlineBankingCZ',\n [TxVariants.onlinebanking_IN]: 'OnlineBankingIN', // NOTE: the txVariant does have a lowercase \"b\"\n [TxVariants.onlineBanking_PL]: 'OnlineBankingPL',\n [TxVariants.onlineBanking_SK]: 'OnlineBankingSK',\n [TxVariants.paybybank]: 'PayByBank',\n [TxVariants.payu_IN_cashcard]: 'PayuCashcard',\n [TxVariants.payu_IN_nb]: 'PayuNetBanking',\n [TxVariants.wallet_IN]: 'WalletINElement',\n /** issuerList */\n\n /** Dragonpay */\n [TxVariants.dragonpay_ebanking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_non_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_philippines]: 'Dragonpay',\n /** Dragonpay */\n\n /** Econtext */\n [TxVariants.econtext_atm]: 'Econtext',\n [TxVariants.econtext_online]: 'Econtext',\n [TxVariants.econtext_seven_eleven]: 'Econtext',\n [TxVariants.econtext_stores]: 'Econtext',\n /** Econtext */\n\n /** Redirect */\n [TxVariants.giropay]: 'Giropay',\n [TxVariants.multibanco]: 'Multibanco',\n [TxVariants.redirect]: 'Redirect',\n [TxVariants.twint]: 'Twint',\n [TxVariants.vipps]: 'Vipps',\n [TxVariants.trustly]: 'Trustly',\n /** Redirect */\n\n /** Klarna */\n [TxVariants.klarna]: 'Klarna',\n [TxVariants.klarna_account]: 'Klarna',\n [TxVariants.klarna_paynow]: 'Klarna',\n [TxVariants.klarna_b2b]: 'Klarna',\n /** Klarna */\n\n /** QRLoader */\n [TxVariants.bcmc_mobile]: 'BcmcMobile',\n [TxVariants.bcmc_mobile_QR]: 'BcmcMobile',\n [TxVariants.pix]: 'Pix',\n [TxVariants.swish]: 'Swish',\n [TxVariants.wechatpay]: 'WeChat',\n [TxVariants.wechatpayQR]: 'WeChat',\n [TxVariants.promptpay]: 'PromptPay',\n [TxVariants.paynow]: 'PayNow',\n [TxVariants.duitnow]: 'Duitnow',\n /** QRLoader */\n\n /** Await */\n [TxVariants.blik]: 'Blik',\n [TxVariants.mbway]: 'MBWay',\n [TxVariants.ancv]: 'ANCV',\n [TxVariants.upi]: 'UPI', // also QR\n [TxVariants.upi_qr]: 'UPI', // also QR\n [TxVariants.upi_collect]: 'UPI', // also QR\n [TxVariants.upi_intent]: 'UPI',\n /** Await */\n\n /** Giftcard */\n [TxVariants.giftcard]: 'Giftcard',\n [TxVariants.mealVoucher_FR_natixis]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_sodexo]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_groupeup]: 'MealVoucherFR'\n /** Giftcard */\n};\n\n/**\n * Returns the Component name based on the payment type\n * @param paymentType\n */\nfunction getComponentNameOfPaymentType(paymentType: string): string {\n return ComponentsNameMap[paymentType];\n}\n\nexport default getComponentNameOfPaymentType;\n"],"names":["ComponentsNameMap","TxVariants","address","bankTransfer_IBAN","donation","personal_details","bcmc","card","scheme","storedCard","customCard","ach","directdebit_GB","sepadirectdebit","affirm","afterpay","afterpay_default","afterpay_b2b","atome","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","ratepay","ratepay_directdebit","riverty","amazonpay","applepay","cashapp","clicktopay","googlepay","paypal","paywithgoogle","boletobancario","boletobancario_itau","boletobancario_santander","doku","doku_alfamart","doku_permata_lite_atm","doku_indomaret","doku_atm_mandiri_va","doku_sinarmas_va","doku_mandiri_va","doku_cimb_va","doku_danamon_va","doku_bri_va","doku_bni_va","doku_bca_va","doku_wallet","oxxo","primeiropay_boleto","billdesk_online","billdesk_wallet","dotpay","eps","molpay_ebanking_fpx_MY","molpay_ebanking_TH","molpay_ebanking_VN","onlineBanking_CZ","onlinebanking_IN","onlineBanking_PL","onlineBanking_SK","paybybank","payu_IN_cashcard","payu_IN_nb","wallet_IN","dragonpay_ebanking","dragonpay_otc_banking","dragonpay_otc_non_banking","dragonpay_otc_philippines","econtext_atm","econtext_online","econtext_seven_eleven","econtext_stores","giropay","multibanco","redirect","twint","vipps","trustly","klarna","klarna_account","klarna_paynow","klarna_b2b","bcmc_mobile","bcmc_mobile_QR","pix","swish","wechatpay","wechatpayQR","promptpay","paynow","duitnow","blik","mbway","ancv","upi","upi_qr","upi_collect","upi_intent","giftcard","mealVoucher_FR_natixis","mealVoucher_FR_sodexo","mealVoucher_FR_groupeup","getComponentNameOfPaymentType","paymentType"],"mappings":"8CAQA,MAAMA,EAAoB,CAEtB,CAACC,EAAWC,SAAU,UACtB,CAACD,EAAWE,mBAAoB,eAChC,CAACF,EAAWG,UAAW,WACvB,CAACH,EAAWI,kBAAmB,kBAI/B,CAACJ,EAAWK,MAAO,aACnB,CAACL,EAAWM,MAAO,OACnB,CAACN,EAAWO,QAAS,OACrB,CAACP,EAAWQ,YAAa,OACzB,CAACR,EAAWS,YAAa,aAIzB,CAACT,EAAWU,KAAM,MAClB,CAACV,EAAWW,gBAAiB,SAC7B,CAACX,EAAWY,iBAAkB,OAI9B,CAACZ,EAAWa,QAAS,SACrB,CAACb,EAAWc,UAAW,WACvB,CAACd,EAAWe,kBAAmB,WAC/B,CAACf,EAAWgB,cAAe,cAC3B,CAAChB,EAAWiB,OAAQ,QACpB,CAACjB,EAAWkB,cAAe,cAC3B,CAAClB,EAAWmB,cAAe,cAC3B,CAACnB,EAAWoB,cAAe,cAC3B,CAACpB,EAAWqB,eAAgB,eAC5B,CAACrB,EAAWsB,eAAgB,eAC5B,CAACtB,EAAWuB,SAAU,UACtB,CAACvB,EAAWwB,qBAAsB,qBAClC,CAACxB,EAAWyB,SAAU,UAItB,CAACzB,EAAW0B,WAAY,YACxB,CAAC1B,EAAW2B,UAAW,WACvB,CAAC3B,EAAW4B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xC,CAACpE,EAAWqE,2BAA4B,YAIxC,CAACrE,EAAWsE,cAAe,WAC3B,CAACtE,EAAWuE,iBAAkB,WAC9B,CAACvE,EAAWwE,uBAAwB,WACpC,CAACxE,EAAWyE,iBAAkB,WAI9B,CAACzE,EAAW0E,SAAU,UACtB,CAAC1E,EAAW2E,YAAa,aACzB,CAAC3E,EAAW4E,UAAW,WACvB,CAAC5E,EAAW6E,OAAQ,QACpB,CAAC7E,EAAW8E,OAAQ,QACpB,CAAC9E,EAAW+E,SAAU,UAItB,CAAC/E,EAAWgF,QAAS,SACrB,CAAChF,EAAWiF,gBAAiB,SAC7B,CAACjF,EAAWkF,eAAgB,SAC5B,CAAClF,EAAWmF,YAAa,SAIzB,CAACnF,EAAWoF,aAAc,aAC1B,CAACpF,EAAWqF,gBAAiB,aAC7B,CAACrF,EAAWsF,KAAM,MAClB,CAACtF,EAAWuF,OAAQ,QACpB,CAACvF,EAAWwF,WAAY,SACxB,CAACxF,EAAWyF,aAAc,SAC1B,CAACzF,EAAW0F,WAAY,YACxB,CAAC1F,EAAW2F,QAAS,SACrB,CAAC3F,EAAW4F,SAAU,UAItB,CAAC5F,EAAW6F,MAAO,OACnB,CAAC7F,EAAW8F,OAAQ,QACpB,CAAC9F,EAAW+F,MAAO,OACnB,CAAC/F,EAAWgG,KAAM,MAClB,CAAChG,EAAWiG,QAAS,MACrB,CAACjG,EAAWkG,aAAc,MAC1B,CAAClG,EAAWmG,YAAa,MAIzB,CAACnG,EAAWoG,UAAW,WACvB,CAACpG,EAAWqG,wBAAyB,gBACrC,CAACrG,EAAWsG,uBAAwB,gBACpC,CAACtG,EAAWuG,yBAA0B,iBAQ1C,SAASC,EAA8BC,GACnC,OAAO1G,EAAkB0G,EAC7B"}
|
|
1
|
+
{"version":3,"file":"components-name-map.js","sources":["../../../src/components/components-name-map.ts"],"sourcesContent":["import { TxVariants } from './tx-variants';\n\n/**\n * Maps each payment type with the string name of its Component element.\n *\n * It is used to give nicer error messages when creating components using Drop-in.\n * Example: paymentMethods response contains blik, but Blik component is not configured. So it warns that 'Blik' must be imported and added to the Drop-in configuration.\n */\nconst ComponentsNameMap = {\n /** internal */\n [TxVariants.address]: 'Address',\n [TxVariants.bankTransfer_IBAN]: 'BankTransfer',\n [TxVariants.donation]: 'Donation',\n [TxVariants.personal_details]: 'PersonalDetails',\n /** internal */\n\n /** Card */\n [TxVariants.bcmc]: 'Bancontact',\n [TxVariants.card]: 'Card',\n [TxVariants.scheme]: 'Card',\n [TxVariants.storedCard]: 'Card',\n [TxVariants.customCard]: 'CustomCard',\n /** Card */\n\n /** Direct debit */\n [TxVariants.ach]: 'Ach',\n [TxVariants.directdebit_GB]: 'BacsDirectDebit',\n [TxVariants.sepadirectdebit]: 'Sepa',\n /** Direct debit */\n\n /** Open Invoice */\n [TxVariants.affirm]: 'Affirm',\n [TxVariants.afterpay]: 'AfterPay',\n [TxVariants.afterpay_default]: 'AfterPay',\n [TxVariants.afterpay_b2b]: 'AfterPayB2B',\n [TxVariants.atome]: 'Atome',\n [TxVariants.facilypay_3x]: 'FacilyPay3x',\n [TxVariants.facilypay_4x]: 'FacilyPay4x',\n [TxVariants.facilypay_6x]: 'FacilyPay6x',\n [TxVariants.facilypay_10x]: 'FacilyPay10x',\n [TxVariants.facilypay_12x]: 'FacilyPay12x',\n [TxVariants.ratepay]: 'RatePay',\n [TxVariants.ratepay_directdebit]: 'RatePayDirectDebit',\n [TxVariants.riverty]: 'Riverty',\n /** Open Invoice */\n\n /** Wallets */\n [TxVariants.amazonpay]: 'AmazonPay',\n [TxVariants.applepay]: 'ApplePay',\n [TxVariants.cashapp]: 'CashAppPay',\n [TxVariants.clicktopay]: 'ClickToPay',\n [TxVariants.googlepay]: 'GooglePay',\n [TxVariants.paypal]: 'PayPal',\n [TxVariants.paywithgoogle]: 'GooglePay',\n /** Wallets */\n\n /** Voucher */\n [TxVariants.boletobancario]: 'Boleto',\n [TxVariants.boletobancario_itau]: 'Boleto',\n [TxVariants.boletobancario_santander]: 'Boleto',\n [TxVariants.doku]: 'Doku',\n [TxVariants.doku_alfamart]: 'Doku',\n [TxVariants.doku_permata_lite_atm]: 'Doku',\n [TxVariants.doku_indomaret]: 'Doku',\n [TxVariants.doku_atm_mandiri_va]: 'Doku',\n [TxVariants.doku_sinarmas_va]: 'Doku',\n [TxVariants.doku_mandiri_va]: 'Doku',\n [TxVariants.doku_cimb_va]: 'Doku',\n [TxVariants.doku_danamon_va]: 'Doku',\n [TxVariants.doku_bri_va]: 'Doku',\n [TxVariants.doku_bni_va]: 'Doku',\n [TxVariants.doku_bca_va]: 'Doku',\n [TxVariants.doku_wallet]: 'Doku',\n [TxVariants.oxxo]: 'Oxxo',\n [TxVariants.primeiropay_boleto]: 'Boleto',\n /** Voucher */\n\n /** issuerList */\n [TxVariants.billdesk_online]: 'BillDeskOnline',\n [TxVariants.billdesk_wallet]: 'BillDeskWallet',\n [TxVariants.dotpay]: 'Dotpay',\n [TxVariants.eps]: 'Eps',\n [TxVariants.molpay_ebanking_fpx_MY]: 'MolPayEBankingMY',\n [TxVariants.molpay_ebanking_TH]: 'MolPayEBankingTH',\n [TxVariants.molpay_ebanking_VN]: 'MolPayEBankingVN',\n [TxVariants.onlineBanking_CZ]: 'OnlineBankingCZ',\n [TxVariants.onlinebanking_IN]: 'OnlineBankingIN', // NOTE: the txVariant does have a lowercase \"b\"\n [TxVariants.onlineBanking_PL]: 'OnlineBankingPL',\n [TxVariants.onlineBanking_SK]: 'OnlineBankingSK',\n [TxVariants.paybybank]: 'PayByBank',\n [TxVariants.payu_IN_cashcard]: 'PayuCashcard',\n [TxVariants.payu_IN_nb]: 'PayuNetBanking',\n [TxVariants.wallet_IN]: 'WalletINElement',\n /** issuerList */\n\n /** Dragonpay */\n [TxVariants.dragonpay_ebanking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_non_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_philippines]: 'Dragonpay',\n /** Dragonpay */\n\n /** Econtext */\n [TxVariants.econtext_atm]: 'Econtext',\n [TxVariants.econtext_online]: 'Econtext',\n [TxVariants.econtext_seven_eleven]: 'Econtext',\n [TxVariants.econtext_stores]: 'Econtext',\n /** Econtext */\n\n /** Redirect */\n [TxVariants.giropay]: 'Giropay',\n [TxVariants.multibanco]: 'Multibanco',\n [TxVariants.redirect]: 'Redirect',\n [TxVariants.twint]: 'Twint',\n [TxVariants.vipps]: 'Vipps',\n [TxVariants.trustly]: 'Trustly',\n /** Redirect */\n\n /** Klarna */\n [TxVariants.klarna]: 'Klarna',\n [TxVariants.klarna_account]: 'Klarna',\n [TxVariants.klarna_paynow]: 'Klarna',\n [TxVariants.klarna_b2b]: 'Klarna',\n /** Klarna */\n\n /** QRLoader */\n [TxVariants.bcmc_mobile]: 'BcmcMobile',\n [TxVariants.bcmc_mobile_QR]: 'BcmcMobile',\n [TxVariants.pix]: 'Pix',\n [TxVariants.swish]: 'Swish',\n [TxVariants.wechatpay]: 'WeChat',\n [TxVariants.wechatpayQR]: 'WeChat',\n [TxVariants.promptpay]: 'PromptPay',\n [TxVariants.paynow]: 'PayNow',\n [TxVariants.duitnow]: 'Duitnow',\n /** QRLoader */\n\n /** Await */\n [TxVariants.blik]: 'Blik',\n [TxVariants.mbway]: 'MBWay',\n [TxVariants.ancv]: 'ANCV',\n [TxVariants.upi]: 'UPI', // also QR\n [TxVariants.upi_qr]: 'UPI', // also QR\n [TxVariants.upi_collect]: 'UPI', // also QR\n [TxVariants.upi_intent]: 'UPI',\n /** Await */\n\n /** Giftcard */\n [TxVariants.giftcard]: 'Giftcard',\n [TxVariants.mealVoucher_FR_natixis]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_sodexo]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_groupeup]: 'MealVoucherFR'\n /** Giftcard */\n};\n\n/**\n * Returns the Component name based on the payment type\n * @param paymentType\n */\nfunction getComponentNameOfPaymentType(paymentType: string): string {\n return ComponentsNameMap[paymentType];\n}\n\nexport default getComponentNameOfPaymentType;\n"],"names":["ComponentsNameMap","TxVariants","address","bankTransfer_IBAN","donation","personal_details","bcmc","card","scheme","storedCard","customCard","ach","directdebit_GB","sepadirectdebit","affirm","afterpay","afterpay_default","afterpay_b2b","atome","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","ratepay","ratepay_directdebit","riverty","amazonpay","applepay","cashapp","clicktopay","googlepay","paypal","paywithgoogle","boletobancario","boletobancario_itau","boletobancario_santander","doku","doku_alfamart","doku_permata_lite_atm","doku_indomaret","doku_atm_mandiri_va","doku_sinarmas_va","doku_mandiri_va","doku_cimb_va","doku_danamon_va","doku_bri_va","doku_bni_va","doku_bca_va","doku_wallet","oxxo","primeiropay_boleto","billdesk_online","billdesk_wallet","dotpay","eps","molpay_ebanking_fpx_MY","molpay_ebanking_TH","molpay_ebanking_VN","onlineBanking_CZ","onlinebanking_IN","onlineBanking_PL","onlineBanking_SK","paybybank","payu_IN_cashcard","payu_IN_nb","wallet_IN","dragonpay_ebanking","dragonpay_otc_banking","dragonpay_otc_non_banking","dragonpay_otc_philippines","econtext_atm","econtext_online","econtext_seven_eleven","econtext_stores","giropay","multibanco","redirect","twint","vipps","trustly","klarna","klarna_account","klarna_paynow","klarna_b2b","bcmc_mobile","bcmc_mobile_QR","pix","swish","wechatpay","wechatpayQR","promptpay","paynow","duitnow","blik","mbway","ancv","upi","upi_qr","upi_collect","upi_intent","giftcard","mealVoucher_FR_natixis","mealVoucher_FR_sodexo","mealVoucher_FR_groupeup","getComponentNameOfPaymentType","paymentType"],"mappings":"8CAQA,MAAMA,EAAoB,CAEtB,CAACC,EAAWC,SAAU,UACtB,CAACD,EAAWE,mBAAoB,eAChC,CAACF,EAAWG,UAAW,WACvB,CAACH,EAAWI,kBAAmB,kBAI/B,CAACJ,EAAWK,MAAO,aACnB,CAACL,EAAWM,MAAO,OACnB,CAACN,EAAWO,QAAS,OACrB,CAACP,EAAWQ,YAAa,OACz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