@adyen/adyen-web 6.35.0 → 6.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/dist/cjs/adyen.css +7 -7
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +2786 -2102
  6. package/dist/es/adyen.css +7 -7
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
  9. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  10. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  11. package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
  12. package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
  13. package/dist/es/components/Card/components/CardInput/components/CVCHint.js +1 -1
  14. package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  15. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  16. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  17. package/dist/es/components/Donation/Donation.js +1 -1
  18. package/dist/es/components/Donation/Donation.js.map +1 -1
  19. package/dist/es/components/Donation/DonationCampaignService.js +2 -0
  20. package/dist/es/components/Donation/DonationCampaignService.js.map +1 -0
  21. package/dist/es/components/Donation/components/DonationComponent.js +1 -1
  22. package/dist/es/components/Donation/components/DonationComponent.js.map +1 -1
  23. package/dist/es/components/Donation/components/utils.js.map +1 -1
  24. package/dist/es/components/Iris/Iris.js +1 -1
  25. package/dist/es/components/Iris/Iris.js.map +1 -1
  26. package/dist/es/components/Iris/types.js.map +1 -1
  27. package/dist/es/components/PayByBankPix/components/Enrollment/Enrollment.js +1 -1
  28. package/dist/es/components/PayByBankPix/components/Enrollment/Enrollment.js.map +1 -1
  29. package/dist/es/components/PayTo/components/PayToComponent.js +1 -1
  30. package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
  31. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  32. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  33. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  34. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  35. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  36. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  37. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  38. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  39. package/dist/es/components/ThreeDS2/components/utils.js +1 -1
  40. package/dist/es/components/ThreeDS2/components/utils.js.map +1 -1
  41. package/dist/es/components/UPI/UPI.js +1 -1
  42. package/dist/es/components/UPI/UPI.js.map +1 -1
  43. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  44. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  45. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  46. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  47. package/dist/es/components/UPI/constants.js +1 -1
  48. package/dist/es/components/UPI/constants.js.map +1 -1
  49. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  50. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  51. package/dist/es/components/internal/Address/Address.js +1 -1
  52. package/dist/es/components/internal/Address/Address.js.map +1 -1
  53. package/dist/es/components/internal/Address/components/AddressSearch.js.map +1 -1
  54. package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
  55. package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
  56. package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js +1 -1
  57. package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
  58. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  59. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  60. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  61. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  62. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  63. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  64. package/dist/es/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js +1 -1
  65. package/dist/es/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js.map +1 -1
  66. package/dist/es/components/internal/IssuerList/IssuerList.js +1 -1
  67. package/dist/es/components/internal/IssuerList/IssuerList.js.map +1 -1
  68. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.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/SegmentedControl/SegmentedControlRegion.js +1 -1
  72. package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -1
  73. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  74. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  75. package/dist/es/components/internal/UIElement/utils.js +1 -1
  76. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  77. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  78. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  79. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  80. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js +1 -1
  81. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  82. package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
  83. package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
  84. package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  85. package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  86. package/dist/es/core/Services/sessions/constants.js +1 -1
  87. package/dist/es/core/Services/sessions/constants.js.map +1 -1
  88. package/dist/es/core/Services/sessions/fetch-donation-campaigns.js +2 -0
  89. package/dist/es/core/Services/sessions/fetch-donation-campaigns.js.map +1 -0
  90. package/dist/es/core/Services/sessions/make-donation.js +2 -0
  91. package/dist/es/core/Services/sessions/make-donation.js.map +1 -0
  92. package/dist/es/core/config.js +1 -1
  93. package/dist/es/core/config.js.map +1 -1
  94. package/dist/es/core/core.registry.js +1 -1
  95. package/dist/es/core/core.registry.js.map +1 -1
  96. package/dist/es/core/utils.js +1 -1
  97. package/dist/es/core/utils.js.map +1 -1
  98. package/dist/es/index.d.ts +2786 -2102
  99. package/dist/es-legacy/adyen.css +7 -7
  100. package/dist/es-legacy/adyen.css.map +1 -1
  101. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
  102. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  103. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  104. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
  105. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
  106. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js +1 -1
  107. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  108. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  109. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  110. package/dist/es-legacy/components/Donation/Donation.js +1 -1
  111. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  112. package/dist/es-legacy/components/Donation/DonationCampaignService.js +2 -0
  113. package/dist/es-legacy/components/Donation/DonationCampaignService.js.map +1 -0
  114. package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
  115. package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
  116. package/dist/es-legacy/components/Donation/components/utils.js.map +1 -1
  117. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  118. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  119. package/dist/es-legacy/components/Iris/types.js.map +1 -1
  120. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/Enrollment.js +1 -1
  121. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/Enrollment.js.map +1 -1
  122. package/dist/es-legacy/components/PayTo/components/PayToComponent.js +1 -1
  123. package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
  124. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  125. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  126. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  127. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  128. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  129. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  130. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  131. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  132. package/dist/es-legacy/components/ThreeDS2/components/utils.js +1 -1
  133. package/dist/es-legacy/components/ThreeDS2/components/utils.js.map +1 -1
  134. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  135. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  136. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  137. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  138. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  139. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  140. package/dist/es-legacy/components/UPI/constants.js +1 -1
  141. package/dist/es-legacy/components/UPI/constants.js.map +1 -1
  142. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  143. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  144. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  145. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  146. package/dist/es-legacy/components/internal/Address/components/AddressSearch.js.map +1 -1
  147. package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
  148. package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
  149. package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js +1 -1
  150. package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
  151. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  152. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  153. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  154. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  155. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  156. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  157. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js +1 -1
  158. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js.map +1 -1
  159. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
  160. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  161. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  162. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  163. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  164. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js +1 -1
  165. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -1
  166. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  167. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  168. package/dist/es-legacy/components/internal/UIElement/utils.js +1 -1
  169. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  170. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  171. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  172. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  173. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js +1 -1
  174. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  175. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js +1 -1
  176. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js.map +1 -1
  177. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  178. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  179. package/dist/es-legacy/core/Services/sessions/constants.js +1 -1
  180. package/dist/es-legacy/core/Services/sessions/constants.js.map +1 -1
  181. package/dist/es-legacy/core/Services/sessions/fetch-donation-campaigns.js +2 -0
  182. package/dist/es-legacy/core/Services/sessions/fetch-donation-campaigns.js.map +1 -0
  183. package/dist/es-legacy/core/Services/sessions/make-donation.js +2 -0
  184. package/dist/es-legacy/core/Services/sessions/make-donation.js.map +1 -0
  185. package/dist/es-legacy/core/config.js +1 -1
  186. package/dist/es-legacy/core/config.js.map +1 -1
  187. package/dist/es-legacy/core/core.registry.js +1 -1
  188. package/dist/es-legacy/core/core.registry.js.map +1 -1
  189. package/dist/es-legacy/core/utils.js +1 -1
  190. package/dist/es-legacy/core/utils.js.map +1 -1
  191. package/package.json +20 -20
  192. package/styles/adyen.css +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { createRef, h, RefObject } from 'preact';\nimport { Resources } from '../../../core/Context/Resources';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\n\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventType } from '../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AnalyticsLogEvent, LogEventType } from '../../../core/Analytics/events/AnalyticsLogEvent';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\nimport type { AdditionalDetailsData, CoreConfiguration, ICore } from '../../../core/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentMethod\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { ComponentMethodsRef, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { AmountProvider, AmountProviderRef } from '../../../core/Context/AmountProvider';\nimport { PayButtonProps } from '../PayButton/PayButton';\nimport './UIElement.scss';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static 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\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n\n this.onEnterKeyPressed = this.onEnterKeyPressed.bind(this);\n this.onActionHandled = this.onActionHandled.bind(this);\n\n this.createBeforeRenderHook(props);\n this.reportIntegrationFlavor();\n }\n\n /**\n * Creates a hook tied to render() method. This hook is called every time render() is invoked.\n * Currently useful for Analytics\n *\n * @param configSetByMerchant\n * @private\n */\n private createBeforeRenderHook(configSetByMerchant: P): void {\n const originalRender = this.render;\n\n this.render = (...args: any[]) => {\n this.beforeRender(configSetByMerchant);\n return originalRender.apply(this, args);\n };\n }\n\n protected beforeRender(configSetByMerchant?: P): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && { isStoredPaymentMethod: true })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n protected reportIntegrationFlavor(): void {\n void this.analytics.sendFlavor('components');\n }\n\n get analytics(): IAnalytics {\n return this.core.modules.analytics;\n }\n\n get srPanel(): SRPanel {\n return this.core.modules.srPanel;\n }\n\n protected getPaymentMethodConfigFromResponse(componentProps: P) {\n if (componentProps?.storedPaymentMethodId) return this.getStoredPaymentMethodDetails(componentProps.storedPaymentMethodId);\n return this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type, componentProps?.paymentMethodId);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n\n const paymentMethodFromResponse = this.getPaymentMethodConfigFromResponse(componentProps);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropinInstance = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropinInstance), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected getStoredPaymentMethodDetails(storedPaymentMethodId: string) {\n return this.core.paymentMethodsResponse.findStoredPaymentMethod(storedPaymentMethodId);\n }\n\n /**\n * Get the payment method from the paymentMethodsResponse\n *\n * @param type - The type of the payment method to get. (This prop is passed by Drop-in OR Standalone components containing the property 'type' as part of their configuration)\n * @param paymentMethodId - Unique internal payment method ID\n */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n /**\n * Updates the amount in the props and propagates it to the AmountProvider.\n * This allows children components to access the updated amount via context.\n *\n * @param amount - Primary payment amount object\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n public updateAmount(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n this.props = {\n ...this.props,\n ...(amount && { amount }),\n ...(secondaryAmount && { secondaryAmount })\n };\n this.amountProviderRef.current?.update(amount, secondaryAmount);\n }\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx\n */\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n /**\n * componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx\n */\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n protected override submitAnalytics(event: AbstractAnalyticsEvent) {\n this.analytics.sendAnalytics(event);\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) => {\n void this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject: () => reject(new CancelError('beforeSubmitRejected'))\n });\n })\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n //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ZiQ9LLMTis2BA7Ap9pdNq8FVXL4fnoVHNZiiANOf3uvSknPKBID8sdOXUStA0crmO322FYjDqh1n6FG+D7+OJSayNsXIz6Zoy0eFn4HbT8nt8L2X2tdzkMayCYHXRwKh13Xyleqxt4WoEZmhwTmB3p9d1F0SylWnjcC6o/DnshJ9mMW/8D3oWS30Z7BwRODqKGVahRD0YGRzwMbVnEe5JFRfNvJZdLGl35L9632DVmuFQ0lr/8WNL/NrAJNtI6PXrZMNiza0/omPwPfe5ZYuD1Jgq59TX4h9d+3fdkArcJYL7AdoMZON1YEiWY5EzazQwtHd9yzdty9ZHPxAfuOfCh4OhbhFNp+v5YQ+PzKZ+UpM1VxV863+9XgWEURPNvX7qq1cpUSRzrSGq01QBBM3MKzRh5mAgqIdXgtl7L0EXAep0MECc7QY0/o3tW3VR8eEJGsSzrNxpFItqj0SEaIWo25dRfkl5zuw47GQrN9Qzxl2WV3A38MQPUqFtIr/71Rjkphgg49ZGWEYCwgFmm8jJc2/5qTabSGk4bzwiETCTzeydq30bUGqCwglj8CrFViAuQeTJm7dp+PYKMkUNvQRpnSXMj6Kz7rvAMzhzJgK62ltN2idqKxLC7WtivCUgejuQUvNreCYBQCaKwTwP02lZsJpGF9yw8gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n this.handleAdditionalDetails(state);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (error.name === NETWORK_ERROR && error.options.code) {\n const event = new AnalyticsErrorEvent({\n component: this.type,\n errorType: ErrorEventType.apiError,\n code: error.options.code\n });\n\n this.submitAnalytics(event);\n }\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /details call', { cause: error }));\n\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session\n ? this.core.update({\n order\n })\n : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * Expected to be called after sanitizeResponse has been run on the raw payment response\n *\n * @param response -\n */\n protected handleResponse(response: PaymentResponseData): void {\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent) {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n\n this.onEnterKeyPressed(document?.activeElement, this);\n }\n }\n\n /**\n * Handle Enter key pressed from a UIElement (called via handleKeyPress)\n * @param obj\n */\n protected onEnterKeyPressed(activeElement: Element, component: UIElement) {\n if (this.props.onEnterKeyPressed) {\n this.props.onEnterKeyPressed(activeElement, component);\n } else {\n (activeElement as HTMLElement).blur();\n this.submit();\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protected _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonProps) => {\n return <PayButton {...props} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<void | PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return resolve();\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n\n protected abstract componentToRender(): h.JSX.Element | 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","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","loadingContext","SRPanelProvider","AmountProvider","providerRef","componentToRender","checkout","super","_define_property","createRef","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","onClick","register","bind","undefined","txVariants"],"mappings":"soCAsCO,MAAeA,UAA6DC,EAyDvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,KAAKC,OAE5BD,KAAKC,OAAS,IAAIC,KACdF,KAAKG,aAAaL,GACXC,EAAeK,MAAMJ,KAAME,GAE1C,CAEUC,YAAAA,CAAaL,GAEnB,GAAIA,GAAqBO,eACrB,OAGJ,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,KAAMC,EAAcC,SACpBC,UAAWX,KAAKQ,KAChBI,WAAY,IAAKd,EAAqBe,cAAeb,KAAKc,MAAMD,kBAC5Df,GAAqBiB,UAAY,CAAEC,uBAAuB,KAGlEhB,KAAKiB,UAAUC,cAAcZ,EACjC,CAEUa,uBAAAA,GACDnB,KAAK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/BA,KAAKkD,SAAWlD,KAAKkD,SAAS2H,KAAK7K,MACnCA,KAAK+F,WAAa/F,KAAK+F,WAAW8E,KAAK7K,MACvCA,KAAKqG,aAAerG,KAAKqG,aAAawE,KAAK7K,MAC3CA,KAAKoH,YAAcpH,KAAKoH,YAAYyD,KAAK7K,MACzCA,KAAKgG,wBAA0BhG,KAAKgG,wBAAwB6E,KAAK7K,MACjEA,KAAK4E,eAAiB5E,KAAK4E,eAAeiG,KAAK7K,MAC/CA,KAAK8D,iBAAmB9D,KAAK8D,iBAAiB+G,KAAK7K,MACnDA,KAAKsE,gBAAkBtE,KAAKsE,gBAAgBuG,KAAK7K,MACjDA,KAAKwE,iBAAmBxE,KAAKwE,iBAAiBqG,KAAK7K,MACnDA,KAAKiG,0BAA4BjG,KAAKiG,0BAA0B4E,KAAK7K,MACrEA,KAAKsF,wBAA0BtF,KAAKsF,wBAAwBuF,KAAK7K,MACjEA,KAAKwD,aAAexD,KAAKwD,aAAaqH,KAAK7K,MAE3CA,KAAKgE,WAAclD,GAASA,EAAMkD,YAAehE,KACjDA,KAAKiI,UAAYjI,KAAKc,MAAMQ,QAAUtB,KAAKc,MAAMQ,QAAQ2G,eAAY6C,EAErE9K,KAAK4C,sBAAsB5C,KAAKc,OAEhCd,KAAK0H,kBAAoB1H,KAAK0H,kBAAkBmD,KAAK7K,MACrDA,KAAK8G,gBAAkB9G,KAAK8G,gBAAgB+D,KAAK7K,MAEjDA,KAAKH,uBAAuBiB,GAC5Bd,KAAKmB,yBACT,EAzCAsI,EAPkB9J,EAOKa,YAA2BsK,GAUlDrB,EAjBkB9J,EAiBKoL,aAAuB"}
1
+ {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { createRef, h, RefObject } from 'preact';\nimport { Resources } from '../../../core/Context/Resources';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\n\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventType } from '../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AnalyticsLogEvent, LogEventType } from '../../../core/Analytics/events/AnalyticsLogEvent';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\nimport type { AdditionalDetailsData, CoreConfiguration, ICore } from '../../../core/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentMethod\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { ComponentMethodsRef, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\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 as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropinInstance), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected getStoredPaymentMethodDetails(storedPaymentMethodId: string) {\n return this.core.paymentMethodsResponse.findStoredPaymentMethod(storedPaymentMethodId);\n }\n\n /**\n * Get the payment method from the paymentMethodsResponse\n *\n * @param type - The type of the payment method to get. (This prop is passed by Drop-in OR Standalone components containing the property 'type' as part of their configuration)\n * @param paymentMethodId - Unique internal payment method ID\n */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n /**\n * Updates the amount in the props and propagates it to the AmountProvider.\n * This allows children components to access the updated amount via context.\n *\n * @param amount - Primary payment amount object\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n public updateAmount(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n this.props = {\n ...this.props,\n ...(amount && { amount }),\n ...(secondaryAmount && { secondaryAmount })\n };\n this.amountProviderRef.current?.update(amount, secondaryAmount);\n }\n\n /**\n * 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/0leR88qkV24vtIkjsIsbJTDB78Pd8wX8MEDsXhaAdEIyX9E8eqxuQ3bwPb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YGRzwMbVnEe5JFRfNvJZdLGl35L9632DVmuFQ0lr/8WNL/NrAJNtI6PXrZMNiza0/omPwPfe5ZYuD1Jgq59TX4h9d+3fdkArcJYL7AdoMZON1YEiWY5EzazQwtHd9yzdty9ZHPxAfuOfCh4OhbhFNp+v5YQ+PzKZ+UpM1VxV863+9XgWEURPNvX7qq1cpUSRzrSGq01QBBM3MKzRh5mAgqIdXgtl7L0EXAep0MECc7QY0/o3tW3VR8eEJGsSzrNxpFItqj0SEaIWo25dRfkl5zuw47GQrN9Qzxl2WV3A38MQPUqFtIr/71Rjkphgg49ZGWEYCwgFmm8jJc2/5qTabSGk4bzwiETCTzeydq30bUGqCwglj8CrFViAuQeTJm7dp+PYKMkUNvQRpnSXMj6Kz7rvAMzhzJgK62ltN2idqKxLC7WtivCUgejuQUvNreCYBQCaKwTwP02lZsJpGF9yw8gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n this.handleAdditionalDetails(state);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (error.name === NETWORK_ERROR && error.options.code) {\n const event = new AnalyticsErrorEvent({\n component: this.type,\n errorType: ErrorEventType.apiError,\n code: error.options.code\n });\n\n this.submitAnalytics(event);\n }\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /details call', { cause: error }));\n\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session\n ? this.core.update({\n order\n })\n : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n 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":"wrCAuCO,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,C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BqE,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,2 +1,2 @@
1
- const e=["action","resultCode","sessionData","order","sessionResult","donationToken","error"];function n(n){const o=[],t=Object.keys(n).reduce((t,r)=>(e.includes(r)?t[r]=n[r]:o.push(r),t),{});return o.length&&console.warn(`The following properties should not be passed to the client: ${o.join(", ")}`),t}function o(e){e&&(delete e.order,delete e.action,e.donationToken&&0!==e.donationToken.length||delete e.donationToken)}function t(e){return["Cancelled","Error","Refused"].includes(e.resultCode)?Promise.reject(e):Promise.resolve(e)}function r(e){if(!e)return!1;return"object"==typeof e.activePaymentMethod&&"function"==typeof e.closeActivePaymentMethod}function s(e,n){return"FI"===e&&n?{openFirstPaymentMethod:!1,openFirstStoredPaymentMethod:!1}:{}}function i(e){return e&&e.orderData&&e.pspReference?{orderData:e.orderData,pspReference:e.pspReference}:null}export{r as assertIsDropin,o as cleanupFinalResult,s as getRegulatoryDefaults,i as sanitizeOrder,n as sanitizeResponse,t as verifyPaymentDidNotFail};
1
+ const e=["action","resultCode","sessionData","order","sessionResult","donationToken","error","askDonation"];function n(n){const o=[],t=Object.keys(n).reduce((t,r)=>(e.includes(r)?t[r]=n[r]:o.push(r),t),{});return o.length&&console.warn(`The following properties should not be passed to the client: ${o.join(", ")}`),t}function o(e){e&&(delete e.order,delete e.action,e.donationToken&&0!==e.donationToken.length||delete e.donationToken)}function t(e){return["Cancelled","Error","Refused"].includes(e.resultCode)?Promise.reject(e):Promise.resolve(e)}function r(e){if(!e)return!1;return"object"==typeof e.activePaymentMethod&&"function"==typeof e.closeActivePaymentMethod}function s(e,n){return"FI"===e&&n?{openFirstPaymentMethod:!1,openFirstStoredPaymentMethod:!1}:{}}function i(e){return e&&e.orderData&&e.pspReference?{orderData:e.orderData,pspReference:e.pspReference}:null}export{r as assertIsDropin,o as cleanupFinalResult,s as getRegulatoryDefaults,i as sanitizeOrder,n as sanitizeResponse,t as verifyPaymentDidNotFail};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/UIElement/utils.ts"],"sourcesContent":["import { UIElementStatus } from './types';\nimport { RawPaymentResponse, PaymentResponseData, Order } from '../../../types/global-types';\nimport { IDropin } from '../../Dropin/types';\n\nconst ALLOWED_PROPERTIES = ['action', 'resultCode', 'sessionData', 'order', 'sessionResult', 'donationToken', 'error'];\n\nexport function sanitizeResponse(response: RawPaymentResponse): PaymentResponseData {\n const removedProperties = [];\n\n const sanitizedObject = Object.keys(response).reduce((acc, cur) => {\n if (!ALLOWED_PROPERTIES.includes(cur)) {\n removedProperties.push(cur);\n } else {\n acc[cur] = response[cur];\n }\n return acc;\n }, {});\n\n if (removedProperties.length) console.warn(`The following properties should not be passed to the client: ${removedProperties.join(', ')}`);\n\n return sanitizedObject as PaymentResponseData;\n}\n\n/**\n * Remove not relevant properties in the final payment result object\n *\n * @param paymentResponse\n */\nexport function cleanupFinalResult(paymentResponse?: PaymentResponseData): void {\n if (!paymentResponse) return;\n\n delete paymentResponse.order;\n delete paymentResponse.action;\n if (!paymentResponse.donationToken || paymentResponse.donationToken.length === 0) {\n delete paymentResponse.donationToken;\n }\n}\n\nexport function resolveFinalResult(result: PaymentResponseData): [status: UIElementStatus, statusProps?: any] {\n switch (result.resultCode) {\n case 'Authorised':\n case 'Received':\n return ['success'];\n case 'Pending':\n return ['success'];\n case 'Cancelled':\n case 'Error':\n case 'Refused':\n return ['error'];\n default:\n }\n}\n\nexport function verifyPaymentDidNotFail(response: PaymentResponseData): Promise<PaymentResponseData> {\n if (['Cancelled', 'Error', 'Refused'].includes(response.resultCode)) {\n return Promise.reject(response);\n }\n\n return Promise.resolve(response);\n}\n\nexport function assertIsDropin(element: any): element is IDropin {\n if (!element) return false;\n\n const isDropin = typeof element.activePaymentMethod === 'object' && typeof element.closeActivePaymentMethod === 'function';\n return isDropin;\n}\n\nexport function getRegulatoryDefaults(countryCode: string, isDropinInstance: boolean): Record<string, any> {\n switch (countryCode) {\n // Finnish regulations state that no payment method can be open by default\n case 'FI':\n return isDropinInstance\n ? {\n openFirstPaymentMethod: false,\n openFirstStoredPaymentMethod: false\n }\n : {};\n default:\n return {};\n }\n}\n\nexport function sanitizeOrder(order: Order) {\n if (!order || !order.orderData || !order.pspReference) return null;\n return {\n orderData: order.orderData,\n pspReference: order.pspReference\n };\n}\n"],"names":["ALLOWED_PROPERTIES","sanitizeResponse","response","removedProperties","sanitizedObject","Object","keys","reduce","acc","cur","includes","push","length","console","warn","join","cleanupFinalResult","paymentResponse","order","action","donationToken","verifyPaymentDidNotFail","resultCode","Promise","reject","resolve","assertIsDropin","element","activePaymentMethod","closeActivePaymentMethod","getRegulatoryDefaults","countryCode","isDropinInstance","openFirstPaymentMethod","openFirstStoredPaymentMethod","sanitizeOrder","orderData","pspReference"],"mappings":"AAIA,MAAMA,EAAqB,CAAC,SAAU,aAAc,cAAe,QAAS,gBAAiB,gBAAiB,SAEvG,SAASC,EAAiBC,GAC7B,MAAMC,EAAoB,GAEpBC,EAAkBC,OAAOC,KAAKJ,GAAUK,OAAO,CAACC,EAAKC,KAClDT,EAAmBU,SAASD,GAG7BD,EAAIC,GAAOP,EAASO,GAFpBN,EAAkBQ,KAAKF,GAIpBD,GACR,CAAA,GAIH,OAFIL,EAAkBS,QAAQC,QAAQC,KAAK,gEAAgEX,EAAkBY,KAAK,SAE3HX,CACX,CAOO,SAASY,EAAmBC,GAC1BA,WAEEA,EAAgBC,aAChBD,EAAgBE,OAClBF,EAAgBG,eAA0D,IAAzCH,EAAgBG,cAAcR,eACzDK,EAAgBG,cAE/B,CAiBO,SAASC,EAAwBnB,GACpC,MAAI,CAAC,YAAa,QAAS,WAAWQ,SAASR,EAASoB,YAC7CC,QAAQC,OAAOtB,GAGnBqB,QAAQE,QAAQvB,EAC3B,CAEO,SAASwB,EAAeC,GAC3B,IAAKA,EAAS,OAAO,EAGrB,MADwD,iBAAhCA,EAAQC,qBAAgF,mBAArCD,EAAQE,wBAEvF,CAEO,SAASC,EAAsBC,EAAqBC,GACvD,MAES,OAFDD,GAGOC,EACD,CACIC,wBAAwB,EACxBC,8BAA8B,GAIjC,CAAA,CAEnB,CAEO,SAASC,EAAcjB,GAC1B,OAAKA,GAAUA,EAAMkB,WAAclB,EAAMmB,aAClC,CACHD,UAAWlB,EAAMkB,UACjBC,aAAcnB,EAAMmB,cAHsC,IAKlE"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/UIElement/utils.ts"],"sourcesContent":["import { UIElementStatus } from './types';\nimport { RawPaymentResponse, PaymentResponseData, Order } from '../../../types/global-types';\nimport { IDropin } from '../../Dropin/types';\n\nconst ALLOWED_PROPERTIES = ['action', 'resultCode', 'sessionData', 'order', 'sessionResult', 'donationToken', 'error', 'askDonation'];\n\nexport function sanitizeResponse(response: RawPaymentResponse): PaymentResponseData {\n const removedProperties = [];\n\n const sanitizedObject = Object.keys(response).reduce((acc, cur) => {\n if (!ALLOWED_PROPERTIES.includes(cur)) {\n removedProperties.push(cur);\n } else {\n acc[cur] = response[cur];\n }\n return acc;\n }, {});\n\n if (removedProperties.length) console.warn(`The following properties should not be passed to the client: ${removedProperties.join(', ')}`);\n\n return sanitizedObject as PaymentResponseData;\n}\n\n/**\n * Remove not relevant properties in the final payment result object\n *\n * @param paymentResponse\n */\nexport function cleanupFinalResult(paymentResponse?: PaymentResponseData): void {\n if (!paymentResponse) return;\n\n delete paymentResponse.order;\n delete paymentResponse.action;\n if (!paymentResponse.donationToken || paymentResponse.donationToken.length === 0) {\n delete paymentResponse.donationToken;\n }\n}\n\nexport function resolveFinalResult(result: PaymentResponseData): [status: UIElementStatus, statusProps?: any] {\n switch (result.resultCode) {\n case 'Authorised':\n case 'Received':\n return ['success'];\n case 'Pending':\n return ['success'];\n case 'Cancelled':\n case 'Error':\n case 'Refused':\n return ['error'];\n default:\n }\n}\n\nexport function verifyPaymentDidNotFail(response: PaymentResponseData): Promise<PaymentResponseData> {\n if (['Cancelled', 'Error', 'Refused'].includes(response.resultCode)) {\n return Promise.reject(response);\n }\n\n return Promise.resolve(response);\n}\n\nexport function assertIsDropin(element: any): element is IDropin {\n if (!element) return false;\n\n const isDropin = typeof element.activePaymentMethod === 'object' && typeof element.closeActivePaymentMethod === 'function';\n return isDropin;\n}\n\nexport function getRegulatoryDefaults(countryCode: string, isDropinInstance: boolean): Record<string, any> {\n switch (countryCode) {\n // Finnish regulations state that no payment method can be open by default\n case 'FI':\n return isDropinInstance\n ? {\n openFirstPaymentMethod: false,\n openFirstStoredPaymentMethod: false\n }\n : {};\n default:\n return {};\n }\n}\n\nexport function sanitizeOrder(order: Order) {\n if (!order || !order.orderData || !order.pspReference) return null;\n return {\n orderData: order.orderData,\n pspReference: order.pspReference\n };\n}\n"],"names":["ALLOWED_PROPERTIES","sanitizeResponse","response","removedProperties","sanitizedObject","Object","keys","reduce","acc","cur","includes","push","length","console","warn","join","cleanupFinalResult","paymentResponse","order","action","donationToken","verifyPaymentDidNotFail","resultCode","Promise","reject","resolve","assertIsDropin","element","activePaymentMethod","closeActivePaymentMethod","getRegulatoryDefaults","countryCode","isDropinInstance","openFirstPaymentMethod","openFirstStoredPaymentMethod","sanitizeOrder","orderData","pspReference"],"mappings":"AAIA,MAAMA,EAAqB,CAAC,SAAU,aAAc,cAAe,QAAS,gBAAiB,gBAAiB,QAAS,eAEhH,SAASC,EAAiBC,GAC7B,MAAMC,EAAoB,GAEpBC,EAAkBC,OAAOC,KAAKJ,GAAUK,OAAO,CAACC,EAAKC,KAClDT,EAAmBU,SAASD,GAG7BD,EAAIC,GAAOP,EAASO,GAFpBN,EAAkBQ,KAAKF,GAIpBD,GACR,CAAA,GAIH,OAFIL,EAAkBS,QAAQC,QAAQC,KAAK,gEAAgEX,EAAkBY,KAAK,SAE3HX,CACX,CAOO,SAASY,EAAmBC,GAC1BA,WAEEA,EAAgBC,aAChBD,EAAgBE,OAClBF,EAAgBG,eAA0D,IAAzCH,EAAgBG,cAAcR,eACzDK,EAAgBG,cAE/B,CAiBO,SAASC,EAAwBnB,GACpC,MAAI,CAAC,YAAa,QAAS,WAAWQ,SAASR,EAASoB,YAC7CC,QAAQC,OAAOtB,GAGnBqB,QAAQE,QAAQvB,EAC3B,CAEO,SAASwB,EAAeC,GAC3B,IAAKA,EAAS,OAAO,EAGrB,MADwD,iBAAhCA,EAAQC,qBAAgF,mBAArCD,EAAQE,wBAEvF,CAEO,SAASC,EAAsBC,EAAqBC,GACvD,MAES,OAFDD,GAGOC,EACD,CACIC,wBAAwB,EACxBC,8BAA8B,GAIjC,CAAA,CAEnB,CAEO,SAASC,EAAcjB,GAC1B,OAAKA,GAAUA,EAAMkB,WAAclB,EAAMmB,aAClC,CACHD,UAAWlB,EAAMkB,UACjBC,aAAcnB,EAAMmB,cAHsC,IAKlE"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsErrorEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsErrorEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\n\ntype AnalyticsErrorEventProps = {\n component: string;\n errorType: ErrorEventType;\n code: string;\n message?: string;\n};\n\nexport enum ErrorEventType {\n network = 'Network',\n implementation = 'Implementation',\n internal = 'Internal',\n apiError = 'ApiError',\n sdkError = 'SdkError',\n thirdParty = 'ThirdParty',\n generic = 'Generic',\n redirect = 'Redirect',\n threeDS2 = 'ThreeDS2'\n}\n\nexport enum ErrorEventCode {\n /** Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined (meaning the containing element is not in the DOM */\n SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND = '500',\n /** */\n REDIRECT = '600',\n /**\n * Key not present in served securedFields asset\n */\n SECURED_FIELDS_KEY_NOT_FOUND = '608',\n /**\n * Encryption key generation failed in securedField\n */\n SECURED_FIELDS_ENCRYPTION_KEY_GEN_FAILED = '609',\n /**\n * Encryption failed in securedField\n */\n SECURED_FIELDS_ENCRYPTION_ERROR = '610',\n\n /** Missing 'paymentData' property from threeDS2 action */\n THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA = '700',\n\n /** Missing 'token' property from threeDS2 action */\n THREEDS2_ACTION_IS_MISSING_TOKEN = '701',\n\n /** Decoded token is missing a valid threeDSMethodURL property */\n THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL = '702',\n /**\n * Decoded token is missing one or more of the following properties:\n * fingerprint: (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)\n * challenge: (acsTransID | messageVersion | threeDSServerTransID)\n */\n THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS = '703',\n\n /** Token decoding or parsing has failed. ('not base64', 'malformed URI sequence' or 'Could not JSON parse token') */\n THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED = '704',\n\n /** 3DS2 process has timed out */\n THREEDS2_TIMEOUT = '710',\n\n /** Decoded token is missing a valid acsURL property */\n THREEDS2_TOKEN_IS_MISSING_ACSURL = '800',\n\n /** Challenge has resulted in an error (no transStatus could be retrieved by the backend) */\n THREEDS2_NO_TRANSSTATUS = '801',\n\n /** callSubmit3DS2Fingerprint has received a response indicating either a \"frictionless\" flow, or a \"refused\" response, but without a details object */\n THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED = '802',\n\n /** callSubmit3DS2Fingerprint cannot find a component to handle the action response */\n THREEDS2_NO_COMPONENT_FOR_ACTION = '803',\n\n /** callSubmit3DS2Fingerprint has received a response indicating a \"challenge\" but without an action object */\n THREEDS2_NO_ACTION_FOR_CHALLENGE = '804',\n\n /** The challenge process has happened, an object has been returned, parsed & accepted as legit, but the result prop on that object is either missing or doesn't have a transStatus prop */\n THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP = '805'\n}\n\nexport class AnalyticsErrorEvent extends AbstractAnalyticsEvent {\n private readonly errorType: ErrorEventType;\n private readonly code: string;\n\n private readonly message?: string;\n\n constructor(props: AnalyticsErrorEventProps) {\n super(props.component);\n\n this.errorType = props.errorType;\n this.code = props.code;\n\n if (props.message) this.message = props.message;\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.error;\n }\n}\n"],"names":["ErrorEventType","ErrorEventCode","AnalyticsErrorEvent","AbstractAnalyticsEvent","getEventCategory","AnalyticsEventCategory","error","constructor","props","super","component","_define_property","errorType","this","code","message"],"mappings":"yNASO,IAAAA,EAAKA,SAAAA,GAAAA,yNAAAA,CAUX,CAVWA,CAUX,CAAA,GAEMC,EAAKA,SAAAA,GAAAA,OACoIA,EAAA,+CAAA,MAExIA,EAAA,SAAA,MAIHA,EAAA,6BAAA,MAIAA,EAAA,yCAAA,MAIAA,EAAA,gCAAA,MAGwDA,EAAA,wCAAA,MAGPA,EAAA,iCAAA,MAGaA,EAAA,2CAAA,MAM9DA,EAAA,sCAAA,MAGkHA,EAAA,wCAAA,MAGpFA,EAAA,iBAAA,MAGsBA,EAAA,iCAAA,MAGqCA,EAAA,wBAAA,MAG2DA,EAAA,gDAAA,MAGjEA,EAAA,iCAAA,MAGwBA,EAAA,iCAAA,MAG6EA,EAAA,gDAAA,MAtDjLA,CAwDX,CAxDWA,CAwDX,CAAA,GAEM,MAAMC,UAA4BC,EAe9BC,gBAAAA,GACH,OAAOC,EAAuBC,KAClC,CAXA,WAAAC,CAAYC,GACRC,MAAMD,EAAME,WANhBC,OAAiBC,oBACjBD,EAAAE,KAAiBC,eAEjBH,EAAAE,KAAiBE,kBAKbF,KAAKD,UAAYJ,EAAMI,UACvBC,KAAKC,KAAON,EAAMM,KAEdN,EAAMO,UAASF,KAAKE,QAAUP,EAAMO,QAC5C"}
1
+ {"version":3,"file":"AnalyticsErrorEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsErrorEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\n\ntype AnalyticsErrorEventProps = {\n component: string;\n errorType: ErrorEventType;\n code: string;\n message?: string;\n};\n\nexport enum ErrorEventType {\n network = 'Network',\n implementation = 'Implementation',\n internal = 'Internal',\n apiError = 'ApiError',\n sdkError = 'SdkError',\n thirdParty = 'ThirdParty',\n generic = 'Generic',\n redirect = 'Redirect',\n threeDS2 = 'ThreeDS2'\n}\n\nexport enum ErrorEventCode {\n /** Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined (meaning the containing element is not in the DOM */\n SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND = '500',\n /** */\n REDIRECT = '600',\n /**\n * Key not present in served securedFields asset\n */\n SECURED_FIELDS_KEY_NOT_FOUND = '608',\n /**\n * Encryption key generation failed in securedField\n */\n SECURED_FIELDS_ENCRYPTION_KEY_GEN_FAILED = '609',\n /**\n * Encryption failed in securedField\n */\n SECURED_FIELDS_ENCRYPTION_ERROR = '610',\n\n /** See also API_ERROR_CODE object in /src/core/Services/sessions/constants.ts which uses codes in the range 620-628 */\n\n /** Missing 'paymentData' property from threeDS2 action */\n THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA = '700',\n\n /** Missing 'token' property from threeDS2 action */\n THREEDS2_ACTION_IS_MISSING_TOKEN = '701',\n\n /** Decoded token is missing a valid threeDSMethodURL property */\n THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL = '702',\n /**\n * Decoded token is missing one or more of the following properties:\n * fingerprint: (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)\n * challenge: (acsTransID | messageVersion | threeDSServerTransID)\n */\n THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS = '703',\n\n /** Token decoding or parsing has failed. ('not base64', 'malformed URI sequence' or 'Could not JSON parse token') */\n THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED = '704',\n\n /** 3DS2 process has timed out */\n THREEDS2_TIMEOUT = '710',\n\n /** Decoded token is missing a valid acsURL property */\n THREEDS2_TOKEN_IS_MISSING_ACSURL = '800',\n\n /** Challenge has resulted in an error (no transStatus could be retrieved by the backend) */\n THREEDS2_NO_TRANSSTATUS = '801',\n\n /** callSubmit3DS2Fingerprint has received a response indicating either a \"frictionless\" flow, or a \"refused\" response, but without a details object */\n THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED = '802',\n\n /** callSubmit3DS2Fingerprint cannot find a component to handle the action response */\n THREEDS2_NO_COMPONENT_FOR_ACTION = '803',\n\n /** callSubmit3DS2Fingerprint has received a response indicating a \"challenge\" but without an action object */\n THREEDS2_NO_ACTION_FOR_CHALLENGE = '804',\n\n /** The challenge process has happened, an object has been returned, parsed & accepted as legit, but the result prop on that object is either missing or doesn't have a transStatus prop */\n THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP = '805'\n}\n\nexport class AnalyticsErrorEvent extends AbstractAnalyticsEvent {\n private readonly errorType: ErrorEventType;\n private readonly code: string;\n\n private readonly message?: string;\n\n constructor(props: AnalyticsErrorEventProps) {\n super(props.component);\n\n this.errorType = props.errorType;\n this.code = props.code;\n\n if (props.message) this.message = props.message;\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.error;\n }\n}\n"],"names":["ErrorEventType","ErrorEventCode","AnalyticsErrorEvent","AbstractAnalyticsEvent","getEventCategory","AnalyticsEventCategory","error","constructor","props","super","component","_define_property","errorType","this","code","message"],"mappings":"yNASO,IAAAA,EAAKA,SAAAA,GAAAA,yNAAAA,CAUX,CAVWA,CAUX,CAAA,GAEMC,EAAKA,SAAAA,GAAAA,OACoIA,EAAA,+CAAA,MAExIA,EAAA,SAAA,MAIHA,EAAA,6BAAA,MAIAA,EAAA,yCAAA,MAIAA,EAAA,gCAAA,MAKwDA,EAAA,wCAAA,MAGPA,EAAA,iCAAA,MAGaA,EAAA,2CAAA,MAM9DA,EAAA,sCAAA,MAGkHA,EAAA,wCAAA,MAGpFA,EAAA,iBAAA,MAGsBA,EAAA,iCAAA,MAGqCA,EAAA,wBAAA,MAG2DA,EAAA,gDAAA,MAGjEA,EAAA,iCAAA,MAGwBA,EAAA,iCAAA,MAG6EA,EAAA,gDAAA,MAxDjLA,CA0DX,CA1DWA,CA0DX,CAAA,GAEM,MAAMC,UAA4BC,EAe9BC,gBAAAA,GACH,OAAOC,EAAuBC,KAClC,CAXA,WAAAC,CAAYC,GACRC,MAAMD,EAAME,WANhBC,OAAiBC,oBACjBD,EAAAE,KAAiBC,eAEjBH,EAAAE,KAAiBE,kBAKbF,KAAKD,UAAYJ,EAAMI,UACvBC,KAAKC,KAAON,EAAMM,KAEdN,EAAMO,UAASF,KAAKE,QAAUP,EAAMO,QAC5C"}
@@ -1,2 +1,2 @@
1
- import{AbstractAnalyticsEvent as e,AnalyticsEventCategory as t}from"./AbstractAnalyticsEvent.js";import{mapErrorCodesForAnalytics as o}from"../utils.js";function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var r=function(e){return e.instantPaymentButton="instant_payment_button",e.dualBrandButton="dual_brand_button",e.fastlaneSignupConsentToggle="fastlane_signup_consent_toggle",e.otherPaymentMethodButton="otherpaymentmethod_button",e.featuredIssuer="featured_issuer",e.list="list",e.listSearch="list_search",e.qrDownloadButton="qr_download_button",e.segmentedControl="segmented_control",e.cardNumber="card_number",e.expiryDate="expiry_date",e.expiryMonth="expiry_month",e.expiryYear="expiry_year",e.securityCode="security_code",e}({}),d=function(e){return e.clicked="clicked",e.rendered="rendered",e.selected="selected",e.validationError="validationError",e.focus="focus",e.unfocus="unfocus",e.configured="configured",e.displayed="displayed",e.input="input",e.download="download",e.sdkDownloadInitiated="sdkDownloadInitiated",e.sdkDownloadFailed="sdkDownloadFailed",e.sdkDownloadAborted="sdkDownloadAborted",e.sdkDownloadCompleted="sdkDownloadCompleted",e.Initialized="initialized",e.LookupStarted="lookupStarted",e.LookupUserNotFound="lookupUserNotFound",e.OtpStarted="otpStarted",e.OtpSucceeded="otpSucceeded",e.OtpCanceled="otpCanceled",e.OtpFailed="otpFailed",e.AddressSelectorClicked="addressSelectorClicked",e.AddressSelectorClosed="addressSelectorClosed",e.AddressChanged="addressChanged",e}({});class s extends e{get configDataExcludedFields(){return["paymentMethodsConfiguration","elementRef","isDropin","oneClick","storedPaymentMethodId","paymentMethodId","isInstantPayment","type","data","holderName","shopperEmail","email","telephoneNumber","clickToPayConfiguration","modules","i18n"]}createAnalyticsConfigData(e){if(!e)return{};const t={};try{for(const[o,i]of Object.entries(e))this.configDataExcludedFields.includes(o)||("function"==typeof i?t[o]="function":Array.isArray(i)?t[o]=i.join(", ").substring(0,128):t[o]="object"==typeof i&&null!==i?JSON.stringify(i).substring(0,128):i);return t}catch(e){return t}}getEventCategory(){return t.info}constructor(e){super(e.component),i(this,"type",void 0),i(this,"configData",void 0),i(this,"target",void 0),i(this,"issuer",void 0),i(this,"isExpress",void 0),i(this,"expressPage",void 0),i(this,"isStoredPaymentMethod",void 0),i(this,"brand",void 0),i(this,"selectedValue",void 0),i(this,"validationErrorCode",void 0),i(this,"validationErrorMessage",void 0),i(this,"cdnUrl",void 0),this.type=e.type,e.target&&(this.target=e.target),e.issuer&&(this.issuer=e.issuer),void 0!==e.isStoredPaymentMethod&&(this.isStoredPaymentMethod=e.isStoredPaymentMethod),void 0!==e.isExpress&&(this.isExpress=e.isExpress),e.expressPage&&(this.expressPage=e.expressPage),e.brand&&(this.brand=e.brand),e.cdnUrl&&(this.cdnUrl=e.cdnUrl),e.selectedValue&&(this.selectedValue=e.selectedValue),e.validationErrorCode&&(this.validationErrorCode=e.validationErrorCode),e.validationErrorMessage&&(this.validationErrorMessage=e.validationErrorMessage),"rendered"!==this.type&&"displayed"!==this.type||(this.configData=this.createAnalyticsConfigData(e?.configData)),"validationError"===this.type&&(this.validationErrorCode=o(this.validationErrorCode,this.target))}}export{s as AnalyticsInfoEvent,d as InfoEventType,r as UiTarget};
1
+ import{AbstractAnalyticsEvent as e,AnalyticsEventCategory as t}from"./AbstractAnalyticsEvent.js";import{mapErrorCodesForAnalytics as o}from"../utils.js";function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var i=function(e){return e.instantPaymentButton="instant_payment_button",e.dualBrandButton="dual_brand_button",e.fastlaneSignupConsentToggle="fastlane_signup_consent_toggle",e.otherPaymentMethodButton="otherpaymentmethod_button",e.featuredIssuer="featured_issuer",e.list="list",e.listSearch="list_search",e.qrDownloadButton="qr_download_button",e.segmentedControl="segmented_control",e.cardNumber="card_number",e.expiryDate="expiry_date",e.expiryMonth="expiry_month",e.expiryYear="expiry_year",e.securityCode="security_code",e.donationAmountButton="donation_amount_button",e}({}),d=function(e){return e.clicked="clicked",e.rendered="rendered",e.selected="selected",e.validationError="validationError",e.focus="focus",e.unfocus="unfocus",e.configured="configured",e.displayed="displayed",e.input="input",e.download="download",e.sdkDownloadInitiated="sdkDownloadInitiated",e.sdkDownloadFailed="sdkDownloadFailed",e.sdkDownloadAborted="sdkDownloadAborted",e.sdkDownloadCompleted="sdkDownloadCompleted",e.Initialized="initialized",e.LookupStarted="lookupStarted",e.LookupUserNotFound="lookupUserNotFound",e.OtpStarted="otpStarted",e.OtpSucceeded="otpSucceeded",e.OtpCanceled="otpCanceled",e.OtpFailed="otpFailed",e.AddressSelectorClicked="addressSelectorClicked",e.AddressSelectorClosed="addressSelectorClosed",e.AddressChanged="addressChanged",e}({});class s extends e{get configDataExcludedFields(){return["paymentMethodsConfiguration","elementRef","isDropin","oneClick","storedPaymentMethodId","paymentMethodId","isInstantPayment","type","data","holderName","shopperEmail","email","telephoneNumber","clickToPayConfiguration","modules","i18n"]}createAnalyticsConfigData(e){if(!e)return{};const t={};try{for(const[o,r]of Object.entries(e))this.configDataExcludedFields.includes(o)||("function"==typeof r?t[o]="function":Array.isArray(r)?t[o]=r.join(", ").substring(0,128):t[o]="object"==typeof r&&null!==r?JSON.stringify(r).substring(0,128):r);return t}catch(e){return t}}getEventCategory(){return t.info}constructor(e){super(e.component),r(this,"type",void 0),r(this,"configData",void 0),r(this,"target",void 0),r(this,"issuer",void 0),r(this,"isExpress",void 0),r(this,"expressPage",void 0),r(this,"isStoredPaymentMethod",void 0),r(this,"brand",void 0),r(this,"selectedValue",void 0),r(this,"validationErrorCode",void 0),r(this,"validationErrorMessage",void 0),r(this,"presentedValues",void 0),r(this,"cdnUrl",void 0),this.type=e.type,e.target&&(this.target=e.target),e.issuer&&(this.issuer=e.issuer),void 0!==e.isStoredPaymentMethod&&(this.isStoredPaymentMethod=e.isStoredPaymentMethod),void 0!==e.isExpress&&(this.isExpress=e.isExpress),e.expressPage&&(this.expressPage=e.expressPage),e.brand&&(this.brand=e.brand),e.cdnUrl&&(this.cdnUrl=e.cdnUrl),e.selectedValue&&(this.selectedValue=e.selectedValue),e.validationErrorCode&&(this.validationErrorCode=e.validationErrorCode),e.validationErrorMessage&&(this.validationErrorMessage=e.validationErrorMessage),e.presentedValues&&(this.presentedValues=e.presentedValues),"rendered"===this.type&&(this.configData=this.createAnalyticsConfigData(e?.configData)),"validationError"===this.type&&(this.validationErrorCode=o(this.validationErrorCode,this.target))}}export{s as AnalyticsInfoEvent,d as InfoEventType,i as UiTarget};
2
2
  //# sourceMappingURL=AnalyticsInfoEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsInfoEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsInfoEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\nimport { mapErrorCodesForAnalytics } from '../utils';\n\ntype AnalyticsInfoEventProps = {\n type: InfoEventType;\n component: string;\n target?: UiTarget;\n issuer?: string;\n isExpress?: boolean;\n expressPage?: string;\n isStoredPaymentMethod?: boolean;\n brand?: string;\n validationErrorCode?: string;\n validationErrorMessage?: string;\n configData?: Record<string, any>;\n cdnUrl?: string;\n selectedValue?: string;\n};\n\nexport enum UiTarget {\n instantPaymentButton = 'instant_payment_button',\n dualBrandButton = 'dual_brand_button',\n fastlaneSignupConsentToggle = 'fastlane_signup_consent_toggle',\n otherPaymentMethodButton = 'otherpaymentmethod_button',\n featuredIssuer = 'featured_issuer',\n list = 'list',\n listSearch = 'list_search',\n qrDownloadButton = 'qr_download_button',\n segmentedControl = 'segmented_control',\n cardNumber = 'card_number',\n expiryDate = 'expiry_date',\n expiryMonth = 'expiry_month',\n expiryYear = 'expiry_year',\n securityCode = 'security_code'\n}\n\nexport enum InfoEventType {\n /** When a UI element is clicked */\n clicked = 'clicked',\n /** When a component is rendered in the browser (e.g. render() method is called) */\n rendered = 'rendered',\n /** When a list item is selected (e.g. issuer list) */\n selected = 'selected',\n /** When there is a validation issue with the input */\n validationError = 'validationError',\n /** When input gets focus */\n focus = 'focus',\n /** When input gets unfocus */\n unfocus = 'unfocus',\n /** When iframe fields are configured */\n configured = 'configured',\n /** When a dropdown list is displayed */\n displayed = 'displayed',\n /** When shopper utilizes an input field to search for values (e.g. issuer list) */\n input = 'input',\n /** When shopper clicks to download the image (e.g. QR code image) */\n download = 'download',\n sdkDownloadInitiated = 'sdkDownloadInitiated',\n sdkDownloadFailed = 'sdkDownloadFailed',\n sdkDownloadAborted = 'sdkDownloadAborted',\n sdkDownloadCompleted = 'sdkDownloadCompleted',\n Initialized = 'initialized',\n LookupStarted = 'lookupStarted',\n LookupUserNotFound = 'lookupUserNotFound',\n OtpStarted = 'otpStarted',\n OtpSucceeded = 'otpSucceeded',\n OtpCanceled = 'otpCanceled',\n OtpFailed = 'otpFailed',\n AddressSelectorClicked = 'addressSelectorClicked',\n AddressSelectorClosed = 'addressSelectorClosed',\n AddressChanged = 'addressChanged'\n}\n\nexport class AnalyticsInfoEvent extends AbstractAnalyticsEvent {\n /**\n * Analytics event type\n */\n private readonly type: InfoEventType;\n\n /**\n * Component config data set by the merchant. Sent only in 'rendered' events\n * @private\n */\n private readonly configData?: Record<string, string | boolean>;\n private readonly target?: UiTarget;\n private readonly issuer?: string;\n private readonly isExpress?: boolean;\n private readonly expressPage?: string;\n private readonly isStoredPaymentMethod?: boolean;\n private readonly brand?: string;\n private readonly selectedValue?: string;\n private readonly validationErrorCode?: string;\n private readonly validationErrorMessage?: string;\n\n /**\n * Third party script URL's (e.g. Apple Pay)\n */\n public cdnUrl?: string;\n\n constructor(props: AnalyticsInfoEventProps) {\n super(props.component);\n\n this.type = props.type;\n\n if (props.target) this.target = props.target;\n if (props.issuer) this.issuer = props.issuer;\n if (props.isStoredPaymentMethod !== undefined) this.isStoredPaymentMethod = props.isStoredPaymentMethod;\n if (props.isExpress !== undefined) this.isExpress = props.isExpress;\n if (props.expressPage) this.expressPage = props.expressPage;\n if (props.brand) this.brand = props.brand;\n if (props.cdnUrl) this.cdnUrl = props.cdnUrl;\n if (props.selectedValue) this.selectedValue = props.selectedValue;\n if (props.validationErrorCode) this.validationErrorCode = props.validationErrorCode;\n if (props.validationErrorMessage) this.validationErrorMessage = props.validationErrorMessage;\n if (this.type === InfoEventType.rendered || this.type === InfoEventType.displayed) {\n this.configData = this.createAnalyticsConfigData(props?.configData);\n }\n\n // Some of the more generic validation error codes required combination with target to retrieve a specific code\n if (this.type === InfoEventType.validationError) {\n this.validationErrorCode = mapErrorCodesForAnalytics(this.validationErrorCode, this.target);\n }\n }\n\n /**\n * Set of properties that must not be included when creating the configData for Analytics\n * @private\n */\n private get configDataExcludedFields() {\n const DROPIN_FIELDS = ['paymentMethodsConfiguration'];\n const FIELDS_INJECTED_BY_DROPIN = [\n 'elementRef',\n 'isDropin',\n 'oneClick',\n 'storedPaymentMethodId',\n 'paymentMethodId',\n 'isInstantPayment',\n 'type'\n ];\n const PII_FIELDS = ['data', 'holderName', 'shopperEmail', 'email', 'telephoneNumber', 'clickToPayConfiguration'];\n\n /**\n * TODO: Many unit tests are passing 'modules' as props, which leads to circular structure issue\n * The components must use the 'modules' from the core and not from the props\n */\n const UNIT_TEST_FIELDS = ['modules', 'i18n'];\n\n return [...DROPIN_FIELDS, ...FIELDS_INJECTED_BY_DROPIN, ...PII_FIELDS, ...UNIT_TEST_FIELDS];\n }\n\n /**\n * Creates a serializable analytics payload from the given config object.\n * Functions are replaced with 'function', and objects/arrays are stringified.\n */\n private createAnalyticsConfigData(config: Record<string, any>) {\n if (!config) return {};\n\n const MAX_STRING_LENGTH = 128;\n const result: Record<string, string> = {};\n\n try {\n for (const [key, value] of Object.entries(config)) {\n if (!this.configDataExcludedFields.includes(key)) {\n if (typeof value === 'function') {\n result[key] = 'function';\n } else if (Array.isArray(value)) {\n result[key] = value.join(', ').substring(0, MAX_STRING_LENGTH);\n } else if (typeof value === 'object' && value !== null) {\n result[key] = JSON.stringify(value).substring(0, MAX_STRING_LENGTH);\n } else {\n result[key] = value;\n }\n }\n }\n\n return result;\n } catch (error: unknown) {\n if (process.env.NODE_ENV === 'development') console.warn('AnalyticsInfoEvent: Error when creating configData\\n', error);\n return result;\n }\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.info;\n }\n}\n"],"names":["UiTarget","InfoEventType","AnalyticsInfoEvent","AbstractAnalyticsEvent","configDataExcludedFields","createAnalyticsConfigData","config","result","key","value","Object","entries","this","includes","Array","isArray","join","substring","JSON","stringify","error","getEventCategory","AnalyticsEventCategory","info","constructor","props","super","component","_define_property","type","configData","target","issuer","isExpress","expressPage","isStoredPaymentMethod","brand","selectedValue","validationErrorCode","validationErrorMessage","cdnUrl","undefined","mapErrorCodesForAnalytics"],"mappings":"iRAmBO,IAAAA,EAAKA,SAAAA,GAAAA,2fAAAA,CAeZ,CAfYA,CAeZ,CAAA,GA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jBX,EAAAhB,KAAO4B,iBAKH5B,KAAKiB,KAAOJ,EAAMI,KAEdJ,EAAMM,SAAQnB,KAAKmB,OAASN,EAAMM,QAClCN,EAAMO,SAAQpB,KAAKoB,OAASP,EAAMO,aACFS,IAAhChB,EAAMU,wBAAqCvB,KAAKuB,sBAAwBV,EAAMU,4BAC1DM,IAApBhB,EAAMQ,YAAyBrB,KAAKqB,UAAYR,EAAMQ,WACtDR,EAAMS,cAAatB,KAAKsB,YAAcT,EAAMS,aAC5CT,EAAMW,QAAOxB,KAAKwB,MAAQX,EAAMW,OAChCX,EAAMe,SAAQ5B,KAAK4B,OAASf,EAAMe,QAClCf,EAAMY,gBAAezB,KAAKyB,cAAgBZ,EAAMY,eAChDZ,EAAMa,sBAAqB1B,KAAK0B,oBAAsBb,EAAMa,qBAC5Db,EAAMc,yBAAwB3B,KAAK2B,uBAAyBd,EAAMc,qCAClE3B,KAAKiB,MAA4C,cAATjB,KAAKiB,OAC7CjB,KAAKkB,WAAalB,KAAKP,0BAA0BoB,GAAOK,aAI/C,oBAATlB,KAAKiB,OACLjB,KAAK0B,oBAAsBI,EAA0B9B,KAAK0B,oBAAqB1B,KAAKmB,QAE5F"}
1
+ {"version":3,"file":"AnalyticsInfoEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsInfoEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\nimport { mapErrorCodesForAnalytics } from '../utils';\n\ntype AnalyticsInfoEventProps = {\n type: InfoEventType;\n component: string;\n target?: UiTarget;\n issuer?: string;\n isExpress?: boolean;\n expressPage?: string;\n isStoredPaymentMethod?: boolean;\n brand?: string;\n validationErrorCode?: string;\n validationErrorMessage?: string;\n configData?: Record<string, any>;\n cdnUrl?: string;\n selectedValue?: string;\n presentedValues?: Array<string>;\n};\n\nexport enum UiTarget {\n instantPaymentButton = 'instant_payment_button',\n dualBrandButton = 'dual_brand_button',\n fastlaneSignupConsentToggle = 'fastlane_signup_consent_toggle',\n otherPaymentMethodButton = 'otherpaymentmethod_button',\n featuredIssuer = 'featured_issuer',\n list = 'list',\n listSearch = 'list_search',\n qrDownloadButton = 'qr_download_button',\n segmentedControl = 'segmented_control',\n cardNumber = 'card_number',\n expiryDate = 'expiry_date',\n expiryMonth = 'expiry_month',\n expiryYear = 'expiry_year',\n securityCode = 'security_code',\n donationAmountButton = 'donation_amount_button'\n}\n\nexport enum InfoEventType {\n /** When a UI element is clicked */\n clicked = 'clicked',\n /** When a component is rendered in the browser (e.g. render() method is called) */\n rendered = 'rendered',\n /** When a list item is selected (e.g. issuer list) */\n selected = 'selected',\n /** When there is a validation issue with the input */\n validationError = 'validationError',\n /** When input gets focus */\n focus = 'focus',\n /** When input gets unfocus */\n unfocus = 'unfocus',\n /** When iframe fields are configured */\n configured = 'configured',\n /** When a dropdown list is displayed */\n displayed = 'displayed',\n /** When shopper utilizes an input field to search for values (e.g. issuer list) */\n input = 'input',\n /** When shopper clicks to download the image (e.g. QR code image) */\n download = 'download',\n sdkDownloadInitiated = 'sdkDownloadInitiated',\n sdkDownloadFailed = 'sdkDownloadFailed',\n sdkDownloadAborted = 'sdkDownloadAborted',\n sdkDownloadCompleted = 'sdkDownloadCompleted',\n Initialized = 'initialized',\n LookupStarted = 'lookupStarted',\n LookupUserNotFound = 'lookupUserNotFound',\n OtpStarted = 'otpStarted',\n OtpSucceeded = 'otpSucceeded',\n OtpCanceled = 'otpCanceled',\n OtpFailed = 'otpFailed',\n AddressSelectorClicked = 'addressSelectorClicked',\n AddressSelectorClosed = 'addressSelectorClosed',\n AddressChanged = 'addressChanged'\n}\n\nexport class AnalyticsInfoEvent extends AbstractAnalyticsEvent {\n /**\n * Analytics event type\n */\n private readonly type: InfoEventType;\n\n /**\n * Component config data set by the merchant. Sent only in 'rendered' events\n * @private\n */\n private readonly configData?: Record<string, string | boolean>;\n private readonly target?: UiTarget;\n private readonly issuer?: string;\n private readonly isExpress?: boolean;\n private readonly expressPage?: string;\n private readonly isStoredPaymentMethod?: boolean;\n private readonly brand?: string;\n private readonly selectedValue?: string;\n private readonly validationErrorCode?: string;\n private readonly validationErrorMessage?: string;\n private readonly presentedValues?: string[];\n\n /**\n * Third party script URL's (e.g. Apple Pay)\n */\n public cdnUrl?: string;\n\n constructor(props: AnalyticsInfoEventProps) {\n super(props.component);\n\n this.type = props.type;\n\n if (props.target) this.target = props.target;\n if (props.issuer) this.issuer = props.issuer;\n if (props.isStoredPaymentMethod !== undefined) this.isStoredPaymentMethod = props.isStoredPaymentMethod;\n if (props.isExpress !== undefined) this.isExpress = props.isExpress;\n if (props.expressPage) this.expressPage = props.expressPage;\n if (props.brand) this.brand = props.brand;\n if (props.cdnUrl) this.cdnUrl = props.cdnUrl;\n if (props.selectedValue) this.selectedValue = props.selectedValue;\n if (props.validationErrorCode) this.validationErrorCode = props.validationErrorCode;\n if (props.validationErrorMessage) this.validationErrorMessage = props.validationErrorMessage;\n if (props.presentedValues) this.presentedValues = props.presentedValues;\n if (this.type === InfoEventType.rendered) {\n this.configData = this.createAnalyticsConfigData(props?.configData);\n }\n\n // Some of the more generic validation error codes required combination with target to retrieve a specific code\n if (this.type === InfoEventType.validationError) {\n this.validationErrorCode = mapErrorCodesForAnalytics(this.validationErrorCode, this.target);\n }\n }\n\n /**\n * Set of properties that must not be included when creating the configData for Analytics\n * @private\n */\n private get configDataExcludedFields() {\n const DROPIN_FIELDS = ['paymentMethodsConfiguration'];\n const FIELDS_INJECTED_BY_DROPIN = [\n 'elementRef',\n 'isDropin',\n 'oneClick',\n 'storedPaymentMethodId',\n 'paymentMethodId',\n 'isInstantPayment',\n 'type'\n ];\n const PII_FIELDS = ['data', 'holderName', 'shopperEmail', 'email', 'telephoneNumber', 'clickToPayConfiguration'];\n\n /**\n * TODO: Many unit tests are passing 'modules' as props, which leads to circular structure issue\n * The components must use the 'modules' from the core and not from the props\n */\n const UNIT_TEST_FIELDS = ['modules', 'i18n'];\n\n return [...DROPIN_FIELDS, ...FIELDS_INJECTED_BY_DROPIN, ...PII_FIELDS, ...UNIT_TEST_FIELDS];\n }\n\n /**\n * Creates a serializable analytics payload from the given config object.\n * Functions are replaced with 'function', and objects/arrays are stringified.\n */\n private createAnalyticsConfigData(config: Record<string, any>) {\n if (!config) return {};\n\n const MAX_STRING_LENGTH = 128;\n const result: Record<string, string> = {};\n\n try {\n for (const [key, value] of Object.entries(config)) {\n if (!this.configDataExcludedFields.includes(key)) {\n if (typeof value === 'function') {\n result[key] = 'function';\n } else if (Array.isArray(value)) {\n result[key] = value.join(', ').substring(0, MAX_STRING_LENGTH);\n } else if (typeof value === 'object' && value !== null) {\n result[key] = JSON.stringify(value).substring(0, MAX_STRING_LENGTH);\n } else {\n result[key] = value;\n }\n }\n }\n\n return result;\n } catch (error: unknown) {\n if (process.env.NODE_ENV === 'development') console.warn('AnalyticsInfoEvent: Error when creating configData\\n', error);\n return result;\n }\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.info;\n }\n}\n"],"names":["UiTarget","InfoEventType","AnalyticsInfoEvent","AbstractAnalyticsEvent","configDataExcludedFields","createAnalyticsConfigData","config","result","key","value","Object","entries","this","includes","Array","isArray","join","substring","JSON","stringify","error","getEventCategory","AnalyticsEventCategory","info","constructor","props","super","component","_define_property","type","configData","target","issuer","isExpress","expressPage","isStoredPaymentMethod","brand","selectedValue","validationErrorCode","validationErrorMessage","presentedValues","cdnUrl","undefined","mapErrorCodesForAnalytics"],"mappings":"iRAoBO,IAAAA,EAAKA,SAAAA,GAAAA,2iBAAAA,CAgBZ,CAhBYA,CAgBZ,CAAA,GAEOC,EAAKA,SAAAA,GAAAA,OACyBA,EAAA,QAAA,UAEgDA,EAAA,SAAA,WAE7BA,EAAA,SAAA,WAEAA,EAAA,gBAAA,kBAE1BA,EAAA,MAAA,QAEEA,EAAA,QAAA,UAEUA,EAAA,WAAA,aAEAA,EAAA,UAAA,YAE2CA,EAAA,MAAA,QAEdA,EAAA,SAAA,+gBAnB3DA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uB,sBAAwBV,EAAMU,4BAC1DO,IAApBjB,EAAMQ,YAAyBrB,KAAKqB,UAAYR,EAAMQ,WACtDR,EAAMS,cAAatB,KAAKsB,YAAcT,EAAMS,aAC5CT,EAAMW,QAAOxB,KAAKwB,MAAQX,EAAMW,OAChCX,EAAMgB,SAAQ7B,KAAK6B,OAAShB,EAAMgB,QAClChB,EAAMY,gBAAezB,KAAKyB,cAAgBZ,EAAMY,eAChDZ,EAAMa,sBAAqB1B,KAAK0B,oBAAsBb,EAAMa,qBAC5Db,EAAMc,yBAAwB3B,KAAK2B,uBAAyBd,EAAMc,wBAClEd,EAAMe,kBAAiB5B,KAAK4B,gBAAkBf,EAAMe,iBAC3C,aAAT5B,KAAKiB,OACLjB,KAAKkB,WAAalB,KAAKP,0BAA0BoB,GAAOK,aAI/C,oBAATlB,KAAKiB,OACLjB,KAAK0B,oBAAsBK,EAA0B/B,KAAK0B,oBAAqB1B,KAAKmB,QAE5F"}
@@ -1,2 +1,2 @@
1
- import{AbstractAnalyticsEvent as e,AnalyticsEventCategory as t}from"./AbstractAnalyticsEvent.js";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n=function(e){return e.action="action",e.submit="submit",e.redirect="redirect",e.threeDS2="threeDS2",e.closed="closed",e}({}),a=function(e){return e.challengeIframeLoaded="challengeIframeLoaded",e.challengeDataSentWeb="challengeDataSentWeb",e.challengeCompleted="challengeCompleted",e.fingerprintDataSentWeb="fingerprintDataSentWeb",e.fingerprintCompleted="fingerprintCompleted",e.fingerprintIframeLoaded="fingerprintIframeLoaded",e.threeDS2="threeDS2",e.redirect="redirect",e.voucher="voucher",e.await="awat",e.qrCode="qrCode",e.bankTransfer="bankTransfer",e.sdk="sdk",e}({});class i extends e{getEventCategory(){return t.log}static getSubtypeFromActionType(e){return a[e]}constructor(e){super(e.component),r(this,"type",void 0),r(this,"subType",void 0),r(this,"message",void 0),r(this,"result",void 0),this.type=e.type,this.message=e.message,e.subType&&(this.subType=e.subType),e.result&&(this.result=e.result)}}export{i as AnalyticsLogEvent,a as LogEventSubtype,n as LogEventType};
1
+ import{AbstractAnalyticsEvent as e,AnalyticsEventCategory as t}from"./AbstractAnalyticsEvent.js";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n=function(e){return e.action="action",e.submit="submit",e.redirect="redirect",e.threeDS2="threeDS2",e.closed="closed",e.apiRequest="apiRequest",e}({}),a=function(e){return e.challengeIframeLoaded="challengeIframeLoaded",e.challengeDataSentWeb="challengeDataSentWeb",e.challengeCompleted="challengeCompleted",e.fingerprintDataSentWeb="fingerprintDataSentWeb",e.fingerprintCompleted="fingerprintCompleted",e.fingerprintIframeLoaded="fingerprintIframeLoaded",e.threeDS2="threeDS2",e.redirect="redirect",e.voucher="voucher",e.await="awat",e.qrCode="qrCode",e.bankTransfer="bankTransfer",e.sdk="sdk",e.donation="donation",e.donationCampaigns="donationCampaigns",e}({});class i extends e{getEventCategory(){return t.log}static getSubtypeFromActionType(e){return a[e]}constructor(e){super(e.component),r(this,"type",void 0),r(this,"subType",void 0),r(this,"message",void 0),r(this,"result",void 0),this.type=e.type,this.message=e.message,e.subType&&(this.subType=e.subType),e.result&&(this.result=e.result)}}export{i as AnalyticsLogEvent,a as LogEventSubtype,n as LogEventType};
2
2
  //# sourceMappingURL=AnalyticsLogEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsLogEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsLogEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\nimport type { PaymentAction } from '../../../types/global-types';\n\ntype AnalyticsLogEventProps = {\n type: LogEventType;\n subType?: LogEventSubtype;\n component: string;\n message: string;\n result?: string;\n};\n\nexport enum LogEventType {\n action = 'action',\n submit = 'submit',\n redirect = 'redirect',\n threeDS2 = 'threeDS2',\n closed = 'closed'\n}\n\nexport enum LogEventSubtype {\n challengeIframeLoaded = 'challengeIframeLoaded',\n challengeDataSentWeb = 'challengeDataSentWeb',\n challengeCompleted = 'challengeCompleted',\n fingerprintDataSentWeb = 'fingerprintDataSentWeb',\n fingerprintCompleted = 'fingerprintCompleted',\n fingerprintIframeLoaded = 'fingerprintIframeLoaded',\n threeDS2 = 'threeDS2',\n redirect = 'redirect',\n voucher = 'voucher',\n await = 'awat',\n qrCode = 'qrCode',\n bankTransfer = 'bankTransfer',\n sdk = 'sdk'\n}\n\nexport class AnalyticsLogEvent extends AbstractAnalyticsEvent {\n private readonly type: LogEventType;\n private readonly subType: LogEventSubtype;\n\n private readonly message?: string;\n private readonly result?: string;\n\n constructor(props: AnalyticsLogEventProps) {\n super(props.component);\n\n this.type = props.type;\n this.message = props.message;\n\n if (props.subType) this.subType = props.subType;\n if (props.result) this.result = props.result;\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.log;\n }\n\n public static getSubtypeFromActionType(type: PaymentAction['type']): LogEventSubtype {\n return LogEventSubtype[type];\n }\n}\n"],"names":["LogEventType","LogEventSubtype","AnalyticsLogEvent","AbstractAnalyticsEvent","getEventCategory","AnalyticsEventCategory","log","getSubtypeFromActionType","type","constructor","props","super","component","_define_property","this","subType","message","result"],"mappings":"yNAWO,IAAAA,EAAKA,SAAAA,GAAAA,yGAAAA,CAMX,CANWA,CAMX,CAAA,GAEMC,EAAKA,SAAAA,GAAAA,8aAAAA,CAcX,CAdWA,CAcX,CAAA,GAEM,MAAMC,UAA0BC,EAiB5BC,gBAAAA,GACH,OAAOC,EAAuBC,GAClC,CAEA,+BAAcC,CAAyBC,GACnC,OAAOP,EAAgBO,EAC3B,CAhBA,WAAAC,CAAYC,GACRC,MAAMD,EAAME,WAPhBC,EAAAC,KAAiBN,YAAjB,GACAK,EAAAC,KAAiBC,kBAEjBF,EAAAC,KAAiBE,kBACjBH,EAAAC,KAAiBG,iBAKbH,KAAKN,KAAOE,EAAMF,KAClBM,KAAKE,QAAUN,EAAMM,QAEjBN,EAAMK,UAASD,KAAKC,QAAUL,EAAMK,SACpCL,EAAMO,SAAQH,KAAKG,OAASP,EAAMO,OAC1C"}
1
+ {"version":3,"file":"AnalyticsLogEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsLogEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\nimport type { PaymentAction } from '../../../types/global-types';\n\ntype AnalyticsLogEventProps = {\n type: LogEventType;\n subType?: LogEventSubtype;\n component: string;\n message: string;\n result?: string;\n};\n\nexport enum LogEventType {\n action = 'action',\n submit = 'submit',\n redirect = 'redirect',\n threeDS2 = 'threeDS2',\n closed = 'closed',\n apiRequest = 'apiRequest'\n}\n\nexport enum LogEventSubtype {\n challengeIframeLoaded = 'challengeIframeLoaded',\n challengeDataSentWeb = 'challengeDataSentWeb',\n challengeCompleted = 'challengeCompleted',\n fingerprintDataSentWeb = 'fingerprintDataSentWeb',\n fingerprintCompleted = 'fingerprintCompleted',\n fingerprintIframeLoaded = 'fingerprintIframeLoaded',\n threeDS2 = 'threeDS2',\n redirect = 'redirect',\n voucher = 'voucher',\n await = 'awat',\n qrCode = 'qrCode',\n bankTransfer = 'bankTransfer',\n sdk = 'sdk',\n donation = 'donation',\n donationCampaigns = 'donationCampaigns'\n}\n\nexport class AnalyticsLogEvent extends AbstractAnalyticsEvent {\n private readonly type: LogEventType;\n private readonly subType: LogEventSubtype;\n\n private readonly message?: string;\n private readonly result?: string;\n\n constructor(props: AnalyticsLogEventProps) {\n super(props.component);\n\n this.type = props.type;\n this.message = props.message;\n\n if (props.subType) this.subType = props.subType;\n if (props.result) this.result = props.result;\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.log;\n }\n\n public static getSubtypeFromActionType(type: PaymentAction['type']): LogEventSubtype {\n return LogEventSubtype[type];\n }\n}\n"],"names":["LogEventType","LogEventSubtype","AnalyticsLogEvent","AbstractAnalyticsEvent","getEventCategory","AnalyticsEventCategory","log","getSubtypeFromActionType","type","constructor","props","super","component","_define_property","this","subType","message","result"],"mappings":"yNAWO,IAAAA,EAAKA,SAAAA,GAAAA,mIAAAA,CAOX,CAPWA,CAOX,CAAA,GAEMC,EAAKA,SAAAA,GAAAA,4eAAAA,CAgBX,CAhBWA,CAgBX,CAAA,GAEM,MAAMC,UAA0BC,EAiB5BC,gBAAAA,GACH,OAAOC,EAAuBC,GAClC,CAEA,+BAAcC,CAAyBC,GACnC,OAAOP,EAAgBO,EAC3B,CAhBA,WAAAC,CAAYC,GACRC,MAAMD,EAAME,WAPhBC,EAAAC,KAAiBN,YAAjB,GACAK,EAAAC,KAAiBC,kBAEjBF,EAAAC,KAAiBE,kBACjBH,EAAAC,KAAiBG,iBAKbH,KAAKN,KAAOE,EAAMF,KAClBM,KAAKE,QAAUN,EAAMM,QAEjBN,EAAMK,UAASD,KAAKC,QAAUL,EAAMK,SACpCL,EAAMO,SAAQH,KAAKG,OAASP,EAAMO,OAC1C"}
@@ -1,2 +1,2 @@
1
- import s from"../Services/sessions/make-payment.js";import e from"../Services/sessions/submit-details.js";import t from"../Services/sessions/setup-session.js";import i from"../Services/sessions/check-balance.js";import o from"../../utils/Storage.js";import n from"../Services/sessions/create-order.js";import{sanitizeSession as a}from"./utils.js";import r from"../Services/sessions/cancel-order.js";import h from"../../utils/browserInfo.js";function c(s,e,t){return e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}class u{get shopperLocale(){return this.session.shopperLocale}get id(){return this.session.id}get data(){return this.session.sessionData}updateSessionData(s){this.session.sessionData=s,this.storeSession()}setupSession(s){const e={...s,browserInfo:h()};return t(this,e).then(s=>(s.configuration&&(this.configuration={...s.configuration}),s.sessionData&&this.updateSessionData(s.sessionData),s))}submitPayment(e){return s(e,this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}submitDetails(s){return e(s,this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}checkBalance(s){return i(s,this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}createOrder(){return n(this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}cancelOrder(s){return r(s.order,this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}getStoredSession(){const s=this.storage.get();return this.id===s?.id?s:this.session}storeSession(){this.storage.set({id:this.session.id,sessionData:this.session.sessionData})}removeStoredSession(){this.storage.remove()}constructor(s,e,t){c(this,"storage",void 0),c(this,"session",void 0),c(this,"clientKey",void 0),c(this,"loadingContext",void 0),c(this,"configuration",void 0);const i=a(s);if(!e)throw new Error("No clientKey available");if(!t)throw new Error("No loadingContext available");this.storage=new o("session","localStorage"),this.clientKey=e,this.loadingContext=t,this.session=i,this.session.sessionData?this.storeSession():this.session=this.getStoredSession()}}export{u as default};
1
+ import s from"../Services/sessions/make-payment.js";import t from"../Services/sessions/submit-details.js";import e from"../Services/sessions/fetch-donation-campaigns.js";import i from"../Services/sessions/make-donation.js";import o from"../Services/sessions/setup-session.js";import n from"../Services/sessions/check-balance.js";import a from"../../utils/Storage.js";import r from"../Services/sessions/create-order.js";import{sanitizeSession as h}from"./utils.js";import d from"../Services/sessions/cancel-order.js";import c from"../../utils/browserInfo.js";function u(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}class D{get shopperLocale(){return this.session.shopperLocale}get id(){return this.session.id}get data(){return this.session.sessionData}set sessionsDonationInitiated(s){this._sessionsDonationInitiated=s}get sessionsDonationInitiated(){return this._sessionsDonationInitiated}updateSessionData(s){this.session.sessionData=s,this.storeSession()}setupSession(s){const t={...s,browserInfo:c()};return o(this,t).then(s=>(s.configuration&&(this.configuration={...s.configuration}),s.sessionData&&this.updateSessionData(s.sessionData),s))}submitPayment(t){return s(t,this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}submitDetails(s){return t(s,this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}fetchDonationCampaigns(){return e(this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}makeDonation(s){return i(s,this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}checkBalance(s){return n(s,this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}createOrder(){return r(this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}cancelOrder(s){return d(s.order,this).then(s=>(s.sessionData&&this.updateSessionData(s.sessionData),s))}getStoredSession(){const s=this.storage.get();return this.id===s?.id?s:this.session}storeSession(){this.storage.set({id:this.session.id,sessionData:this.session.sessionData})}removeStoredSession(){this.storage.remove()}constructor(s,t,e){u(this,"storage",void 0),u(this,"session",void 0),u(this,"clientKey",void 0),u(this,"loadingContext",void 0),u(this,"configuration",void 0),u(this,"_sessionsDonationInitiated",void 0);const i=h(s);if(!t)throw new Error("No clientKey available");if(!e)throw new Error("No loadingContext available");this.storage=new a("session","localStorage"),this.clientKey=t,this.loadingContext=e,this.session=i,this._sessionsDonationInitiated=!1,this.session.sessionData?this.storeSession():this.session=this.getStoredSession()}}export{D as default};
2
2
  //# sourceMappingURL=CheckoutSession.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutSession.js","sources":["../../../../src/core/CheckoutSession/CheckoutSession.ts"],"sourcesContent":["import makePayment from '../Services/sessions/make-payment';\nimport submitDetails from '../Services/sessions/submit-details';\nimport setupSession from '../Services/sessions/setup-session';\nimport checkBalance from '../Services/sessions/check-balance';\nimport Storage from '../../utils/Storage';\nimport createOrder from '../Services/sessions/create-order';\nimport { sanitizeSession } from './utils';\nimport {\n CheckoutSession,\n CheckoutSessionBalanceResponse,\n CheckoutSessionDetailsResponse,\n CheckoutSessionOrdersResponse,\n CheckoutSessionPaymentResponse,\n CheckoutSessionSetupResponse,\n SessionConfiguration,\n SetupSessionOptions\n} from './types';\nimport cancelOrder from '../Services/sessions/cancel-order';\nimport { onOrderCancelData } from '../../components/Dropin/types';\nimport type { AdditionalDetailsData } from '../types';\nimport collectBrowserInfo from '../../utils/browserInfo';\n\nclass Session {\n private readonly storage: Storage<CheckoutSession>;\n\n public readonly session: CheckoutSession;\n public readonly clientKey: string;\n public readonly loadingContext: string;\n public configuration: SessionConfiguration;\n\n constructor(rawSession: Partial<CheckoutSession>, clientKey: string, loadingContext: string) {\n const session = sanitizeSession(rawSession) as CheckoutSession;\n\n if (!clientKey) throw new Error('No clientKey available');\n if (!loadingContext) throw new Error('No loadingContext available');\n\n this.storage = new Storage('session', 'localStorage');\n this.clientKey = clientKey;\n this.loadingContext = loadingContext;\n this.session = session;\n\n if (!this.session.sessionData) {\n this.session = this.getStoredSession();\n } else {\n this.storeSession();\n }\n }\n\n get shopperLocale() {\n return this.session.shopperLocale;\n }\n\n get id() {\n return this.session.id;\n }\n\n get data() {\n return this.session.sessionData;\n }\n\n /**\n * Updates the session.data with the latest data blob\n */\n private updateSessionData(latestData: string): void {\n this.session.sessionData = latestData;\n this.storeSession();\n }\n\n /**\n * Fetches data from a session\n */\n setupSession(options: SetupSessionOptions): Promise<CheckoutSessionSetupResponse> {\n const mergedOptions = { ...options, browserInfo: collectBrowserInfo() };\n return setupSession(this, mergedOptions).then(response => {\n if (response.configuration) {\n this.configuration = { ...response.configuration };\n }\n\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Submits a session payment\n */\n submitPayment(data): Promise<CheckoutSessionPaymentResponse> {\n return makePayment(data, this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Submits session payment additional details\n */\n submitDetails(data: AdditionalDetailsData['data']): Promise<CheckoutSessionDetailsResponse> {\n return submitDetails(data, this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Checks the balance for a payment method\n */\n checkBalance(data): Promise<CheckoutSessionBalanceResponse> {\n return checkBalance(data, this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Creates an order for the current session\n */\n createOrder(): Promise<CheckoutSessionOrdersResponse> {\n return createOrder(this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Cancels an order for the current session\n */\n cancelOrder(data: onOrderCancelData): Promise<CheckoutSessionOrdersResponse> {\n return cancelOrder(data.order, this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Gets the stored session but only if the current id and the stored id match\n */\n getStoredSession(): CheckoutSession {\n const storedSession = this.storage.get();\n return this.id === storedSession?.id ? storedSession : this.session;\n }\n\n /**\n * Stores the session\n */\n storeSession(): void {\n this.storage.set({ id: this.session.id, sessionData: this.session.sessionData });\n }\n\n /**\n * Clears the stored session\n */\n removeStoredSession(): void {\n this.storage.remove();\n }\n}\n\nexport default Session;\n"],"names":["Session","shopperLocale","this","session","id","data","sessionData","updateSessionData","latestData","storeSession","setupSession","options","mergedOptions","browserInfo","collectBrowserInfo","then","response","configuration","submitPayment","makePayment","submitDetails","checkBalance","createOrder","cancelOrder","order","getStoredSession","storedSession","storage","get","set","removeStoredSession","remove","constructor","rawSession","clientKey","loadingContext","_define_property","sanitizeSession","Error","Storage"],"mappings":"ijBAsBA,MAAMA,EA0BF,iBAAIC,GACA,OAAOC,KAAKC,QAAQF,aACxB,CAEA,MAAIG,GACA,OAAOF,KAAKC,QAAQC,EACxB,CAEA,QAAIC,GACA,OAAOH,KAAKC,QAAQG,WACxB,CAKQC,iBAAAA,CAAkBC,GACtBN,KAAKC,QAAQG,YAAcE,EAC3BN,KAAKO,cACT,CAKAC,YAAAA,CAAaC,GACT,MAAMC,EAAgB,IAAKD,EAASE,YAAaC,KACjD,OAAOJ,EAAaR,KAAMU,GAAeG,KAAKC,IACtCA,EAASC,gBACTf,KAAKe,cAAgB,IAAKD,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ErCpC,KAAKyB,QAAU,IAAIY,EAAQ,UAAW,gBACtCrC,KAAKgC,UAAYA,EACjBhC,KAAKiC,eAAiBA,EACtBjC,KAAKC,QAAUA,EAEVD,KAAKC,QAAQG,YAGdJ,KAAKO,eAFLP,KAAKC,QAAUD,KAAKuB,kBAI5B"}
1
+ {"version":3,"file":"CheckoutSession.js","sources":["../../../../src/core/CheckoutSession/CheckoutSession.ts"],"sourcesContent":["import makePayment from '../Services/sessions/make-payment';\nimport submitDetails from '../Services/sessions/submit-details';\nimport fetchDonationCampaigns from '../Services/sessions/fetch-donation-campaigns';\nimport makeDonation from '../Services/sessions/make-donation';\nimport setupSession from '../Services/sessions/setup-session';\nimport checkBalance from '../Services/sessions/check-balance';\nimport Storage from '../../utils/Storage';\nimport createOrder from '../Services/sessions/create-order';\nimport { sanitizeSession } from './utils';\nimport {\n CheckoutSession,\n CheckoutSessionBalanceResponse,\n CheckoutSessionDetailsResponse,\n CheckoutSessionDonationCampaignsResponse,\n CheckoutSessionDonationsRequestData,\n CheckoutSessionDonationsResponse,\n CheckoutSessionOrdersResponse,\n CheckoutSessionPaymentResponse,\n CheckoutSessionSetupResponse,\n SessionConfiguration,\n SetupSessionOptions\n} from './types';\nimport cancelOrder from '../Services/sessions/cancel-order';\nimport { onOrderCancelData } from '../../components/Dropin/types';\nimport type { AdditionalDetailsData } from '../types';\nimport collectBrowserInfo from '../../utils/browserInfo';\n\nclass Session {\n private readonly storage: Storage<CheckoutSession>;\n\n public readonly session: CheckoutSession;\n public readonly clientKey: string;\n public readonly loadingContext: string;\n public configuration: SessionConfiguration;\n private _sessionsDonationInitiated: boolean;\n\n constructor(rawSession: Partial<CheckoutSession>, clientKey: string, loadingContext: string) {\n const session = sanitizeSession(rawSession) as CheckoutSession;\n\n if (!clientKey) throw new Error('No clientKey available');\n if (!loadingContext) throw new Error('No loadingContext available');\n\n this.storage = new Storage('session', 'localStorage');\n this.clientKey = clientKey;\n this.loadingContext = loadingContext;\n this.session = session;\n\n this._sessionsDonationInitiated = false;\n\n if (!this.session.sessionData) {\n this.session = this.getStoredSession();\n } else {\n this.storeSession();\n }\n }\n\n get shopperLocale() {\n return this.session.shopperLocale;\n }\n\n get id() {\n return this.session.id;\n }\n\n get data() {\n return this.session.sessionData;\n }\n\n set sessionsDonationInitiated(donationInitiated: boolean) {\n this._sessionsDonationInitiated = donationInitiated;\n }\n\n get sessionsDonationInitiated() {\n return this._sessionsDonationInitiated;\n }\n\n /**\n * Updates the session.data with the latest data blob\n */\n private updateSessionData(latestData: string): void {\n this.session.sessionData = latestData;\n this.storeSession();\n }\n\n /**\n * Fetches data from a session\n */\n setupSession(options: SetupSessionOptions): Promise<CheckoutSessionSetupResponse> {\n const mergedOptions = { ...options, browserInfo: collectBrowserInfo() };\n return setupSession(this, mergedOptions).then(response => {\n if (response.configuration) {\n this.configuration = { ...response.configuration };\n }\n\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Submits a session payment\n */\n submitPayment(data): Promise<CheckoutSessionPaymentResponse> {\n return makePayment(data, this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Submits session payment additional details\n */\n submitDetails(data: AdditionalDetailsData['data']): Promise<CheckoutSessionDetailsResponse> {\n return submitDetails(data, this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Call donationCampaigns endpoint\n */\n fetchDonationCampaigns(): Promise<CheckoutSessionDonationCampaignsResponse> {\n return fetchDonationCampaigns(this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Call donations endpoint\n */\n makeDonation(data: CheckoutSessionDonationsRequestData): Promise<CheckoutSessionDonationsResponse> {\n return makeDonation(data, this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Checks the balance for a payment method\n */\n checkBalance(data): Promise<CheckoutSessionBalanceResponse> {\n return checkBalance(data, this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Creates an order for the current session\n */\n createOrder(): Promise<CheckoutSessionOrdersResponse> {\n return createOrder(this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Cancels an order for the current session\n */\n cancelOrder(data: onOrderCancelData): Promise<CheckoutSessionOrdersResponse> {\n return cancelOrder(data.order, this).then(response => {\n if (response.sessionData) {\n this.updateSessionData(response.sessionData);\n }\n\n return response;\n });\n }\n\n /**\n * Gets the stored session but only if the current id and the stored id match\n */\n getStoredSession(): CheckoutSession {\n const storedSession = this.storage.get();\n return this.id === storedSession?.id ? storedSession : this.session;\n }\n\n /**\n * Stores the session\n */\n storeSession(): void {\n this.storage.set({ id: this.session.id, sessionData: this.session.sessionData });\n }\n\n /**\n * Clears the stored session\n */\n removeStoredSession(): void {\n this.storage.remove();\n }\n}\n\nexport default Session;\n"],"names":["Session","shopperLocale","this","session","id","data","sessionData","sessionsDonationInitiated","donationInitiated","_sessionsDonationInitiated","updateSessionData","latestData","storeSession","setupSession","options","mergedOptions","browserInfo","collectBrowserInfo","then","response","configuration","submitPayment","makePayment","submitDetails","fetchDonationCampaigns","makeDonation","checkBalance","createOrder","cancelOrder","order","getStoredSession","storedSession","storage","get","set","removeStoredSession","remove","constructor","rawSession","clientKey","loadingContext","_define_property","sanitizeSession","Error","Storage"],"mappings":"sqBA2BA,MAAMA,EA6BF,iBAAIC,GACA,OAAOC,KAAKC,QAAQF,aACxB,CAEA,MAAIG,GACA,OAAOF,KAAKC,QAAQC,EACxB,CAEA,QAAIC,GACA,OAAOH,KAAKC,QAAQG,WACxB,CAEA,6BAAIC,CAA0BC,GAC1BN,KAAKO,2BAA6BD,CACtC,CAEA,6BAAID,GACA,OAAOL,KAAKO,0BAChB,CAKQC,iBAAAA,CA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,GAAK2B,EAAgB7B,KAAKC,OAChE,CAKAS,YAAAA,GACIV,KAAK8B,QAAQE,IAAI,CAAE9B,GAAIF,KAAKC,QAAQC,GAAIE,YAAaJ,KAAKC,QAAQG,aACtE,CAKA6B,mBAAAA,GACIjC,KAAK8B,QAAQI,QACjB,CAjLA,WAAAC,CAAYC,EAAsCC,EAAmBC,GARrEC,EAAAvC,KAAiB8B,kBAEjBS,EAAAvC,KAAgBC,kBAChBsC,EAAAvC,KAAgBqC,oBAChBE,EAAAvC,KAAgBsC,yBAChBC,EAAAvC,KAAOkB,wBACPqB,EAAAvC,KAAQO,qCAGJ,MAAMN,EAAUuC,EAAgBJ,GAEhC,IAAKC,EAAW,MAAM,IAAII,MAAM,0BAChC,IAAKH,EAAgB,MAAM,IAAIG,MAAM,+BAErCzC,KAAK8B,QAAU,IAAIY,EAAQ,UAAW,gBACtC1C,KAAKqC,UAAYA,EACjBrC,KAAKsC,eAAiBA,EACtBtC,KAAKC,QAAUA,EAEfD,KAAKO,4BAA6B,EAE7BP,KAAKC,QAAQG,YAGdJ,KAAKU,eAFLV,KAAKC,QAAUD,KAAK4B,kBAI5B"}
@@ -1,2 +1,2 @@
1
- import{get3DS2FlowProps as e}from"../../../components/ThreeDS2/components/utils.js";import t from"../../../utils/uuid.js";const o=(e,o,n,r)=>{const i=o.getComponent(n);if(!i)throw Error(`Action Element of type ${n} not found in the registry`);return new i(e,{...r,id:`${n}-${t()}`})},n=e=>(t,n,r,i)=>{const s={...i,...r,onError:i.onError,statusType:e,originalAction:r};return o(t,n,r.paymentMethodType,s)},r={redirect:(e,t,n,r)=>{const i={...r,...n,statusType:"redirect",originalAction:n};return o(e,t,"redirect",i)},threeDS2:(t,n,r,i)=>{const s="fingerprint"===r.subtype?"threeDS2DeviceFingerprint":"threeDS2Challenge",a="fingerprint"===r.subtype||i.isMDFlow?r.paymentData:r.authorisationToken,l={core:t,token:r.token,paymentData:a,onActionHandled:i.onActionHandled,onComplete:i.onComplete,onAdditionalDetails:i.onAdditionalDetails,onError:i.onError,isDropin:!!i.isDropin,loadingContext:i.loadingContext,clientKey:i.clientKey,paymentMethodType:i.paymentMethodType,challengeWindowSize:i.challengeWindowSize,isMDFlow:i.isMDFlow,modules:{analytics:i.modules?.analytics,resources:i.modules?.resources},...e(r.subtype,i)};return o(t,n,s,l)},voucher:n("custom"),qrCode:n("custom"),await:n("custom"),bankTransfer:n("custom"),sdk:n("custom")};export{r as default};
1
+ import{get3DS2FlowProps as e}from"../../../components/ThreeDS2/components/utils.js";import t from"../../../utils/uuid.js";const o=(e,o,n,r)=>{const i=o.getComponent(n);if(!i)throw Error(`Action Element of type ${n} not found in the registry`);return new i(e,{...r,id:`${n}-${t()}`})},n=e=>(t,n,r,i)=>{const s={...i,...r,onError:i.onError,statusType:e,originalAction:r};return o(t,n,r.paymentMethodType,s)},r={redirect:(e,t,n,r)=>{const i={...r,...n,statusType:"redirect",originalAction:n};return o(e,t,"redirect",i)},threeDS2:(t,n,r,i)=>{const s="fingerprint"===r.subtype?"threeDS2DeviceFingerprint":"threeDS2Challenge",a="fingerprint"===r.subtype||i.isMDFlow?r.paymentData:r.authorisationToken,l={core:t,token:r.token,paymentData:a,onActionHandled:i.onActionHandled,on3DS2RedirectFlowComplete:i.on3DS2RedirectFlowComplete,onAdditionalDetails:i.onAdditionalDetails,onError:i.onError,isDropin:!!i.isDropin,loadingContext:i.loadingContext,clientKey:i.clientKey,paymentMethodType:i.paymentMethodType,challengeWindowSize:i.challengeWindowSize,isMDFlow:i.isMDFlow,modules:{analytics:i.modules?.analytics,resources:i.modules?.resources},...e(r.subtype,i)};return o(t,n,s,l)},voucher:n("custom"),qrCode:n("custom"),await:n("custom"),bankTransfer:n("custom"),sdk:n("custom")};export{r as default};
2
2
  //# sourceMappingURL=actionTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actionTypes.js","sources":["../../../../../src/core/ProcessResponse/PaymentAction/actionTypes.ts"],"sourcesContent":["import { get3DS2FlowProps } from '../../../components/ThreeDS2/components/utils';\nimport uuid from '../../../utils/uuid';\nimport type { StatusFromAction, ThreeDS2ActionProps, UIElement, UIElementProps } from '../../../types';\nimport type { PaymentAction } from '../../../types/global-types';\nimport type { IRegistry } from '../../core.registry';\nimport type { ICore } from '../../types';\nimport type { ThreeDS2ConfigProps } from '../../../types';\nimport type { ActionHandlerConfig } from './types';\n\nconst createComponent = (core: ICore, registry: IRegistry, componentType: string, props: ActionHandlerConfig | ThreeDS2ConfigProps): UIElement => {\n const Element = registry.getComponent(componentType);\n\n if (!Element) {\n throw Error(`Action Element of type ${componentType} not found in the registry`);\n }\n\n const element = new Element(core, { ...props, id: `${componentType}-${uuid()}` });\n return element;\n};\n\nconst getActionHandler = (statusType: StatusFromAction) => {\n return (core: ICore, registry: IRegistry, action: PaymentAction, props: UIElementProps): UIElement => {\n const config: ActionHandlerConfig = {\n ...props,\n ...action,\n onError: props.onError,\n statusType,\n originalAction: action\n };\n\n return createComponent(core, registry, action.paymentMethodType, config);\n };\n};\n\nconst actionTypes = {\n redirect: (core: ICore, registry, action: PaymentAction, props: UIElementProps): UIElement => {\n const config: ActionHandlerConfig = {\n ...props,\n ...action,\n statusType: 'redirect',\n originalAction: action\n };\n\n return createComponent(core, registry, 'redirect', config);\n },\n\n threeDS2: (core: ICore, registry, action: PaymentAction, props: ThreeDS2ActionProps): UIElement => {\n const componentType = action.subtype === 'fingerprint' ? 'threeDS2DeviceFingerprint' : 'threeDS2Challenge';\n\n /**\n * NOTE: the isMDFlow prop comes from the options object, added within the MDFlow when it calls createFromAction(action, options) to initiate a 3DS2 component\n * It replaces the useOriginalFlow config prop that the MDFlow used to pass when directly initiating the threeDS2Fingerprint or threeDS2Challenge components\n */\n const paymentData = action.subtype === 'fingerprint' || props.isMDFlow ? action.paymentData : action.authorisationToken;\n\n const config: ThreeDS2ConfigProps = {\n // Props common to both flows\n core,\n token: action.token,\n paymentData,\n onActionHandled: props.onActionHandled,\n onComplete: props.onComplete, // NOTE: We only ever expect props.onComplete to be defined for the MDFlow\n onAdditionalDetails: props.onAdditionalDetails, // Needed to prevent regression in v6.24.0 re. supporting onAdditionalDetails being directly set on Card component (in v7 we will *not* allow this, & this line can be removed)\n onError: props.onError,\n isDropin: !!props.isDropin,\n loadingContext: props.loadingContext,\n clientKey: props.clientKey,\n paymentMethodType: props.paymentMethodType,\n challengeWindowSize: props.challengeWindowSize, // always pass challengeWindowSize in case it's been set directly in the handleAction config object\n isMDFlow: props.isMDFlow,\n modules: {\n analytics: props.modules?.analytics,\n resources: props.modules?.resources\n },\n\n // Props unique to a particular flow\n ...get3DS2FlowProps(action.subtype, props)\n };\n\n return createComponent(core, registry, componentType, config);\n },\n\n voucher: getActionHandler('custom'),\n qrCode: getActionHandler('custom'),\n await: getActionHandler('custom'),\n bankTransfer: getActionHandler('custom'),\n sdk: getActionHandler('custom')\n} as const;\n\nexport default actionTypes;\n"],"names":["createComponent","core","registry","componentType","props","Element","getComponent","Error","id","uuid","getActionHandler","statusType","action","config","onError","originalAction","paymentMethodType","actionTypes","redirect","threeDS2","subtype","paymentData","isMDFlow","authorisationToken","token","onActionHandled","onComplete","onAdditionalDetails","isDropin","loadingContext","clientKey","challengeWindowSize","modules","analytics","resources","get3DS2FlowProps","voucher","qrCode","await","bankTransfer","sdk"],"mappings":"0HASA,MAAMA,EAAkB,CAACC,EAAaC,EAAqBC,EAAuBC,KAC9E,MAAMC,EAAUH,EAASI,aAAaH,GAEtC,IAAKE,EACD,MAAME,MAAM,0BAA0BJ,+BAI1C,OADgB,IAAIE,EAAQJ,EAAM,IAAKG,EAAOI,GAAI,GAAGL,KAAiBM,SAIpEC,EAAoBC,GACf,CAACV,EAAaC,EAAqBU,EAAuBR,KAC7D,MAAMS,EAA8B,IAC7BT,KACAQ,EACHE,QAASV,EAAMU,QACfH,aACAI,eAAgBH,GAGpB,OAAOZ,EAAgBC,EAAMC,EAAUU,EAAOI,kBAAmBH,IAInEI,EAAc,CAChBC,SAAU,CAACjB,EAAaC,EAAUU,EAAuBR,KACrD,MAAMS,EAA8B,IAC7BT,KACAQ,EACHD,WAAY,WACZI,eAAgBH,GAGpB,OAAOZ,EAAgBC,EAAMC,EAAU,WAAYW,IAGvDM,SAAU,CAAClB,EAAaC,EAAUU,EAAuBR,KACrD,MAAMD,EAAmC,gBAAnBS,EAAOQ,QAA4B,4BAA8B,oBAMjFC,EAAiC,gBAAnBT,EAAOQ,SAA6BhB,EAAMkB,SAAWV,EAAOS,YAAcT,EAAOW,mBAE/FV,EAA8B,CAEhCZ,OACAuB,MAAOZ,EAAOY,MACdH,cACAI,gBAAiBrB,EAAMqB,gBACvBC,WAAYtB,EAAMsB,WAClBC,oBAAqBvB,EAAMuB,oBAC3Bb,QAASV,EAAMU,QACfc,WAAYxB,EAAMwB,SAClBC,eAAgBzB,EAAMyB,eACtBC,UAAW1B,EAAM0B,UACjBd,kBAAmBZ,EAAMY,kBACzBe,oBAAqB3B,EAAM2B,oBAC3BT,SAAUlB,EAAMkB,SAChBU,QAAS,CACLC,UAAW7B,EAAM4B,SAASC,UAC1BC,UAAW9B,EAAM4B,SAASE,cAI3BC,EAAiBvB,EAAOQ,QAAShB,IAGxC,OAAOJ,EAAgBC,EAAMC,EAAUC,EAAeU,IAG1DuB,QAAS1B,EAAiB,UAC1B2B,OAAQ3B,EAAiB,UACzB4B,MAAO5B,EAAiB,UACxB6B,aAAc7B,EAAiB,UAC/B8B,IAAK9B,EAAiB"}
1
+ {"version":3,"file":"actionTypes.js","sources":["../../../../../src/core/ProcessResponse/PaymentAction/actionTypes.ts"],"sourcesContent":["import { get3DS2FlowProps } from '../../../components/ThreeDS2/components/utils';\nimport uuid from '../../../utils/uuid';\nimport type { StatusFromAction, ThreeDS2ActionProps, UIElement, UIElementProps } from '../../../types';\nimport type { PaymentAction } from '../../../types/global-types';\nimport type { IRegistry } from '../../core.registry';\nimport type { ICore } from '../../types';\nimport type { ThreeDS2ConfigProps } from '../../../types';\nimport type { ActionHandlerConfig } from './types';\n\nconst createComponent = (core: ICore, registry: IRegistry, componentType: string, props: ActionHandlerConfig | ThreeDS2ConfigProps): UIElement => {\n const Element = registry.getComponent(componentType);\n\n if (!Element) {\n throw Error(`Action Element of type ${componentType} not found in the registry`);\n }\n\n const element = new Element(core, { ...props, id: `${componentType}-${uuid()}` });\n return element;\n};\n\nconst getActionHandler = (statusType: StatusFromAction) => {\n return (core: ICore, registry: IRegistry, action: PaymentAction, props: UIElementProps): UIElement => {\n const config: ActionHandlerConfig = {\n ...props,\n ...action,\n onError: props.onError,\n statusType,\n originalAction: action\n };\n\n return createComponent(core, registry, action.paymentMethodType, config);\n };\n};\n\nconst actionTypes = {\n redirect: (core: ICore, registry, action: PaymentAction, props: UIElementProps): UIElement => {\n const config: ActionHandlerConfig = {\n ...props,\n ...action,\n statusType: 'redirect',\n originalAction: action\n };\n\n return createComponent(core, registry, 'redirect', config);\n },\n\n threeDS2: (core: ICore, registry, action: PaymentAction, props: ThreeDS2ActionProps): UIElement => {\n const componentType = action.subtype === 'fingerprint' ? 'threeDS2DeviceFingerprint' : 'threeDS2Challenge';\n\n /**\n * NOTE: the isMDFlow prop comes from the options object, added within the MDFlow when it calls createFromAction(action, options) to initiate a 3DS2 component\n * It replaces the useOriginalFlow config prop that the MDFlow used to pass when directly initiating the threeDS2Fingerprint or threeDS2Challenge components\n */\n const paymentData = action.subtype === 'fingerprint' || props.isMDFlow ? action.paymentData : action.authorisationToken;\n\n const config: ThreeDS2ConfigProps = {\n // Props common to both flows\n core,\n token: action.token,\n paymentData,\n onActionHandled: props.onActionHandled,\n on3DS2RedirectFlowComplete: props.on3DS2RedirectFlowComplete, // NOTE: We only ever expect props.on3DS2RedirectFlowComplete to be defined for the MDFlow\n onAdditionalDetails: props.onAdditionalDetails, // Needed to prevent regression in v6.24.0 re. supporting onAdditionalDetails being directly set on Card component (in v7 we will *not* allow this, & this line can be removed)\n onError: props.onError,\n isDropin: !!props.isDropin,\n loadingContext: props.loadingContext,\n clientKey: props.clientKey,\n paymentMethodType: props.paymentMethodType,\n challengeWindowSize: props.challengeWindowSize, // always pass challengeWindowSize in case it's been set directly in the handleAction config object\n isMDFlow: props.isMDFlow,\n modules: {\n analytics: props.modules?.analytics,\n resources: props.modules?.resources\n },\n\n // Props unique to a particular flow\n ...get3DS2FlowProps(action.subtype, props)\n };\n\n return createComponent(core, registry, componentType, config);\n },\n\n voucher: getActionHandler('custom'),\n qrCode: getActionHandler('custom'),\n await: getActionHandler('custom'),\n bankTransfer: getActionHandler('custom'),\n sdk: getActionHandler('custom')\n} as const;\n\nexport default actionTypes;\n"],"names":["createComponent","core","registry","componentType","props","Element","getComponent","Error","id","uuid","getActionHandler","statusType","action","config","onError","originalAction","paymentMethodType","actionTypes","redirect","threeDS2","subtype","paymentData","isMDFlow","authorisationToken","token","onActionHandled","on3DS2RedirectFlowComplete","onAdditionalDetails","isDropin","loadingContext","clientKey","challengeWindowSize","modules","analytics","resources","get3DS2FlowProps","voucher","qrCode","await","bankTransfer","sdk"],"mappings":"0HASA,MAAMA,EAAkB,CAACC,EAAaC,EAAqBC,EAAuBC,KAC9E,MAAMC,EAAUH,EAASI,aAAaH,GAEtC,IAAKE,EACD,MAAME,MAAM,0BAA0BJ,+BAI1C,OADgB,IAAIE,EAAQJ,EAAM,IAAKG,EAAOI,GAAI,GAAGL,KAAiBM,SAIpEC,EAAoBC,GACf,CAACV,EAAaC,EAAqBU,EAAuBR,KAC7D,MAAMS,EAA8B,IAC7BT,KACAQ,EACHE,QAASV,EAAMU,QACfH,aACAI,eAAgBH,GAGpB,OAAOZ,EAAgBC,EAAMC,EAAUU,EAAOI,kBAAmBH,IAInEI,EAAc,CAChBC,SAAU,CAACjB,EAAaC,EAAUU,EAAuBR,KACrD,MAAMS,EAA8B,IAC7BT,KACAQ,EACHD,WAAY,WACZI,eAAgBH,GAGpB,OAAOZ,EAAgBC,EAAMC,EAAU,WAAYW,IAGvDM,SAAU,CAAClB,EAAaC,EAAUU,EAAuBR,KACrD,MAAMD,EAAmC,gBAAnBS,EAAOQ,QAA4B,4BAA8B,oBAMjFC,EAAiC,gBAAnBT,EAAOQ,SAA6BhB,EAAMkB,SAAWV,EAAOS,YAAcT,EAAOW,mBAE/FV,EAA8B,CAEhCZ,OACAuB,MAAOZ,EAAOY,MACdH,cACAI,gBAAiBrB,EAAMqB,gBACvBC,2BAA4BtB,EAAMsB,2BAClCC,oBAAqBvB,EAAMuB,oBAC3Bb,QAASV,EAAMU,QACfc,WAAYxB,EAAMwB,SAClBC,eAAgBzB,EAAMyB,eACtBC,UAAW1B,EAAM0B,UACjBd,kBAAmBZ,EAAMY,kBACzBe,oBAAqB3B,EAAM2B,oBAC3BT,SAAUlB,EAAMkB,SAChBU,QAAS,CACLC,UAAW7B,EAAM4B,SAASC,UAC1BC,UAAW9B,EAAM4B,SAASE,cAI3BC,EAAiBvB,EAAOQ,QAAShB,IAGxC,OAAOJ,EAAgBC,EAAMC,EAAUC,EAAeU,IAG1DuB,QAAS1B,EAAiB,UAC1B2B,OAAQ3B,EAAiB,UACzB4B,MAAO5B,EAAiB,UACxB6B,aAAc7B,EAAiB,UAC/B8B,IAAK9B,EAAiB"}
@@ -1,2 +1,2 @@
1
- const e="v1",t={makePayments:"620",submitPaymentDetails:"621",submitThreeDS2Fingerprint:"622",createOrder:"623"};export{t as API_ERROR_CODE,e as API_VERSION};
1
+ const e="v1",t={makePayments:"620",submitPaymentDetails:"621",submitThreeDS2Fingerprint:"622",createOrder:"624",donationCampaigns:"627",donations:"628"};export{t as API_ERROR_CODE,e as API_VERSION};
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../../src/core/Services/sessions/constants.ts"],"sourcesContent":["export const API_VERSION = 'v1';\n\n// Same error code will be sent to the analytics\nexport const API_ERROR_CODE = {\n makePayments: '620',\n submitPaymentDetails: '621',\n submitThreeDS2Fingerprint: '622',\n createOrder: '623'\n};\n"],"names":["API_VERSION","API_ERROR_CODE","makePayments","submitPaymentDetails","submitThreeDS2Fingerprint","createOrder"],"mappings":"AAAO,MAAMA,EAAc,KAGdC,EAAiB,CAC1BC,aAAc,MACdC,qBAAsB,MACtBC,0BAA2B,MAC3BC,YAAa"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../../src/core/Services/sessions/constants.ts"],"sourcesContent":["export const API_VERSION = 'v1';\n\n// Same error code will be sent to the analytics\nexport const API_ERROR_CODE = {\n makePayments: '620',\n submitPaymentDetails: '621',\n submitThreeDS2Fingerprint: '622',\n createOrder: '624',\n donationCampaigns: '627',\n donations: '628'\n};\n"],"names":["API_VERSION","API_ERROR_CODE","makePayments","submitPaymentDetails","submitThreeDS2Fingerprint","createOrder","donationCampaigns","donations"],"mappings":"AAAO,MAAMA,EAAc,KAGdC,EAAiB,CAC1BC,aAAc,MACdC,qBAAsB,MACtBC,0BAA2B,MAC3BC,YAAa,MACbC,kBAAmB,MACnBC,UAAW"}
@@ -0,0 +1,2 @@
1
+ import{httpPost as t}from"../http.js";import{API_VERSION as o,API_ERROR_CODE as a}from"./constants.js";function n(n){const e=`${o}/sessions/${n.id}/donationCampaigns?clientKey=${n.clientKey}`,s={...n.data&&{sessionData:n.data}};return t({loadingContext:n.loadingContext,path:e,errorLevel:"fatal",errorCode:a.donationCampaigns},s)}export{n as default};
2
+ //# sourceMappingURL=fetch-donation-campaigns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-donation-campaigns.js","sources":["../../../../../src/core/Services/sessions/fetch-donation-campaigns.ts"],"sourcesContent":["import { httpPost } from '../http';\nimport Session from '../../CheckoutSession';\nimport { API_ERROR_CODE, API_VERSION } from './constants';\nimport { CheckoutSessionDonationCampaignsResponse } from '../../CheckoutSession/types';\n\n/**\n */\nfunction fetchDonationCampaigns(session: Session): Promise<CheckoutSessionDonationCampaignsResponse> {\n const path = `${API_VERSION}/sessions/${session.id}/donationCampaigns?clientKey=${session.clientKey}`;\n const data = {\n ...(session.data && { sessionData: session.data })\n };\n\n return httpPost({ loadingContext: session.loadingContext, path, errorLevel: 'fatal', errorCode: API_ERROR_CODE.donationCampaigns }, data);\n}\n\nexport default fetchDonationCampaigns;\n"],"names":["fetchDonationCampaigns","session","path","API_VERSION","id","clientKey","data","sessionData","httpPost","loadingContext","errorLevel","errorCode","API_ERROR_CODE","donationCampaigns"],"mappings":"uGAOA,SAASA,EAAuBC,GAC5B,MAAMC,EAAO,GAAGC,cAAwBF,EAAQG,kCAAkCH,EAAQI,YACpFC,EAAO,IACLL,EAAQK,MAAQ,CAAEC,YAAaN,EAAQK,OAG/C,OAAOE,EAAS,CAAEC,eAAgBR,EAAQQ,eAAgBP,OAAMQ,WAAY,QAASC,UAAWC,EAAeC,mBAAqBP,EACxI"}
@@ -0,0 +1,2 @@
1
+ import{httpPost as t}from"../http.js";import{API_VERSION as o,API_ERROR_CODE as n}from"./constants.js";function a(a,e){const s=`${o}/sessions/${e.id}/donations?clientKey=${e.clientKey}`,r={...e.data&&{sessionData:e.data},...a};return t({loadingContext:e.loadingContext,path:s,errorLevel:"fatal",errorCode:n.donations},r)}export{a as default};
2
+ //# sourceMappingURL=make-donation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-donation.js","sources":["../../../../../src/core/Services/sessions/make-donation.ts"],"sourcesContent":["import { httpPost } from '../http';\nimport Session from '../../CheckoutSession';\nimport { API_ERROR_CODE, API_VERSION } from './constants';\nimport { CheckoutSessionDonationsRequestData, CheckoutSessionDonationsResponse } from '../../CheckoutSession/types';\n\n/**\n */\nfunction makeDonation(details: CheckoutSessionDonationsRequestData, session: Session): Promise<CheckoutSessionDonationsResponse> {\n const path = `${API_VERSION}/sessions/${session.id}/donations?clientKey=${session.clientKey}`;\n const data = {\n ...(session.data && { sessionData: session.data }),\n ...details\n };\n\n return httpPost({ loadingContext: session.loadingContext, path, errorLevel: 'fatal', errorCode: API_ERROR_CODE.donations }, data);\n}\n\nexport default makeDonation;\n"],"names":["makeDonation","details","session","path","API_VERSION","id","clientKey","data","sessionData","httpPost","loadingContext","errorLevel","errorCode","API_ERROR_CODE","donations"],"mappings":"uGAOA,SAASA,EAAaC,EAA8CC,GAChE,MAAMC,EAAO,GAAGC,cAAwBF,EAAQG,0BAA0BH,EAAQI,YAC5EC,EAAO,IACLL,EAAQK,MAAQ,CAAEC,YAAaN,EAAQK,SACxCN,GAGP,OAAOQ,EAAS,CAAEC,eAAgBR,EAAQQ,eAAgBP,OAAMQ,WAAY,QAASC,UAAWC,EAAeC,WAAaP,EAChI"}
@@ -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.35.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","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.37.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};
2
2
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/core/config.ts"],"sourcesContent":["/**\n * Asserts that a value is defined and throws an error if it is not.\n *\n * @param value The value to check.\n * @param message The error message to throw if the value is undefined.\n * @returns The value if it is defined.\n */\nfunction assertDefined<T>(value: T | undefined, message: string): T {\n if (value === undefined || value === null) {\n throw new Error(message);\n }\n return value;\n}\n\n/**\n * FALLBACK_CONTEXT\n */\nexport const FALLBACK_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\n\n/**\n * Library version injected at build time.\n * Always defined - the build process ensures this value is set.\n */\nexport const LIBRARY_VERSION = assertDefined(process.env.VERSION, 'LIBRARY_VERSION is not defined');\n\n/**\n * Bundle type injected at build time.\n * Always defined - the build process ensures this value is set.\n */\nexport const LIBRARY_BUNDLE_TYPE = assertDefined(process.env.BUNDLE_TYPE, 'BUNDLE_TYPE is not defined');\n\nexport const GENERIC_OPTIONS = [\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'environment',\n '_environmentUrls',\n 'loadingContext',\n 'i18n',\n 'modules',\n 'order',\n 'session',\n 'clientKey',\n 'showPayButton',\n 'redirectFromTopWhenInIframe',\n\n // Events\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onSubmit',\n 'onActionHandled',\n 'onAdditionalDetails',\n 'onChange',\n 'onEnterKeyPressed',\n 'onError',\n 'onBalanceCheck',\n 'onOrderCancel',\n 'onOrderRequest',\n 'onOrderUpdated',\n 'onPaymentMethodsRequest'\n];\n\nexport const DEFAULT_HTTP_TIMEOUT = 60000;\n\nexport default {\n FALLBACK_CONTEXT,\n GENERIC_OPTIONS,\n DEFAULT_HTTP_TIMEOUT\n};\n\n/**\n * @internal\n */\n\nexport enum CHANNEL {\n WEB = 'web'\n}\n\n/**\n * @internal\n */\nexport const PLATFORM = 'web';\n\n/**\n * How the SDK handles the rendering of a payment method.\n *\n * - NATIVE: The payment method has a dedicated component in the SDK.\n * - GENERIC: The payment method has no dedicated component; it falls back to a generic component (Redirect).\n * @internal\n */\nexport enum PAYMENT_METHOD_BEHAVIOR {\n NATIVE = 'nativeComponent',\n GENERIC = 'genericComponent'\n}\n"],"names":["assertDefined","value","message","Error","FALLBACK_CONTEXT","LIBRARY_VERSION","LIBRARY_BUNDLE_TYPE","GENERIC_OPTIONS","DEFAULT_HTTP_TIMEOUT","CHANNEL","PLATFORM","PAYMENT_METHOD_BEHAVIOR"],"mappings":"AAOA,SAASA,EAAiBC,EAAsBC,GAC5C,GAAID,QACA,MAAM,IAAIE,MAAMD,GAEpB,OAAOD,CACX,CAKO,MAAMG,EAAmB,0DAMnBC,EAAkBL,EAAc,SAAqB,kCAMrDM,EAAsBN,EAAc,MAAyB,8BAE7DO,EAAkB,CAC3B,SACA,kBACA,cACA,cACA,mBACA,iBACA,OACA,UACA,QACA,UACA,YACA,gBACA,8BAGA,qBACA,kBACA,iBACA,eACA,WACA,kBACA,sBACA,WACA,oBACA,UACA,iBACA,gBACA,iBACA,iBACA,2BAGSC,EAAuB,IAY7B,IAAKC,EAAAA,SAAAA,GAAAA,mBAAAA,CAEZ,CAFYA,CAEZ,CAAA,GAKO,MAAMC,EAAW,MASjB,IAAKC,EAAAA,SAAAA,GAAAA,+DAAAA,CAGZ,CAHYA,CAGZ,CAAA"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/core/config.ts"],"sourcesContent":["/**\n * Asserts that a value is defined and throws an error if it is not.\n *\n * @param value The value to check.\n * @param message The error message to throw if the value is undefined.\n * @returns The value if it is defined.\n */\nfunction assertDefined<T>(value: T | undefined, message: string): T {\n if (value === undefined || value === null) {\n throw new Error(message);\n }\n return value;\n}\n\n/**\n * FALLBACK_CONTEXT\n */\nexport const FALLBACK_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\n\n/**\n * Library version injected at build time.\n * Always defined - the build process ensures this value is set.\n */\nexport const LIBRARY_VERSION = assertDefined(process.env.VERSION, 'LIBRARY_VERSION is not defined');\n\n/**\n * Bundle type injected at build time.\n * Always defined - the build process ensures this value is set.\n */\nexport const LIBRARY_BUNDLE_TYPE = assertDefined(process.env.BUNDLE_TYPE, 'BUNDLE_TYPE is not defined');\n\nexport const GENERIC_OPTIONS = [\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'environment',\n '_environmentUrls',\n 'loadingContext',\n 'i18n',\n 'modules',\n 'order',\n 'session',\n 'clientKey',\n 'showPayButton',\n 'redirectFromTopWhenInIframe',\n 'donation',\n\n // Events\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onSubmit',\n 'onActionHandled',\n 'onAdditionalDetails',\n 'onChange',\n 'onEnterKeyPressed',\n 'onError',\n 'onBalanceCheck',\n 'onOrderCancel',\n 'onOrderRequest',\n 'onOrderUpdated',\n 'onPaymentMethodsRequest'\n];\n\nexport const DEFAULT_HTTP_TIMEOUT = 60000;\n\nexport default {\n FALLBACK_CONTEXT,\n GENERIC_OPTIONS,\n DEFAULT_HTTP_TIMEOUT\n};\n\n/**\n * @internal\n */\n\nexport enum CHANNEL {\n WEB = 'web'\n}\n\n/**\n * @internal\n */\nexport const PLATFORM = 'web';\n\n/**\n * How the SDK handles the rendering of a payment method.\n *\n * - NATIVE: The payment method has a dedicated component in the SDK.\n * - GENERIC: The payment method has no dedicated component; it falls back to a generic component (Redirect).\n * @internal\n */\nexport enum PAYMENT_METHOD_BEHAVIOR {\n NATIVE = 'nativeComponent',\n GENERIC = 'genericComponent'\n}\n"],"names":["assertDefined","value","message","Error","FALLBACK_CONTEXT","LIBRARY_VERSION","LIBRARY_BUNDLE_TYPE","GENERIC_OPTIONS","DEFAULT_HTTP_TIMEOUT","CHANNEL","PLATFORM","PAYMENT_METHOD_BEHAVIOR"],"mappings":"AAOA,SAASA,EAAiBC,EAAsBC,GAC5C,GAAID,QACA,MAAM,IAAIE,MAAMD,GAEpB,OAAOD,CACX,CAKO,MAAMG,EAAmB,0DAMnBC,EAAkBL,EAAc,SAAqB,kCAMrDM,EAAsBN,EAAc,MAAyB,8BAE7DO,EAAkB,CAC3B,SACA,kBACA,cACA,cACA,mBACA,iBACA,OACA,UACA,QACA,UACA,YACA,gBACA,8BACA,WAGA,qBACA,kBACA,iBACA,eACA,WACA,kBACA,sBACA,WACA,oBACA,UACA,iBACA,gBACA,iBACA,iBACA,2BAGSC,EAAuB,IAY7B,IAAKC,EAAAA,SAAAA,GAAAA,mBAAAA,CAEZ,CAFYA,CAEZ,CAAA,GAKO,MAAMC,EAAW,MASjB,IAAKC,EAAAA,SAAAA,GAAAA,+DAAAA,CAGZ,CAHYA,CAGZ,CAAA"}
@@ -1,2 +1,2 @@
1
- import e from"../components/ThreeDS2/ThreeDS2Challenge.js";import t from"../components/ThreeDS2/ThreeDS2DeviceFingerprint.js";import r from"../components/Redirect/Redirect.js";import{TxVariants as n}from"../components/tx-variants.js";function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const s={[n.redirect]:r,[n.threeDS2Challenge]:e,[n.threeDS2DeviceFingerprint]:t};var i=new class{add(...e){this.componentsMap={...this.componentsMap,...this.createComponentsMap(e)}}getComponent(e){const t=this.componentsMap[e];return t||(this.supportedTxVariants.has(e)?void 0:r)}createComponentsMap(e){return e.reduce((e,t)=>{var r;if(!("string"==typeof(r=t).type&&!!r.type))return console.error("CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement"),e;if("dropin"===t.type)return e;return[t.type,...t.txVariants].filter(e=>e).forEach(r=>{e={...e,[r]:t}}),e},{})}constructor(){o(this,"componentsMap",s),o(this,"supportedTxVariants",new Set(Object.values(n)))}};export{i as default};
1
+ import e from"../components/ThreeDS2/ThreeDS2Challenge.js";import t from"../components/ThreeDS2/ThreeDS2DeviceFingerprint.js";import r from"../components/Redirect/Redirect.js";import{TxVariants as n}from"../components/tx-variants.js";import o from"../components/Donation/Donation.js";function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const i={[n.redirect]:r,[n.threeDS2Challenge]:e,[n.threeDS2DeviceFingerprint]:t,[n.donation]:o};var a=new class{add(...e){this.componentsMap={...this.componentsMap,...this.createComponentsMap(e)}}getComponent(e){const t=this.componentsMap[e];return t||(this.supportedTxVariants.has(e)?void 0:r)}createComponentsMap(e){return e.reduce((e,t)=>{var r;if(!("string"==typeof(r=t).type&&!!r.type))return console.error("CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement"),e;if("dropin"===t.type)return e;return[t.type,...t.txVariants].filter(e=>e).forEach(r=>{e={...e,[r]:t}}),e},{})}constructor(){s(this,"componentsMap",i),s(this,"supportedTxVariants",new Set(Object.values(n)))}};export{a as default};
2
2
  //# sourceMappingURL=core.registry.js.map