@adyen/adyen-web 6.32.0 → 6.33.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.
Files changed (49) hide show
  1. package/dist/cjs/index.cjs +1 -1
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.cts +26 -8
  4. package/dist/es/components/ApplePay/ApplePay.js +1 -1
  5. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  6. package/dist/es/components/ApplePay/services/ApplePayService.js +1 -1
  7. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
  8. package/dist/es/components/ApplePay/utils/payment-request.js +1 -1
  9. package/dist/es/components/ApplePay/utils/payment-request.js.map +1 -1
  10. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  11. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  12. package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js +1 -1
  13. package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
  14. package/dist/es/components/internal/Brand/Brand.js +1 -1
  15. package/dist/es/components/internal/Brand/Brand.js.map +1 -1
  16. package/dist/es/components/internal/PayButton/PayButton.js +1 -1
  17. package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
  18. package/dist/es/components/internal/PayButton/utils.js +1 -1
  19. package/dist/es/components/internal/PayButton/utils.js.map +1 -1
  20. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  21. package/dist/es/core/Environment/constants.js +1 -1
  22. package/dist/es/core/Environment/constants.js.map +1 -1
  23. package/dist/es/core/config.js +1 -1
  24. package/dist/es/core/core.js +1 -1
  25. package/dist/es/core/core.js.map +1 -1
  26. package/dist/es/index.d.ts +26 -8
  27. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  28. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  29. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js +1 -1
  30. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
  31. package/dist/es-legacy/components/ApplePay/utils/payment-request.js +1 -1
  32. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
  33. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  34. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  35. package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js +1 -1
  36. package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
  37. package/dist/es-legacy/components/internal/Brand/Brand.js +1 -1
  38. package/dist/es-legacy/components/internal/Brand/Brand.js.map +1 -1
  39. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  40. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  41. package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
  42. package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
  43. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  44. package/dist/es-legacy/core/Environment/constants.js +1 -1
  45. package/dist/es-legacy/core/Environment/constants.js.map +1 -1
  46. package/dist/es-legacy/core/config.js +1 -1
  47. package/dist/es-legacy/core/core.js +1 -1
  48. package/dist/es-legacy/core/core.js.map +1 -1
  49. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { createRef, h, RefObject } from 'preact';\nimport { Resources } from '../../../core/Context/Resources';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\n\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventType } from '../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AnalyticsLogEvent, LogEventType } from '../../../core/Analytics/events/AnalyticsLogEvent';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\nimport type { AdditionalDetailsData, CoreConfiguration, ICore } from '../../../core/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentMethod\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { ComponentMethodsRef, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport './UIElement.scss';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { AmountProvider, AmountProviderRef } from '../../../core/Context/AmountProvider';\nimport { PayButtonProps } from '../PayButton/PayButton';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static readonly type = undefined;\n\n /**\n * Reference to the methods exposed by the AmountProvider context\n */\n protected amountProviderRef: RefObject<AmountProviderRef> = createRef();\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static readonly txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n this.core.register(this.constructor as NewableComponent);\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n this.updateAmount = this.updateAmount.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n\n this.onEnterKeyPressed = this.onEnterKeyPressed.bind(this);\n this.onActionHandled = this.onActionHandled.bind(this);\n\n this.createBeforeRenderHook(props);\n this.reportIntegrationFlavor();\n }\n\n /**\n * Creates a hook tied to render() method. This hook is called every time render() is invoked.\n * Currently useful for Analytics\n *\n * @param configSetByMerchant\n * @private\n */\n private createBeforeRenderHook(configSetByMerchant: P): void {\n const originalRender = this.render;\n\n this.render = (...args: any[]) => {\n this.beforeRender(configSetByMerchant);\n return originalRender.apply(this, args);\n };\n }\n\n protected beforeRender(configSetByMerchant?: P): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && { isStoredPaymentMethod: true })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n protected reportIntegrationFlavor(): void {\n void this.analytics.sendFlavor('components');\n }\n\n get analytics(): IAnalytics {\n return this.core.modules.analytics;\n }\n\n get srPanel(): SRPanel {\n return this.core.modules.srPanel;\n }\n\n protected getPaymentMethodConfigFromResponse(componentProps: P) {\n if (componentProps?.storedPaymentMethodId) return this.getStoredPaymentMethodDetails(componentProps.storedPaymentMethodId);\n return this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type, componentProps?.paymentMethodId);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n\n const paymentMethodFromResponse = this.getPaymentMethodConfigFromResponse(componentProps);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropinInstance = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropinInstance), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected getStoredPaymentMethodDetails(storedPaymentMethodId: string) {\n return this.core.paymentMethodsResponse.findStoredPaymentMethod(storedPaymentMethodId);\n }\n\n /**\n * Get the payment method from the paymentMethodsResponse\n *\n * @param type - The type of the payment method to get. (This prop is passed by Drop-in OR Standalone components containing the property 'type' as part of their configuration)\n * @param paymentMethodId - Unique internal payment method ID\n */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n /**\n * Updates the amount in the props and propagates it to the AmountProvider.\n * This allows children components to access the updated amount via context.\n *\n * @param amount - Primary payment amount object\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n public updateAmount(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n this.props = {\n ...this.props,\n ...(amount && { amount }),\n ...(secondaryAmount && { secondaryAmount })\n };\n this.amountProviderRef.current?.update(amount, secondaryAmount);\n }\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx\n */\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n /**\n * componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx\n */\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n protected override submitAnalytics(event: AbstractAnalyticsEvent) {\n this.analytics.sendAnalytics(event);\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) => {\n void this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject: () => reject(new CancelError('beforeSubmitRejected'))\n });\n })\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CNDBAjOa+B88wRoj/rLTieuWh/0leR88qkV24vtIkjsIsbJTDB78Pd8wX8MEDsXhaAdEIyX9E8eqxuQ3bwPbvLs1Dlgo1ZrfkQRzaNiuVM8ejRG0IWE1bGThJzY+sJvZZHvlDMXIlxhZcDoQvsMj/WwE6+nFJxBiC3oRzmvVn3AbkLQGtvwq16UUSfYbPzG9dXypJMtcrZAQYq2g/2+BSibCcmee9AXq/wij11BERrYmjbDt5NkkdUnDVgAB7pdqbnWX0A2sxBKeYtLSP2kxp+5LoU/Wty3fmcVA3VKVkHfgmIihkeL8lY++5hvHjnkzOE4tyx/sheiKS4zqoWE43TD6n8mpFskAzwMHq4G2o6vkXqvaKFEq7y/R2fVrCypenmRhkPASizpM265rKLU+L4E/C+LMHfN0LYKRMCrLr0gI2GAp+1PZLH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zeydq30bUGqCwglj8CrFViAuQeTJm7dp+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: PayButtonProps) => {\n return <PayButton {...props} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<void | PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return resolve();\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n\n protected abstract componentToRender(): h.JSX.Element;\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources} analytics={this.analytics}>\n <SRPanelProvider srPanel={this.srPanel}>\n <AmountProvider amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} providerRef={this.amountProviderRef}>\n {this.componentToRender()}\n </AmountProvider>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","createBeforeRenderHook","configSetByMerchant","originalRender","this","render","args","beforeRender","apply","originalAction","event","AnalyticsInfoEvent","_object_spread","type","InfoEventType","rendered","component","configData","_object_spread_props","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","_this_core_paymentMethodsResponse","findById","find","storeElementRefOnCore","isDropin","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","updateAmount","amount","secondaryAmount","_this_amountProviderRef_current","amountProviderRef","current","update","setElementStatus","status","_this_elementRef","elementRef","setStatus","_this_componentRef","_this_props_onChange","_this_props","call","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","_this_props_onActionHandled","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","document","key","code","preventDefault","onEnterKeyPressed","activeElement","blur","updateParent","icon","_this_props_icon","paymentMethodType","resources","getImage","displayName","_this_core_paymentMethodsResponse_paymentMethods","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","loadingContext","SRPanelProvider","AmountProvider","providerRef","componentToRender","checkout","super","_define_property","createRef","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","_this_props_onOrderUpdated","onOrderUpdated","result","_this_props_onPaymentFailed","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","_this_props_onPaymentCompleted","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","onClick","register","bind","undefined","txVariants"],"mappings":"uzDAsCO,MAAeA,UAA6DC,EAyDvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,KAAKC,OAE5BD,KAAKC,OAAS,IAAIC,KACdF,KAAKG,aAAaL,GACXC,EAAeK,MAAMJ,KAAME,GAE1C,CAEUC,YAAAA,CAAaL,GAEnB,GAAIA,aAAAA,EAAAA,EAAqBO,eACrB,OAGJ,MAAMC,EAAQ,IAAIC,EAAmBC,EAAA,CACjCC,KAAMC,EAAcC,SACpBC,UAAWZ,KAAKS,KAChBI,WAAYC,EAAAN,EAAA,CAAA,EAAKV,GAAAA,CAAqBiB,cAAef,KAAKgB,MAAMD,kBAC5DjB,aAAAA,EAAAA,EAAqBmB,WAAY,CAAEC,uBAAuB,KAGlElB,KAAKmB,UAAUC,cAAcd,EACjC,CAEUe,uBAAAA,GACDrB,KAAKmB,UAAUG,WAAW,aACnC,CAEA,aAAIH,GACA,OAAOnB,KAAKuB,KAAKC,QAAQL,SAC7B,CAEA,WAAIM,GACA,OAAOzB,KAAKuB,KAAKC,QAAQC,OAC7B,CAEUC,kCAAAA,CAAmCC,GACzC,OAAIA,aAAAA,EAAAA,EAAgBC,uBAA8B5B,KAAK6B,8BAA8BF,EAAeC,uBAC7F5B,KAAK8B,2CAA2CH,eAAAA,EAAgBlB,KAAMkB,aAAAA,EAAAA,EAAgBI,gBACjG,CAEmBC,iBAAAA,CAAkBL,GACjC,MAIMM,EAAazB,EAAA,CACfO,eAAe,GALKf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B6F,KAAK5L,MACjEA,KAAK2D,aAAe3D,KAAK2D,aAAaiI,KAAK5L,MAE3CA,KAAKqE,WAAcrD,GAASA,EAAMqD,YAAerE,KACjDA,KAAK4I,UAAY5I,KAAKgB,MAAMQ,QAAUxB,KAAKgB,MAAMQ,QAAQoH,eAAYiD,EAErE7L,KAAK+C,sBAAsB/C,KAAKgB,OAEhChB,KAAKqI,kBAAoBrI,KAAKqI,kBAAkBuD,KAAK5L,MACrDA,KAAKuH,gBAAkBvH,KAAKuH,gBAAgBqE,KAAK5L,MAEjDA,KAAKH,uBAAuBmB,GAC5BhB,KAAKqB,yBACT,EAzCAgJ,EAPkB1K,EAOKc,YAAOoL,GAU9BxB,EAjBkB1K,EAiBKmM,aAAuB"}
1
+ {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { createRef, h, RefObject } from 'preact';\nimport { Resources } from '../../../core/Context/Resources';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\n\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventType } from '../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AnalyticsLogEvent, LogEventType } from '../../../core/Analytics/events/AnalyticsLogEvent';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\nimport type { AdditionalDetailsData, CoreConfiguration, ICore } from '../../../core/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentMethod\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { ComponentMethodsRef, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport './UIElement.scss';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { AmountProvider, AmountProviderRef } from '../../../core/Context/AmountProvider';\nimport { PayButtonProps } from '../PayButton/PayButton';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static readonly type = undefined;\n\n /**\n * Reference to the methods exposed by the AmountProvider context\n */\n protected amountProviderRef: RefObject<AmountProviderRef> = createRef();\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static readonly txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n this.core.register(this.constructor as NewableComponent);\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n this.updateAmount = this.updateAmount.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n\n this.onEnterKeyPressed = this.onEnterKeyPressed.bind(this);\n this.onActionHandled = this.onActionHandled.bind(this);\n\n this.createBeforeRenderHook(props);\n this.reportIntegrationFlavor();\n }\n\n /**\n * Creates a hook tied to render() method. This hook is called every time render() is invoked.\n * Currently useful for Analytics\n *\n * @param configSetByMerchant\n * @private\n */\n private createBeforeRenderHook(configSetByMerchant: P): void {\n const originalRender = this.render;\n\n this.render = (...args: any[]) => {\n this.beforeRender(configSetByMerchant);\n return originalRender.apply(this, args);\n };\n }\n\n protected beforeRender(configSetByMerchant?: P): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && { isStoredPaymentMethod: true })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n protected reportIntegrationFlavor(): void {\n void this.analytics.sendFlavor('components');\n }\n\n get analytics(): IAnalytics {\n return this.core.modules.analytics;\n }\n\n get srPanel(): SRPanel {\n return this.core.modules.srPanel;\n }\n\n protected getPaymentMethodConfigFromResponse(componentProps: P) {\n if (componentProps?.storedPaymentMethodId) return this.getStoredPaymentMethodDetails(componentProps.storedPaymentMethodId);\n return this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type, componentProps?.paymentMethodId);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n\n const paymentMethodFromResponse = this.getPaymentMethodConfigFromResponse(componentProps);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropinInstance = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropinInstance), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected getStoredPaymentMethodDetails(storedPaymentMethodId: string) {\n return this.core.paymentMethodsResponse.findStoredPaymentMethod(storedPaymentMethodId);\n }\n\n /**\n * Get the payment method from the paymentMethodsResponse\n *\n * @param type - The type of the payment method to get. (This prop is passed by Drop-in OR Standalone components containing the property 'type' as part of their configuration)\n * @param paymentMethodId - Unique internal payment method ID\n */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n /**\n * Updates the amount in the props and propagates it to the AmountProvider.\n * This allows children components to access the updated amount via context.\n *\n * @param amount - Primary payment amount object\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n public updateAmount(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n this.props = {\n ...this.props,\n ...(amount && { amount }),\n ...(secondaryAmount && { secondaryAmount })\n };\n this.amountProviderRef.current?.update(amount, secondaryAmount);\n }\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx\n */\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n /**\n * componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx\n */\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n protected override submitAnalytics(event: AbstractAnalyticsEvent) {\n this.analytics.sendAnalytics(event);\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) => {\n void this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject: () => reject(new CancelError('beforeSubmitRejected'))\n });\n })\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CNDBAjOa+B88wRoj/rLTieuWh/0leR88qkV24vtIkjsIsbJTDB78Pd8wX8MEDsXhaAdEIyX9E8eqxuQ3bwPbvLs1Dlgo1ZrfkQRzaNiuVM8ejRG0IWE1bGThJzY+sJvZZHvlDMXIlxhZcDoQvsMj/WwE6+nFJxBiC3oRzmvVn3AbkLQGtvwq16UUSfYbPzG9dXypJMtcrZAQYq2g/2+BSibCcmee9AXq/wij11BERrYmjbDt5NkkdUnDVgAB7pdqbnWX0A2sxBKeYtLSP2kxp+5LoU/Wty3fmcVA3VKVkHfgmIihkeL8lY++5hvHjnkzOE4tyx/sheiKS4zqoWE43TD6n8mpFskAzwMHq4G2o6vkXqvaKFEq7y/R2fVrCypenmRhkPASizpM265rKLU+L4E/C+LMHfN0LYKRMCrLr0gI2GAp+1PZLHgh0tCtiJC/zcJJtJs6sHNQxLUN+kxJuELUHOcuL3ivjG+mWteUnBENZu7KqOSZYetiWYRiyLOXDiBHqbxuQwTuO54L15VLkS/mYB20etibM1nn+fRmbo+1IJkCSalhwi5D7fSrpjbQTmAsOpJT1N8lC1MSNmAvAwG1kWL4JxYwXDKYyYASnsia2V5IjoiQUYwQUFBMTAzQ0E1MzdFQUVEODdDMjRERDUzOTA5QjgwQTc4QTkyM0UzODIzRDY4REFDQzk0QjlGRjgzMDVEQyJ98uZI4thGveOByYbomCeeP2Gy2rzs99FOBoDYVeWIUjyM+gfnW89DdJZAhxe74Tv0TnL5DRQYPCTRQPOoLbQ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HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n this.handleAdditionalDetails(state);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (error.name === NETWORK_ERROR && error.options.code) {\n const event = new AnalyticsErrorEvent({\n component: this.type,\n errorType: ErrorEventType.apiError,\n code: error.options.code\n });\n\n this.submitAnalytics(event);\n }\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /details call', { cause: error }));\n\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session\n ? this.core.update({\n order\n })\n : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * Expected to be called after sanitizeResponse has been run on the raw payment response\n *\n * @param response -\n */\n protected handleResponse(response: PaymentResponseData): void {\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent) {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n\n this.onEnterKeyPressed(document?.activeElement, this);\n }\n }\n\n /**\n * Handle Enter key pressed from a UIElement (called via handleKeyPress)\n * @param obj\n */\n protected onEnterKeyPressed(activeElement: Element, component: UIElement) {\n if (this.props.onEnterKeyPressed) {\n this.props.onEnterKeyPressed(activeElement, component);\n } else {\n (activeElement as HTMLElement).blur();\n this.submit();\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protected _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonProps) => {\n return <PayButton {...props} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<void | PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return resolve();\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n\n protected abstract componentToRender(): h.JSX.Element;\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources} analytics={this.analytics}>\n <SRPanelProvider srPanel={this.srPanel}>\n <AmountProvider amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} providerRef={this.amountProviderRef}>\n {this.componentToRender()}\n </AmountProvider>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","createBeforeRenderHook","configSetByMerchant","originalRender","this","render","args","beforeRender","apply","originalAction","event","AnalyticsInfoEvent","_object_spread","type","InfoEventType","rendered","component","configData","_object_spread_props","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","_this_core_paymentMethodsResponse","findById","find","storeElementRefOnCore","isDropin","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","updateAmount","amount","secondaryAmount","_this_amountProviderRef_current","amountProviderRef","current","update","setElementStatus","status","_this_elementRef","elementRef","setStatus","_this_componentRef","_this_props_onChange","_this_props","call","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","_this_props_onActionHandled","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","document","key","code","preventDefault","onEnterKeyPressed","activeElement","blur","updateParent","icon","_this_props_icon","paymentMethodType","resources","getImage","displayName","_this_core_paymentMethodsResponse_paymentMethods","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","loadingContext","SRPanelProvider","AmountProvider","providerRef","componentToRender","checkout","super","_define_property","createRef","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","_this_props_onOrderUpdated","onOrderUpdated","result","_this_props_onPaymentFailed","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","_this_props_onPaymentCompleted","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","onClick","register","bind","undefined","txVariants"],"mappings":"uzDAsCO,MAAeA,UAA6DC,EAyDvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,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EAPkB1K,EAOKc,YAAOoL,GAU9BxB,EAjBkB1K,EAiBKmM,aAAuB"}
@@ -1,2 +1,2 @@
1
- const e={test:"https://checkoutshopper-test.adyen.com/checkoutshopper/",live:"https://checkoutshopper-live.adyen.com/checkoutshopper/","live-us":"https://checkoutshopper-live-us.adyen.com/checkoutshopper/","live-au":"https://checkoutshopper-live-au.adyen.com/checkoutshopper/","live-apse":"https://checkoutshopper-live-apse.adyen.com/checkoutshopper/","live-in":"https://checkoutshopper-live-in.adyen.com/checkoutshopper/",fallback:"https://checkoutshopper-live.adyen.com/checkoutshopper/"},c={test:"https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/",live:"https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/","live-us":"https://checkoutshopper-live-us.cdn.adyen.com/checkoutshopper/","live-au":"https://checkoutshopper-live-au.cdn.adyen.com/checkoutshopper/","live-apse":"https://checkoutshopper-live-apse.cdn.adyen.com/checkoutshopper/","live-in":"https://checkoutshopper-live-in.cdn.adyen.com/checkoutshopper/",fallback:"https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/"},t={test:"https://checkoutanalytics-test.adyen.com/checkoutanalytics/",live:"https://checkoutanalytics-live.adyen.com/checkoutanalytics/","live-us":"https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/","live-au":"https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/","live-apse":"https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/","live-in":"https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/",fallback:"https://checkoutanalytics-live.adyen.com/checkoutanalytics/"};export{t as ANALYTICS_ENVIRONMENTS,e as API_ENVIRONMENTS,c as CDN_ENVIRONMENTS};
1
+ const e={test:"https://checkoutshopper-test.adyen.com/checkoutshopper/",live:"https://checkoutshopper-live.adyen.com/checkoutshopper/","live-us":"https://checkoutshopper-live-us.adyen.com/checkoutshopper/","live-au":"https://checkoutshopper-live-au.adyen.com/checkoutshopper/","live-apse":"https://checkoutshopper-live-apse.adyen.com/checkoutshopper/","live-in":"https://checkoutshopper-live-in.adyen.com/checkoutshopper/","live-nea":"https://checkoutshopper-live-nea.adyen.com/checkoutshopper/",fallback:"https://checkoutshopper-live.adyen.com/checkoutshopper/"},c={test:"https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/",live:"https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/","live-us":"https://checkoutshopper-live-us.cdn.adyen.com/checkoutshopper/","live-au":"https://checkoutshopper-live-au.cdn.adyen.com/checkoutshopper/","live-apse":"https://checkoutshopper-live-apse.cdn.adyen.com/checkoutshopper/","live-in":"https://checkoutshopper-live-in.cdn.adyen.com/checkoutshopper/","live-nea":"https://checkoutshopper-live-nea.cdn.adyen.com/checkoutshopper/",fallback:"https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/"},t={test:"https://checkoutanalytics-test.adyen.com/checkoutanalytics/",live:"https://checkoutanalytics-live.adyen.com/checkoutanalytics/","live-us":"https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/","live-au":"https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/","live-apse":"https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/","live-in":"https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/","live-nea":"https://checkoutanalytics-live-nea.adyen.com/checkoutanalytics/",fallback:"https://checkoutanalytics-live.adyen.com/checkoutanalytics/"};export{t as ANALYTICS_ENVIRONMENTS,e as API_ENVIRONMENTS,c as CDN_ENVIRONMENTS};
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/core/Environment/constants.ts"],"sourcesContent":["const API_ENVIRONMENTS = {\n test: 'https://checkoutshopper-test.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.adyen.com/checkoutshopper/',\n fallback: 'https://checkoutshopper-live.adyen.com/checkoutshopper/'\n};\n\nconst CDN_ENVIRONMENTS = {\n test: 'https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.cdn.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.cdn.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.cdn.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.cdn.adyen.com/checkoutshopper/',\n fallback: 'https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/'\n};\n\nconst ANALYTICS_ENVIRONMENTS = {\n test: 'https://checkoutanalytics-test.adyen.com/checkoutanalytics/',\n live: 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/',\n 'live-us': 'https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/',\n 'live-au': 'https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/',\n 'live-apse': 'https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/',\n 'live-in': 'https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/',\n fallback: 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/'\n};\n\nexport { API_ENVIRONMENTS, CDN_ENVIRONMENTS, ANALYTICS_ENVIRONMENTS };\n"],"names":["API_ENVIRONMENTS","test","live","fallback","CDN_ENVIRONMENTS","ANALYTICS_ENVIRONMENTS"],"mappings":"AAAA,MAAMA,EAAmB,CACrBC,KAAM,0DACNC,KAAM,0DACN,UAAW,6DACX,UAAW,6DACX,YAAa,+DACb,UAAW,6DACXC,SAAU,2DAGRC,EAAmB,CACrBH,KAAM,8DACNC,KAAM,8DACN,UAAW,iEACX,UAAW,iEACX,YAAa,mEACb,UAAW,iEACXC,SAAU,+DAGRE,EAAyB,CAC3BJ,KAAM,8DACNC,KAAM,8DACN,UAAW,iEACX,UAAW,iEACX,YAAa,mEACb,UAAW,iEACXC,SAAU"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/core/Environment/constants.ts"],"sourcesContent":["const API_ENVIRONMENTS = {\n test: 'https://checkoutshopper-test.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.adyen.com/checkoutshopper/',\n 'live-nea': 'https://checkoutshopper-live-nea.adyen.com/checkoutshopper/',\n fallback: 'https://checkoutshopper-live.adyen.com/checkoutshopper/'\n};\n\nconst CDN_ENVIRONMENTS = {\n test: 'https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.cdn.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.cdn.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.cdn.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.cdn.adyen.com/checkoutshopper/',\n 'live-nea': 'https://checkoutshopper-live-nea.cdn.adyen.com/checkoutshopper/',\n fallback: 'https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/'\n};\n\nconst ANALYTICS_ENVIRONMENTS = {\n test: 'https://checkoutanalytics-test.adyen.com/checkoutanalytics/',\n live: 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/',\n 'live-us': 'https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/',\n 'live-au': 'https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/',\n 'live-apse': 'https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/',\n 'live-in': 'https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/',\n 'live-nea': 'https://checkoutanalytics-live-nea.adyen.com/checkoutanalytics/',\n fallback: 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/'\n};\n\nexport { API_ENVIRONMENTS, CDN_ENVIRONMENTS, ANALYTICS_ENVIRONMENTS };\n"],"names":["API_ENVIRONMENTS","test","live","fallback","CDN_ENVIRONMENTS","ANALYTICS_ENVIRONMENTS"],"mappings":"AAAA,MAAMA,EAAmB,CACrBC,KAAM,0DACNC,KAAM,0DACN,UAAW,6DACX,UAAW,6DACX,YAAa,+DACb,UAAW,6DACX,WAAY,8DACZC,SAAU,2DAGRC,EAAmB,CACrBH,KAAM,8DACNC,KAAM,8DACN,UAAW,iEACX,UAAW,iEACX,YAAa,mEACb,UAAW,iEACX,WAAY,kEACZC,SAAU,+DAGRE,EAAyB,CAC3BJ,KAAM,8DACNC,KAAM,8DACN,UAAW,iEACX,UAAW,iEACX,YAAa,mEACb,UAAW,iEACX,WAAY,kEACZC,SAAU"}
@@ -1,2 +1,2 @@
1
- const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",n="6.32.0",o="eslegacy",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};
1
+ const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",n="6.33.0",o="eslegacy",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
@@ -1,2 +1,2 @@
1
- import{Language as t}from"../language/Language.js";import e from"./RiskModule/RiskModule.js";import o from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import n from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as s,assertConfigurationPropertiesAreValid as r}from"./utils.js";import a from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as l}from"../utils/hasOwnProperty.js";import{Resources as c}from"./Context/Resources.js";import{SRPanel as p}from"./Errors/SRPanel.js";import h from"./core.registry.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as m,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{THREEDS2_FULL as v}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as g}from"../language/constants.js";import b from"./Services/get-translations.js";import{defaultProps as w}from"./core.defaultProps.js";import{formatLocale as j,formatCustomTranslations as C}from"../language/utils.js";import{resolveEnvironments as O}from"./Environment/Environment.js";import{LIBRARY_BUNDLE_TYPE as A,LIBRARY_VERSION as P}from"./config.js";import{AnalyticsLogEvent as E,LogEventType as M}from"./Analytics/events/AnalyticsLogEvent.js";import R from"./Errors/CancelError.js";import{AnalyticsService as I}from"./Analytics/AnalyticsService.js";import{AnalyticsEventQueue as T}from"./Analytics/AnalyticsEventQueue.js";import{isAmountValid as x}from"../utils/amount-util.js";function k(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function D(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),n.forEach(function(e){k(t,e,o[e])})}return t}function U(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}function S(t,e){if(null==t)return{};var o,n,i,s={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(t),i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n]);return s}if(s=function(t,e){if(null==t)return{};var o,n,i={},s=Object.getOwnPropertyNames(t);for(n=0;n<s.length;n++)o=s[n],e.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(t,o)&&(i[o]=t[o]);return i}(t,e),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(t),i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n]);return s}class F{static setBundleType(t){F.metadata.bundleType=t}static register(...t){h.add(...t)}register(...t){h.add(...t)}getComponent(t){return h.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),await this.requestAnalyticsAttemptId(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then(t=>{const{amount:e,shopperLocale:o,countryCode:n,paymentMethods:i}=t,s=S(t,["amount","shopperLocale","countryCode","paymentMethods"]);return this.setOptions(U(D({},s),{amount:this.options.order?this.options.order.remainingAmount:e,locale:this.options.locale||o,countryCode:this.options.countryCode||n})),this.createPaymentMethodsList(i),this}).catch(t=>(this.options.onError&&this.options.onError(t),Promise.reject(t))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await b(this.cdnTranslationsUrl,F.metadata.version,this.options.locale)}catch(i){var t,e,o,n;i instanceof y?null===(t=(e=this.options).onError)||void 0===t||t.call(e,i):null===(o=(n=this.options).onError)||void 0===o||o.call(n,new y("ERROR","Failed to fetch translation",{cause:i}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:g}),this.options.locale=j(this.options.locale),this.options.translations=C(this.options.translations)}submitDetails(t){let e=null;var o,n;(this.options.onAdditionalDetails&&(e=new Promise((e,o)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:e,reject:o})})),this.session&&(e=this.session.submitDetails(t).catch(t=>{var e,o;return null===(e=(o=this.options).onError)||void 0===e||e.call(o,t),Promise.reject(t)})),e)?e.then(d).then(m).then(this.afterAdditionalDetails).then(t=>{var e,o;u(t),null===(e=(o=this.options).onPaymentCompleted)||void 0===e||e.call(o,t)}).catch(t=>{var e,o;t instanceof R||(u(t),null===(e=(o=this.options).onPaymentFailed)||void 0===e||e.call(o,t))}):null===(o=(n=this.options).onError)||void 0===o||o.call(n,new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,e={}){if(!t||!t.type){if(l(t,"action")&&l(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const o=t.type===v?`${t.type}${t.subtype}`:t.paymentMethodType,i=new E({type:M.action,subType:E.getSubtypeFromActionType(t.type),message:`${o} action was handled by the SDK`,component:o});this.modules.analytics.sendAnalytics(i);const s=D({},this.getCorePropsForComponent(),e);return n(this,h,t,s)}return this.handleCreateError()}update(t={},{shouldReinitializeCheckout:e=!0}={}){if(e)return this.setOptions(t),this.initialize().then(()=>(this.components.forEach(e=>{const o=D({},t,this.session&&{session:this.session});e.update(o)}),this));const{amount:o,secondaryAmount:n}=t;return(o||n)&&this.triggerAmountUpdate(o,n),Promise.resolve(this)}triggerAmountUpdate(t,e){x(t)?!e||x(e)?(this.setOptions(D({amount:t},e&&{secondaryAmount:e})),this.components.forEach(o=>{o.updateAmount(t,e)})):console.warn("Core update(): Update canceled. Invalid secondary amount object"):console.warn("Core update(): Update canceled. Invalid amount object")}getCorePropsForComponent(){return U(D({},s(this.options)),{core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction})}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){var e;const o=null!==(e=null==t?void 0:t.name)&&void 0!==e?e:"The passed payment method",n=t?`${o} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(n)}createPaymentMethodsList(t){this.paymentMethodsResponse=new o(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){var o,n;if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new e(this,U(D({},this.options),{loadingContext:this.loadingContext})),analytics:new i({eventQueue:new T,service:new I({analyticsContext:this.analyticsContext,clientKey:this.options.clientKey}),enabled:null===(o=this.options.analytics)||void 0===o?void 0:o.enabled,analyticsData:null===(n=this.options.analytics)||void 0===n?void 0:n.analyticsData}),resources:new c(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new p(this,D({},this.options.srConfig))})}async requestAnalyticsAttemptId(){var t;await this.modules.analytics.setUp(D({locale:this.options.locale},(null===(t=this.session)||void 0===t?void 0:t.id)&&{sessionId:this.session.id}))}constructor(t){var e;k(this,"session",void 0),k(this,"paymentMethodsResponse",void 0),k(this,"modules",void 0),k(this,"options",void 0),k(this,"analyticsContext",void 0),k(this,"loadingContext",void 0),k(this,"cdnImagesUrl",void 0),k(this,"cdnTranslationsUrl",void 0),k(this,"components",[]),k(this,"afterAdditionalDetails",t=>{if(this.options.afterAdditionalDetails&&(null==t?void 0:t.action)){const e=this.createFromAction(t.action);return this.options.afterAdditionalDetails(e),Promise.reject(new R("Handled by afterAdditionalDetails"))}return Promise.resolve(t)}),k(this,"remove",t=>(this.components=this.components.filter(e=>e._id!==t._id),t.unmount(),this)),k(this,"setOptions",t=>{var e,o;this.options=U(D({},this.options,t),{locale:(null==t?void 0:t.locale)||(null===(e=this.options)||void 0===e?void 0:e.locale),environment:String.prototype.toLowerCase.apply((null==t?void 0:t.environment)||(null===(o=this.options)||void 0===o?void 0:o.environment))})}),r(t),this.createFromAction=this.createFromAction.bind(this),this.update=this.update.bind(this),this.setOptions(D({},w,t));const{apiUrl:o,analyticsUrl:n,cdnImagesUrl:i,cdnTranslationsUrl:s}=O(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=n,this.cdnImagesUrl=i,this.cdnTranslationsUrl=s,this.session=this.options.session&&new a(this.options.session,this.options.clientKey,this.loadingContext);const l=null===(e=this.options.clientKey)||void 0===e?void 0:e.substring(0,4);var c,p;if(("test"===l||"live"===l)&&!this.loadingContext.includes(l))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${l} clientKey against the ${(null===(c=this.options._environmentUrls)||void 0===c?void 0:c.api)||this.options.environment} environment`);"pub."===l&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${null===(p=this.options.clientKey)||void 0===p?void 0:p.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`);this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=F.metadata)}}k(F,"metadata",{version:P,bundleType:A}),k(F,"registry",h);export{F as default};
1
+ import{Language as t}from"../language/Language.js";import e from"./RiskModule/RiskModule.js";import o from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import n from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as s,assertConfigurationPropertiesAreValid as r}from"./utils.js";import a from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as l}from"../utils/hasOwnProperty.js";import{Resources as c}from"./Context/Resources.js";import{SRPanel as p}from"./Errors/SRPanel.js";import h from"./core.registry.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as m,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{THREEDS2_FULL as v}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as g}from"../language/constants.js";import b from"./Services/get-translations.js";import{defaultProps as w}from"./core.defaultProps.js";import{formatLocale as j,formatCustomTranslations as C}from"../language/utils.js";import{resolveEnvironments as A}from"./Environment/Environment.js";import{LIBRARY_BUNDLE_TYPE as O,LIBRARY_VERSION as P}from"./config.js";import{AnalyticsLogEvent as E,LogEventType as M}from"./Analytics/events/AnalyticsLogEvent.js";import R from"./Errors/CancelError.js";import{AnalyticsService as I}from"./Analytics/AnalyticsService.js";import{AnalyticsEventQueue as T}from"./Analytics/AnalyticsEventQueue.js";import{isAmountValid as x}from"../utils/amount-util.js";function k(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function D(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),n.forEach(function(e){k(t,e,o[e])})}return t}function U(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}function S(t,e){if(null==t)return{};var o,n,i,s={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(t),i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n]);return s}if(s=function(t,e){if(null==t)return{};var o,n,i={},s=Object.getOwnPropertyNames(t);for(n=0;n<s.length;n++)o=s[n],e.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(t,o)&&(i[o]=t[o]);return i}(t,e),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(t),i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n]);return s}class F{static setBundleType(t){F.metadata.bundleType=t}static register(...t){h.add(...t)}register(...t){h.add(...t)}getComponent(t){return h.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),await this.requestAnalyticsAttemptId(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then(t=>{const{amount:e,shopperLocale:o,countryCode:n,paymentMethods:i}=t,s=S(t,["amount","shopperLocale","countryCode","paymentMethods"]);return this.setOptions(U(D({},s),{amount:this.options.order?this.options.order.remainingAmount:e,locale:this.options.locale||o,countryCode:this.options.countryCode||n})),this.createPaymentMethodsList(i),this}).catch(t=>(this.options.onError&&this.options.onError(t),Promise.reject(t))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await b(this.cdnTranslationsUrl,F.metadata.version,this.options.locale)}catch(i){var t,e,o,n;i instanceof y?null===(t=(e=this.options).onError)||void 0===t||t.call(e,i):null===(o=(n=this.options).onError)||void 0===o||o.call(n,new y("ERROR","Failed to fetch translation",{cause:i}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:g}),this.options.locale=j(this.options.locale),this.options.translations=C(this.options.translations)}submitDetails(t){let e=null;var o,n;(this.options.onAdditionalDetails&&(e=new Promise((e,o)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:e,reject:o})})),this.session&&(e=this.session.submitDetails(t).catch(t=>{var e,o;return null===(e=(o=this.options).onError)||void 0===e||e.call(o,t),Promise.reject(t)})),e)?e.then(d).then(m).then(this.afterAdditionalDetails).then(t=>{var e,o;u(t),null===(e=(o=this.options).onPaymentCompleted)||void 0===e||e.call(o,t)}).catch(t=>{var e,o;t instanceof R||(u(t),null===(e=(o=this.options).onPaymentFailed)||void 0===e||e.call(o,t))}):null===(o=(n=this.options).onError)||void 0===o||o.call(n,new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,e={}){if(!t||!t.type){if(l(t,"action")&&l(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const o=t.type===v?`${t.type}${t.subtype}`:t.paymentMethodType,i=new E({type:M.action,subType:E.getSubtypeFromActionType(t.type),message:`${o} action was handled by the SDK`,component:o});this.modules.analytics.sendAnalytics(i);const s=D({},this.getCorePropsForComponent(),e);return n(this,h,t,s)}return this.handleCreateError()}update(t={},{shouldReinitializeCheckout:e=!0}={}){if(e)return this.setOptions(t),this.initialize().then(()=>(this.components.forEach(e=>{var o;const n=D({},(null===(o=t.order)||void 0===o?void 0:o.remainingAmount)?{amount:t.order.remainingAmount}:{amount:this.options.amount},this.session&&{session:this.session},t);e.update(n)}),this));const{amount:o,secondaryAmount:n}=t;return(o||n)&&this.triggerAmountUpdate(o,n),Promise.resolve(this)}triggerAmountUpdate(t,e){x(t)?!e||x(e)?(this.setOptions(D({amount:t},e&&{secondaryAmount:e})),this.components.forEach(o=>{o.updateAmount(t,e)})):console.warn("Core update(): Update canceled. Invalid secondary amount object"):console.warn("Core update(): Update canceled. Invalid amount object")}getCorePropsForComponent(){return U(D({},s(this.options)),{core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction})}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){var e;const o=null!==(e=null==t?void 0:t.name)&&void 0!==e?e:"The passed payment method",n=t?`${o} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(n)}createPaymentMethodsList(t){this.paymentMethodsResponse=new o(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){var o,n;if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new e(this,U(D({},this.options),{loadingContext:this.loadingContext})),analytics:new i({eventQueue:new T,service:new I({analyticsContext:this.analyticsContext,clientKey:this.options.clientKey}),enabled:null===(o=this.options.analytics)||void 0===o?void 0:o.enabled,analyticsData:null===(n=this.options.analytics)||void 0===n?void 0:n.analyticsData}),resources:new c(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new p(this,D({},this.options.srConfig))})}async requestAnalyticsAttemptId(){var t;await this.modules.analytics.setUp(D({locale:this.options.locale},(null===(t=this.session)||void 0===t?void 0:t.id)&&{sessionId:this.session.id}))}constructor(t){var e;k(this,"session",void 0),k(this,"paymentMethodsResponse",void 0),k(this,"modules",void 0),k(this,"options",void 0),k(this,"analyticsContext",void 0),k(this,"loadingContext",void 0),k(this,"cdnImagesUrl",void 0),k(this,"cdnTranslationsUrl",void 0),k(this,"components",[]),k(this,"afterAdditionalDetails",t=>{if(this.options.afterAdditionalDetails&&(null==t?void 0:t.action)){const e=this.createFromAction(t.action);return this.options.afterAdditionalDetails(e),Promise.reject(new R("Handled by afterAdditionalDetails"))}return Promise.resolve(t)}),k(this,"remove",t=>(this.components=this.components.filter(e=>e._id!==t._id),t.unmount(),this)),k(this,"setOptions",t=>{var e,o;this.options=U(D({},this.options,t),{locale:(null==t?void 0:t.locale)||(null===(e=this.options)||void 0===e?void 0:e.locale),environment:String.prototype.toLowerCase.apply((null==t?void 0:t.environment)||(null===(o=this.options)||void 0===o?void 0:o.environment))})}),r(t),this.createFromAction=this.createFromAction.bind(this),this.update=this.update.bind(this),this.setOptions(D({},w,t));const{apiUrl:o,analyticsUrl:n,cdnImagesUrl:i,cdnTranslationsUrl:s}=A(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=n,this.cdnImagesUrl=i,this.cdnTranslationsUrl=s,this.session=this.options.session&&new a(this.options.session,this.options.clientKey,this.loadingContext);const l=null===(e=this.options.clientKey)||void 0===e?void 0:e.substring(0,4);var c,p;if(("test"===l||"live"===l)&&!this.loadingContext.includes(l))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${l} clientKey against the ${(null===(c=this.options._environmentUrls)||void 0===c?void 0:c.api)||this.options.environment} environment`);"pub."===l&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${null===(p=this.options.clientKey)||void 0===p?void 0:p.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`);this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=F.metadata)}}k(F,"metadata",{version:P,bundleType:O}),k(F,"registry",h);export{F as default};
2
2
  //# sourceMappingURL=core.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { DEFAULT_LOCALE } from '../language/constants';\nimport getTranslations from './Services/get-translations';\nimport { defaultProps } from './core.defaultProps';\nimport { formatCustomTranslations, formatLocale } from '../language/utils';\nimport { resolveEnvironments } from './Environment';\nimport { LIBRARY_BUNDLE_TYPE, LIBRARY_VERSION } from './config';\n\nimport type { PaymentAction, PaymentAmount, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData, CoreModules } from './types';\nimport type { Translations } from '../language/types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\nimport { AnalyticsLogEvent, LogEventType } from './Analytics/events/AnalyticsLogEvent';\nimport CancelError from './Errors/CancelError';\nimport { AnalyticsService } from './Analytics/AnalyticsService';\nimport { AnalyticsEventQueue } from './Analytics/AnalyticsEventQueue';\nimport { isAmountValid } from '../utils/amount-util';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: CoreModules;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: LIBRARY_VERSION,\n bundleType: LIBRARY_BUNDLE_TYPE\n };\n\n public static readonly registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n this.update = this.update.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n console.debug(\n `The value you are passing as your \"clientKey\" looks like an originKey (${this.options.clientKey?.substring(0, 12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n await this.createCoreModules();\n await this.requestAnalyticsAttemptId();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private async fetchLocaleTranslations(): Promise<Translations> {\n try {\n return await getTranslations(this.cdnTranslationsUrl, Core.metadata.version, this.options.locale);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.options.onError?.(error);\n else this.options.onError?.(new AdyenCheckoutError('ERROR', 'Failed to fetch translation', { cause: error }));\n }\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n this.options.locale = formatLocale(this.options.locale);\n this.options.translations = formatCustomTranslations(this.options.translations);\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.afterAdditionalDetails)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n return;\n }\n\n cleanupFinalResult(e as PaymentResponseData);\n this.options.onPaymentFailed?.(e as PaymentResponseData);\n });\n }\n\n private readonly afterAdditionalDetails = (response: PaymentResponseData): Promise<PaymentResponseData | Error> => {\n /**\n * After the user is redirected back, a request to `/details` or `/paymentDetails` will be made.\n * Typically, the response will not include an action object, except for the case of `paybybank_pix` payment method.\n * In terms of `paybybank_pix`, the action UIElement will be created and passed to the `afterAdditionalDetails` callback, allowing it to be mounted on the page.\n */\n if (this.options.afterAdditionalDetails && response?.action) {\n const actionEle = this.createFromAction(response.action);\n this.options.afterAdditionalDetails(actionEle);\n return Promise.reject(new CancelError('Handled by afterAdditionalDetails'));\n }\n return Promise.resolve(response);\n };\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n const event = new AnalyticsLogEvent({\n type: LogEventType.action,\n subType: AnalyticsLogEvent.getSubtypeFromActionType(action.type),\n message: `${component} action was handled by the SDK`,\n component\n });\n this.modules.analytics.sendAnalytics(event);\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param props - props to update\n * @param options - Can be used to avoid remounting the elements\n * @returns this - the Core instance\n */\n public update(props: Partial<CoreConfiguration> = {}, { shouldReinitializeCheckout = true } = {}): Promise<this> {\n if (shouldReinitializeCheckout) {\n this.setOptions(props);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...props,\n ...(this.session && { session: this.session })\n };\n component.update(newProps);\n });\n return this;\n });\n }\n\n const { amount, secondaryAmount } = props;\n\n if (amount || secondaryAmount) {\n this.triggerAmountUpdate(amount, secondaryAmount);\n }\n\n return Promise.resolve(this);\n }\n\n /**\n * Validates and propagates amount updates to all mounted components.\n *\n * @param amount - Primary payment amount object (required)\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n private triggerAmountUpdate(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n if (!isAmountValid(amount)) {\n console.warn('Core update(): Update canceled. Invalid amount object');\n return;\n }\n\n if (secondaryAmount && !isAmountValid(secondaryAmount)) {\n console.warn('Core update(): Update canceled. Invalid secondary amount object');\n return;\n }\n\n this.setOptions({\n amount,\n ...(secondaryAmount && { secondaryAmount })\n });\n\n this.components.forEach(component => {\n component.updateAmount(amount, secondaryAmount);\n });\n }\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale,\n // Make environment lowercase to ensure consistency\n environment: String.prototype.toLowerCase.apply(options?.environment || this.options?.environment)\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private async createCoreModules(): Promise<void> {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n const translations = await this.fetchLocaleTranslations();\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: new Analytics({\n eventQueue: new AnalyticsEventQueue(),\n service: new AnalyticsService({\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey\n }),\n enabled: this.options.analytics?.enabled,\n analyticsData: this.options.analytics?.analyticsData\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n translations,\n customTranslations: this.options.translations\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n\n private async requestAnalyticsAttemptId(): Promise<void> {\n await this.modules.analytics.setUp({\n locale: this.options.locale,\n ...(this.session?.id && { sessionId: this.session.id })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","setBundleType","type","metadata","bundleType","register","items","registry","add","getComponent","txVariant","initialize","this","initializeCore","validateCoreConfiguration","createCoreModules","requestAnalyticsAttemptId","session","setupSession","options","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","setOptions","_object_spread_props","_object_spread","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","fetchLocaleTranslations","getTranslations","cdnTranslationsUrl","version","_this_options_onError","_this_options","_this_options_onError1","_this_options1","AdyenCheckoutError","call","cause","paymentMethodsConfiguration","console","warn","IMPLEMENTATION_ERROR","DEFAULT_LOCALE","formatLocale","translations","formatCustomTranslations","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","afterAdditionalDetails","response","_this_options_onPaymentCompleted","cleanupFinalResult","onPaymentCompleted","e","_this_options_onPaymentFailed","CancelError","onPaymentFailed","createFromAction","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","event","AnalyticsLogEvent","LogEventType","subType","getSubtypeFromActionType","message","modules","analytics","sendAnalytics","props","getCorePropsForComponent","getComponentForAction","handleCreateError","update","shouldReinitializeCheckout","components","forEach","newProps","secondaryAmount","triggerAmountUpdate","isAmountValid","updateAmount","processGlobalOptions","globalOptions","core","i18n","loadingContext","cdnContext","cdnImagesUrl","storeElementReference","element","push","paymentMethod","paymentMethodName","name","_ref","errorMessage","JSON","stringify","paymentMethodsResponse","PaymentMethods","_this_options_analytics","_this_options_analytics1","Object","freeze","risk","RiskModule","Analytics","eventQueue","AnalyticsEventQueue","service","AnalyticsService","analyticsContext","clientKey","enabled","analyticsData","resources","Resources","Language","customTranslations","srPanel","SRPanel","srConfig","_this_session","setUp","id","sessionId","constructor","_this_options_clientKey","_define_property","actionEle","remove","filter","c","_id","unmount","environment","String","prototype","toLowerCase","apply","assertConfigurationPropertiesAreValid","bind","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","_environmentUrls","Session","clientKeyType","substring","_this_options__environmentUrls","_this_options_clientKey1","includes","api","debug","exposeLibraryMetadata","window","LIBRARY_VERSION","LIBRARY_BUNDLE_TYPE"],"mappings":"m8FAgCA,MAAMA,EAoBF,oBAAcC,CAAcC,GACxBF,EAAKG,SAASC,WAAaF,CAC/B,CAEA,eAAcG,IAAYC,GACtBC,EAASC,OAAOF,EACpB,CAMA,QAAAD,IAAmBC,GACfC,EAASC,OAAOF,EACpB,CAEOG,YAAAA,CAAaC,GAChB,OAAOH,EAASE,aAAaC,EACjC,CAwCA,gBAAaC,GAKT,aAJMC,KAAKC,iBACXD,KAAKE,kCACCF,KAAKG,0BACLH,KAAKI,4BACJJ,IACX,CAEA,oBAAcC,GACV,OAAID,KAAKK,QACEL,KAAKK,QACPC,aAAaN,KAAKO,SAClBC,KAAKC,IACF,MAAMC,OAAEA,EAAMC,cAAEA,EAAaC,YAAEA,EAAWC,eAAEA,GAA4BJ,EAATK,EAAAA,EAASL,EAAAA,2DAWxE,OATAT,KAAKe,WAAWC,EAAAC,EAAA,CAAA,EACTH,GAAAA,CACHJ,OAAQV,KAAKO,QAAQW,MAAQlB,KAAKO,QAAQW,MAAMC,gBAAkBT,EAClEU,OAAQpB,KAAKO,QAAQa,QAAUT,EAC/BC,YAAaZ,KAAKO,QAAQK,aAAeA,KAG7CZ,KAAKqB,yBAAyBR,GAEvBb,OAEVsB,MAAMC,IACCvB,KAAKO,QAAQiB,SAASxB,KAAKO,QAAQiB,QAAQD,GACxCE,QAAQC,OAAOH,MAIlCvB,KAAKqB,2BACEI,QAAQE,QAAQ3B,MAC3B,CAEA,6BAAc4B,GACV,IACI,aAAaC,EAAgB7B,KAAK8B,mBAAoB1C,EAAKG,SAASwC,QAAS/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ASJ,GACxF,MAAM,IAAI7H,EACN,uBACA,0BAA0B6H,4BAAoE,QAA7BE,EAAAnK,KAAKO,QAAQwJ,4BAAbI,OAAA,EAAAA,EAA+BG,MAAOtK,KAAKO,QAAQ6I,2BAGtG,SAAlBa,GACAzH,QAAQ+H,MACJ,0EAAgG,QAAtBH,EAAApK,KAAKO,QAAQsH,qBAAbuC,SAAAA,EAAwBF,UAAU,EAAG,oQAInHlK,KAAKO,QAAQiK,wBACbC,OAAO,iBAAsBrL,EAAKG,SAE1C,EA/DAsJ,EAbEzJ,EAaqBG,WAAW,CAC9BwC,QAAS2I,EACTlL,WAAYmL,IAGhB9B,EAlBEzJ,EAkBqBO,WAAWA"}
1
+ {"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { DEFAULT_LOCALE } from '../language/constants';\nimport getTranslations from './Services/get-translations';\nimport { defaultProps } from './core.defaultProps';\nimport { formatCustomTranslations, formatLocale } from '../language/utils';\nimport { resolveEnvironments } from './Environment';\nimport { LIBRARY_BUNDLE_TYPE, LIBRARY_VERSION } from './config';\n\nimport type { PaymentAction, PaymentAmount, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData, CoreModules } from './types';\nimport type { Translations } from '../language/types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\nimport { AnalyticsLogEvent, LogEventType } from './Analytics/events/AnalyticsLogEvent';\nimport CancelError from './Errors/CancelError';\nimport { AnalyticsService } from './Analytics/AnalyticsService';\nimport { AnalyticsEventQueue } from './Analytics/AnalyticsEventQueue';\nimport { isAmountValid } from '../utils/amount-util';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: CoreModules;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: LIBRARY_VERSION,\n bundleType: LIBRARY_BUNDLE_TYPE\n };\n\n public static readonly registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n this.update = this.update.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n console.debug(\n `The value you are passing as your \"clientKey\" looks like an originKey (${this.options.clientKey?.substring(0, 12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n await this.createCoreModules();\n await this.requestAnalyticsAttemptId();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private async fetchLocaleTranslations(): Promise<Translations> {\n try {\n return await getTranslations(this.cdnTranslationsUrl, Core.metadata.version, this.options.locale);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.options.onError?.(error);\n else this.options.onError?.(new AdyenCheckoutError('ERROR', 'Failed to fetch translation', { cause: error }));\n }\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n this.options.locale = formatLocale(this.options.locale);\n this.options.translations = formatCustomTranslations(this.options.translations);\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.afterAdditionalDetails)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n return;\n }\n\n cleanupFinalResult(e as PaymentResponseData);\n this.options.onPaymentFailed?.(e as PaymentResponseData);\n });\n }\n\n private readonly afterAdditionalDetails = (response: PaymentResponseData): Promise<PaymentResponseData | Error> => {\n /**\n * After the user is redirected back, a request to `/details` or `/paymentDetails` will be made.\n * Typically, the response will not include an action object, except for the case of `paybybank_pix` payment method.\n * In terms of `paybybank_pix`, the action UIElement will be created and passed to the `afterAdditionalDetails` callback, allowing it to be mounted on the page.\n */\n if (this.options.afterAdditionalDetails && response?.action) {\n const actionEle = this.createFromAction(response.action);\n this.options.afterAdditionalDetails(actionEle);\n return Promise.reject(new CancelError('Handled by afterAdditionalDetails'));\n }\n return Promise.resolve(response);\n };\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n const event = new AnalyticsLogEvent({\n type: LogEventType.action,\n subType: AnalyticsLogEvent.getSubtypeFromActionType(action.type),\n message: `${component} action was handled by the SDK`,\n component\n });\n this.modules.analytics.sendAnalytics(event);\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param props - props to update\n * @param options - Can be used to avoid remounting the elements\n * @returns this - the Core instance\n */\n public update(props: Partial<Omit<CoreConfiguration, 'session'>> = {}, { shouldReinitializeCheckout = true } = {}): Promise<this> {\n if (shouldReinitializeCheckout) {\n this.setOptions(props);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...(props.order?.remainingAmount ? { amount: props.order.remainingAmount } : { amount: this.options.amount }),\n ...(this.session && { session: this.session }),\n ...props\n };\n component.update(newProps);\n });\n return this;\n });\n }\n\n const { amount, secondaryAmount } = props;\n\n if (amount || secondaryAmount) {\n this.triggerAmountUpdate(amount, secondaryAmount);\n }\n\n return Promise.resolve(this);\n }\n\n /**\n * Validates and propagates amount updates to all mounted components.\n *\n * @param amount - Primary payment amount object (required)\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n private triggerAmountUpdate(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n if (!isAmountValid(amount)) {\n console.warn('Core update(): Update canceled. Invalid amount object');\n return;\n }\n\n if (secondaryAmount && !isAmountValid(secondaryAmount)) {\n console.warn('Core update(): Update canceled. Invalid secondary amount object');\n return;\n }\n\n this.setOptions({\n amount,\n ...(secondaryAmount && { secondaryAmount })\n });\n\n this.components.forEach(component => {\n component.updateAmount(amount, secondaryAmount);\n });\n }\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale,\n // Make environment lowercase to ensure consistency\n environment: String.prototype.toLowerCase.apply(options?.environment || this.options?.environment)\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private async createCoreModules(): Promise<void> {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n const translations = await this.fetchLocaleTranslations();\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: new Analytics({\n eventQueue: new AnalyticsEventQueue(),\n service: new AnalyticsService({\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey\n }),\n enabled: this.options.analytics?.enabled,\n analyticsData: this.options.analytics?.analyticsData\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n translations,\n customTranslations: this.options.translations\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n\n private async requestAnalyticsAttemptId(): Promise<void> {\n await this.modules.analytics.setUp({\n locale: this.options.locale,\n ...(this.session?.id && { sessionId: this.session.id })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","setBundleType","type","metadata","bundleType","register","items","registry","add","getComponent","txVariant","initialize","this","initializeCore","validateCoreConfiguration","createCoreModules","requestAnalyticsAttemptId","session","setupSession","options","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","setOptions","_object_spread_props","_object_spread","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","fetchLocaleTranslations","getTranslations","cdnTranslationsUrl","version","_this_options_onError","_this_options","_this_options_onError1","_this_options1","AdyenCheckoutError","call","cause","paymentMethodsConfiguration","console","warn","IMPLEMENTATION_ERROR","DEFAULT_LOCALE","formatLocale","translations","formatCustomTranslations","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","afterAdditionalDetails","response","_this_options_onPaymentCompleted","cleanupFinalResult","onPaymentCompleted","e","_this_options_onPaymentFailed","CancelError","onPaymentFailed","createFromAction","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","event","AnalyticsLogEvent","LogEventType","subType","getSubtypeFromActionType","message","modules","analytics","sendAnalytics","props","getCorePropsForComponent","getComponentForAction","handleCreateError","update","shouldReinitializeCheckout","components","forEach","newProps","secondaryAmount","triggerAmountUpdate","isAmountValid","updateAmount","processGlobalOptions","globalOptions","core","i18n","loadingContext","cdnContext","cdnImagesUrl","storeElementReference","element","push","paymentMethod","paymentMethodName","name","_ref","errorMessage","JSON","stringify","paymentMethodsResponse","PaymentMethods","_this_options_analytics","_this_options_analytics1","Object","freeze","risk","RiskModule","Analytics","eventQueue","AnalyticsEventQueue","service","AnalyticsService","analyticsContext","clientKey","enabled","analyticsData","resources","Resources","Language","customTranslations","srPanel","SRPanel","srConfig","_this_session","setUp","id","sessionId","constructor","_this_options_clientKey","_define_property","actionEle","remove","filter","c","_id","unmount","environment","String","prototype","toLowerCase","apply","assertConfigurationPropertiesAreValid","bind","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","_environmentUrls","Session","clientKeyType","substring","_this_options__environmentUrls","_this_options_clientKey1","includes","api","debug","exposeLibraryMetadata","window","LIBRARY_VERSION","LIBRARY_BUNDLE_TYPE"],"mappings":"m8FAgCA,MAAMA,EAoBF,oBAAcC,CAAcC,GACxBF,EAAKG,SAASC,WAAaF,CAC/B,CAEA,eAAcG,IAAYC,GACtBC,EAASC,OAAOF,EACpB,CAMA,QAAAD,IAAmBC,GACfC,EAASC,OAAOF,EACpB,CAEOG,YAAAA,CAAaC,GAChB,OAAOH,EAASE,aAAaC,EACjC,CAwCA,gBAAaC,GAKT,aAJMC,KAAKC,iBACXD,KAAKE,kCACCF,KAAKG,0BACLH,KAAKI,4BACJJ,IACX,CAEA,oBAAcC,GACV,OAAID,KAAKK,QACEL,KAAKK,QACPC,aAAaN,KAAKO,SAClBC,KAAKC,IACF,MAAMC,OAAEA,EAA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  "license": "MIT",
5
5
  "homepage": "https://docs.adyen.com/checkout",
6
6
  "type": "module",
@@ -92,9 +92,9 @@
92
92
  "@rollup/plugin-replace": "6.0.3",
93
93
  "@rollup/plugin-terser": "0.4.4",
94
94
  "@size-limit/preset-big-lib": "12.0.0",
95
- "@storybook/addon-a11y": "10.2.8",
96
- "@storybook/addon-docs": "10.2.8",
97
- "@storybook/preact-vite": "10.2.8",
95
+ "@storybook/addon-a11y": "10.2.10",
96
+ "@storybook/addon-docs": "10.2.10",
97
+ "@storybook/preact-vite": "10.2.10",
98
98
  "@swc/core": "1.15.11",
99
99
  "@testing-library/jest-dom": "6.9.1",
100
100
  "@testing-library/preact": "3.2.4",
@@ -108,8 +108,8 @@
108
108
  "eslint-plugin-import": "2.32.0",
109
109
  "eslint-plugin-jsx-a11y": "6.10.2",
110
110
  "eslint-plugin-react": "7.37.5",
111
- "eslint-plugin-storybook": "10.2.8",
112
- "eslint-plugin-testing-library": "7.15.4",
111
+ "eslint-plugin-storybook": "10.2.10",
112
+ "eslint-plugin-testing-library": "7.16.0",
113
113
  "globals": "17.3.0",
114
114
  "jest": "29.7.0",
115
115
  "jest-environment-jsdom": "29.7.0",