@adyen/adyen-web 6.41.0 → 6.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/cjs/index.cjs +2 -2
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.cts +33 -31
  4. package/dist/es/components/Card/Card.js +1 -1
  5. package/dist/es/components/Card/Card.js.map +1 -1
  6. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  7. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  8. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  9. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  10. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  11. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  12. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  13. package/dist/es/components/Dropin/Dropin.js +1 -1
  14. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  15. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  16. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  17. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  18. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  19. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  20. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  21. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  22. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  23. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  24. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  25. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  26. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  27. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  28. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  29. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  30. package/dist/es/components/internal/Button/Button.js +1 -1
  31. package/dist/es/components/internal/Button/Button.js.map +1 -1
  32. package/dist/es/components/internal/Button/CopyButton.js +1 -1
  33. package/dist/es/components/internal/Button/CopyButton.js.map +1 -1
  34. package/dist/es/components/internal/Button/CopyIconButton.js +1 -1
  35. package/dist/es/components/internal/Button/CopyIconButton.js.map +1 -1
  36. package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  37. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  38. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  39. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  40. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  41. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  42. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  43. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  44. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  45. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  46. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  47. package/dist/es/components/internal/Modal/Modal.js +1 -1
  48. package/dist/es/components/internal/Modal/Modal.js.map +1 -1
  49. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  50. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  51. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  52. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  53. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  54. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  55. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  56. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  57. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  58. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  59. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  60. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  61. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  62. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  63. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  64. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  65. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  66. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  67. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  68. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  69. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  70. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  71. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  72. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  73. package/dist/es/core/config.js +1 -1
  74. package/dist/es/index.d.ts +33 -31
  75. package/dist/es/utils/validator-utils.js +1 -1
  76. package/dist/es/utils/validator-utils.js.map +1 -1
  77. package/dist/es-legacy/components/Card/Card.js +1 -1
  78. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  79. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  80. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  81. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  82. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  83. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  84. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  85. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  86. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  87. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  88. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  89. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  90. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  91. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  92. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  93. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  94. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  95. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  96. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  97. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  98. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  99. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  100. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  101. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  102. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  103. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  104. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  105. package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
  106. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  107. package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
  108. package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
  109. package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  110. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  111. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  112. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  113. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  114. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  115. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  116. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  117. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  118. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  119. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  120. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  121. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  122. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  123. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  124. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  125. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  126. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  127. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  128. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  129. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  130. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  131. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  132. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  133. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  134. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  135. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  136. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  137. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  138. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  139. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  140. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  141. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  142. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  143. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  144. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  145. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  146. package/dist/es-legacy/core/config.js +1 -1
  147. package/dist/es-legacy/utils/validator-utils.js +1 -1
  148. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  149. package/package.json +19 -19
@@ -1 +1 @@
1
- {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { createRef, h, RefObject, TargetedKeyboardEvent } 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 { ComponentMethodsRef, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { AmountProvider, AmountProviderRef } from '../../../core/Context/AmountProvider';\nimport { PayButtonProps } from '../PayButton/PayButton';\nimport { TxVariants } from '../../tx-variants';\nimport Donation from '../../Donation/Donation';\nimport './UIElement.scss';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n /**\n * componentRef is a ref to the primary component inside the subclass that extends UIElement e.g. CardInput.tsx (which sits inside Card.tsx)\n */\n protected componentRef: any;\n\n protected resources: Resources;\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx or Dropin.tsx\n */\n public elementRef: UIElement;\n\n public static readonly type: string | undefined = 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 this.setupSessionsDonation = this.setupSessionsDonation.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);\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 * 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 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+gfnW89DdJZAhxe74Tv0TnL5DRQYPCTRQPOoLbQ21NaeSho70FNE+n8XYKlVK5Ore6BoB6IVCaal5MkM27V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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 protected setupSessionsDonation() {\n const { amount, donation } = this.props;\n\n // If merchant hasn't explicitly disabled autoMount by setting it to false\n if (donation?.autoMount !== false) {\n const rootNode: HTMLElement = assertIsDropin(this.elementRef) ? this.elementRef._node : this._node;\n\n const DonationComponentRef = this.core.getComponent(TxVariants.donation) as typeof Donation;\n new DonationComponentRef(this.core, { rootNode, commercialTxAmount: amount.value }); // NOSONAR: Instantiation triggers internal async initialization (fire-and-forget pattern)\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\n /** If we are using sessions and the response mandates it - create a Donation instance */\n if (this.core.session && result.askDonation === true) {\n this.setupSessionsDonation();\n }\n\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 handleKeyDown(e: 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 handleKeyDown)\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 | null;\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources} analytics={this.analytics}>\n <SRPanelProvider srPanel={this.srPanel}>\n <AmountProvider amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} providerRef={this.amountProviderRef}>\n {this.componentToRender()}\n </AmountProvider>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","createBeforeRenderHook","configSetByMerchant","originalRender","this","render","args","beforeRender","apply","originalAction","event","AnalyticsInfoEvent","type","InfoEventType","rendered","component","configData","showPayButton","props","oneClick","isStoredPaymentMethod","analytics","sendAnalytics","reportIntegrationFlavor","sendFlavor","core","modules","srPanel","getPaymentMethodConfigFromResponse","componentProps","storedPaymentMethodId","getStoredPaymentMethodDetails","getPaymentMethodFromPaymentMethodsResponse","paymentMethodId","buildElementProps","finalProps","getCorePropsForComponent","isDropinInstance","assertIsDropin","formatProps","constructor","getRegulatoryDefaults","options","countryCode","paymentMethodsResponse","findStoredPaymentMethod","findById","find","storeElementRefOnCore","isDropin","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","updateAmount","amount","secondaryAmount","amountProviderRef","current","update","setElementStatus","status","elementRef","setStatus","data","isValid","errors","valid","submitAnalytics","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","session","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","AnalyticsLogEvent","LogEventType","message","submitPayment","error","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","setupSessionsDonation","donation","autoMount","rootNode","getComponent","TxVariants","commercialTxAmount","value","response","order","remainingAmount","handleOrder","handleSuccessResult","handleKeyDown","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","loadingContext","SRPanelProvider","AmountProvider","providerRef","componentToRender","checkout","super","_define_property","createRef","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","askDonation","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","onClick","register","bind","undefined","txVariants"],"mappings":"wrCAsCO,MAAeA,UAA6DC,EAgEvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,KAAKC,OAE5BD,KAAKC,OAAS,IAAIC,KACdF,KAAKG,aAAaL,GACXC,EAAeK,MAAMJ,KAAME,GAE1C,CAEUC,YAAAA,CAAaL,GAEnB,GAAIA,GAAqBO,eACrB,OAGJ,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,KAAMC,EAAcC,SACpBC,UAAWX,KAAKQ,KAChBI,WAAY,IAAKd,EAAqBe,cAAeb,KAAKc,MAAMD,kBAC5Df,GAAqBiB,UAAY,CAAEC,uBAAuB,KAGlEhB,KAAKiB,UAAUC,cAAcZ,EACjC,CAEUa,uBAAAA,GACDnB,KAAKiB,UAAUG,WAAW,aACnC,CAEA,aAAIH,GACA,OAAOjB,KAAKqB,KAAKC,QAAQL,SAC7B,CAEA,WAAIM,GACA,OAAOvB,KAAKqB,KAAKC,QAAQC,OAC7B,CAEUC,kCAAAA,CAAmCC,GACzC,OAAIA,GAAgBC,sBAA8B1B,KAAK2B,8BAA8BF,EAAeC,uBAC7F1B,KAAK4B,2CAA2CH,GAAgBjB,KAAMiB,GAAgBI,gBACjG,CAEmBC,iBAAAA,CAAkBL,GACjC,MAIMM,EAAa,CACflB,eAAe,KALKb,KAAKqB,KAAKW,8BAEAhC,KAAKwB,mCAAmCC,MAMnEA,GAGDQ,EAAmBC,EAAelC,MAExCA,KAAKc,MAAQd,KAAKmC,YAAY,IACvBnC,KAAKoC,YAAY,gBACjBC,EAAsBrC,KAAKqB,KAAKiB,QAAQC,YAAaN,MACrDF,GAEX,CAEUJ,6BAAAA,CAA8BD,GACpC,OAAO1B,KAAKqB,KAAKmB,uBAAuBC,wBAAwBf,EACpE,CAQA,0CAAAE,CAAqDpB,EAAeqB,GAChE,OAAIA,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MAC/CA,KAAK8D,iBAAmB9D,KAAK8D,iBAAiBuH,KAAKrL,MACnDA,KAAKsE,gBAAkBtE,KAAKsE,gBAAgB+G,KAAKrL,MACjDA,KAAKwE,iBAAmBxE,KAAKwE,iBAAiB6G,KAAKrL,MACnDA,KAAKiG,0BAA4BjG,KAAKiG,0BAA0BoF,KAAKrL,MACrEA,KAAKsF,wBAA0BtF,KAAKsF,wBAAwB+F,KAAKrL,MACjEA,KAAKwD,aAAexD,KAAKwD,aAAa6H,KAAKrL,MAC3CA,KAAKgH,sBAAwBhH,KAAKgH,sBAAsBqE,KAAKrL,MAE7DA,KAAKgE,WAAclD,GAASA,EAAMkD,YAAehE,KACjDA,KAAKwI,UAAYxI,KAAKc,MAAMQ,QAAUtB,KAAKc,MAAMQ,QAAQkH,eAAY8C,EAErEtL,KAAK4C,sBAAsB5C,KAAKc,OAEhCd,KAAKiI,kBAAoBjI,KAAKiI,kBAAkBoD,KAAKrL,MACrDA,KAAK8G,gBAAkB9G,KAAK8G,gBAAgBuE,KAAKrL,MAEjDA,KAAKH,uBAAuBiB,GAC5Bd,KAAKmB,yBACT,EA1CA6I,EAbkBrK,EAaKa,YAA2B8K,GAUlDtB,EAvBkBrK,EAuBK4L,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 { ComponentMethodsRef, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { AmountProvider, AmountProviderRef } from '../../../core/Context/AmountProvider';\nimport { PayButtonProps } from '../PayButton/PayButton';\nimport { TxVariants } from '../../tx-variants';\nimport Donation from '../../Donation/Donation';\nimport './UIElement.scss';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n /**\n * componentRef is a ref to the primary component inside the subclass that extends UIElement e.g. CardInput.tsx (which sits inside Card.tsx)\n */\n protected componentRef: any;\n\n protected resources: Resources;\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx or Dropin.tsx\n */\n public elementRef: UIElement;\n\n public static readonly type: string | undefined = 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 this.setupSessionsDonation = this.setupSessionsDonation.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);\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 * 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 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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R8eEJGsSzrNxpFItqj0SEaIWo25dRfkl5zuw47GQrN9Qzxl2WV3A38MQPUqFtIr/71Rjkphgg49ZGWEYCwgFmm8jJc2/5qTabSGk4bzwiETCTzeydq30bUGqCwglj8CrFViAuQeTJm7dp+PYKMkUNvQRpnSXMj6Kz7rvAMzhzJgK62ltN2idqKxLC7WtivCUgejuQUvNreCYBQCaKwTwP02lZsJpGF9yw8gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n this.handleAdditionalDetails(state);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (error.name === NETWORK_ERROR && error.options.code) {\n const event = new AnalyticsErrorEvent({\n component: this.type,\n errorType: ErrorEventType.apiError,\n code: error.options.code\n });\n\n this.submitAnalytics(event);\n }\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /details call', { cause: error }));\n\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session\n ? this.core.update({\n order\n })\n : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n protected setupSessionsDonation() {\n const { amount, donation } = this.props;\n\n // If merchant hasn't explicitly disabled autoMount by setting it to false\n if (donation?.autoMount !== false) {\n const rootNode: HTMLElement = assertIsDropin(this.elementRef) ? this.elementRef._node : this._node;\n\n const DonationComponentRef = this.core.getComponent(TxVariants.donation) as typeof Donation;\n new DonationComponentRef(this.core, { rootNode, commercialTxAmount: amount.value }); // NOSONAR: Instantiation triggers internal async initialization (fire-and-forget pattern)\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\n /** If we are using sessions and the response mandates it - create a Donation instance */\n if (this.core.session && result.askDonation === true) {\n this.setupSessionsDonation();\n }\n\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 | null;\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources} analytics={this.analytics}>\n <SRPanelProvider srPanel={this.srPanel}>\n <AmountProvider amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} providerRef={this.amountProviderRef}>\n {this.componentToRender()}\n </AmountProvider>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","createBeforeRenderHook","configSetByMerchant","originalRender","this","render","args","beforeRender","apply","originalAction","event","AnalyticsInfoEvent","type","InfoEventType","rendered","component","configData","showPayButton","props","oneClick","isStoredPaymentMethod","analytics","sendAnalytics","reportIntegrationFlavor","sendFlavor","core","modules","srPanel","getPaymentMethodConfigFromResponse","componentProps","storedPaymentMethodId","getStoredPaymentMethodDetails","getPaymentMethodFromPaymentMethodsResponse","paymentMethodId","buildElementProps","finalProps","getCorePropsForComponent","isDropinInstance","assertIsDropin","formatProps","constructor","getRegulatoryDefaults","options","countryCode","paymentMethodsResponse","findStoredPaymentMethod","findById","find","storeElementRefOnCore","isDropin","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","updateAmount","amount","secondaryAmount","amountProviderRef","current","update","setElementStatus","status","elementRef","setStatus","data","isValid","errors","valid","submitAnalytics","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","session","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","AnalyticsLogEvent","LogEventType","message","submitPayment","error","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","setupSessionsDonation","donation","autoMount","rootNode","getComponent","TxVariants","commercialTxAmount","value","response","order","remainingAmount","handleOrder","handleSuccessResult","handleKeyPress","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","loadingContext","SRPanelProvider","AmountProvider","providerRef","componentToRender","checkout","super","_define_property","createRef","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","askDonation","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","onClick","register","bind","undefined","txVariants"],"mappings":"wrCAsCO,MAAeA,UAA6DC,EAgEvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,KAAKC,OAE5BD,KAAKC,OAAS,IAAIC,KACdF,KAAKG,aAAaL,GACXC,EAAeK,MAAMJ,KAAME,GAE1C,CAEUC,YAAAA,CAAaL,GAEnB,GAAIA,GAAqBO,eACrB,OAGJ,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,KAAMC,EAAcC,SACpBC,UAAWX,KAAKQ,KAChBI,WAAY,IAAKd,EAAqBe,cAAeb,KAAKc,MAAMD,kBAC5Df,GAAqBiB,UAAY,CAAEC,uBAAuB,KAGlEhB,KAAKiB,UAAUC,cAAcZ,EACjC,CAEUa,uBAAAA,GACDnB,KAAKiB,UAAUG,WAAW,aACnC,CAEA,aAAIH,GACA,OAAOjB,KAAKqB,KAAKC,QAAQL,SAC7B,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L,MAEjDA,KAAKH,uBAAuBiB,GAC5Bd,KAAKmB,yBACT,EA1CA6I,EAbkBrK,EAaKa,YAA2B8K,GAUlDtB,EAvBkBrK,EAuBK4L,aAAuB"}
@@ -1,2 +1,2 @@
1
- function e(e,n){if(null==e)throw new Error(n);return e}const n="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=e("6.41.0","LIBRARY_VERSION is not defined"),t=e("esm","BUNDLE_TYPE is not defined"),r=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","donation","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],i=6e4;var d=function(e){return e.WEB="web",e}({});const a="web";var s=function(e){return e.NATIVE="nativeComponent",e.GENERIC="genericComponent",e}({});export{d as CHANNEL,i as DEFAULT_HTTP_TIMEOUT,n as FALLBACK_CONTEXT,r as GENERIC_OPTIONS,t as LIBRARY_BUNDLE_TYPE,o as LIBRARY_VERSION,s as PAYMENT_METHOD_BEHAVIOR,a as PLATFORM};
1
+ function e(e,n){if(null==e)throw new Error(n);return e}const n="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=e("6.41.1","LIBRARY_VERSION is not defined"),t=e("esm","BUNDLE_TYPE is not defined"),r=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","donation","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],i=6e4;var d=function(e){return e.WEB="web",e}({});const a="web";var s=function(e){return e.NATIVE="nativeComponent",e.GENERIC="genericComponent",e}({});export{d as CHANNEL,i as DEFAULT_HTTP_TIMEOUT,n as FALLBACK_CONTEXT,r as GENERIC_OPTIONS,t as LIBRARY_BUNDLE_TYPE,o as LIBRARY_VERSION,s as PAYMENT_METHOD_BEHAVIOR,a as PLATFORM};
2
2
  //# sourceMappingURL=config.js.map
@@ -1,7 +1,7 @@
1
1
  /// <reference types="applepayjs" />
2
2
  /// <reference types="googlepay" />
3
3
  import * as preact from 'preact';
4
- import { h, TargetedMouseEvent, Ref, RefObject, Component, ComponentChildren, FunctionComponent, ComponentChild, TargetedKeyboardEvent } from 'preact';
4
+ import { h, TargetedMouseEvent, Ref, RefObject, Component, ComponentChildren, FunctionComponent, ComponentChild } from 'preact';
5
5
  import { OrderResponseBody, OnShippingAddressChangeData, OnShippingOptionsChangeData, OnInitActions } from '@paypal/paypal-js';
6
6
 
7
7
  interface ILanguageService {
@@ -290,6 +290,7 @@ interface ButtonProps {
290
290
  complete?: () => void;
291
291
  }) => void;
292
292
  onKeyDown?: (event: KeyboardEvent) => void;
293
+ onKeyPress?: (event: KeyboardEvent) => void;
293
294
  buttonRef?: Ref<HTMLButtonElement>;
294
295
  onMouseEnter?: (event: MouseEvent) => void;
295
296
  onMouseLeave?: (event: MouseEvent) => void;
@@ -1465,24 +1466,24 @@ type GiftcardFieldsProps = {
1465
1466
  */
1466
1467
  declare class SecuredFieldsProvider extends Component<SFPProps, SFPState> {
1467
1468
  private csfLoadFailTimeout;
1468
- private readonly csfLoadFailTimeoutMS;
1469
- private readonly csfConfigFailTimeout;
1470
- private readonly csfConfigFailTimeoutMS;
1469
+ private csfLoadFailTimeoutMS;
1470
+ private csfConfigFailTimeout;
1471
+ private csfConfigFailTimeoutMS;
1471
1472
  private numCharsInField;
1472
1473
  private rootNode;
1473
1474
  private numDateFields;
1474
1475
  private csf;
1475
- private readonly handleOnLoad;
1476
- private readonly handleOnConfigSuccess;
1477
- private readonly handleOnFieldValid;
1478
- private readonly handleOnAllValid;
1479
- private readonly handleOnBrand;
1480
- private readonly handleFocus;
1481
- private readonly handleOnError;
1482
- private readonly handleOnAutoComplete;
1483
- private readonly handleOnNoDataRequired;
1484
- private readonly handleOnTouchstartIOS;
1485
- private readonly handleKeyDown;
1476
+ private handleOnLoad;
1477
+ private handleOnConfigSuccess;
1478
+ private handleOnFieldValid;
1479
+ private handleOnAllValid;
1480
+ private handleOnBrand;
1481
+ private handleFocus;
1482
+ private handleOnError;
1483
+ private handleOnAutoComplete;
1484
+ private handleOnNoDataRequired;
1485
+ private handleOnTouchstartIOS;
1486
+ private handleKeyPressed;
1486
1487
  state: SFPState;
1487
1488
  props: SFPProps;
1488
1489
  private issuingCountryCode;
@@ -1506,7 +1507,7 @@ declare class SecuredFieldsProvider extends Component<SFPProps, SFPState> {
1506
1507
  onBinValue: () => void;
1507
1508
  onFocus: () => void;
1508
1509
  onAutoComplete: () => void;
1509
- handleKeyDown: () => void;
1510
+ handleKeyPress: () => void;
1510
1511
  styles: {};
1511
1512
  };
1512
1513
  componentDidMount(): void;
@@ -1566,7 +1567,7 @@ interface SFPProps {
1566
1567
  onLoad?: (cbObj: CardLoadData) => void;
1567
1568
  onStateUpdate?: (obj: SFPState) => void;
1568
1569
  onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;
1569
- handleKeyDown?: (event: KeyboardEvent) => void;
1570
+ handleKeyPress?: (obj: KeyboardEvent) => void;
1570
1571
  rootNode?: HTMLElement;
1571
1572
  showWarnings?: boolean;
1572
1573
  styles?: StylesObject;
@@ -1685,8 +1686,8 @@ interface CardAutoCompleteData {
1685
1686
  }
1686
1687
  interface CardBinLookupData {
1687
1688
  type?: string;
1688
- detectedBrands?: string[];
1689
- supportedBrands?: string[];
1689
+ detectedBrands?: string[] | null;
1690
+ supportedBrands?: string[] | null;
1690
1691
  brands?: string[];
1691
1692
  issuingCountryCode?: string;
1692
1693
  healthcare?: Record<string, boolean>[];
@@ -1694,6 +1695,7 @@ interface CardBinLookupData {
1694
1695
  rootNode?: HTMLElement;
1695
1696
  isReset?: boolean;
1696
1697
  dualBrandingType?: string;
1698
+ paymentMethodVariants?: (string | undefined)[];
1697
1699
  }
1698
1700
  interface CardBinValueData {
1699
1701
  type: string;
@@ -4316,7 +4318,7 @@ interface GiftcardComponentProps extends Partial<Pick<SFPProps, 'clientKey' | 'l
4316
4318
  expiryDateRequired?: boolean;
4317
4319
  fieldsLayoutComponent: FunctionComponent<GiftcardFieldsProps>;
4318
4320
  placeholders?: Placeholders$1;
4319
- handleKeyDown?: (event: KeyboardEvent) => void;
4321
+ handleKeyPress?: (o: KeyboardEvent) => void;
4320
4322
  onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;
4321
4323
  }
4322
4324
  declare class Giftcard extends Component<Readonly<GiftcardComponentProps>> {
@@ -7157,8 +7159,8 @@ declare abstract class BaseElement<P extends BaseElementProps> implements IBaseE
7157
7159
  * Returns the component data necessary for the /payments request
7158
7160
  */
7159
7161
  protected formatData(): any;
7160
- protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent): any;
7161
- protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>): any;
7162
+ protected submitAnalytics(analyticsObj?: AbstractAnalyticsEvent): any;
7163
+ protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement>): any;
7162
7164
  protected setState(newState: object): void;
7163
7165
  /**
7164
7166
  * Returns the component payment data ready to submit to the Checkout API
@@ -7299,9 +7301,9 @@ declare abstract class UIElement<P extends UIElementProps = UIElementProps> exte
7299
7301
  * @param response -
7300
7302
  */
7301
7303
  protected handleResponse(response: PaymentResponseData): void;
7302
- protected handleKeyDown(e: TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent): void;
7304
+ protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent): void;
7303
7305
  /**
7304
- * Handle Enter key pressed from a UIElement (called via handleKeyDown)
7306
+ * Handle Enter key pressed from a UIElement (called via handleKeyPress)
7305
7307
  * @param obj
7306
7308
  */
7307
7309
  protected onEnterKeyPressed(activeElement: Element, component: UIElement): void;
@@ -8121,7 +8123,7 @@ declare class CardElement extends UIElement<CardConfiguration> {
8121
8123
  constructor(checkout: ICore, props?: CardConfiguration);
8122
8124
  protected static readonly defaultProps: any;
8123
8125
  setStatus(status: UIElementStatus, props?: any): this;
8124
- private setClickToPayRef;
8126
+ private readonly setClickToPayRef;
8125
8127
  protected getPaymentMethodConfigFromResponse(componentProps: CardConfiguration): RawPaymentMethod;
8126
8128
  formatProps(props: CardConfiguration): CardConfiguration;
8127
8129
  /**
@@ -8132,13 +8134,13 @@ declare class CardElement extends UIElement<CardConfiguration> {
8132
8134
  updateStyles(stylesObj: any): this;
8133
8135
  setFocusOn(fieldName: any): this;
8134
8136
  onBrand: (event: any) => void;
8135
- processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset?: boolean): this;
8137
+ processBinLookupResponse(binLookupResponse: BinLookupResponse | null, isReset?: boolean): this;
8136
8138
  handleUnsupportedCard(errObj: any): this;
8137
- private handleClickToPaySubmit;
8139
+ private readonly handleClickToPaySubmit;
8138
8140
  onBinLookup(obj: CardBinLookupData): void;
8139
- private onConfigSuccess;
8140
- private onFocus;
8141
- private onBlur;
8141
+ private readonly onConfigSuccess;
8142
+ private readonly onFocus;
8143
+ private readonly onBlur;
8142
8144
  onBinValue: (callbackObj: CardBinValueData) => void;
8143
8145
  get storePaymentMethodPayload(): {
8144
8146
  storePaymentMethod?: undefined;
@@ -8395,7 +8397,7 @@ declare class DropinElement extends UIElement<DropinConfiguration> implements ID
8395
8397
  */
8396
8398
  protected handleOrder: ({ order }: PaymentResponseData) => void;
8397
8399
  closeActivePaymentMethod(): void;
8398
- protected handleKeyDown(e: TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent): void;
8400
+ protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent): void;
8399
8401
  protected onEnterKeyPressed(activeElement: Element, component: UIElement): void;
8400
8402
  protected componentToRender(): h.JSX.Element;
8401
8403
  }
@@ -1,2 +1,2 @@
1
- const t=(t,e,r,n)=>{if(t[r]?.[e]?.formatterFn)return null;const l=t[r]?.[e]?.maxlength;return l||30},e=t=>!(null!=t&&!/^[\s]*$/.test(t)),r="?\\+_=!@#$%^&*(){}~<>\\[\\]\\\\",n=(t,e="g")=>new RegExp(`[${t}]`,e),l=t=>t.trimStart().replace(/\s+/g," ");export{r as SPECIAL_CHARS,n as getFormattingRegEx,t as getMaxLengthByFieldAndCountry,e as isEmpty,l as trimValWithOneSpace};
1
+ const t=(t,e,n,r)=>{if(t[n]?.[e]?.formatterFn)return null;const l=t[n]?.[e]?.maxlength;return l||30},e=t=>!(null!=t&&!/^[\s]*$/.test(t)),n="?\\+_=!@#$%^&*(){}~<>\\[\\]\\\\",r=(t,e="g")=>new RegExp(`[${t}]`,e),l=t=>t.trim().replace(/\s+/g," ");export{n as SPECIAL_CHARS,r as getFormattingRegEx,t as getMaxLengthByFieldAndCountry,e as isEmpty,l as trimValWithOneSpace};
2
2
  //# sourceMappingURL=validator-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validator-utils.js","sources":["../../../src/utils/validator-utils.ts"],"sourcesContent":["import { CountryFormatRules } from './Validator/types';\n\nconst MAX_LENGTH = 30;\n\nexport const getMaxLengthByFieldAndCountry = (\n formattingRules: CountryFormatRules,\n field: string,\n country: string,\n ignoreIfFormatterExists: boolean\n): number | null => {\n // In ignoreIfFormatterExists is true we expect the formatter function to also act to limit length\n if (ignoreIfFormatterExists && formattingRules[country]?.[field]?.formatterFn) {\n return null;\n }\n const maxLength = formattingRules[country]?.[field]?.maxlength;\n return maxLength ? maxLength : MAX_LENGTH;\n};\n\n// Not null or undefined or only spaces\nexport const isEmpty = (input: string) => !!(input == null || /^[\\s]*$/.test(input));\n\nexport const isString = (input: unknown) => typeof input === 'string' || input instanceof String;\nexport const hasText = (input: string) => isString(input) && !isEmpty(input);\n\nexport const SPECIAL_CHARS = '?\\\\+_=!@#$%^&*(){}~<>\\\\[\\\\]\\\\\\\\'; // N.B. difficulty escaping \\ (takes 3 backslashes!)\n\n// Generates a regEx ideal for use in a String.replace call for use in a formatter\n// e.g. getFormattingRegEx('^\\\\d', 'g') will generate: /[^\\d]/g which is a regEx to match anything that is not a digit\nexport const getFormattingRegEx = (specChars: string, flags = 'g') => new RegExp(`[${specChars}]`, flags);\n\n// Creates a regEx ideal for use in a RegExp.test call for use in a validator\nexport const getValidatingRegEx = (specChars: string, exclude: boolean) => new RegExp(`^[${exclude ? '^' : ''}${specChars}]+$`);\n\nexport const CHARACTER_PATTERNS: { [key: string]: RegExp } = {\n digitsHyphen: /^[\\d-]+$/,\n noHtml: /^[^<>&]+$/,\n alphaNum: /^\\d[a-zA-Z0-9]{6,11}$/,\n noSpecialChars: getValidatingRegEx(SPECIAL_CHARS, true)\n};\n\nexport const exactLength = (input: string, length: number) => {\n if (isEmpty(input)) {\n return true;\n }\n return input.length === length;\n};\n\nexport const validateForSpecialChars = (name: string) => {\n const hasNoLength = !name.length;\n // RegEx .test, if run against empty string, will return false\n return CHARACTER_PATTERNS.noSpecialChars.test(name) || hasNoLength;\n};\n\n// Trim start and never allow more than 1 space on the end\nexport const trimValWithOneSpace = (val: string) => val.trimStart().replace(/\\s+/g, ' ');\n"],"names":["getMaxLengthByFieldAndCountry","formattingRules","field","country","ignoreIfFormatterExists","formatterFn","maxLength","maxlength","isEmpty","input","test","SPECIAL_CHARS","getFormattingRegEx","specChars","flags","RegExp","trimValWithOneSpace","val","trimStart","replace"],"mappings":"AAEA,MAEaA,EAAgC,CACzCC,EACAC,EACAC,EACAC,KAGA,GAA+BH,EAAgBE,KAAWD,IAAQG,YAC9D,OAAO,KAEX,MAAMC,EAAYL,EAAgBE,KAAWD,IAAQK,UACrD,OAAOD,GAbQ,IAiBNE,EAAWC,KAA8B,MAATA,IAAiB,UAAUC,KAAKD,IAKhEE,EAAgB,kCAIhBC,EAAqB,CAACC,EAAmBC,EAAQ,MAAQ,IAAIC,OAAO,IAAIF,KAAcC,GA0BtFE,EAAuBC,GAAgBA,EAAIC,YAAYC,QAAQ,OAAQ"}
1
+ {"version":3,"file":"validator-utils.js","sources":["../../../src/utils/validator-utils.ts"],"sourcesContent":["import { CountryFormatRules } from './Validator/types';\n\nconst MAX_LENGTH = 30;\n\nexport const getMaxLengthByFieldAndCountry = (\n formattingRules: CountryFormatRules,\n field: string,\n country: string,\n ignoreIfFormatterExists: boolean\n): number | null => {\n // In ignoreIfFormatterExists is true we expect the formatter function to also act to limit length\n if (ignoreIfFormatterExists && formattingRules[country]?.[field]?.formatterFn) {\n return null;\n }\n const maxLength = formattingRules[country]?.[field]?.maxlength;\n return maxLength ? maxLength : MAX_LENGTH;\n};\n\n// Not null or undefined or only spaces\nexport const isEmpty = (input: string) => !!(input == null || /^[\\s]*$/.test(input));\n\nexport const isString = (input: unknown) => typeof input === 'string' || input instanceof String;\nexport const hasText = (input: string) => isString(input) && !isEmpty(input);\n\nexport const SPECIAL_CHARS = '?\\\\+_=!@#$%^&*(){}~<>\\\\[\\\\]\\\\\\\\'; // N.B. difficulty escaping \\ (takes 3 backslashes!)\n\n// Generates a regEx ideal for use in a String.replace call for use in a formatter\n// e.g. getFormattingRegEx('^\\\\d', 'g') will generate: /[^\\d]/g which is a regEx to match anything that is not a digit\nexport const getFormattingRegEx = (specChars: string, flags = 'g') => new RegExp(`[${specChars}]`, flags);\n\n// Creates a regEx ideal for use in a RegExp.test call for use in a validator\nexport const getValidatingRegEx = (specChars: string, exclude: boolean) => new RegExp(`^[${exclude ? '^' : ''}${specChars}]+$`);\n\nexport const CHARACTER_PATTERNS: { [key: string]: RegExp } = {\n digitsHyphen: /^[\\d-]+$/,\n noHtml: /^[^<>&]+$/,\n alphaNum: /^\\d[a-zA-Z0-9]{6,11}$/,\n noSpecialChars: getValidatingRegEx(SPECIAL_CHARS, true)\n};\n\nexport const exactLength = (input: string, length: number) => {\n if (isEmpty(input)) {\n return true;\n }\n return input.length === length;\n};\n\nexport const validateForSpecialChars = (name: string) => {\n const hasNoLength = !name.length;\n // RegEx .test, if run against empty string, will return false\n return CHARACTER_PATTERNS.noSpecialChars.test(name) || hasNoLength;\n};\n\n// Trim both ends and never allow more than 1 space in between\nexport const trimValWithOneSpace = (val: string) => val.trim().replace(/\\s+/g, ' ');\n"],"names":["getMaxLengthByFieldAndCountry","formattingRules","field","country","ignoreIfFormatterExists","formatterFn","maxLength","maxlength","isEmpty","input","test","SPECIAL_CHARS","getFormattingRegEx","specChars","flags","RegExp","trimValWithOneSpace","val","trim","replace"],"mappings":"AAEA,MAEaA,EAAgC,CACzCC,EACAC,EACAC,EACAC,KAGA,GAA+BH,EAAgBE,KAAWD,IAAQG,YAC9D,OAAO,KAEX,MAAMC,EAAYL,EAAgBE,KAAWD,IAAQK,UACrD,OAAOD,GAbQ,IAiBNE,EAAWC,KAA8B,MAATA,IAAiB,UAAUC,KAAKD,IAKhEE,EAAgB,kCAIhBC,EAAqB,CAACC,EAAmBC,EAAQ,MAAQ,IAAIC,OAAO,IAAIF,KAAcC,GA0BtFE,EAAuBC,GAAgBA,EAAIC,OAAOC,QAAQ,OAAQ"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import o from"./components/CardInput/CardInput.js";import e from"../../utils/browserInfo.js";import n from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{fieldTypeToSnakeCase as i,isSecuredField as s}from"../internal/SecuredFields/utils.js";import{reject as r,notFalsy as a}from"../../utils/commonUtils.js";import{shouldIncludeInstallmentsInPaymentData as l}from"./components/CardInput/utils.js";import d from"../internal/ClickToPay/services/create-clicktopay-service.js";import u from"./components/ClickToPayWrapper.js";import{TxVariants as c}from"../tx-variants.js";import{UIElement as p}from"../internal/UIElement/UIElement.js";import h from"../internal/PayButton/PayButton.js";import m,{IMPLEMENTATION_ERROR as y}from"../../core/Errors/AdyenCheckoutError.js";import f from"./components/CardInput/defaultProps.js";import{AnalyticsInfoEvent as v,InfoEventType as b}from"../../core/Analytics/events/AnalyticsInfoEvent.js";function g(t,o,e){return o in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function P(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{},n=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.forEach(function(o){g(t,o,e[o])})}return t}function C(t,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):function(t){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);o.push.apply(o,e)}return o}(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}),t}class S extends p{setStatus(t,o){var e,n;return(null===(e=this.componentRef)||void 0===e?void 0:e.setStatus)&&this.componentRef.setStatus(t,o),(null===(n=this.clickToPayRef)||void 0===n?void 0:n.setStatus)&&this.clickToPayRef.setStatus(t,o),this}getPaymentMethodConfigFromResponse(t){var o;return(null==t?void 0:t.fundingSource)?null===(o=this.core.paymentMethodsResponse)||void 0===o?void 0:o.findByFundingSource(t.type,t.fundingSource):super.getPaymentMethodConfigFromResponse(t)}formatProps(t){var o,e,n,i,s,r,l,d,u,p,h,v,b,g,S,k,w,R,B,O,T,j,I;const M=null!==(o=null===(r=t.session)||void 0===r||null===(s=r.configuration)||void 0===s?void 0:s.enableStoreDetails)&&void 0!==o?o:t.enableStoreDetails,A=!(0===(null===(l=t.amount)||void 0===l?void 0:l.value))&&M,D=t.storedPaymentMethodId||t.id,F=D&&(null==t||null===(d=t.supportedShopperInteractions)||void 0===d?void 0:d.includes("Ecommerce"));if(D&&!F)throw new m(y,"You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions");const N=t.installmentOptions;t.session&&a(N)&&console.warn("WARNING: You have defined installments configuration on the Card component, but you are using a /sessions integration.\nWith this integration, installments configuration must be defined when you create the session. Any configuration defined elsewhere will be ignored.\n\n");const E=t.session?null!==(e=null===(p=t.session)||void 0===p||null===(u=p.configuration)||void 0===u?void 0:u.installmentOptions)&&void 0!==e?e:f.installmentOptions:N;return P(C(P({},t),{holderNameRequired:!!t.hasHolderName&&t.holderNameRequired,hasCVC:!(t.brand&&"bcmc"===t.brand||t.hideCVC),billingAddressRequired:!t.storedPaymentMethodId&&t.billingAddressRequired,billingAddressMode:t.onAddressLookup?f.billingAddressMode:t.billingAddressMode,brand:null!==(n=t.brand)&&void 0!==n?n:c.card,countryCode:t.countryCode?t.countryCode.toLowerCase():null,configuration:C(P({},t.configuration),{socialSecurityNumberMode:null!==(i=null===(h=t.configuration)||void 0===h?void 0:h.socialSecurityNumberMode)&&void 0!==i?i:"auto"}),brandsConfiguration:t.brandsConfiguration||(null===(v=t.configuration)||void 0===v?void 0:v.brandsConfiguration)||{},icon:t.icon||(null===(b=t.configuration)||void 0===b?void 0:b.icon),installmentOptions:E,enableStoreDetails:M,showStoreDetailsCheckbox:A,clickToPayConfiguration:C(P({},t.clickToPayConfiguration),{disableOtpAutoFocus:(null===(g=t.clickToPayConfiguration)||void 0===g?void 0:g.disableOtpAutoFocus)||!1,shopperEmail:(null===(S=t.clickToPayConfiguration)||void 0===S?void 0:S.shopperEmail)||(null===(w=this.core.options)||void 0===w||null===(k=w.session)||void 0===k?void 0:k.shopperEmail),telephoneNumber:(null===(R=t.clickToPayConfiguration)||void 0===R?void 0:R.telephoneNumber)||(null===(O=this.core.options)||void 0===O||null===(B=O.session)||void 0===B?void 0:B.telephoneNumber),locale:(null===(T=t.clickToPayConfiguration)||void 0===T?void 0:T.locale)||(null===(I=t.i18n)||void 0===I||null===(j=I.locale)||void 0===j?void 0:j.replace("-","_"))})}),D&&{storedPaymentMethodId:D})}formatData(){var t;const o=this.state.selectedBrandValue;return C(P({paymentMethod:P({type:S.type},this.state.data,this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId,holderName:null!==(t=this.props.holderName)&&void 0!==t?t:""},o&&{brand:o},this.props.fundingSource&&{fundingSource:this.props.fundingSource},this.state.fastlaneData&&{fastlaneData:btoa(JSON.stringify(this.state.fastlaneData))})},this.state.billingAddress&&{billingAddress:this.state.billingAddress},this.state.socialSecurityNumber&&{socialSecurityNumber:this.state.socialSecurityNumber},this.storePaymentMethodPayload,l(this.state.installments)&&{installments:this.state.installments}),{browserInfo:this.browserInfo,origin:!!window&&window.location.origin})}beforeRender(t){if(null==t?void 0:t.originalAction)return;const o=new v(P({type:b.rendered,component:this.type,configData:C(P({},t),{showPayButton:this.props.showPayButton})},(null==t?void 0:t.oneClick)&&{isStoredPaymentMethod:!0,brand:t.brand}));this.analytics.sendAnalytics(o)}updateStyles(t){var o;return(null===(o=this.componentRef)||void 0===o?void 0:o.updateStyles)&&this.componentRef.updateStyles(t),this}setFocusOn(t){var o;return(null===(o=this.componentRef)||void 0===o?void 0:o.setFocusOn)&&this.componentRef.setFocusOn(t),this}processBinLookupResponse(t,o=!1){var e;return(null===(e=this.componentRef)||void 0===e?void 0:e.processBinLookupResponse)&&this.componentRef.processBinLookupResponse(t,o),this}handleUnsupportedCard(t){var o;return(null===(o=this.componentRef)||void 0===o?void 0:o.handleUnsupportedCard)&&this.componentRef.handleUnsupportedCard(t),this}onBinLookup(t){if(!t.isReset){var o,e;const n=r("supportedBrandsRaw").from(t);null===(o=(e=this.props).onBinLookup)||void 0===o||o.call(e,n)}}get storePaymentMethodPayload(){var t,o;if((null===(t=this.props.storedPaymentMethodId)||void 0===t?void 0:t.length)>0)return{};if(0===(null===(o=this.props.amount)||void 0===o?void 0:o.value))return this.props.enableStoreDetails?{storePaymentMethod:!0}:{};return this.props.showStoreDetailsCheckbox&&void 0!==this.state.storePaymentMethod?{storePaymentMethod:Boolean(this.state.storePaymentMethod)}:{}}get isValid(){return!!this.state.isValid}get icon(){var t;return null!==(t=this.props.icon)&&void 0!==t?t:this.resources.getImage()(this.props.brand)}get brands(){const{brands:t,brandsConfiguration:o}=this.props;return t?t.map(t=>{var e,n;return{icon:null!==(e=null==o||null===(n=o[t])||void 0===n?void 0:n.icon)&&void 0!==e?e:this.props.modules.resources.getImage()(t),name:t}}):[]}get displayName(){return this.props.storedPaymentMethodId?`•••• ${this.props.lastFour}`:this.props.name||S.type}get accessibleName(){return(this.props.name||S.type)+(this.props.storedPaymentMethodId?" "+this.props.i18n.get("creditCard.storedCard.description.ariaLabel").replace("%@",this.props.lastFour):"")}get browserInfo(){return e()}renderCardInput(e=!0){return t(o,C(P({setComponentRef:this.setComponentRef},this.props,this.state),{onSubmitAnalytics:this.submitAnalytics,onChange:this.setState,onSubmit:this.submit,handleKeyDown:this.handleKeyDown,payButton:this.payButton,onBrand:this.onBrand,onBinValue:this.onBinValue,brand:this.props.brand,brandsIcons:this.brands,isPayButtonPrimaryVariant:e,resources:this.resources,onFocus:this.onFocus,onBlur:this.onBlur,onConfigSuccess:this.onConfigSuccess}))}componentToRender(){return t(u,{configuration:this.props.clickToPayConfiguration,clickToPayService:this.clickToPayService,isStandaloneComponent:!1,setClickToPayRef:this.setClickToPayRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},t=>this.renderCardInput(t))}constructor(o,e){var r;(super(o,e),g(this,"clickToPayService",void 0),g(this,"clickToPayRef",null),g(this,"setClickToPayRef",t=>{this.clickToPayRef=t}),g(this,"onBrand",t=>{var o,e;null===(o=(e=this.props).onBrand)||void 0===o||o.call(e,t)}),g(this,"handleClickToPaySubmit",t=>{this.setState({data:P({},t),valid:{},errors:{},isValid:!0}),this.submit()}),g(this,"onConfigSuccess",t=>{var o,e;const n=new v({component:this.type,type:b.configured});this.submitAnalytics(n),null===(o=(e=this.props).onConfigSuccess)||void 0===o||o.call(e,t)}),g(this,"onFocus",t=>{const o=new v({component:this.type,type:b.focus,target:i(t.fieldType)});var e,n,r,a;(this.submitAnalytics(o),s(t.fieldType))?null===(e=(n=this.props).onFocus)||void 0===e||e.call(n,t.event):null===(r=(a=this.props).onFocus)||void 0===r||r.call(a,t)}),g(this,"onBlur",t=>{const o=new v({component:this.type,type:b.unfocus,target:i(t.fieldType)});var e,n,r,a;(this.submitAnalytics(o),s(t.fieldType))?null===(e=(n=this.props).onBlur)||void 0===e||e.call(n,t.event):null===(r=(a=this.props).onBlur)||void 0===r||r.call(a,t)}),g(this,"onBinValue",n(this)),g(this,"payButton",o=>{var e,n;const i=0===(null===(e=this.props.amount)||void 0===e?void 0:e.value),s=(null===(n=this.props.storedPaymentMethodId)||void 0===n?void 0:n.length)>0;return t(h,C(P({},o),{label:i&&!s?this.props.i18n.get("payButton.saveDetails"):"",onClick:this.submit}))}),e&&!e._disableClickToPay&&"prepaid"!==this.props.fundingSource)&&(this.clickToPayService=d(this.props.configuration,this.props.clickToPayConfiguration,this.props.environment,this.analytics),null===(r=this.clickToPayService)||void 0===r||r.initialize())}}g(S,"type",c.scheme),g(S,"defaultProps",P({showFormInstruction:!0,_disableClickToPay:!1,doBinLookup:!0},r(["type","setComponentRef"]).from(f)));export{S as CardElement,S as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import o from"./components/CardInput/CardInput.js";import e from"../../utils/browserInfo.js";import{triggerBinLookUp as n}from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{fieldTypeToSnakeCase as i,isSecuredField as s}from"../internal/SecuredFields/utils.js";import{reject as r,notFalsy as a}from"../../utils/commonUtils.js";import{shouldIncludeInstallmentsInPaymentData as l}from"./components/CardInput/utils.js";import d from"../internal/ClickToPay/services/create-clicktopay-service.js";import u from"./components/ClickToPayWrapper.js";import{TxVariants as c}from"../tx-variants.js";import{UIElement as p}from"../internal/UIElement/UIElement.js";import h from"../internal/PayButton/PayButton.js";import m,{IMPLEMENTATION_ERROR as y}from"../../core/Errors/AdyenCheckoutError.js";import f from"./components/CardInput/defaultProps.js";import{AnalyticsInfoEvent as v,InfoEventType as b}from"../../core/Analytics/events/AnalyticsInfoEvent.js";function g(t,o,e){return o in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function P(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{},n=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.forEach(function(o){g(t,o,e[o])})}return t}function C(t,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):function(t){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);o.push.apply(o,e)}return o}(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}),t}class S extends p{setStatus(t,o){var e,n;return(null===(e=this.componentRef)||void 0===e?void 0:e.setStatus)&&this.componentRef.setStatus(t,o),(null===(n=this.clickToPayRef)||void 0===n?void 0:n.setStatus)&&this.clickToPayRef.setStatus(t),this}getPaymentMethodConfigFromResponse(t){var o;return(null==t?void 0:t.fundingSource)?null===(o=this.core.paymentMethodsResponse)||void 0===o?void 0:o.findByFundingSource(t.type,t.fundingSource):super.getPaymentMethodConfigFromResponse(t)}formatProps(t){var o,e,n,i,s,r,l,d,u,p,h,v,b,g,S,k,R,w,B,O,T,j,I;const M=null!==(o=null===(r=t.session)||void 0===r||null===(s=r.configuration)||void 0===s?void 0:s.enableStoreDetails)&&void 0!==o?o:t.enableStoreDetails,A=!(0===(null===(l=t.amount)||void 0===l?void 0:l.value))&&M,F=t.storedPaymentMethodId||t.id,N=F&&(null==t||null===(d=t.supportedShopperInteractions)||void 0===d?void 0:d.includes("Ecommerce"));if(F&&!N)throw new m(y,"You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions");const D=t.installmentOptions;t.session&&a(D)&&console.warn("WARNING: You have defined installments configuration on the Card component, but you are using a /sessions integration.\nWith this integration, installments configuration must be defined when you create the session. Any configuration defined elsewhere will be ignored.\n\n");const E=t.session?null!==(e=null===(p=t.session)||void 0===p||null===(u=p.configuration)||void 0===u?void 0:u.installmentOptions)&&void 0!==e?e:f.installmentOptions:D;return P(C(P({},t),{holderNameRequired:!!t.hasHolderName&&t.holderNameRequired,hasCVC:!(t.brand&&"bcmc"===t.brand||t.hideCVC),billingAddressRequired:!t.storedPaymentMethodId&&t.billingAddressRequired,billingAddressMode:t.onAddressLookup?f.billingAddressMode:t.billingAddressMode,brand:null!==(n=t.brand)&&void 0!==n?n:c.card,countryCode:t.countryCode?t.countryCode.toLowerCase():null,configuration:C(P({},t.configuration),{socialSecurityNumberMode:null!==(i=null===(h=t.configuration)||void 0===h?void 0:h.socialSecurityNumberMode)&&void 0!==i?i:"auto"}),brandsConfiguration:t.brandsConfiguration||(null===(v=t.configuration)||void 0===v?void 0:v.brandsConfiguration)||{},icon:t.icon||(null===(b=t.configuration)||void 0===b?void 0:b.icon),installmentOptions:E,enableStoreDetails:M,showStoreDetailsCheckbox:A,clickToPayConfiguration:C(P({},t.clickToPayConfiguration),{disableOtpAutoFocus:(null===(g=t.clickToPayConfiguration)||void 0===g?void 0:g.disableOtpAutoFocus)||!1,shopperEmail:(null===(S=t.clickToPayConfiguration)||void 0===S?void 0:S.shopperEmail)||(null===(R=this.core.options)||void 0===R||null===(k=R.session)||void 0===k?void 0:k.shopperEmail),telephoneNumber:(null===(w=t.clickToPayConfiguration)||void 0===w?void 0:w.telephoneNumber)||(null===(O=this.core.options)||void 0===O||null===(B=O.session)||void 0===B?void 0:B.telephoneNumber),locale:(null===(T=t.clickToPayConfiguration)||void 0===T?void 0:T.locale)||(null===(I=t.i18n)||void 0===I||null===(j=I.locale)||void 0===j?void 0:j.replace("-","_"))})}),F&&{storedPaymentMethodId:F})}formatData(){var t;const o=this.state.selectedBrandValue;return C(P({paymentMethod:P({type:S.type},this.state.data,this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId,holderName:null!==(t=this.props.holderName)&&void 0!==t?t:""},o&&{brand:o},this.props.fundingSource&&{fundingSource:this.props.fundingSource},this.state.fastlaneData&&{fastlaneData:btoa(JSON.stringify(this.state.fastlaneData))})},this.state.billingAddress&&{billingAddress:this.state.billingAddress},this.state.socialSecurityNumber&&{socialSecurityNumber:this.state.socialSecurityNumber},this.storePaymentMethodPayload,l(this.state.installments)&&{installments:this.state.installments}),{browserInfo:this.browserInfo,origin:!!window&&window.location.origin})}beforeRender(t){if(null==t?void 0:t.originalAction)return;const o=new v(P({type:b.rendered,component:this.type,configData:C(P({},t),{showPayButton:this.props.showPayButton})},(null==t?void 0:t.oneClick)&&{isStoredPaymentMethod:!0,brand:t.brand}));this.analytics.sendAnalytics(o)}updateStyles(t){var o;return(null===(o=this.componentRef)||void 0===o?void 0:o.updateStyles)&&this.componentRef.updateStyles(t),this}setFocusOn(t){var o;return(null===(o=this.componentRef)||void 0===o?void 0:o.setFocusOn)&&this.componentRef.setFocusOn(t),this}processBinLookupResponse(t,o=!1){var e;return(null===(e=this.componentRef)||void 0===e?void 0:e.processBinLookupResponse)&&this.componentRef.processBinLookupResponse(t,o),this}handleUnsupportedCard(t){var o;return(null===(o=this.componentRef)||void 0===o?void 0:o.handleUnsupportedCard)&&this.componentRef.handleUnsupportedCard(t),this}onBinLookup(t){if(!t.isReset){var o,e;const n=r("supportedBrandsRaw").from(t);null===(o=(e=this.props).onBinLookup)||void 0===o||o.call(e,n)}}get storePaymentMethodPayload(){var t,o;if((null===(t=this.props.storedPaymentMethodId)||void 0===t?void 0:t.length)>0)return{};if(0===(null===(o=this.props.amount)||void 0===o?void 0:o.value))return this.props.enableStoreDetails?{storePaymentMethod:!0}:{};return this.props.showStoreDetailsCheckbox&&void 0!==this.state.storePaymentMethod?{storePaymentMethod:Boolean(this.state.storePaymentMethod)}:{}}get isValid(){return!!this.state.isValid}get icon(){var t;return null!==(t=this.props.icon)&&void 0!==t?t:this.resources.getImage()(this.props.brand)}get brands(){const{brands:t,brandsConfiguration:o}=this.props;return t?t.map(t=>{var e,n;return{icon:null!==(e=null==o||null===(n=o[t])||void 0===n?void 0:n.icon)&&void 0!==e?e:this.props.modules.resources.getImage()(t),name:t}}):[]}get displayName(){return this.props.storedPaymentMethodId?`•••• ${this.props.lastFour}`:this.props.name||S.type}get accessibleName(){return(this.props.name||S.type)+(this.props.storedPaymentMethodId?" "+this.props.i18n.get("creditCard.storedCard.description.ariaLabel").replace("%@",this.props.lastFour):"")}get browserInfo(){return e()}renderCardInput(e=!0){return t(o,C(P({setComponentRef:this.setComponentRef},this.props,this.state),{onSubmitAnalytics:this.submitAnalytics,onChange:this.setState,onSubmit:this.submit,handleKeyPress:this.handleKeyPress,payButton:this.payButton,onBrand:this.onBrand,onBinValue:this.onBinValue,brand:this.props.brand,brandsIcons:this.brands,isPayButtonPrimaryVariant:e,resources:this.resources,onFocus:this.onFocus,onBlur:this.onBlur,onConfigSuccess:this.onConfigSuccess}))}componentToRender(){return t(u,{configuration:this.props.clickToPayConfiguration,clickToPayService:this.clickToPayService,isStandaloneComponent:!1,setClickToPayRef:this.setClickToPayRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},t=>this.renderCardInput(t))}constructor(o,e){var r;(super(o,e),g(this,"clickToPayService",void 0),g(this,"clickToPayRef",null),g(this,"setClickToPayRef",t=>{this.clickToPayRef=t}),g(this,"onBrand",t=>{var o,e;null===(o=(e=this.props).onBrand)||void 0===o||o.call(e,t)}),g(this,"handleClickToPaySubmit",t=>{this.setState({data:P({},t),valid:{},errors:{},isValid:!0}),this.submit()}),g(this,"onConfigSuccess",t=>{var o,e;const n=new v({component:this.type,type:b.configured});this.submitAnalytics(n),null===(o=(e=this.props).onConfigSuccess)||void 0===o||o.call(e,t)}),g(this,"onFocus",t=>{const o=new v({component:this.type,type:b.focus,target:i(t.fieldType)});var e,n,r,a;(this.submitAnalytics(o),s(t.fieldType))?null===(e=(n=this.props).onFocus)||void 0===e||e.call(n,t.event):null===(r=(a=this.props).onFocus)||void 0===r||r.call(a,t)}),g(this,"onBlur",t=>{const o=new v({component:this.type,type:b.unfocus,target:i(t.fieldType)});var e,n,r,a;(this.submitAnalytics(o),s(t.fieldType))?null===(e=(n=this.props).onBlur)||void 0===e||e.call(n,t.event):null===(r=(a=this.props).onBlur)||void 0===r||r.call(a,t)}),g(this,"onBinValue",n(this)),g(this,"payButton",o=>{var e,n;const i=0===(null===(e=this.props.amount)||void 0===e?void 0:e.value),s=(null===(n=this.props.storedPaymentMethodId)||void 0===n?void 0:n.length)>0;return t(h,C(P({},o),{label:i&&!s?this.props.i18n.get("payButton.saveDetails"):"",onClick:this.submit}))}),e&&!e._disableClickToPay&&"prepaid"!==this.props.fundingSource)&&(this.clickToPayService=d(this.props.configuration,this.props.clickToPayConfiguration,this.props.environment,this.analytics),null===(r=this.clickToPayService)||void 0===r||r.initialize())}}g(S,"type",c.scheme),g(S,"defaultProps",P({showFormInstruction:!0,_disableClickToPay:!1,doBinLookup:!0},r(["type","setComponentRef"]).from(f)));export{S as CardElement,S as default};
2
2
  //# sourceMappingURL=Card.js.map