@adyen/adyen-web 6.26.0 → 6.27.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 +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +14 -15
- package/dist/es/adyen.css +1 -1
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/ANCV/ANCV.js +1 -1
- package/dist/es/components/ANCV/ANCV.js.map +1 -1
- package/dist/es/components/Ach/Ach.js +1 -1
- package/dist/es/components/Ach/Ach.js.map +1 -1
- package/dist/es/components/Blik/Blik.js +1 -1
- package/dist/es/components/Blik/Blik.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/Dropin/Dropin.js +1 -1
- package/dist/es/components/Dropin/Dropin.js.map +1 -1
- package/dist/es/components/Giftcard/Giftcard.js +1 -1
- package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es/components/MBWay/MBWay.js +1 -1
- package/dist/es/components/MBWay/MBWay.js.map +1 -1
- package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es/components/PayTo/PayTo.js +1 -1
- package/dist/es/components/PayTo/PayTo.js.map +1 -1
- package/dist/es/components/Pix/Pix.js +1 -1
- package/dist/es/components/Pix/Pix.js.map +1 -1
- package/dist/es/components/UPI/UPI.js +1 -1
- package/dist/es/components/UPI/UPI.js.map +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js +1 -1
- package/dist/es/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
- package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
- package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/core/Errors/SRPanel.js +1 -1
- package/dist/es/core/Errors/SRPanel.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/index.d.ts +14 -15
- package/dist/es/utils/Script.js +1 -1
- package/dist/es/utils/Script.js.map +1 -1
- package/dist/es-legacy/adyen.css +1 -1
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
- package/dist/es-legacy/components/Ach/Ach.js +1 -1
- package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
- package/dist/es-legacy/components/Blik/Blik.js +1 -1
- package/dist/es-legacy/components/Blik/Blik.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/Dropin/Dropin.js +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
- package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
- package/dist/es-legacy/components/Pix/Pix.js +1 -1
- package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
- package/dist/es-legacy/components/UPI/UPI.js +1 -1
- package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js +1 -1
- package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
- package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
- package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/core/Errors/SRPanel.js +1 -1
- package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/utils/Script.js +1 -1
- package/dist/es-legacy/utils/Script.js.map +1 -1
- package/package.json +1 -1
- package/styles/adyen.css +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { Resources } from '../../../core/Context/Resources';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\n\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventType } from '../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AnalyticsLogEvent, LogEventType } from '../../../core/Analytics/events/AnalyticsLogEvent';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\nimport type { AdditionalDetailsData, CoreConfiguration, ICore } from '../../../core/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentMethod\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { ComponentMethodsRef, PayButtonFunctionProps, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport './UIElement.scss';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static type = undefined;\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n this.core.register(this.constructor as NewableComponent);\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n\n this.onEnterKeyPressed = this.onEnterKeyPressed.bind(this);\n this.onActionHandled = this.onActionHandled.bind(this);\n\n this.createBeforeRenderHook(props);\n this.reportIntegrationFlavor();\n }\n\n /**\n * Creates a hook tied to render() method. This hook is called every time render() is invoked.\n * Currently useful for Analytics\n *\n * @param configSetByMerchant\n * @private\n */\n private createBeforeRenderHook(configSetByMerchant: P): void {\n const originalRender = this.render;\n\n this.render = (...args: any[]) => {\n this.beforeRender(configSetByMerchant);\n return originalRender.apply(this, args);\n };\n }\n\n protected beforeRender(configSetByMerchant?: P): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && { isStoredPaymentMethod: true })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n protected reportIntegrationFlavor(): void {\n void this.analytics.sendFlavor('components');\n }\n\n get analytics(): IAnalytics {\n return this.core.modules.analytics;\n }\n\n get srPanel(): SRPanel {\n return this.core.modules.srPanel;\n }\n\n private getPaymentMethodConfigFromResponse(componentProps: P) {\n if (componentProps?.storedPaymentMethodId) return this.getStoredPaymentMethodDetails(componentProps.storedPaymentMethodId);\n return this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type, componentProps?.paymentMethodId);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n\n const paymentMethodFromResponse = this.getPaymentMethodConfigFromResponse(componentProps);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropinInstance = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropinInstance), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected getStoredPaymentMethodDetails(storedPaymentMethodId: string) {\n return this.core.paymentMethodsResponse.findStoredPaymentMethod(storedPaymentMethodId);\n }\n\n /**\n * Get the payment method from the paymentMethodsResponse\n *\n * @param type - The type of the payment method to get. (This prop is passed by Drop-in OR Standalone components containing the property 'type' as part of their configuration)\n * @param paymentMethodId - Unique internal payment method ID\n */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx\n */\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n /**\n * componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx\n */\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n protected override submitAnalytics(event: AbstractAnalyticsEvent) {\n this.analytics.sendAnalytics(event);\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) =>\n this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject: () => reject(new CancelError('beforeSubmitRejected'))\n })\n )\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CNDBAjOa+B88wRoj/rLTieuWh/0leR88qkV24vtIkjsIsbJTDB78Pd8wX8MEDsXhaAdEIyX9E8eqxuQ3bwPbvLs1Dlgo1ZrfkQRzaNiuVM8ejRG0IWE1bGThJzY+sJvZZHvlDMXIlxhZcDoQvsMj/WwE6+nFJxBiC3oRzmvVn3AbkLQGtvwq16UUSfYbPzG9dXypJMtcrZAQYq2g/2+BSibCcmee9AXq/wij11BERrYmjbDt5NkkdUnDVgAB7pdqbnWX0A2sxBKeYtLSP2kxp+5LoU/Wty3fmcVA3VKVkHfgmIihkeL8lY++5hvHjnkzOE4tyx/sheiKS4zqoWE43TD6n8mpFskAzwMHq4G2o6vkXqvaKFEq7y/R2fVrCypenmRhkPASizpM265rKLU+L4E/C+LMHfN0LYKRMCrLr0gI2GAp+1PZLHgh0tCtiJC/zcJJtJs6sHNQxLUN+kxJuELUHOcuL3ivjG+mWteUnBENZu7KqOSZYetiWYRiyLOXDiBHqbxuQwTuO54L15VLkS/mYB20etibM1nn+fRmbo+1IJkCSalhwi5D7fSrpjbQTmAsOpJT1N8lC1MSNmAvAwG1kWL4JxYwXDKYyYASnsia2V5IjoiQUYwQUFBMTAzQ0E1MzdFQUVEODdDMjRERDUzOTA5QjgwQTc4QTkyM0UzODIzRDY4REFDQzk0QjlGRjgzMDVEQyJ98uZI4thGveOByYbomCeeP2Gy2rzs99FOBoDYVeWIUjyM+gfnW89DdJZAhxe74Tv0TnL5DRQYPCTRQPOoLbQ21NaeSho70FNE+n8XYKlVK5Ore6BoB6IVCaal5MkM27VmZPMmGflgcPx+pakx+EmRsYGdvYNImYxJYrRk3CI+l3T3ZiVpPPqebaVSLaSkEfu0iOFPjjLUhWN6QW6c18heE5vq/pcoeBf7p0Jgr9I5aBFY0avYG57BDGHzU1ZiQ9LLMTis2BA7Ap9pdNq8FVXL4fnoVHNZiiANOf3uvSknPKBID8sdOXUStA0crmO322FYjDqh1n6FG+D7+OJSayNsXIz6Zoy0eFn4HbT8nt8L2X2tdzkMayCYHXRwKh13Xyleqxt4WoEZmhwTmB3p9d1F0SylWnjcC6o/DnshJ9mMW/8D3oWS30Z7BwRODqKGVahRD0YGRzwMbVnEe5JFRfNvJZdLGl35L9632DVmuFQ0lr/8WNL/NrAJNtI6PXrZMNiza0/omPwPfe5ZYuD1Jgq59TX4h9d+3fdkArcJYL7AdoMZON1YEiWY5EzazQwtHd9yzdty9ZHPxAfuOfCh4OhbhFNp+v5YQ+PzKZ+UpM1VxV863+9XgWEURPNvX7qq1cpUSRzrSGq01QBBM3MKzRh5mAgqIdXgtl7L0EXAep0MECc7QY0/o3tW3VR8eEJGsSzrNxpFItqj0SEaIWo25dRfkl5zuw47GQrN9Qzxl2WV3A38MQPUqFtIr/71Rjkphgg49ZGWEYCwgFmm8jJc2/5qTabSGk4bzwiETCTzeydq30bUGqCwglj8CrFViAuQeTJm7dp+PYKMkUNvQRpnSXMj6Kz7rvAMzhzJgK62ltN2idqKxLC7WtivCUgejuQUvNreCYBQCaKwTwP02lZsJpGF9yw8gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n this.handleAdditionalDetails(state);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (error.name === NETWORK_ERROR && error.options.code) {\n const event = new AnalyticsErrorEvent({\n component: this.type,\n errorType: ErrorEventType.apiError,\n code: error.options.code\n });\n\n this.submitAnalytics(event);\n }\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /details call', { cause: error }));\n\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session ? this.core.update({ order }) : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * Expected to be called after sanitizeResponse has been run on the raw payment response\n *\n * @param response -\n */\n protected handleResponse(response: PaymentResponseData): void {\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent) {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n\n this.onEnterKeyPressed(document?.activeElement, this);\n }\n }\n\n /**\n * Handle Enter key pressed from a UIElement (called via handleKeyPress)\n * @param obj\n */\n protected onEnterKeyPressed(activeElement: Element, component: UIElement) {\n if (this.props.onEnterKeyPressed) {\n this.props.onEnterKeyPressed(activeElement, component);\n } else {\n (activeElement as HTMLElement).blur();\n this.submit();\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protected _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonFunctionProps) => {\n return <PayButton {...props} amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<void | PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return resolve();\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n\n protected abstract componentToRender(): h.JSX.Element;\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources} analytics={this.analytics}>\n {this.componentToRender()}\n </CoreProvider>\n );\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","createBeforeRenderHook","configSetByMerchant","originalRender","this","render","args","beforeRender","apply","originalAction","event","AnalyticsInfoEvent","type","InfoEventType","rendered","component","configData","showPayButton","props","oneClick","isStoredPaymentMethod","analytics","sendAnalytics","reportIntegrationFlavor","sendFlavor","core","modules","srPanel","getPaymentMethodConfigFromResponse","componentProps","storedPaymentMethodId","getStoredPaymentMethodDetails","getPaymentMethodFromPaymentMethodsResponse","paymentMethodId","buildElementProps","finalProps","getCorePropsForComponent","isDropinInstance","assertIsDropin","formatProps","constructor","getRegulatoryDefaults","options","countryCode","paymentMethodsResponse","findStoredPaymentMethod","findById","find","storeElementRefOnCore","isDropin","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","setElementStatus","status","elementRef","setStatus","data","isValid","errors","valid","submitAnalytics","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","session","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","AnalyticsLogEvent","LogEventType","message","submitPayment","error","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","update","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","amount","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","loadingContext","componentToRender","checkout","super","_define_property","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","secondaryAmount","onClick","register","bind","undefined","txVariants"],"mappings":"u/BAmCO,MAAeA,UAA6DC,EAmDvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,KAAKC,OAE5BD,KAAKC,OAAS,IAAIC,KACdF,KAAKG,aAAaL,GACXC,EAAeK,MAAMJ,KAAME,GAE1C,CAEUC,YAAAA,CAAaL,GAEnB,GAAIA,GAAqBO,eACrB,OAGJ,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,KAAMC,EAAcC,SACpBC,UAAWX,KAAKQ,KAChBI,WAAY,IAAKd,EAAqBe,cAAeb,KAAKc,MAAMD,kBAC5Df,GAAqBiB,UAAY,CAAEC,uBAAuB,KAGlEhB,KAAKiB,UAAUC,cAAcZ,EACjC,CAEUa,uBAAAA,GACDnB,KAAKiB,UAAUG,WAAW,aACnC,CAEA,aAAIH,GACA,OAAOjB,KAAKqB,KAAKC,QAAQL,SAC7B,CAEA,WAAIM,G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E,gBAAkBhE,KAAKgE,gBAAgBsG,KAAKtK,MACjDA,KAAKkE,iBAAmBlE,KAAKkE,iBAAiBoG,KAAKtK,MACnDA,KAAK2F,0BAA4B3F,KAAK2F,0BAA0B2E,KAAKtK,MACrEA,KAAKgF,wBAA0BhF,KAAKgF,wBAAwBsF,KAAKtK,MAEjEA,KAAK0D,WAAc5C,GAASA,EAAM4C,YAAe1D,KACjDA,KAAK4H,UAAY5H,KAAKc,MAAMQ,QAAUtB,KAAKc,MAAMQ,QAAQsG,eAAY2C,EAErEvK,KAAK4C,sBAAsB5C,KAAKc,OAEhCd,KAAKoH,kBAAoBpH,KAAKoH,kBAAkBkD,KAAKtK,MACrDA,KAAKwG,gBAAkBxG,KAAKwG,gBAAgB8D,KAAKtK,MAEjDA,KAAKH,uBAAuBiB,GAC5Bd,KAAKmB,yBACT,EAnCA+H,EAPkBvJ,EAOJa,YAAO+J,GAKrBrB,EAZkBvJ,EAYJ6K,aAAuB"}
|
|
1
|
+
{"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { Resources } from '../../../core/Context/Resources';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\n\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventType } from '../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AnalyticsLogEvent, LogEventType } from '../../../core/Analytics/events/AnalyticsLogEvent';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\nimport type { AdditionalDetailsData, CoreConfiguration, ICore } from '../../../core/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentMethod\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { ComponentMethodsRef, PayButtonFunctionProps, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport './UIElement.scss';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static type = undefined;\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n this.core.register(this.constructor as NewableComponent);\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n\n this.onEnterKeyPressed = this.onEnterKeyPressed.bind(this);\n this.onActionHandled = this.onActionHandled.bind(this);\n\n this.createBeforeRenderHook(props);\n this.reportIntegrationFlavor();\n }\n\n /**\n * Creates a hook tied to render() method. This hook is called every time render() is invoked.\n * Currently useful for Analytics\n *\n * @param configSetByMerchant\n * @private\n */\n private createBeforeRenderHook(configSetByMerchant: P): void {\n const originalRender = this.render;\n\n this.render = (...args: any[]) => {\n this.beforeRender(configSetByMerchant);\n return originalRender.apply(this, args);\n };\n }\n\n protected beforeRender(configSetByMerchant?: P): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && { isStoredPaymentMethod: true })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n protected reportIntegrationFlavor(): void {\n void this.analytics.sendFlavor('components');\n }\n\n get analytics(): IAnalytics {\n return this.core.modules.analytics;\n }\n\n get srPanel(): SRPanel {\n return this.core.modules.srPanel;\n }\n\n private getPaymentMethodConfigFromResponse(componentProps: P) {\n if (componentProps?.storedPaymentMethodId) return this.getStoredPaymentMethodDetails(componentProps.storedPaymentMethodId);\n return this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type, componentProps?.paymentMethodId);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n\n const paymentMethodFromResponse = this.getPaymentMethodConfigFromResponse(componentProps);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropinInstance = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropinInstance), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected getStoredPaymentMethodDetails(storedPaymentMethodId: string) {\n return this.core.paymentMethodsResponse.findStoredPaymentMethod(storedPaymentMethodId);\n }\n\n /**\n * Get the payment method from the paymentMethodsResponse\n *\n * @param type - The type of the payment method to get. (This prop is passed by Drop-in OR Standalone components containing the property 'type' as part of their configuration)\n * @param paymentMethodId - Unique internal payment method ID\n */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx\n */\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n /**\n * componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx\n */\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n protected override submitAnalytics(event: AbstractAnalyticsEvent) {\n this.analytics.sendAnalytics(event);\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) =>\n this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject: () => reject(new CancelError('beforeSubmitRejected'))\n })\n )\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CND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ayCYHXRwKh13Xyleqxt4WoEZmhwTmB3p9d1F0SylWnjcC6o/DnshJ9mMW/8D3oWS30Z7BwRODqKGVahRD0YGRzwMbVnEe5JFRfNvJZdLGl35L9632DVmuFQ0lr/8WNL/NrAJNtI6PXrZMNiza0/omPwPfe5ZYuD1Jgq59TX4h9d+3fdkArcJYL7AdoMZON1YEiWY5EzazQwtHd9yzdty9ZHPxAfuOfCh4OhbhFNp+v5YQ+PzKZ+UpM1VxV863+9XgWEURPNvX7qq1cpUSRzrSGq01QBBM3MKzRh5mAgqIdXgtl7L0EXAep0MECc7QY0/o3tW3VR8eEJGsSzrNxpFItqj0SEaIWo25dRfkl5zuw47GQrN9Qzxl2WV3A38MQPUqFtIr/71Rjkphgg49ZGWEYCwgFmm8jJc2/5qTabSGk4bzwiETCTzeydq30bUGqCwglj8CrFViAuQeTJm7dp+PYKMkUNvQRpnSXMj6Kz7rvAMzhzJgK62ltN2idqKxLC7WtivCUgejuQUvNreCYBQCaKwTwP02lZsJpGF9yw8gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n this.handleAdditionalDetails(state);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (error.name === NETWORK_ERROR && error.options.code) {\n const event = new AnalyticsErrorEvent({\n component: this.type,\n errorType: ErrorEventType.apiError,\n code: error.options.code\n });\n\n this.submitAnalytics(event);\n }\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /details call', { cause: error }));\n\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session ? this.core.update({ order }) : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * Expected to be called after sanitizeResponse has been run on the raw payment response\n *\n * @param response -\n */\n protected handleResponse(response: PaymentResponseData): void {\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent) {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n\n this.onEnterKeyPressed(document?.activeElement, this);\n }\n }\n\n /**\n * Handle Enter key pressed from a UIElement (called via handleKeyPress)\n * @param obj\n */\n protected onEnterKeyPressed(activeElement: Element, component: UIElement) {\n if (this.props.onEnterKeyPressed) {\n this.props.onEnterKeyPressed(activeElement, component);\n } else {\n (activeElement as HTMLElement).blur();\n this.submit();\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protected _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonFunctionProps) => {\n return <PayButton {...props} amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<void | PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return resolve();\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n\n protected abstract componentToRender(): h.JSX.Element;\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources} analytics={this.analytics}>\n <SRPanelProvider srPanel={this.srPanel}>{this.componentToRender()}</SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","createBeforeRenderHook","configSetByMerchant","originalRender","this","render","args","beforeRender","apply","originalAction","event","AnalyticsInfoEvent","type","InfoEventType","rendered","component","configData","showPayButton","props","oneClick","isStoredPaymentMethod","analytics","sendAnalytics","reportIntegrationFlavor","sendFlavor","core","modules","srPanel","getPaymentMethodConfigFromResponse","componentProps","storedPaymentMethodId","getStoredPaymentMethodDetails","getPaymentMethodFromPaymentMethodsResponse","paymentMethodId","buildElementProps","finalProps","getCorePropsForComponent","isDropinInstance","assertIsDropin","formatProps","constructor","getRegulatoryDefaults","options","countryCode","paymentMethodsResponse","findStoredPaymentMethod","findById","find","storeElementRefOnCore","isDropin","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","setElementStatus","status","elementRef","setStatus","data","isValid","errors","valid","submitAnalytics","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","session","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","AnalyticsLogEvent","LogEventType","message","submitPayment","error","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","update","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","amount","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","loadingContext","SRPanelProvider","componentToRender","checkout","super","_define_property","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","secondaryAmount","onClick","register","bind","undefined","txVariants"],"mappings":"8iCAoCO,MAAeA,UAA6DC,EAmDvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,KAAKC,OAE5BD,KAAKC,OAAS,IAAIC,KACdF,KAAKG,aAAaL,GACXC,EAAeK,MAAMJ,KAAME,GAE1C,CAEUC,YAAAA,CAAaL,GAEnB,GAAIA,GAAqBO,eACrB,OAGJ,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,KAAMC,EAAcC,SACpBC,UAAWX,KAAKQ,KAChBI,WAAY,IAAKd,EAAqBe,cAAeb,KAAKc,MAAMD,kBAC5Df,GAAqBiB,UAAY,CAAEC,uBAAuB,KAGlEhB,KAAKiB,UAAUC,cAAcZ,EACjC,CAEUa,uBAAAA,GACDnB,KAAKiB,UAAUG,WAAW,aACnC,CAEA,aAAIH,GACA,OAAOjB,KAAKqB,KAAKC,QAAQL,SAC7B,CAEA,WAAIM,GACA,OAAOvB,KAAKqB,KAAKC,QAAQC,OAC7B,CAEQC,kCAAAA,CAAmCC,GACvC,OAAIA,GAAgBC,sBAA8B1B,KAAK2B,8BAA8BF,EAAeC,uBAC7F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iBqG,KAAKvK,MACnDA,KAAK2F,0BAA4B3F,KAAK2F,0BAA0B4E,KAAKvK,MACrEA,KAAKgF,wBAA0BhF,KAAKgF,wBAAwBuF,KAAKvK,MAEjEA,KAAK0D,WAAc5C,GAASA,EAAM4C,YAAe1D,KACjDA,KAAK4H,UAAY5H,KAAKc,MAAMQ,QAAUtB,KAAKc,MAAMQ,QAAQsG,eAAY4C,EAErExK,KAAK4C,sBAAsB5C,KAAKc,OAEhCd,KAAKoH,kBAAoBpH,KAAKoH,kBAAkBmD,KAAKvK,MACrDA,KAAKwG,gBAAkBxG,KAAKwG,gBAAgB+D,KAAKvK,MAEjDA,KAAKH,uBAAuBiB,GAC5Bd,KAAKmB,yBACT,EAnCAgI,EAPkBxJ,EAOJa,YAAOgK,GAKrBrB,EAZkBxJ,EAYJ8K,aAAuB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../external/preact/dist/preact.js";import t from"../../components/internal/BaseElement/BaseElement.js";import{SRMessages as s}from"./SRMessages.js";function n(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class o extends t{get enabled(){return this._enabled}get moveFocus(){return this._moveFocus}setAriaProps(e){const t=document.querySelector('[class^="adyen-checkout-sr-panel"]');for(const[s,n]of Object.entries(e))t.setAttribute(s,n);this.props={...this.props,ariaAttributes:{...this.props.ariaAttributes,...e}}}render(){return this.props.enabled?e("div",{className:this.showPanel?"adyen-checkout-sr-panel":"adyen-checkout-sr-panel--sr-only",role:"log",...this.props.ariaAttributes},e(s,{setComponentRef:this.setComponentRef})):null}constructor(e,t){if(super(e,t),n(this,"srPanelContainer",null),n(this,"id",void 0),n(this,"showPanel",void 0),n(this,"_enabled",void 0),n(this,"_moveFocus",void 0),n(this,"componentRef",void 0),n(this,"setComponentRef",e=>{this.componentRef=e}),n(this,"setMessages",e=>{if(!this.props.enabled)return;let t=null;e&&(t=Array.isArray(e)?e:[e]),this.componentRef.setMessages(t)}),this.id=this.props.id,this.showPanel=!1,this._enabled=!1,this._moveFocus=this.props.moveFocus??!0,this.props.enabled){this._enabled=!0;const e=document.querySelector(this.props.node);if(!e)throw new Error("Component could not mount. Root node was not found.");{const t=document.getElementById(this.id);t&&e.removeChild(t),this.srPanelContainer=document.createElement("div"),this.srPanelContainer.className="sr-panel-holder",this.srPanelContainer.id=this.id,e.appendChild(this.srPanelContainer),this.mount(this.srPanelContainer)}}}}n(o,"type","srPanel"),n(o,"defaultProps",{enabled:!0,node:"body",showPanel:!1,id:"ariaLiveSRPanel",ariaAttributes:{"aria-relevant":"all","aria-live":"polite","aria-atomic":"true"}});export{o as SRPanel};
|
|
1
|
+
import{createElement as e}from"../../external/preact/dist/preact.js";import t from"../../components/internal/BaseElement/BaseElement.js";import{SRMessages as s}from"./SRMessages.js";function n(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class o extends t{get enabled(){return this._enabled}get moveFocus(){return this._moveFocus}setAriaProps(e){if(!this.props.enabled)return;const t=document.querySelector('[class^="adyen-checkout-sr-panel"]');if(t){for(const[s,n]of Object.entries(e))t.setAttribute(s,n);this.props={...this.props,ariaAttributes:{...this.props.ariaAttributes,...e}}}else console.error("SRPanel: Failed to set aria props because no panel was found")}render(){return this.props.enabled?e("div",{className:this.showPanel?"adyen-checkout-sr-panel":"adyen-checkout-sr-panel--sr-only",role:"log",...this.props.ariaAttributes},e(s,{setComponentRef:this.setComponentRef})):null}constructor(e,t){if(super(e,t),n(this,"srPanelContainer",null),n(this,"id",void 0),n(this,"showPanel",void 0),n(this,"_enabled",void 0),n(this,"_moveFocus",void 0),n(this,"componentRef",void 0),n(this,"setComponentRef",e=>{this.componentRef=e}),n(this,"setMessages",e=>{if(!this.props.enabled)return;let t=null;e&&(t=Array.isArray(e)?e:[e]),this.componentRef.setMessages(t)}),this.id=this.props.id,this.showPanel=!1,this._enabled=!1,this._moveFocus=this.props.moveFocus??!0,this.props.enabled){this._enabled=!0;const e=document.querySelector(this.props.node);if(!e)throw new Error("Component could not mount. Root node was not found.");{const t=document.getElementById(this.id);t&&e.removeChild(t),this.srPanelContainer=document.createElement("div"),this.srPanelContainer.className="sr-panel-holder",this.srPanelContainer.id=this.id,e.appendChild(this.srPanelContainer),this.mount(this.srPanelContainer)}}}}n(o,"type","srPanel"),n(o,"defaultProps",{enabled:!0,node:"body",showPanel:!1,id:"ariaLiveSRPanel",ariaAttributes:{"aria-relevant":"all","aria-live":"polite","aria-atomic":"true"}});export{o as SRPanel};
|
|
2
2
|
//# sourceMappingURL=SRPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SRPanel.js","sources":["../../../../src/core/Errors/SRPanel.tsx"],"sourcesContent":["import { h } from 'preact';\nimport
|
|
1
|
+
{"version":3,"file":"SRPanel.js","sources":["../../../../src/core/Errors/SRPanel.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { AriaAttributes, SRPanelProps } from './types';\nimport BaseElement from '../../components/internal/BaseElement/BaseElement';\nimport { SRMessages, SRMessagesRef } from './SRMessages';\nimport type { ICore } from '../types';\nimport './SRPanel.scss';\n\n/**\n * A panel meant to hold messages that will be read out by ScreenReaders on an aria-live=\"polite\" basis\n * Expects a string or string array of message to add to the panel to be read out\n * For testing purposes can be made visible\n */\nexport class SRPanel extends BaseElement<SRPanelProps> {\n public static type = 'srPanel';\n\n public static defaultProps: Partial<SRPanelProps> = {\n enabled: true,\n node: 'body',\n showPanel: false,\n id: 'ariaLiveSRPanel',\n ariaAttributes: {\n 'aria-relevant': 'all',\n 'aria-live': 'polite',\n 'aria-atomic': 'true'\n }\n };\n\n private readonly srPanelContainer = null;\n\n private readonly id;\n private readonly showPanel;\n private readonly _enabled: boolean;\n private readonly _moveFocus: boolean;\n\n private componentRef: SRMessagesRef;\n\n constructor(checkout: ICore, props?: SRPanelProps) {\n super(checkout, props);\n\n this.id = this.props.id;\n this.showPanel = process.env.NODE_ENV !== 'production' ? this.props.showPanel : false;\n this._enabled = false;\n this._moveFocus = this.props.moveFocus ?? true;\n\n if (this.props.enabled) {\n this._enabled = true;\n\n const panelParent = document.querySelector(this.props.node);\n\n if (panelParent) {\n const preExistingSRPanel = document.getElementById(this.id);\n if (preExistingSRPanel) {\n panelParent.removeChild(preExistingSRPanel);\n }\n\n this.srPanelContainer = document.createElement('div');\n this.srPanelContainer.className = 'sr-panel-holder';\n this.srPanelContainer.id = this.id;\n\n panelParent.appendChild(this.srPanelContainer);\n\n this.mount(this.srPanelContainer);\n } else {\n throw new Error('Component could not mount. Root node was not found.');\n }\n }\n }\n\n public setComponentRef = ref => {\n this.componentRef = ref;\n };\n\n public get enabled() {\n return this._enabled;\n }\n\n public get moveFocus() {\n return this._moveFocus;\n }\n\n public setAriaProps(ariaAttributes: AriaAttributes): void {\n if (!this.props.enabled) return;\n\n const firstPanel = document.querySelector('[class^=\"adyen-checkout-sr-panel\"]');\n\n if (!firstPanel) {\n console.error('SRPanel: Failed to set aria props because no panel was found');\n return;\n }\n\n for (const [key, value] of Object.entries(ariaAttributes)) {\n firstPanel.setAttribute(key, value);\n }\n this.props = { ...this.props, ariaAttributes: { ...this.props.ariaAttributes, ...ariaAttributes } };\n }\n\n // A method we can expose to allow comps to set messages in this panel\n public setMessages = (messages: string[] | string): void => {\n if (!this.props.enabled) return;\n\n let panelMessages = null;\n if (messages) {\n // Ensure panelMessages is an array\n panelMessages = Array.isArray(messages) ? messages : [messages];\n }\n\n this.componentRef.setMessages(panelMessages);\n };\n\n render() {\n if (!this.props.enabled) return null;\n return (\n <div\n className={this.showPanel ? 'adyen-checkout-sr-panel' : 'adyen-checkout-sr-panel--sr-only'}\n role={'log'}\n {...this.props.ariaAttributes}\n {...(process.env.NODE_ENV !== 'production' && { 'data-testid': this.id })}\n >\n <SRMessages setComponentRef={this.setComponentRef} />\n </div>\n );\n }\n}\n"],"names":["SRPanel","BaseElement","enabled","this","_enabled","moveFocus","_moveFocus","setAriaProps","ariaAttributes","props","firstPanel","document","querySelector","key","value","Object","entries","setAttribute","console","error","render","h","div","className","showPanel","role","SRMessages","setComponentRef","constructor","checkout","super","_define_property","srPanelContainer","id","componentRef","ref","setMessages","messages","panelMessages","Array","isArray","panelParent","node","Error","preExistingSRPanel","getElementById","removeChild","createElement","appendChild","mount","type","defaultProps"],"mappings":"8SAYO,MAAMA,UAAgBC,EA4DzB,WAAWC,GACP,OAAOC,KAAKC,QAChB,CAEA,aAAWC,GACP,OAAOF,KAAKG,UAChB,CAEOC,YAAAA,CAAaC,GAChB,IAAKL,KAAKM,MAAMP,QAAS,OAEzB,MAAMQ,EAAaC,SAASC,cAAc,sCAE1C,GAAKF,EAAL,CAKA,IAAK,MAAOG,EAAKC,KAAUC,OAAOC,QAAQR,GACtCE,EAAWO,aAAaJ,EAAKC,GAEjCX,KAAKM,MAAQ,IAAKN,KAAKM,MAAOD,eAAgB,IAAKL,KAAKM,MAAMD,kBAAmBA,GALjF,MAFIU,QAAQC,MAAM,+DAQtB,CAeAC,MAAAA,GACI,OAAKjB,KAAKM,MAAMP,QAEZmB,EAACC,MAAAA,CACGC,UAAWpB,KAAKqB,UAAY,0BAA4B,mCACxDC,KAAM,SACFtB,KAAKM,MAAMD,gBAGfa,EAACK,EAAAA,CAAWC,gBAAiBxB,KAAKwB,mBARV,IAWpC,CArFA,WAAAC,CAAYC,EAAiBpB,GAQzB,GAPAqB,MAAMD,EAAUpB,GAVpBsB,EAAA5B,KAAiB6B,mBAAmB,MAEpCD,EAAA5B,KAAiB8B,UAAjB,GACAF,EAAA5B,KAAiBqB,iBAAjB,GACAO,EAAA5B,KAAiBC,gBAAjB,GACA2B,EAAA5B,KAAiBG,kBAAjB,GAEAyB,EAAA5B,KAAQ+B,oBAAR,GAkCAH,EAAA5B,KAAOwB,kBAAkBQ,IACrBhC,KAAK+B,aAAeC,IA4BxBJ,EAAA5B,KAAOiC,cAAeC,IAClB,IAAKlC,KAAKM,MAAMP,QAAS,OAEzB,IAAIoC,EAAgB,KAChBD,IAEAC,EAAgBC,MAAMC,QAAQH,GAAYA,EAAW,CAACA,IAG1DlC,KAAK+B,aAAaE,YAAYE,KAnE9BnC,KAAK8B,GAAK9B,KAAKM,MAAMwB,GACrB9B,KAAKqB,WAA2E,EAChFrB,KAAKC,UAAW,EAChBD,KAAKG,WAAaH,KAAKM,MAAMJ,YAAa,EAEtCF,KAAKM,MAAMP,QAAS,CACpBC,KAAKC,UAAW,EAEhB,MAAMqC,EAAc9B,SAASC,cAAcT,KAAKM,MAAMiC,MAEtD,IAAID,EAcA,MAAM,IAAIE,MAAM,uDAdH,CACb,MAAMC,EAAqBjC,SAASkC,eAAe1C,KAAK8B,IACpDW,GACAH,EAAYK,YAAYF,GAG5BzC,KAAK6B,iBAAmBrB,SAASoC,cAAc,OAC/C5C,KAAK6B,iBAAiBT,UAAY,kBAClCpB,KAAK6B,iBAAiBC,GAAK9B,KAAK8B,GAEhCQ,EAAYO,YAAY7C,KAAK6B,kBAE7B7B,KAAK8C,MAAM9C,KAAK6B,iBACpB,CAGJ,CACJ,EArDAD,EADS/B,EACKkD,OAAO,WAErBnB,EAHS/B,EAGKmD,eAAsC,CAChDjD,SAAS,EACTwC,KAAM,OACNlB,WAAW,EACXS,GAAI,kBACJzB,eAAgB,CACZ,gBAAiB,MACjB,YAAa,SACb,cAAe"}
|
package/dist/es/core/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",n="6.
|
|
1
|
+
const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",n="6.27.0",o="esm",t=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],r=6e4;export{r as DEFAULT_HTTP_TIMEOUT,e as FALLBACK_CONTEXT,t as GENERIC_OPTIONS,o as LIBRARY_BUNDLE_TYPE,n as LIBRARY_VERSION};
|
|
2
2
|
//# sourceMappingURL=config.js.map
|
package/dist/es/index.d.ts
CHANGED
|
@@ -2912,11 +2912,11 @@ interface PayPalConfiguration extends UIElementProps {
|
|
|
2912
2912
|
*/
|
|
2913
2913
|
configuration?: {
|
|
2914
2914
|
/**
|
|
2915
|
-
* @see {@link https://developer.paypal.com/sdk/js/configuration/#
|
|
2915
|
+
* @see {@link https://developer.paypal.com/sdk/js/configuration/#merchant-id}
|
|
2916
2916
|
*/
|
|
2917
2917
|
merchantId: string;
|
|
2918
2918
|
/**
|
|
2919
|
-
* @see {@link https://developer.paypal.com/sdk/js/configuration/#
|
|
2919
|
+
* @see {@link https://developer.paypal.com/sdk/js/configuration/#intent}
|
|
2920
2920
|
*/
|
|
2921
2921
|
intent?: Intent;
|
|
2922
2922
|
};
|
|
@@ -2966,7 +2966,7 @@ interface PayPalConfiguration extends UIElementProps {
|
|
|
2966
2966
|
}) => void;
|
|
2967
2967
|
/**
|
|
2968
2968
|
* While the buyer is on the PayPal site, you can update their shopping cart to reflect the shipping address they chose on PayPal
|
|
2969
|
-
* @see {@link https://developer.paypal.com/sdk/js/reference/#
|
|
2969
|
+
* @see {@link https://developer.paypal.com/sdk/js/reference/#on-shipping-address-change}
|
|
2970
2970
|
*
|
|
2971
2971
|
* @param data - PayPal data object
|
|
2972
2972
|
* @param actions - Used to reject the address change in case the address is invalid
|
|
@@ -2977,7 +2977,7 @@ interface PayPalConfiguration extends UIElementProps {
|
|
|
2977
2977
|
}, component: PaypalElement) => Promise<void>;
|
|
2978
2978
|
/**
|
|
2979
2979
|
* This callback is triggered any time the user selects a new shipping option.
|
|
2980
|
-
* @see {@link https://developer.paypal.com/sdk/js/reference/#
|
|
2980
|
+
* @see {@link https://developer.paypal.com/sdk/js/reference/#on-shipping-options-change}
|
|
2981
2981
|
*
|
|
2982
2982
|
* @param data - An PayPal object containing the payer’s selected shipping option
|
|
2983
2983
|
* @param actions - Used to indicates to PayPal that you will not support the shipping method selected by the buyer
|
|
@@ -2994,7 +2994,7 @@ interface PayPalConfiguration extends UIElementProps {
|
|
|
2994
2994
|
/**
|
|
2995
2995
|
* Customize your buttons using the style option.
|
|
2996
2996
|
*
|
|
2997
|
-
* @see {@link https://developer.paypal.com/sdk/js/reference/#
|
|
2997
|
+
* @see {@link https://developer.paypal.com/sdk/js/reference/#style}
|
|
2998
2998
|
* @default style.height 48px
|
|
2999
2999
|
*/
|
|
3000
3000
|
style?: {
|
|
@@ -3008,31 +3008,31 @@ interface PayPalConfiguration extends UIElementProps {
|
|
|
3008
3008
|
};
|
|
3009
3009
|
/**
|
|
3010
3010
|
* Called when the button first renders. You can use it for validations on your page if you are unable to do so prior to rendering.
|
|
3011
|
-
* @see {@link https://developer.paypal.com/sdk/js/reference/#
|
|
3011
|
+
* @see {@link https://developer.paypal.com/sdk/js/reference/#oninitonclick}
|
|
3012
3012
|
*/
|
|
3013
3013
|
onInit?: (data?: any, actions?: any) => void;
|
|
3014
3014
|
/**
|
|
3015
|
-
* @see {@link https://developer.paypal.com/sdk/js/reference/#
|
|
3015
|
+
* @see {@link https://developer.paypal.com/sdk/js/reference/#oninitonclick}
|
|
3016
3016
|
*/
|
|
3017
3017
|
onClick?: () => void;
|
|
3018
3018
|
/**
|
|
3019
3019
|
* The commit status of the transaction. Determines whether to show a Pay Now or Continue button in the Checkout flow.
|
|
3020
3020
|
*
|
|
3021
|
-
* @see {@link https://developer.paypal.com/sdk/js/configuration/#
|
|
3021
|
+
* @see {@link https://developer.paypal.com/sdk/js/configuration/#commit}
|
|
3022
3022
|
* @default true
|
|
3023
3023
|
*/
|
|
3024
3024
|
commit?: boolean;
|
|
3025
3025
|
/**
|
|
3026
3026
|
* Whether the payment information in the transaction will be saved. Save your customers' payment information for billing agreements, subscriptions, or recurring payments.
|
|
3027
3027
|
*
|
|
3028
|
-
* @see {@link https://developer.paypal.com/sdk/js/configuration/#
|
|
3028
|
+
* @see {@link https://developer.paypal.com/sdk/js/configuration/#vault}
|
|
3029
3029
|
* @default false
|
|
3030
3030
|
*/
|
|
3031
3031
|
vault?: boolean;
|
|
3032
3032
|
/**
|
|
3033
3033
|
* The locale renders components. By default PayPal detects the correct locale for the buyer based on their geolocation and browser preferences.
|
|
3034
3034
|
*
|
|
3035
|
-
* @see {@link https://developer.paypal.com/sdk/js/configuration/#
|
|
3035
|
+
* @see {@link https://developer.paypal.com/sdk/js/configuration/#locale}
|
|
3036
3036
|
* @default undefined
|
|
3037
3037
|
*/
|
|
3038
3038
|
locale?: string;
|
|
@@ -3040,21 +3040,21 @@ interface PayPalConfiguration extends UIElementProps {
|
|
|
3040
3040
|
* Determines whether the funds are captured immediately on checkout or if the buyer authorizes the funds to be captured later.
|
|
3041
3041
|
* If set, it will override the intent passed inside the 'configuration' object
|
|
3042
3042
|
*
|
|
3043
|
-
* @see {@link https://developer.paypal.com/sdk/js/configuration/#
|
|
3043
|
+
* @see {@link https://developer.paypal.com/sdk/js/configuration/#intent}
|
|
3044
3044
|
* @default undefined
|
|
3045
3045
|
*/
|
|
3046
3046
|
intent?: Intent;
|
|
3047
3047
|
/**
|
|
3048
3048
|
* Pass a Content Security Policy single-use token if you use them on your site
|
|
3049
3049
|
*
|
|
3050
|
-
* @see {@link https://developer.paypal.com/sdk/js/configuration/#
|
|
3050
|
+
* @see {@link https://developer.paypal.com/sdk/js/configuration/#data-csp-nonce}
|
|
3051
3051
|
* @default undefined
|
|
3052
3052
|
*/
|
|
3053
3053
|
cspNonce?: string;
|
|
3054
3054
|
enableMessages?: boolean;
|
|
3055
3055
|
/**
|
|
3056
3056
|
* Set to true to enable debug mode. Defaults to false.
|
|
3057
|
-
* @see {@link https://developer.paypal.com/sdk/js/configuration/#
|
|
3057
|
+
* @see {@link https://developer.paypal.com/sdk/js/configuration/#debug}
|
|
3058
3058
|
* @default undefined
|
|
3059
3059
|
*/
|
|
3060
3060
|
debug?: boolean;
|
|
@@ -3062,7 +3062,7 @@ interface PayPalConfiguration extends UIElementProps {
|
|
|
3062
3062
|
* A two-letter ISO 3166 country code which will be passed to the PayPal SDK as the buyer-country.
|
|
3063
3063
|
* Note: The buyer country is only used in the sandbox. Don't pass this query parameter in production.
|
|
3064
3064
|
*
|
|
3065
|
-
* @see {@link https://developer.paypal.com/sdk/js/configuration/#
|
|
3065
|
+
* @see {@link https://developer.paypal.com/sdk/js/configuration/#buyer-country}
|
|
3066
3066
|
* @default undefined
|
|
3067
3067
|
*/
|
|
3068
3068
|
countryCode?: string;
|
|
@@ -4919,7 +4919,6 @@ declare class UPI extends UIElement<UPIConfiguration> {
|
|
|
4919
4919
|
formatData(): UpiPaymentData;
|
|
4920
4920
|
get paymentType(): UpiType;
|
|
4921
4921
|
private onUpdateMode;
|
|
4922
|
-
private renderContent;
|
|
4923
4922
|
protected componentToRender(): h.JSX.Element;
|
|
4924
4923
|
}
|
|
4925
4924
|
|
package/dist/es/utils/Script.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"../core/Errors/AdyenCheckoutError.js";import{AnalyticsInfoEvent as s,InfoEventType as
|
|
1
|
+
import t from"../core/Errors/AdyenCheckoutError.js";import{AnalyticsInfoEvent as s,InfoEventType as e}from"../core/Analytics/events/AnalyticsInfoEvent.js";function i(t,s,e){return s in t?Object.defineProperty(t,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[s]=e,t}class r{removeScript(){this.cleanupListeners(),this.script?.parentNode?.removeChild(this.script),this.script=null}cleanupListeners(){this.script&&(this.script.removeEventListener("load",this.handleOnLoad),this.script.removeEventListener("error",this.handleOnError))}attachListeners(){this.script&&(this.cleanupListeners(),this.script.addEventListener("load",this.handleOnLoad),this.script.addEventListener("error",this.handleOnError))}loadScript(){return new Promise((s,e)=>{const i=document.querySelector(this.node);i?(this.resolveLoadScript=s,this.rejectLoadScript=e,this.script=i.querySelector(`script[src="${this.src}"]`),this.script?.getAttribute("data-script-loaded")?this.resolveLoadScript():this.script?this.attachListeners():(this.script=document.createElement("script"),Object.assign(this.script,this.attributes),Object.assign(this.script.dataset,this.dataAttributes),this.script.src=this.src,this.script.async=!0,this.attachListeners(),i.appendChild(this.script))):e(new t("SCRIPT_ERROR",`Unable to find script container node: ${this.node}`))})}trackEvent(t){const e=new s({type:t,component:this.component,cdnUrl:this.baseUrl});this.analytics?.sendAnalytics(e)}constructor({src:s,component:o,node:n="body",attributes:a,dataAttributes:c,analytics:h}){i(this,"src",void 0),i(this,"component",void 0),i(this,"node",void 0),i(this,"attributes",void 0),i(this,"dataAttributes",void 0),i(this,"analytics",void 0),i(this,"baseUrl",void 0),i(this,"script",void 0),i(this,"loadPromise",null),i(this,"rejectLoadPromise",null),i(this,"resolveLoadScript",null),i(this,"rejectLoadScript",null),i(this,"handleOnLoad",()=>{this.script?.setAttribute("data-script-loaded","true"),this.cleanupListeners(),this.resolveLoadScript?.()}),i(this,"handleOnError",s=>{this.cleanupListeners();const e=new t("SCRIPT_ERROR",`Unable to load script ${this.src}.${s?.message&&`Message: ${s.message}`}`,{cause:s?.error||s});this.rejectLoadScript?.(e)}),i(this,"load",()=>(null!==this.loadPromise||(this.loadPromise=new Promise((t,s)=>{this.rejectLoadPromise=s;let i=0;this.trackEvent(e.sdkDownloadInitiated);const o=async()=>{try{i++,await this.loadScript(),this.trackEvent(e.sdkDownloadCompleted),t()}catch(t){if(null===this.loadPromise)return;this.trackEvent(e.sdkDownloadFailed),this.removeScript(),i<r.MAX_NUMBER_OF_RETRIES?setTimeout(()=>{o()},r.RETRY_DELAY):(this.trackEvent(e.sdkDownloadAborted),this.loadPromise=null,this.rejectLoadPromise=null,s(t))}};o()})),this.loadPromise)),i(this,"remove",()=>{this.rejectLoadPromise?.(new t("CANCEL","Script loading cancelled.")),this.removeScript(),this.loadPromise=null}),this.src=s,this.component=o,this.node=n,this.attributes=a,this.dataAttributes=c,this.analytics=h,this.baseUrl=function(t){const s=new URL(t);return s.origin+s.pathname}(this.src)}}i(r,"RETRY_DELAY",1e3),i(r,"MAX_NUMBER_OF_RETRIES",3);export{r as default};
|
|
2
2
|
//# sourceMappingURL=Script.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Script.js","sources":["../../../src/utils/Script.ts"],"sourcesContent":["import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport { AnalyticsInfoEvent, InfoEventType } from '../core/Analytics/events/AnalyticsInfoEvent';\nimport type { IAnalytics } from '../core/Analytics/Analytics';\n\ninterface IScript {\n load(): Promise<void>;\n remove(): void;\n}\n\ninterface IScriptProps {\n src: string;\n component: string;\n analytics: IAnalytics;\n node?: string;\n attributes?: Partial<HTMLScriptElement>;\n dataAttributes?: Record<string, string | undefined>;\n}\n\n// Returns Base URL of the resource without any query parameters (e.g. merchant ID, token, etc). Used for Analytics\nfunction getBaseURL(src: string): string {\n const url = new URL(src);\n return url.origin + url.pathname;\n}\n\nclass Script implements IScript {\n private readonly src: string;\n private readonly component: string;\n private readonly node: string;\n private readonly attributes: Partial<HTMLScriptElement>;\n private readonly dataAttributes: Record<string, string | undefined>;\n private readonly analytics: IAnalytics;\n private readonly baseUrl: string;\n\n private script: HTMLScriptElement;\n private loadPromise: Promise<void> | null = null;\n private rejectLoadPromise: (reason?: any) => void | null = null;\n\n public static readonly RETRY_DELAY = 1000;\n public static readonly MAX_NUMBER_OF_RETRIES = 3;\n\n constructor({ src, component, node = 'body', attributes, dataAttributes, analytics }: IScriptProps) {\n this.src = src;\n this.component = component;\n this.node = node;\n this.attributes = attributes;\n this.dataAttributes = dataAttributes;\n this.analytics = analytics;\n this.baseUrl = getBaseURL(this.src);\n }\n\n public load = (): Promise<void> => {\n if (this.loadPromise !== null) {\n if (process.env.NODE_ENV === 'development') console.warn(`[Warning] script.load called more than once for ${this.src}`);\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise((resolve, reject) => {\n this.rejectLoadPromise = reject;\n let attempts = 0;\n\n this.trackEvent(InfoEventType.sdkDownloadInitiated);\n\n const loadScriptWithRetry = async (): Promise<void> => {\n try {\n attempts++;\n await this.loadScript();\n this.trackEvent(InfoEventType.sdkDownloadCompleted);\n resolve();\n } catch (error: unknown) {\n if (this.loadPromise === null) {\n return;\n }\n\n this.trackEvent(InfoEventType.sdkDownloadFailed);\n\n this.removeScript();\n\n if (attempts < Script.MAX_NUMBER_OF_RETRIES) {\n setTimeout(() => void loadScriptWithRetry(), Script.RETRY_DELAY);\n } else {\n this.trackEvent(InfoEventType.sdkDownloadAborted);\n this.loadPromise = null;\n this.rejectLoadPromise = null;\n reject(error);\n }\n }\n };\n\n void loadScriptWithRetry();\n });\n\n return this.loadPromise;\n };\n\n public remove = () => {\n this.rejectLoadPromise?.(new AdyenCheckoutError('CANCEL', 'Script loading cancelled.'));\n this.removeScript();\n this.loadPromise = null;\n };\n\n private removeScript() {\n this.script?.parentNode?.removeChild(this.script);\n this.script = null;\n }\n\n private loadScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n const scriptContainer = document.querySelector(this.node);\n\n if (!scriptContainer) {\n reject(new AdyenCheckoutError('SCRIPT_ERROR', `Unable to find script container node: ${this.node}`));\n return;\n }\n\n const cleanupListeners = () => {\n if (!this.script) return;\n this.script.removeEventListener('load', handleOnLoad);\n this.script.removeEventListener('error', handleOnError);\n };\n\n const handleOnLoad = () => {\n this.script.setAttribute('data-script-loaded', 'true');\n cleanupListeners();\n resolve();\n };\n\n const handleOnError = (errorEvent: ErrorEvent) => {\n cleanupListeners();\n reject(\n new AdyenCheckoutError(\n 'SCRIPT_ERROR',\n `Unable to load script ${this.src}.${errorEvent?.message && `Message: ${errorEvent.message}`}`,\n {\n cause: errorEvent?.error || errorEvent\n }\n )\n );\n };\n\n this.script = scriptContainer.querySelector(`script[src=\"${this.src}\"]`);\n\n // Script element exists in the browser and is already loaded\n if (this.script?.getAttribute('data-script-loaded')) {\n resolve();\n return;\n }\n\n // Script element exists in the browser, but it is not loaded yet\n // Use-case: Multiple PayPal standalone components being loaded in different parts of the screen.\n if (this.script) {\n this.script.addEventListener('load', handleOnLoad);\n this.script.addEventListener('error', handleOnError);\n return;\n }\n\n // Script element doesn't exist in the browser, so we create it and append to the DOM tree\n this.script = document.createElement('script');\n\n Object.assign(this.script, this.attributes);\n Object.assign(this.script.dataset, this.dataAttributes);\n\n this.script.src = this.src;\n this.script.async = true;\n\n this.script.addEventListener('load', handleOnLoad);\n this.script.addEventListener('error', handleOnError);\n\n scriptContainer.appendChild(this.script);\n });\n }\n\n private trackEvent(eventType: InfoEventType) {\n const event = new AnalyticsInfoEvent({\n type: eventType,\n component: this.component,\n cdnUrl: this.baseUrl\n });\n this.analytics?.sendAnalytics(event);\n }\n}\n\nexport default Script;\n"],"names":["Script","removeScript","this","script","parentNode","removeChild","loadScript","Promise","resolve","reject","scriptContainer","document","querySelector","node","AdyenCheckoutError","cleanupListeners","removeEventListener","handleOnLoad","handleOnError","setAttribute","errorEvent","src","message","cause","error","getAttribute","addEventListener","createElement","Object","assign","attributes","dataset","dataAttributes","async","appendChild","trackEvent","eventType","event","AnalyticsInfoEvent","type","component","cdnUrl","baseUrl","analytics","sendAnalytics","constructor","_define_property","loadPromise","rejectLoadPromise","load","attempts","InfoEventType","sdkDownloadInitiated","loadScriptWithRetry","sdkDownloadCompleted","sdkDownloadFailed","MAX_NUMBER_OF_RETRIES","setTimeout","RETRY_DELAY","sdkDownloadAborted","remove","url","URL","origin","pathname","getBaseURL"],"mappings":"mRAwBA,MAAMA,EA4EMC,YAAAA,GACJC,KAAKC,QAAQC,YAAYC,YAAYH,KAAKC,QAC1CD,KAAKC,OAAS,IAClB,CAEQG,UAAAA,GACJ,OAAO,IAAIC,QAAQ,CAACC,EAASC,KACzB,MAAMC,EAAkBC,SAASC,cAAcV,KAAKW,MAEpD,IAAKH,EAED,YADAD,EAAO,IAAIK,EAAmB,eAAgB,yCAAyCZ,KAAKW,SAIhG,MAAME,EAAmB,KACh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dE9C,EAcqBwD,wBAAwB"}
|
|
1
|
+
{"version":3,"file":"Script.js","sources":["../../../src/utils/Script.ts"],"sourcesContent":["import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport { AnalyticsInfoEvent, InfoEventType } from '../core/Analytics/events/AnalyticsInfoEvent';\nimport type { IAnalytics } from '../core/Analytics/Analytics';\n\ninterface IScript {\n load(): Promise<void>;\n remove(): void;\n}\n\ninterface IScriptProps {\n src: string;\n component: string;\n analytics: IAnalytics;\n node?: string;\n attributes?: Partial<HTMLScriptElement>;\n dataAttributes?: Record<string, string | undefined>;\n}\n\n// Returns Base URL of the resource without any query parameters (e.g. merchant ID, token, etc). Used for Analytics\nfunction getBaseURL(src: string): string {\n const url = new URL(src);\n return url.origin + url.pathname;\n}\n\nclass Script implements IScript {\n private readonly src: string;\n private readonly component: string;\n private readonly node: string;\n private readonly attributes: Partial<HTMLScriptElement>;\n private readonly dataAttributes: Record<string, string | undefined>;\n private readonly analytics: IAnalytics;\n private readonly baseUrl: string;\n\n private script: HTMLScriptElement;\n private loadPromise: Promise<void> | null = null;\n private rejectLoadPromise: (reason?: any) => void | null = null;\n private resolveLoadScript: (() => void) | null = null;\n private rejectLoadScript: ((reason?: any) => void) | null = null;\n\n private readonly handleOnLoad = () => {\n this.script?.setAttribute('data-script-loaded', 'true');\n this.cleanupListeners();\n this.resolveLoadScript?.();\n };\n\n private readonly handleOnError = (errorEvent: ErrorEvent) => {\n this.cleanupListeners();\n const error = new AdyenCheckoutError(\n 'SCRIPT_ERROR',\n `Unable to load script ${this.src}.${errorEvent?.message && `Message: ${errorEvent.message}`}`,\n {\n cause: errorEvent?.error || errorEvent\n }\n );\n this.rejectLoadScript?.(error);\n };\n\n public static readonly RETRY_DELAY = 1000;\n public static readonly MAX_NUMBER_OF_RETRIES = 3;\n\n constructor({ src, component, node = 'body', attributes, dataAttributes, analytics }: IScriptProps) {\n this.src = src;\n this.component = component;\n this.node = node;\n this.attributes = attributes;\n this.dataAttributes = dataAttributes;\n this.analytics = analytics;\n this.baseUrl = getBaseURL(this.src);\n }\n\n public load = (): Promise<void> => {\n if (this.loadPromise !== null) {\n if (process.env.NODE_ENV === 'development') console.warn(`[Warning] script.load called more than once for ${this.src}`);\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise((resolve, reject) => {\n this.rejectLoadPromise = reject;\n let attempts = 0;\n\n this.trackEvent(InfoEventType.sdkDownloadInitiated);\n\n const loadScriptWithRetry = async (): Promise<void> => {\n try {\n attempts++;\n await this.loadScript();\n this.trackEvent(InfoEventType.sdkDownloadCompleted);\n resolve();\n } catch (error: unknown) {\n if (this.loadPromise === null) {\n return;\n }\n\n this.trackEvent(InfoEventType.sdkDownloadFailed);\n\n this.removeScript();\n\n if (attempts < Script.MAX_NUMBER_OF_RETRIES) {\n setTimeout(() => void loadScriptWithRetry(), Script.RETRY_DELAY);\n } else {\n this.trackEvent(InfoEventType.sdkDownloadAborted);\n this.loadPromise = null;\n this.rejectLoadPromise = null;\n reject(error);\n }\n }\n };\n\n void loadScriptWithRetry();\n });\n\n return this.loadPromise;\n };\n\n public remove = () => {\n this.rejectLoadPromise?.(new AdyenCheckoutError('CANCEL', 'Script loading cancelled.'));\n this.removeScript();\n this.loadPromise = null;\n };\n\n private removeScript() {\n this.cleanupListeners();\n this.script?.parentNode?.removeChild(this.script);\n this.script = null;\n }\n\n private cleanupListeners() {\n if (!this.script) return;\n this.script.removeEventListener('load', this.handleOnLoad);\n this.script.removeEventListener('error', this.handleOnError);\n }\n\n private attachListeners() {\n if (!this.script) return;\n this.cleanupListeners();\n this.script.addEventListener('load', this.handleOnLoad);\n this.script.addEventListener('error', this.handleOnError);\n }\n\n private loadScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n const scriptContainer = document.querySelector(this.node);\n\n if (!scriptContainer) {\n reject(new AdyenCheckoutError('SCRIPT_ERROR', `Unable to find script container node: ${this.node}`));\n return;\n }\n\n this.resolveLoadScript = resolve;\n this.rejectLoadScript = reject;\n\n this.script = scriptContainer.querySelector(`script[src=\"${this.src}\"]`);\n\n // Script element exists in the browser and is already loaded\n if (this.script?.getAttribute('data-script-loaded')) {\n this.resolveLoadScript();\n return;\n }\n\n // Script element exists in the browser, but it is not loaded yet\n // Use-case: Multiple PayPal standalone components being loaded in different parts of the screen.\n if (this.script) {\n this.attachListeners();\n return;\n }\n\n // Script element doesn't exist in the browser, so we create it and append to the DOM tree\n this.script = document.createElement('script');\n\n Object.assign(this.script, this.attributes);\n Object.assign(this.script.dataset, this.dataAttributes);\n\n this.script.src = this.src;\n this.script.async = true;\n\n this.attachListeners();\n\n scriptContainer.appendChild(this.script);\n });\n }\n\n private trackEvent(eventType: InfoEventType) {\n const event = new AnalyticsInfoEvent({\n type: eventType,\n component: this.component,\n cdnUrl: this.baseUrl\n });\n this.analytics?.sendAnalytics(event);\n }\n}\n\nexport default Script;\n"],"names":["Script","removeScript","this","cleanupListeners","script","parentNode","removeChild","removeEventListener","handleOnLoad","handleOnError","attachListeners","addEventListener","loadScript","Promise","resolve","reject","scriptContainer","document","querySelector","node","resolveLoadScript","rejectLoadScript","src","getAttribute","createElement","Object","assign","attributes","dataset","dataAttributes","async","appendChild","AdyenCheckoutError","trackEvent","eventType","event","AnalyticsInfoEvent","type","component","cdnUrl","baseUrl","analytics","sendAnalytics","constructor","_define_property","loadPromise","rejectLoadPromise","setAttribute","errorEvent","error","message","cause","load","attempts","InfoEventType","sdkDownloadInitiated","loadScriptWithRetry","sdkDownloadCompleted","sdkDownloadFailed","MAX_NUMBER_OF_RETRIES","setTimeout","RETRY_DELAY","sdkDownloadAborted","remove","url","URL","origin","pathname","getBaseURL"],"mappings":"mRAwBA,MAAMA,EAgGMC,YAAAA,GACJC,KAAKC,mBACLD,KAAKE,QAAQC,YAAYC,YAAYJ,KAAKE,QAC1CF,KAAKE,OAAS,IAClB,CAEQD,gBAAAA,GACCD,KAAKE,SACVF,KAAKE,OAAOG,oBAAoB,OAAQL,KAAKM,cAC7CN,KAAKE,OAAO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KAAKoB,IAAMA,EACXpB,KAAKoC,UAAYA,EACjBpC,KAAKiB,KAAOA,EACZjB,KAAKyB,WAAaA,EAClBzB,KAAK2B,eAAiBA,EACtB3B,KAAKuC,UAAYA,EACjBvC,KAAKsC,QAhDb,SAAoBlB,GAChB,MAAM0C,EAAM,IAAIC,IAAI3C,GACpB,OAAO0C,EAAIE,OAASF,EAAIG,QAC5B,CA6CuBC,CAAWlE,KAAKoB,IACnC,EAXAsB,EAjCE5C,EAiCqB6D,cAAc,KACrCjB,EAlCE5C,EAkCqB2D,wBAAwB"}
|
package/dist/es-legacy/adyen.css
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
.adyen-checkout__fieldset{border:none;display:block;margin-inline-end:0;margin-inline-start:0;margin:0;padding-block-start:0;padding-bottom:var(--adyen-sdk-spacer-040,8px);padding-block-end:0;padding-inline-end:0;padding-inline-start:0;width:100%}.adyen-checkout__fieldset__description{color:var(--adyen-sdk-color-label-secondary,#5c687c);font-size:var(--adyen-sdk-text-body-font-size,.875rem);font-weight:var(--adyen-sdk-text-body-font-weight,400);line-height:1.5;list-style-type:disc;margin:0}.adyen-checkout__fieldset:last-of-type{padding-bottom:0}.adyen-checkout__fieldset+.adyen-checkout__fieldset{margin-top:var(--adyen-sdk-spacer-070,16px)}.adyen-checkout__fieldset__title{color:var(--adyen-sdk-color-label-primary,#00112c);display:block;font-size:var(--adyen-sdk-text-subtitle-font-size,1rem);font-weight:var(--adyen-sdk-text-subtitle-stronger-font-weight,600);font-weight:var(--adyen-sdk-text-subtitle-font-weight,500);line-height:var(--adyen-sdk-text-subtitle-line-height,26px);margin:0;padding:0 0 var(--adyen-sdk-spacer-060,12px)}.adyen-checkout__fieldset__title:has(+.adyen-checkout__fieldset__description){padding:0}.adyen-checkout__fieldset__fields{display:flex;flex-wrap:wrap;gap:var(--adyen-sdk-spacer-070,16px);width:100%}.adyen-checkout__fieldset__fields>.adyen-checkout__field{margin-bottom:0}.adyen-checkout__fieldset--readonly .adyen-checkout__fieldset__fields{color:var(--adyen-sdk-color-label-primary,#00112c);font-size:var(--adyen-sdk-text-body-font-size,.875rem);line-height:var(--adyen-sdk-text-caption-line-height,18px);margin:0}
|
|
10
10
|
.adyen-checkout__card__exp-date__input--oneclick{font-weight:var(--adyen-sdk-text-body-font-weight,400);line-height:var(--adyen-sdk-text-title-line-height,26px);overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}
|
|
11
11
|
.adyen-checkout__radio_group+.adyen-checkout-input__inline-validation{display:none}.adyen-checkout__radio_group__input{opacity:0;position:absolute}.adyen-checkout__radio_group__label{color:inherit;display:block;font-size:var(--adyen-sdk-text-body-font-size,.875rem);font-weight:400;line-height:var(--adyen-sdk-text-body-line-height,20px);margin:0;overflow:visible;padding-bottom:0;padding-left:var(--adyen-sdk-spacer-090,24px);position:relative}.adyen-checkout__label--focused .adyen-checkout__radio_group__label{color:inherit}.adyen-checkout__radio_group__label:before{background-color:var(--adyen-sdk-color-background-primary,#ffffff);border:var(--adyen-sdk-border-width-s,1px) solid var(--adyen-sdk-color-outline-tertiary,#8d95a3);border-radius:50%;content:"";height:var(--adyen-sdk-spacer-070,16px);left:0;position:absolute;top:var(--adyen-sdk-spacer-010,2px);transition:border-color .2s ease-out,box-shadow .2s ease-out;width:var(--adyen-sdk-spacer-070,16px)}.adyen-checkout__radio_group__label:hover:before{box-shadow:0 0 0 var(--adyen-sdk-spacer-010,2px) var(--adyen-sdk-color-outline-primary-hover,#c9cdd3);cursor:pointer}.adyen-checkout__radio_group__label:after{background-color:var(--adyen-sdk-color-background-primary,#ffffff);border-radius:50%;box-shadow:0 1px 1px rgba(0,15,45,.25);content:"";display:block;height:var(--adyen-sdk-spacer-030,6px);left:5px;margin:0 auto;position:absolute;top:7px;transform:scale(0);transition:transform .2s ease-out;width:var(--adyen-sdk-spacer-030,6px)}.adyen-checkout__radio_group__label:hover{border-color:var(--adyen-sdk-color-label-primary,#00112c);cursor:pointer}.adyen-checkout__radio_group__input:checked+.adyen-checkout__radio_group__label:before,.adyen-checkout__radio_group__label--selected{background-color:var(--adyen-sdk-color-label-primary,#00112c);border:0;transition:all .2s ease-out}.adyen-checkout__radio_group__input:checked+.adyen-checkout__radio_group__label:after{transform:scale(1)}.adyen-checkout__radio_group__input:focus+.adyen-checkout__radio_group__label:before{border-color:var(--adyen-sdk-color-label-primary,#00112c)}.adyen-checkout__radio_group__input:checked+.adyen-checkout__radio_group__label:hover:before,.adyen-checkout__radio_group__input:checked:active+.adyen-checkout__radio_group__label:before,.adyen-checkout__radio_group__input:checked:focus+.adyen-checkout__radio_group__label:before,.adyen-checkout__radio_group__input:focus+.adyen-checkout__radio_group__label:before{box-shadow:0 0 0 var(--adyen-sdk-spacer-010,2px) var(--adyen-sdk-color-outline-tertiary,#8d95a3)}.adyen-checkout__radio_group__label.adyen-checkout__radio_group__label--invalid:before{border:var(--adyen-sdk-border-width-s,1px) solid var(--adyen-sdk-color-outline-critical,#e22d2d)}.adyen-checkout__radio_group--button{align-items:flex-start;align-self:stretch;display:flex;flex-wrap:wrap;gap:var(--adyen-sdk-spacer-070,16px);width:100%}.adyen-checkout__radio_group--button .adyen-checkout__radio_group__input-wrapper{display:flex;flex:1 0 0}.adyen-checkout__radio_group--button .adyen-checkout__radio_group__label:after{left:calc(var(--adyen-sdk-spacer-060, 12px) + 5px);position:absolute;top:calc(50% - var(--adyen-sdk-spacer-030, 6px)/2)}.adyen-checkout__radio_group--button .adyen-checkout__radio_group__label:before{left:calc(var(--adyen-sdk-spacer-060, 12px));position:absolute;top:calc(50% - var(--adyen-sdk-spacer-070, 16px)/2)}.adyen-checkout__radio_group--button .adyen-checkout__radio_group__label{background-color:var(--adyen-sdk-color-background-primary,#ffffff);border:var(--adyen-sdk-border-width-s,1px) solid var(--adyen-sdk-color-outline-primary,#dbdee2);border-radius:var(--adyen-sdk-border-radius-m,8px);padding:var(--adyen-sdk-spacer-060,12px);padding-left:calc(var(--adyen-sdk-spacer-060, 12px) + var(--adyen-sdk-spacer-090, 24px));width:100%}.adyen-checkout__radio_group--button .adyen-checkout__radio_group__input+.adyen-checkout__radio_group__label:hover,.adyen-checkout__radio_group--button .adyen-checkout__radio_group__input:checked+.adyen-checkout__radio_group__label{border-color:var(--adyen-sdk-color-outline-primary-active,#00112c)}.adyen-checkout__radio_group--button .adyen-checkout__radio_group__input:checked:active+.adyen-checkout__radio_group__label,.adyen-checkout__radio_group--button .adyen-checkout__radio_group__input:checked:focus+.adyen-checkout__radio_group__label{border-color:var(--adyen-sdk-color-outline-primary-active,#00112c);box-shadow:0 0 0 .5px var(--adyen-sdk-color-outline-primary-active,#00112c)}
|
|
12
|
-
.adyen-checkout__dropdown__button-icon--left{flex-direction:row-reverse;justify-content:flex-end}.adyen-checkout__dropdown__button-icon--left>img{margin-left:0;margin-right:var(--adyen-sdk-spacer-060,12px)}.adyen-checkout__dropdown{max-width:100%;position:relative}.adyen-checkout__dropdown,.adyen-checkout__dropdown__button{font-size:var(--adyen-sdk-text-subtitle-font-size,1rem);width:100%}.adyen-checkout__dropdown__button{align-items:center;background:inherit;border-radius:inherit;color:var(--adyen-sdk-color-label-primary,#00112c);cursor:pointer;display:flex;height:var(--adyen-sdk-spacer-110,40px);line-height:var(--adyen-sdk-text-body-line-height,20px);outline:0;padding:0 var(--adyen-sdk-spacer-060,12px);text-decoration:none;transition:border .2s ease-out,box-shadow .2s ease-out;-webkit-user-select:none;-moz-user-select:none;user-select:none}[dir=rtl] .adyen-checkout__dropdown__button{padding:7px var(--adyen-sdk-spacer-060,12px) 7px var(--adyen-sdk-spacer-090,24px)}.adyen-checkout__dropdown__button:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='17' fill='none' viewBox='0 0 16 17'%3E%3Cpath fill='%2300112c' fill-rule='evenodd' d='M4.47 6.47a.75.75 0 0 1 1.06 0L8 8.94l2.47-2.47a.75.75 0 0 1 1.06 1.06l-3 3a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 0 1 0-1.06' clip-rule='evenodd'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;content:"";height:var(--adyen-sdk-spacer-030,6px);position:absolute;right:var(--adyen-sdk-spacer-070,16px);width:var(--adyen-sdk-spacer-040,8px)}[dir=rtl] .adyen-checkout__dropdown__button:after{left:var(--adyen-sdk-spacer-070,16px);right:auto}.adyen-checkout__dropdown__button--active:after{transform:rotate(180deg)}.adyen-checkout__dropdown__button--disabled{opacity:.4}.adyen-checkout__dropdown__button--readonly,.adyen-checkout__dropdown__button--readonly--active,.adyen-checkout__dropdown__button--readonly:focus,.adyen-checkout__dropdown__button--readonly:hover{background:var(--adyen-sdk-color-background-disabled,#eeeff1);border-color:transparent;color:var(--adyen-sdk-color-label-primary,#00112c);cursor:not-allowed}.adyen-checkout__dropdown__button--readonly:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='7' fill='none' viewBox='0 0 8 7'%3E%3Cpath fill='%23b9c4c9' d='M3.195 6.565a1 1 0 0 0 1.6 0l2.992-3.98a1 1 0 0 0-.8-1.602H1.013a1 1 0 0 0-.8 1.6z'/%3E%3C/svg%3E")}.adyen-checkout__dropdown__button--invalid{border-color:var(--adyen-sdk-color-outline-critical,#e22d2d)}.adyen-checkout__dropdown__button__icon{border-radius:3px;height:26px;margin-right:var(--adyen-sdk-spacer-060,12px);max-width:var(--adyen-sdk-spacer-110,40px)}.adyen-checkout__dropdown__button__text{flex-grow:1;overflow:hidden;pointer-events:none;text-align:left;text-overflow:ellipsis;white-space:nowrap}.adyen-checkout__dropdown__button__text-placeholder{color:var(--adyen-sdk-color-label-secondary,#5c687c)}.adyen-checkout__dropdown__button__secondary-text{margin-right:var(--adyen-sdk-spacer-070,16px)}.adyen-checkout__filter-input{background:inherit;border:0;color:var(--adyen-sdk-color-label-primary,#00112c);font-family:inherit;font-size:var(--adyen-sdk-text-subtitle-font-size,1rem);height:100%;padding:0;width:100%}.adyen-checkout__filter-input:active,.adyen-checkout__filter-input:focus{outline:0}.adyen-checkout__filter-input[readonly]{border-color:transparent;color:var(--adyen-sdk-color-label-secondary,#5c687c)!important;cursor:not-allowed}.adyen-checkout__dropdown__list{background:var(--adyen-sdk-color-background-primary,#ffffff);border-radius:var(--adyen-sdk-border-radius-m,8px);box-shadow:0 var(--adyen-sdk-spacer-010,2px) 7px rgba(0,15,45,.3);display:none;list-style:none;margin:0 0 var(--adyen-sdk-spacer-120,48px);max-height:375px;overflow-y:auto;padding:0;position:absolute;width:100%;z-index:2}.adyen-checkout__dropdown__list.adyen-checkout__dropdown__list--active{display:block;margin-top:var(--adyen-sdk-spacer-010,2px)}.adyen-checkout__dropdown__element{align-items:center;border:var(--adyen-sdk-border-width-s,1px) solid transparent;cursor:pointer;display:flex;font-size:var(--adyen-sdk-text-body-font-size,.875rem);hyphens:auto;line-height:var(--adyen-sdk-text-body-line-height,20px);outline:0;padding:var(--adyen-sdk-spacer-040,8px);transition:background .2s ease-out,border-color .2s ease-out;-webkit-user-select:none;-moz-user-select:none;user-select:none;word-break:break-word}.adyen-checkout__dropdown__element .adyen-checkout__icon{position:absolute;right:var(--adyen-sdk-spacer-040,8px)}.adyen-checkout__dropdown__element:last-child{border-bottom:0}.adyen-checkout__dropdown__element.adyen-checkout__dropdown__element--active{background:rgba(230,233,235,.6)}.adyen-checkout__dropdown__element.adyen-checkout__dropdown__element--selected{background:rgba(0,102,255,.1)}.adyen-checkout__dropdown__element.adyen-checkout__dropdown__element--selected:active,.adyen-checkout__dropdown__element.adyen-checkout__dropdown__element--selected:focus,.adyen-checkout__dropdown__element.adyen-checkout__dropdown__element--selected:hover{background:rgba(0,102,255,.15)}.adyen-checkout__dropdown__element--disabled{cursor:not-allowed;opacity:.4}.adyen-checkout__dropdown__element__icon{border-radius:var(--adyen-sdk-border-radius-s,4px);margin-right:var(--adyen-sdk-spacer-060,12px);max-height:26px;max-width:var(--adyen-sdk-spacer-110,40px)}.adyen-checkout__dropdown__element__text{flex-grow:1}.adyen-checkout__dropdown__element__secondary-text:not(:last-child){margin-right:var(--adyen-sdk-spacer-040,8px)}.adyen-checkout__dropdown__element__flag{margin-left:var(--adyen-sdk-spacer-040,8px);margin-right:var(--adyen-sdk-spacer-050,10px);max-height:18px;max-width:27px}.adyen-checkout__dropdown+.adyen-checkout-input__inline-validation{right:var(--adyen-sdk-spacer-100,32px)}
|
|
12
|
+
.adyen-checkout__dropdown__button-icon--left{flex-direction:row-reverse;justify-content:flex-end}.adyen-checkout__dropdown__button-icon--left>img{margin-left:0;margin-right:var(--adyen-sdk-spacer-060,12px)}.adyen-checkout__dropdown{max-width:100%;position:relative}.adyen-checkout__dropdown,.adyen-checkout__dropdown__button{font-size:var(--adyen-sdk-text-subtitle-font-size,1rem);width:100%}.adyen-checkout__dropdown__button{align-items:center;background:inherit;border-radius:inherit;color:var(--adyen-sdk-color-label-primary,#00112c);cursor:pointer;display:flex;height:var(--adyen-sdk-spacer-110,40px);line-height:var(--adyen-sdk-text-body-line-height,20px);outline:0;padding:0 var(--adyen-sdk-spacer-060,12px);text-decoration:none;transition:border .2s ease-out,box-shadow .2s ease-out;-webkit-user-select:none;-moz-user-select:none;user-select:none}[dir=rtl] .adyen-checkout__dropdown__button{padding:7px var(--adyen-sdk-spacer-060,12px) 7px var(--adyen-sdk-spacer-090,24px)}.adyen-checkout__dropdown__button:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='17' fill='none' viewBox='0 0 16 17'%3E%3Cpath fill='%2300112c' fill-rule='evenodd' d='M4.47 6.47a.75.75 0 0 1 1.06 0L8 8.94l2.47-2.47a.75.75 0 0 1 1.06 1.06l-3 3a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 0 1 0-1.06' clip-rule='evenodd'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;content:"";height:var(--adyen-sdk-spacer-030,6px);position:absolute;right:var(--adyen-sdk-spacer-070,16px);width:var(--adyen-sdk-spacer-040,8px)}[dir=rtl] .adyen-checkout__dropdown__button:after{left:var(--adyen-sdk-spacer-070,16px);right:auto}.adyen-checkout__dropdown__button--active:after{transform:rotate(180deg)}.adyen-checkout__dropdown__button--disabled{opacity:.4}.adyen-checkout__dropdown__button--readonly,.adyen-checkout__dropdown__button--readonly--active,.adyen-checkout__dropdown__button--readonly:focus,.adyen-checkout__dropdown__button--readonly:hover{background:var(--adyen-sdk-color-background-disabled,#eeeff1);border-color:transparent;color:var(--adyen-sdk-color-label-primary,#00112c);cursor:not-allowed}.adyen-checkout__dropdown__button--readonly:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='7' fill='none' viewBox='0 0 8 7'%3E%3Cpath fill='%23b9c4c9' d='M3.195 6.565a1 1 0 0 0 1.6 0l2.992-3.98a1 1 0 0 0-.8-1.602H1.013a1 1 0 0 0-.8 1.6z'/%3E%3C/svg%3E")}.adyen-checkout__dropdown__button--invalid{border-color:var(--adyen-sdk-color-outline-critical,#e22d2d)}.adyen-checkout__dropdown__button__icon{border-radius:3px;height:26px;margin-right:var(--adyen-sdk-spacer-060,12px);max-width:var(--adyen-sdk-spacer-110,40px)}.adyen-checkout__dropdown__button__text{flex-grow:1;overflow:hidden;pointer-events:none;text-align:left;text-overflow:ellipsis;white-space:nowrap}.adyen-checkout__dropdown__button__text-placeholder{color:var(--adyen-sdk-color-label-secondary,#5c687c)}.adyen-checkout__dropdown__button__secondary-text{margin-right:var(--adyen-sdk-spacer-070,16px)}.adyen-checkout__filter-input{background:inherit;border:0;color:var(--adyen-sdk-color-label-primary,#00112c);font-family:inherit;font-size:var(--adyen-sdk-text-subtitle-font-size,1rem);height:100%;padding:0;width:100%}.adyen-checkout__filter-input:active,.adyen-checkout__filter-input:focus{outline:0}.adyen-checkout__filter-input[readonly]{border-color:transparent;color:var(--adyen-sdk-color-label-secondary,#5c687c)!important;cursor:not-allowed}.adyen-checkout__dropdown__list{background:var(--adyen-sdk-color-background-primary,#ffffff);border-radius:var(--adyen-sdk-border-radius-m,8px);box-shadow:0 var(--adyen-sdk-spacer-010,2px) 7px rgba(0,15,45,.3);display:none;list-style:none;margin:0 0 var(--adyen-sdk-spacer-120,48px);max-height:375px;overflow-y:auto;padding:0;position:absolute;width:100%;z-index:2}.adyen-checkout__dropdown__list.adyen-checkout__dropdown__list--active{display:block;margin-top:var(--adyen-sdk-spacer-010,2px)}.adyen-checkout__dropdown__element{align-items:center;border:var(--adyen-sdk-border-width-s,1px) solid transparent;cursor:pointer;display:flex;font-size:var(--adyen-sdk-text-body-font-size,.875rem);hyphens:auto;line-height:var(--adyen-sdk-text-body-line-height,20px);outline:0;padding:var(--adyen-sdk-spacer-040,8px);transition:background .2s ease-out,border-color .2s ease-out;-webkit-user-select:none;-moz-user-select:none;user-select:none;word-break:break-word}.adyen-checkout__dropdown__element .adyen-checkout__icon{position:absolute;right:var(--adyen-sdk-spacer-040,8px)}.adyen-checkout__dropdown__element:last-child{border-bottom:0}.adyen-checkout__dropdown__element.adyen-checkout__dropdown__element--active{background:rgba(230,233,235,.6);border-radius:var(--adyen-sdk-border-radius-m,8px);box-shadow:inset 0 0 0 var(--adyen-sdk-border-width-s,1px) var(--adyen-sdk-color-outline-primary-active,#00112c)}.adyen-checkout__dropdown__element:hover{background:rgba(230,233,235,.6)}.adyen-checkout__dropdown__element.adyen-checkout__dropdown__element--selected{background:rgba(0,102,255,.1)}.adyen-checkout__dropdown__element.adyen-checkout__dropdown__element--selected:active,.adyen-checkout__dropdown__element.adyen-checkout__dropdown__element--selected:focus,.adyen-checkout__dropdown__element.adyen-checkout__dropdown__element--selected:hover{background:rgba(0,102,255,.15)}.adyen-checkout__dropdown__element--disabled{cursor:not-allowed;opacity:.4}.adyen-checkout__dropdown__element__icon{border-radius:var(--adyen-sdk-border-radius-s,4px);margin-right:var(--adyen-sdk-spacer-060,12px);max-height:26px;max-width:var(--adyen-sdk-spacer-110,40px)}.adyen-checkout__dropdown__element__text{flex-grow:1}.adyen-checkout__dropdown__element__secondary-text:not(:last-child){margin-right:var(--adyen-sdk-spacer-040,8px)}.adyen-checkout__dropdown__element__flag{margin-left:var(--adyen-sdk-spacer-040,8px);margin-right:var(--adyen-sdk-spacer-050,10px);max-height:18px;max-width:27px}.adyen-checkout__dropdown+.adyen-checkout-input__inline-validation{right:var(--adyen-sdk-spacer-100,32px)}
|
|
13
13
|
.adyen-checkout__installments--revolving-plan .adyen-checkout__input-wrapper{background-color:transparent;border:none;box-shadow:none}.adyen-checkout__installments--revolving-plan .adyen-checkout__input-wrapper:active,.adyen-checkout__installments--revolving-plan .adyen-checkout__input-wrapper:active:hover,.adyen-checkout__installments--revolving-plan .adyen-checkout__input-wrapper:focus-within,.adyen-checkout__installments--revolving-plan .adyen-checkout__input-wrapper:focus-within:hover{box-shadow:none}.adyen-checkout__installments--revolving-plan .adyen-checkout__fieldset--revolving-plan{margin-top:-5px}
|
|
14
14
|
.adyen-checkout-disclaimer__label{color:var(--adyen-sdk-color-label-secondary,#5c687c);display:inline-block;font-size:var(--adyen-sdk-text-caption-font-size,.75rem);font-weight:400;line-height:var(--adyen-sdk-text-caption-line-height,18px);margin-top:var(--adyen-sdk-spacer-070,16px);padding-left:0}[dir=rtl] .adyen-checkout-disclaimer__label{padding-right:0}
|
|
15
15
|
.adyen-checkout-link{--text-decoration:none;color:var(--adyen-sdk-color-label-highlight,#0070f5);-webkit-text-decoration:var(--text-decoration);text-decoration:var(--text-decoration)}.adyen-checkout-link:focus-visible{outline:none}.adyen-checkout-link:active,.adyen-checkout-link:hover{--text-decoration:underline}.adyen-checkout-link:focus-visible{border-radius:var(--adyen-sdk-border-radius-xs,2px);box-shadow:0 0 0 1px #fff,0 0 0 3px var(--adyen-sdk-focus-ring-color,rgba(0,112,245,.8));transition:.1s cubic-bezier(.785,.135,.15,.86)}
|