@adyen/adyen-web 6.19.0 → 6.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/adyen.css +5 -5
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +29 -62
- package/dist/es/adyen.css +5 -5
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/Ach/components/useSRPanelForACHErrors.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/handlers.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
- package/dist/es/components/Dropin/Dropin.js +1 -1
- package/dist/es/components/Dropin/Dropin.js.map +1 -1
- package/dist/es/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
- package/dist/es/components/PayPal/utils/get-paypal-styles.js.map +1 -1
- package/dist/es/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es/components/UPI/UPI.js +1 -1
- package/dist/es/components/UPI/UPI.js.map +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
- package/dist/es/components/UPI/constants.js +2 -0
- package/dist/es/components/UPI/constants.js.map +1 -0
- package/dist/es/components/internal/Address/Address.js.map +1 -1
- package/dist/es/components/internal/Alert/Alert.js +1 -1
- package/dist/es/components/internal/Alert/Alert.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/models/ShopperCard.js +1 -1
- package/dist/es/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
- package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
- package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/components/internal/UIElement/utils.js.map +1 -1
- package/dist/es/core/Analytics/utils.js.map +1 -1
- package/dist/es/core/Errors/SRPanel.js.map +1 -1
- package/dist/es/core/Errors/utils.js.map +1 -1
- package/dist/es/core/Services/analytics/collect-id.js +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/core.registry.js.map +1 -1
- package/dist/es/core/utils.js.map +1 -1
- package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
- package/dist/es/external/preact/dist/preact.js.map +1 -1
- package/dist/es/index.d.ts +29 -62
- package/dist/es/language/utils.js.map +1 -1
- package/dist/es/utils/clipboard.js.map +1 -1
- package/dist/es/utils/setFocus.js.map +1 -1
- package/dist/es/utils/useForm/reducer.js.map +1 -1
- package/dist/es-legacy/adyen.css +5 -5
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/Ach/components/useSRPanelForACHErrors.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/handlers.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
- package/dist/es-legacy/components/PayPal/utils/get-paypal-styles.js.map +1 -1
- package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es-legacy/components/UPI/UPI.js +1 -1
- package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
- package/dist/es-legacy/components/UPI/constants.js +2 -0
- package/dist/es-legacy/components/UPI/constants.js.map +1 -0
- package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/internal/Alert/Alert.js +1 -1
- package/dist/es-legacy/components/internal/Alert/Alert.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/models/ShopperCard.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
- package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
- package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
- package/dist/es-legacy/core/Errors/utils.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.registry.js.map +1 -1
- package/dist/es-legacy/core/utils.js.map +1 -1
- package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
- package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
- package/dist/es-legacy/language/utils.js.map +1 -1
- package/dist/es-legacy/utils/clipboard.js.map +1 -1
- package/dist/es-legacy/utils/setFocus.js.map +1 -1
- package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
- package/package.json +159 -159
- package/styles/adyen.css +5 -5
- package/dist/es/components/UPI/components/UPIComponent/constants.js +0 -2
- package/dist/es/components/UPI/components/UPIComponent/constants.js.map +0 -1
- package/dist/es/components/UPI/components/UPIComponent/useUpiSegmentedControlOptions.js +0 -2
- package/dist/es/components/UPI/components/UPIComponent/useUpiSegmentedControlOptions.js.map +0 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/constants.js +0 -2
- package/dist/es-legacy/components/UPI/components/UPIComponent/constants.js.map +0 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/useUpiSegmentedControlOptions.js +0 -2
- package/dist/es-legacy/components/UPI/components/UPIComponent/useUpiSegmentedControlOptions.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { h } from 'preact';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport { Resources } from '../../../core/Context/Resources';\nimport { ANALYTICS_ERROR_TYPE, ANALYTICS_SUBMIT_STR } from '../../../core/Analytics/constants';\n\nimport { AnalyticsInitialEvent } from '../../../core/Analytics/types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData } from '../../../core/types';\nimport type { ComponentMethodsRef, PayButtonFunctionProps, UIElementProps, UIElementStatus } from './types';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethod,\n PaymentMethodsResponse,\n PaymentResponseData\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\n\nimport './UIElement.scss';\nimport { AnalyticsEvent } from '../../../core/Analytics/AnalyticsEvent';\nimport { AnalyticsLogEvent } from '../../../core/Analytics/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent } from '../../../core/Analytics/AnalyticsErrorEvent';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static type = undefined;\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n this.core.register(this.constructor as NewableComponent);\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n\n this.onEnterKeyPressed = this.onEnterKeyPressed.bind(this);\n this.onActionHandled = this.onActionHandled.bind(this);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n const isStoredPaymentMethod = !!componentProps?.isStoredPaymentMethod;\n\n const paymentMethodFromResponse = isStoredPaymentMethod ? {} : this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropin = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropin), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\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 */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string): PaymentMethod {\n return this.core.paymentMethodsResponse.find(type || this.constructor['type']);\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx\n */\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n /**\n * componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx\n */\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n // Only called once, for UIElements (including Dropin), as they are being mounted\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n const sessionId = this.props.session?.id;\n\n return this.props.modules.analytics.setUp({\n ...setUpAnalyticsObj,\n ...(sessionId && { sessionId })\n });\n }\n\n /**\n * A function for all UIElements, or BaseElement, to use to create an analytics action for when it's been:\n * - mounted,\n * - a PM has been selected\n * - onSubmit has been called (as a result of the pay button being pressed)\n *\n * In some other cases e.g. 3DS2 components, this function is overridden to allow more specific analytics actions to be created\n */\n\n protected submitAnalytics(analyticsObj: AnalyticsEvent) {\n try {\n analyticsObj.component = this.getComponent(analyticsObj);\n\n this.props.modules.analytics.sendAnalytics(analyticsObj);\n } catch (error) {\n console.warn('Failed to submit the analytics event. Error:', error);\n }\n }\n\n /** Work out what the component's \"type\" is:\n * - first check for a dedicated \"analyticsType\" (currently only applies to custom-cards)\n * - otherwise, distinguish cards from non-cards: cards will use their static type property, everything else will use props.type\n */\n private getComponent({ component }: AnalyticsEvent): string {\n if (component) {\n return component;\n }\n if (this.constructor['analyticsType']) {\n return this.constructor['analyticsType'];\n }\n if (this.constructor['type'] === 'scheme' || this.constructor['type'] === 'bcmc') {\n return this.constructor['type'];\n }\n return this.type;\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) =>\n this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject: () => reject(new CancelError('beforeSubmitRejected'))\n })\n )\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n // Call analytics endpoint\n const event = new AnalyticsLogEvent({\n type: ANALYTICS_SUBMIT_STR,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\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 type: ANALYTICS_SUBMIT_STR,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CNDBAjOa+B88wRoj/rLTieuWh/0leR88qkV24vtIkjsIsbJTDB78Pd8wX8MEDsXhaAdEIyX9E8eqxuQ3bwPbvLs1Dlgo1ZrfkQRzaNiuVM8ejRG0IWE1bGThJzY+sJvZZHvlDMXIlxhZcDoQvsMj/WwE6+nFJxBiC3oRzmvVn3AbkLQGtvwq16UUSfYbPzG9dXypJMtcrZAQYq2g/2+BSibCcmee9AXq/wij11BERrYmjbDt5NkkdUnDVgAB7pdqbnWX0A2sxBKeYtLSP2kxp+5LoU/Wty3fmcVA3VKVkHfgmIihkeL8lY++5hvHjnkzOE4tyx/sheiKS4zqoWE43TD6n8mpFskAzwMHq4G2o6vkXqvaKFEq7y/R2fVrCypenmRhkPASizpM265rKLU+L4E/C+LMHfN0LYKRMCrLr0gI2GAp+1PZLHgh0tCtiJC/zcJJtJs6sHNQxLUN+kxJuELUHOcuL3ivjG+mWteUnBENZu7KqOSZYetiWYRiyLOXDiBHqbxuQwTuO54L15VLkS/mYB20etibM1n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JpGF9yw8gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n if (this.props.onComplete) this.props.onComplete(state, this.elementRef);\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 errorType: ANALYTICS_ERROR_TYPE.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 onAdditionalDetails: this.handleAdditionalDetails\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session ? this.core.update({ order }) : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * Expected to be called after sanitizeResponse has been run on the raw payment response\n *\n * @param response -\n */\n protected handleResponse(response: PaymentResponseData): void {\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent) {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n\n this.onEnterKeyPressed(document?.activeElement, this);\n }\n }\n\n /**\n * Handle Enter key pressed from a UIElement (called via handleKeyPress)\n * @param obj\n */\n protected onEnterKeyPressed(activeElement: Element, component: UIElement) {\n if (this.props.onEnterKeyPressed) {\n this.props.onEnterKeyPressed(activeElement, component);\n } else {\n (activeElement as HTMLElement).blur();\n this.submit();\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protected _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonFunctionProps) => {\n return <PayButton {...props} amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<void | PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return resolve();\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","buildElementProps","componentProps","finalProps","showPayButton","this","core","getCorePropsForComponent","isStoredPaymentMethod","getPaymentMethodFromPaymentMethodsResponse","type","isDropin","assertIsDropin","props","formatProps","constructor","getRegulatoryDefaults","options","countryCode","paymentMethodsResponse","find","storeElementRefOnCore","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","setElementStatus","status","elementRef","setStatus","data","isValid","errors","valid","setUpAnalytics","setUpAnalyticsObj","sessionId","session","id","modules","analytics","setUp","submitAnalytics","analyticsObj","component","getComponent","sendAnalytics","error","console","warn","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","event","AnalyticsLogEvent","ANALYTICS_SUBMIT_STR","message","submitPayment","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","originalAction","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","update","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","amount","onPaymentMethodsRequest","orderData","pspReference","locale","checkout","super","_define_property","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ANALYTICS_ERROR_TYPE","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","onPaymentCompleted","setComponentRef","ref","payButton","h","PayButton","secondaryAmount","onClick","register","bind","undefined","txVariants"],"mappings":"u3BAiCO,MAAeA,UAA6DC,EAyC5DC,iBAAAA,CAAkBC,GACjC,MAKMC,EAAa,CACfC,eAAe,KANKC,KAAKC,KAAKC,gCACFL,GAAgBM,sBAEU,CAAA,EAAKH,KAAKI,2CAA2CP,GAAgBQ,SAMxHR,GAGDS,EAAWC,EAAeP,MAEhCA,KAAKQ,MAAQR,KAAKS,YAAY,IACvBT,KAAKU,YAAY,gBACjBC,EAAsBX,KAAKC,KAAKW,QAAQC,YAAaP,MACrDR,GAEX,CAOUM,0CAAAA,CAA2CC,GACjD,OAAOL,KAAKC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,kBAAkB8C,KAAKpJ,MACrDA,KAAKyF,gBAAkBzF,KAAKyF,gBAAgB2D,KAAKpJ,KACrD,EAhCA+H,EAPkBrI,EAOJW,YAAOgJ,GAKrBtB,EAZkBrI,EAYJ4J,aAAuB"}
|
|
1
|
+
{"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { h } from 'preact';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport { Resources } from '../../../core/Context/Resources';\nimport { ANALYTICS_ERROR_TYPE, ANALYTICS_SUBMIT_STR } from '../../../core/Analytics/constants';\n\nimport { AnalyticsInitialEvent } from '../../../core/Analytics/types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData } from '../../../core/types';\nimport type { ComponentMethodsRef, PayButtonFunctionProps, UIElementProps, UIElementStatus } from './types';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethod,\n PaymentMethodsResponse,\n PaymentResponseData\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\n\nimport './UIElement.scss';\nimport { AnalyticsEvent } from '../../../core/Analytics/AnalyticsEvent';\nimport { AnalyticsLogEvent } from '../../../core/Analytics/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent } from '../../../core/Analytics/AnalyticsErrorEvent';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static type = undefined;\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n this.core.register(this.constructor as NewableComponent);\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n\n this.onEnterKeyPressed = this.onEnterKeyPressed.bind(this);\n this.onActionHandled = this.onActionHandled.bind(this);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n const isStoredPaymentMethod = !!componentProps?.isStoredPaymentMethod;\n\n const paymentMethodFromResponse = isStoredPaymentMethod ? {} : this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropin = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropin), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\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 */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string): PaymentMethod {\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx\n */\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n /**\n * componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx\n */\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n // Only called once, for UIElements (including Dropin), as they are being mounted\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n const sessionId = this.props.session?.id;\n\n return this.props.modules.analytics.setUp({\n ...setUpAnalyticsObj,\n ...(sessionId && { sessionId })\n });\n }\n\n /**\n * A function for all UIElements, or BaseElement, to use to create an analytics action for when it's been:\n * - mounted,\n * - a PM has been selected\n * - onSubmit has been called (as a result of the pay button being pressed)\n *\n * In some other cases e.g. 3DS2 components, this function is overridden to allow more specific analytics actions to be created\n */\n\n protected submitAnalytics(analyticsObj: AnalyticsEvent) {\n try {\n analyticsObj.component = this.getComponent(analyticsObj);\n\n this.props.modules.analytics.sendAnalytics(analyticsObj);\n } catch (error) {\n console.warn('Failed to submit the analytics event. Error:', error);\n }\n }\n\n /** Work out what the component's \"type\" is:\n * - first check for a dedicated \"analyticsType\" (currently only applies to custom-cards)\n * - otherwise, distinguish cards from non-cards: cards will use their static type property, everything else will use props.type\n */\n private getComponent({ component }: AnalyticsEvent): string {\n if (component) {\n return component;\n }\n if (this.constructor['analyticsType']) {\n return this.constructor['analyticsType'];\n }\n if (this.constructor['type'] === 'scheme' || this.constructor['type'] === 'bcmc') {\n return this.constructor['type'];\n }\n return this.type;\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) =>\n this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject: () => reject(new CancelError('beforeSubmitRejected'))\n })\n )\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n // Call analytics endpoint\n const event = new AnalyticsLogEvent({\n type: ANALYTICS_SUBMIT_STR,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\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 type: ANALYTICS_SUBMIT_STR,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CNDBAjOa+B88wRoj/rLTieuWh/0leR88qkV24vtIkjsIsbJTDB78Pd8wX8MEDsXhaAdEIyX9E8eqxuQ3bwPbvLs1Dlgo1ZrfkQRzaNiuVM8ejRG0IWE1bGThJzY+sJvZZHvlDMXIlxhZcDoQvsMj/WwE6+nFJxBiC3oRzmvVn3AbkLQGtvwq16UUSfYbPzG9dXypJMtcrZAQYq2g/2+BSibCcmee9AXq/wij11BERrYmjbDt5NkkdUnDVgAB7pdqbnWX0A2sxBKeYtLSP2kxp+5LoU/Wty3fmcVA3VKVkHfgmIihkeL8lY++5hvHjnkzOE4tyx/sheiKS4zqoWE43TD6n8mpFskAzwMHq4G2o6vkXqvaKFEq7y/R2fVrCypenmRhkPASizpM265rKLU+L4E/C+LMHfN0LYKRMCrLr0gI2GAp+1PZLHgh0tCtiJC/zcJJtJs6sHNQxLUN+kxJuELUHOcuL3ivjG+mWteUnBENZu7KqOSZYetiWYRiyLOXDiBHqbxuQwTuO54L15VLkS/mYB20etibM1nn+fRmbo+1IJkCSalhwi5D7fSrpjbQTmAsOpJT1N8lC1MSNmAvAwG1kWL4JxYwXDKYyYASnsia2V5IjoiQUYwQUFBMTAzQ0E1MzdFQUVEODdDMjRERDUzOTA5QjgwQTc4QTkyM0UzOD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lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n if (this.props.onComplete) this.props.onComplete(state, this.elementRef);\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 errorType: ANALYTICS_ERROR_TYPE.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 onAdditionalDetails: this.handleAdditionalDetails\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session ? this.core.update({ order }) : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * Expected to be called after sanitizeResponse has been run on the raw payment response\n *\n * @param response -\n */\n protected handleResponse(response: PaymentResponseData): void {\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent) {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n\n this.onEnterKeyPressed(document?.activeElement, this);\n }\n }\n\n /**\n * Handle Enter key pressed from a UIElement (called via handleKeyPress)\n * @param obj\n */\n protected onEnterKeyPressed(activeElement: Element, component: UIElement) {\n if (this.props.onEnterKeyPressed) {\n this.props.onEnterKeyPressed(activeElement, component);\n } else {\n (activeElement as HTMLElement).blur();\n this.submit();\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protected _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonFunctionProps) => {\n return <PayButton {...props} amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<void | PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return resolve();\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","buildElementProps","componentProps","finalProps","showPayButton","this","core","getCorePropsForComponent","isStoredPaymentMethod","getPaymentMethodFromPaymentMethodsResponse","type","isDropin","assertIsDropin","props","formatProps","constructor","getRegulatoryDefaults","options","countryCode","paymentMethodsResponse","find","storeElementRefOnCore","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","setElementStatus","status","elementRef","setStatus","data","isValid","errors","valid","setUpAnalytics","setUpAnalyticsObj","sessionId","session","id","modules","analytics","setUp","submitAnalytics","analyticsObj","component","getComponent","sendAnalytics","error","console","warn","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","event","AnalyticsLogEvent","ANALYTICS_SUBMIT_STR","message","submitPayment","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","originalAction","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","update","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","amount","onPaymentMethodsRequest","orderData","pspReference","locale","checkout","super","_define_property","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ANALYTICS_ERROR_TYPE","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","onPaymentCompleted","setComponentRef","ref","payButton","h","PayButton","secondaryAmount","onClick","register","bind","undefined","txVariants"],"mappings":"u3BAiCO,MAAeA,UAA6DC,EAyC5DC,iBAAAA,CAAkBC,GACjC,MAKMC,EAAa,CACfC,eAAe,KANKC,KAAKC,KAAKC,gCACFL,GAAgBM,sBAEU,CAAA,EAAKH,KAAKI,2CAA2CP,GAAgBQ,SAMxHR,GAGDS,EAAWC,EAAeP,MAEhCA,KAAKQ,MAAQR,KAAKS,YAAY,IACvBT,KAAKU,YAAY,gBACjBC,EAAsBX,KAAKC,KAAKW,QAAQC,YAAaP,MACrDR,GAEX,CAOUM,0CAAAA,CAA2CC,GACjD,OAAOL,KAAKC,KAAKa,wBAAwBC,KAAKV,GAAQL,KAAKU,YAAY,KAC3E,CAEUM,qBAAAA,CAAsBR,GACvBA,GAAOF,UACRN,KAAKC,KAAKgB,sBAAsBjB,KAExC,CAEOkB,WAAAA,GACH,OAAOC,QA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|
@@ -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, isDropin: 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 isDropin\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","isDropin","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,
|
|
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, isDropin: 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 isDropin\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","isDropin","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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/core/Analytics/utils.ts"],"sourcesContent":["import { AnalyticsData } from './types';\nimport { errorCodeMapping, ALLOWED_ANALYTICS_DATA } from './constants';\nimport { digitsOnlyFormatter } from '../../utils/Formatters/formatters';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS } from '../Errors/constants';\n\nexport const getUTCTimestamp = () => Date.now();\n\nexport const mapErrorCodesForAnalytics = (errorCode: string, target: string) => {\n // Some of the more generic error codes required combination with target to retrieve a specific code\n if (errorCode === ERROR_FIELD_REQUIRED || errorCode === ERROR_INVALID_FORMAT_EXPECTS) {\n return errorCodeMapping[`${errorCode}.${target}`] ?? errorCode;\n }\n\n let errCode = errorCodeMapping[errorCode] ?? errorCode;\n\n // If errCode isn't now a number - then we just need to remove any non-digits\n // since the correct error code is already contained within the string e.g. securedField related errors\n if (isNaN(Number(errCode))) {\n errCode = digitsOnlyFormatter(errCode);\n }\n\n return errCode;\n};\n\nexport const processAnalyticsData = (analyticsData: AnalyticsData): AnalyticsData => {\n return Object.keys(analyticsData).reduce((acc, prop) => {\n if (ALLOWED_ANALYTICS_DATA.includes(prop)) acc[prop] = analyticsData[prop];\n return acc;\n }, {});\n};\n"],"names":["getUTCTimestamp","Date","now","mapErrorCodesForAnalytics","errorCode","target","ERROR_FIELD_REQUIRED","ERROR_INVALID_FORMAT_EXPECTS","errorCodeMapping","errCode","isNaN","Number","digitsOnlyFormatter","processAnalyticsData","analyticsData","Object","keys","reduce","acc","prop","ALLOWED_ANALYTICS_DATA","includes"],"mappings":"yPAKO,MAAMA,EAAkB,IAAMC,KAAKC,MAE7BC,EAA4B,CAACC,EAAmBC,KAEzD,GAAID,IAAcE,GAAwBF,IAAcG,EACpD,OAAOC,EAAiB,GAAGJ,KAAaC,MAAaD,EAGzD,IAAIK,EAAUD,EAAiBJ,IAAcA,EAQ7C,OAJIM,MAAMC,OAAOF,MACbA,EAAUG,EAAoBH,IAG3BA,GAGEI,EAAwBC,GAC1BC,OAAOC,KAAKF,GAAeG,OAAO,CAACC,EAAKC,KACvCC,EAAuBC,SAASF,KAAOD,EAAIC,GAAQL,EAAcK,IAC9DD,GACR"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/core/Analytics/utils.ts"],"sourcesContent":["import { AnalyticsData } from './types';\nimport { errorCodeMapping, ALLOWED_ANALYTICS_DATA } from './constants';\nimport { digitsOnlyFormatter } from '../../utils/Formatters/formatters';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS } from '../Errors/constants';\n\nexport const getUTCTimestamp = () => Date.now();\n\nexport const mapErrorCodesForAnalytics = (errorCode: string, target: string) => {\n // Some of the more generic error codes required combination with target to retrieve a specific code\n if (errorCode === ERROR_FIELD_REQUIRED || errorCode === ERROR_INVALID_FORMAT_EXPECTS) {\n return errorCodeMapping[`${errorCode}.${target}`] ?? errorCode;\n }\n\n let errCode = errorCodeMapping[errorCode] ?? errorCode;\n\n // If errCode isn't now a number - then we just need to remove any non-digits\n // since the correct error code is already contained within the string e.g. securedField related errors\n if (isNaN(Number(errCode))) {\n errCode = digitsOnlyFormatter(errCode);\n }\n\n return errCode;\n};\n\nexport const processAnalyticsData = (analyticsData: AnalyticsData): AnalyticsData => {\n return Object.keys(analyticsData).reduce((acc, prop) => {\n if (ALLOWED_ANALYTICS_DATA.includes(prop)) acc[prop] = analyticsData[prop];\n return acc;\n }, {});\n};\n"],"names":["getUTCTimestamp","Date","now","mapErrorCodesForAnalytics","errorCode","target","ERROR_FIELD_REQUIRED","ERROR_INVALID_FORMAT_EXPECTS","errorCodeMapping","errCode","isNaN","Number","digitsOnlyFormatter","processAnalyticsData","analyticsData","Object","keys","reduce","acc","prop","ALLOWED_ANALYTICS_DATA","includes"],"mappings":"yPAKO,MAAMA,EAAkB,IAAMC,KAAKC,MAE7BC,EAA4B,CAACC,EAAmBC,KAEzD,GAAID,IAAcE,GAAwBF,IAAcG,EACpD,OAAOC,EAAiB,GAAGJ,KAAaC,MAAaD,EAGzD,IAAIK,EAAUD,EAAiBJ,IAAcA,EAQ7C,OAJIM,MAAMC,OAAOF,MACbA,EAAUG,EAAoBH,IAG3BA,GAGEI,EAAwBC,GAC1BC,OAAOC,KAAKF,GAAeG,OAAO,CAACC,EAAKC,KACvCC,EAAuBC,SAASF,KAAOD,EAAIC,GAAQL,EAAcK,IAC9DD,GACR,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SRPanel.js","sources":["../../../../src/core/Errors/SRPanel.tsx"],"sourcesContent":["import { h } from 'preact';\nimport './SRPanel.scss';\nimport { AriaAttributes, SRPanelProps } from './types';\nimport BaseElement from '../../components/internal/BaseElement/BaseElement';\nimport { SRMessages, SRMessagesRef } from './SRMessages';\nimport type { ICore } from '../types';\n\n/**\n * A panel meant to hold messages that will be read out by ScreenReaders on an aria-live=\"polite\" basis\n * Expects a string or string array of message to add to the panel to be read out\n * For testing purposes can be made visible\n */\nexport class SRPanel extends BaseElement<SRPanelProps> {\n public static type = 'srPanel';\n\n public static defaultProps: Partial<SRPanelProps> = {\n enabled: true,\n node: 'body',\n showPanel: false,\n id: 'ariaLiveSRPanel',\n ariaAttributes: {\n 'aria-relevant': 'all',\n 'aria-live': 'polite',\n 'aria-atomic': 'true'\n }\n };\n\n private readonly srPanelContainer = null;\n\n private readonly id;\n private readonly showPanel;\n private readonly _enabled: boolean;\n private readonly _moveFocus: boolean;\n\n private componentRef: SRMessagesRef;\n\n constructor(checkout: ICore, props?: SRPanelProps) {\n super(checkout, props);\n\n this.id = this.props.id;\n this.showPanel = process.env.NODE_ENV !== 'production' ? this.props.showPanel : false;\n this._enabled = false;\n this._moveFocus = this.props.moveFocus ?? true;\n\n if (this.props.enabled) {\n this._enabled = true;\n\n const panelParent = document.querySelector(this.props.node);\n\n if (panelParent) {\n const preExistingSRPanel = document.getElementById(this.id);\n if (preExistingSRPanel) {\n panelParent.removeChild(preExistingSRPanel);\n }\n\n this.srPanelContainer = document.createElement('div');\n this.srPanelContainer.className = 'sr-panel-holder';\n this.srPanelContainer.id = this.id;\n\n panelParent.appendChild(this.srPanelContainer);\n\n this.mount(this.srPanelContainer);\n } else {\n throw new Error('Component could not mount. Root node was not found.');\n }\n }\n }\n\n public setComponentRef = ref => {\n this.componentRef = ref;\n };\n\n public get enabled() {\n return this._enabled;\n }\n\n public get moveFocus() {\n return this._moveFocus;\n }\n\n public setAriaProps(ariaAttributes: AriaAttributes): void {\n const firstPanel = document.querySelector('[class^=\"adyen-checkout-sr-panel\"]');\n for (const [key, value] of Object.entries(ariaAttributes)) {\n firstPanel.setAttribute(key, value);\n }\n this.props = { ...this.props, ariaAttributes: { ...this.props.ariaAttributes, ...ariaAttributes } };\n }\n\n // A method we can expose to allow comps to set messages in this panel\n public setMessages = (messages: string[] | string): void => {\n if (!this.props.enabled) return;\n\n let panelMessages = null;\n if (messages) {\n // Ensure panelMessages is an array\n panelMessages = Array.isArray(messages) ? messages : [messages];\n }\n\n this.componentRef.setMessages(panelMessages);\n };\n\n render() {\n if (!this.props.enabled) return null;\n return (\n <div\n className={this.showPanel ? 'adyen-checkout-sr-panel' : 'adyen-checkout-sr-panel--sr-only'}\n role={'log'}\n {...this.props.ariaAttributes}\n {...(process.env.NODE_ENV !== 'production' && { 'data-testid': this.id })}\n >\n <SRMessages setComponentRef={this.setComponentRef} />\n </div>\n );\n }\n}\n"],"names":["SRPanel","BaseElement","enabled","this","_enabled","moveFocus","_moveFocus","setAriaProps","ariaAttributes","firstPanel","document","querySelector","key","value","Object","entries","setAttribute","props","render","h","div","className","showPanel","role","SRMessages","setComponentRef","constructor","checkout","super","_define_property","srPanelContainer","id","componentRef","ref","setMessages","messages","panelMessages","Array","isArray","panelParent","node","Error","preExistingSRPanel","getElementById","removeChild","createElement","appendChild","mount","type","defaultProps"],"mappings":"8SAYO,MAAMA,UAAgBC,EA4DzB,WAAWC,GACP,OAAOC,KAAKC,QAChB,CAEA,aAAWC,GACP,OAAOF,KAAKG,UAChB,CAEOC,YAAAA,CAAaC,GAChB,MAAMC,EAAaC,SAASC,cAAc,sCAC1C,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQP,GACtCC,EAAWO,aAAaJ,EAAKC,GAEjCV,KAAKc,MAAQ,IAAKd,KAAKc,MAAOT,eAAgB,IA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2B,kBAE7B3B,KAAK4C,MAAM5C,KAAK2B,
|
|
1
|
+
{"version":3,"file":"SRPanel.js","sources":["../../../../src/core/Errors/SRPanel.tsx"],"sourcesContent":["import { h } from 'preact';\nimport './SRPanel.scss';\nimport { AriaAttributes, SRPanelProps } from './types';\nimport BaseElement from '../../components/internal/BaseElement/BaseElement';\nimport { SRMessages, SRMessagesRef } from './SRMessages';\nimport type { ICore } from '../types';\n\n/**\n * A panel meant to hold messages that will be read out by ScreenReaders on an aria-live=\"polite\" basis\n * Expects a string or string array of message to add to the panel to be read out\n * For testing purposes can be made visible\n */\nexport class SRPanel extends BaseElement<SRPanelProps> {\n public static type = 'srPanel';\n\n public static defaultProps: Partial<SRPanelProps> = {\n enabled: true,\n node: 'body',\n showPanel: false,\n id: 'ariaLiveSRPanel',\n ariaAttributes: {\n 'aria-relevant': 'all',\n 'aria-live': 'polite',\n 'aria-atomic': 'true'\n }\n };\n\n private readonly srPanelContainer = null;\n\n private readonly id;\n private readonly showPanel;\n private readonly _enabled: boolean;\n private readonly _moveFocus: boolean;\n\n private componentRef: SRMessagesRef;\n\n constructor(checkout: ICore, props?: SRPanelProps) {\n super(checkout, props);\n\n this.id = this.props.id;\n this.showPanel = process.env.NODE_ENV !== 'production' ? this.props.showPanel : false;\n this._enabled = false;\n this._moveFocus = this.props.moveFocus ?? true;\n\n if (this.props.enabled) {\n this._enabled = true;\n\n const panelParent = document.querySelector(this.props.node);\n\n if (panelParent) {\n const preExistingSRPanel = document.getElementById(this.id);\n if (preExistingSRPanel) {\n panelParent.removeChild(preExistingSRPanel);\n }\n\n this.srPanelContainer = document.createElement('div');\n this.srPanelContainer.className = 'sr-panel-holder';\n this.srPanelContainer.id = this.id;\n\n panelParent.appendChild(this.srPanelContainer);\n\n this.mount(this.srPanelContainer);\n } else {\n throw new Error('Component could not mount. Root node was not found.');\n }\n }\n }\n\n public setComponentRef = ref => {\n this.componentRef = ref;\n };\n\n public get enabled() {\n return this._enabled;\n }\n\n public get moveFocus() {\n return this._moveFocus;\n }\n\n public setAriaProps(ariaAttributes: AriaAttributes): void {\n const firstPanel = document.querySelector('[class^=\"adyen-checkout-sr-panel\"]');\n for (const [key, value] of Object.entries(ariaAttributes)) {\n firstPanel.setAttribute(key, value);\n }\n this.props = { ...this.props, ariaAttributes: { ...this.props.ariaAttributes, ...ariaAttributes } };\n }\n\n // A method we can expose to allow comps to set messages in this panel\n public setMessages = (messages: string[] | string): void => {\n if (!this.props.enabled) return;\n\n let panelMessages = null;\n if (messages) {\n // Ensure panelMessages is an array\n panelMessages = Array.isArray(messages) ? messages : [messages];\n }\n\n this.componentRef.setMessages(panelMessages);\n };\n\n render() {\n if (!this.props.enabled) return null;\n return (\n <div\n className={this.showPanel ? 'adyen-checkout-sr-panel' : 'adyen-checkout-sr-panel--sr-only'}\n role={'log'}\n {...this.props.ariaAttributes}\n {...(process.env.NODE_ENV !== 'production' && { 'data-testid': this.id })}\n >\n <SRMessages setComponentRef={this.setComponentRef} />\n </div>\n );\n }\n}\n"],"names":["SRPanel","BaseElement","enabled","this","_enabled","moveFocus","_moveFocus","setAriaProps","ariaAttributes","firstPanel","document","querySelector","key","value","Object","entries","setAttribute","props","render","h","div","className","showPanel","role","SRMessages","setComponentRef","constructor","checkout","super","_define_property","srPanelContainer","id","componentRef","ref","setMessages","messages","panelMessages","Array","isArray","panelParent","node","Error","preExistingSRPanel","getElementById","removeChild","createElement","appendChild","mount","type","defaultProps"],"mappings":"8SAYO,MAAMA,UAAgBC,EA4DzB,WAAWC,GACP,OAAOC,KAAKC,QAChB,CAEA,aAAWC,GACP,OAAOF,KAAKG,UAChB,CAEOC,YAAAA,CAAaC,GAChB,MAAMC,EAAaC,SAASC,cAAc,sCAC1C,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQP,GACtCC,EAAWO,aAAaJ,EAAKC,GAEjCV,KAAKc,MAAQ,IAAKd,KAAKc,MAAOT,eAAgB,IAAKL,KAAKc,MAAMT,kBAAmBA,GACrF,CAeA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iBACpB,CAGJ,CACJ,EArDAD,EADS7B,EACKgD,OAAO,WAErBnB,EAHS7B,EAGKiD,eAAsC,CAChD/C,SAAS,EACTsC,KAAM,OACNlB,WAAW,EACXS,GAAI,kBACJvB,eAAgB,CACZ,gBAAiB,MACjB,YAAa,SACb,cAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/core/Errors/utils.ts"],"sourcesContent":["import { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD, ErrorCodePrefixes, SF_ErrorCodes } from './constants';\nimport { SFError } from '../../components/Card/components/CardInput/types';\nimport { SortErrorsObj, SortedErrorObject, GenericError, SetSRMessagesReturnObject } from './types';\nimport { ValidationRuleResult } from '../../utils/Validator/ValidationRuleResult';\nimport { ErrorMessageObject } from '../../utils/Validator/types';\nimport {\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_PWD_FIELD,\n ENCRYPTED_SECURITY_CODE\n} from '../../components/internal/SecuredFields/lib/constants';\nimport { AriaConfigObject } from '../../components/internal/SecuredFields/lib/types';\nimport type Language from '../../language';\n\n/**\n * Extract and translate all the errorCodes related to a specific securedField\n * @param i18n\n * @param errorCodeIdentifier - the identifier for which type of errorCodes we need to collect e.g. 'cc-num'\n */\nexport const getTranslatedErrors = (i18n: Language, errorCodeIdentifier: string): Record<SF_ErrorCodes, string> => {\n const transObj = Object.values(SF_ErrorCodes).reduce((acc, value) => {\n // Limit to errors related to specific sf\n if (value.includes(errorCodeIdentifier)) {\n acc[value] = i18n.get(value);\n }\n return acc;\n }, {}) as Record<SF_ErrorCodes, string>;\n\n return transObj;\n};\n\n/**\n * Adds a new error property to an object.\n * This error property is an object containing the translated errors, stored by code, that relate to the securedFields\n * @param originalObject - object we want to duplicate and enhance\n * @param i18n - an i18n object to use to get translations\n * @returns a duplicate of the original object with a new property: \"error\" whose value is a object containing the translated errors\n */\nexport const addErrorTranslationsToObject = (originalObj: AriaConfigObject, i18n: Language, fieldType: string): AriaConfigObject => {\n const nuObj: AriaConfigObject = { ...originalObj };\n\n const errorCodeIdentifier = fieldTypeToErrorCodeIdentifier(fieldType);\n nuObj.error = getTranslatedErrors(i18n, errorCodeIdentifier);\n\n return nuObj;\n};\n\nexport const getErrorMessageFromCode = (errorCode: string, codeMap: Record<string, string>): string => {\n let errMsg = errorCode;\n for (const [key, value] of Object.entries(codeMap)) {\n if (value === errorCode) {\n errMsg = key;\n break;\n }\n }\n return errMsg?.toLowerCase().replace(/[_.\\s]/g, '-');\n};\n\n/**\n * errorCodeIdentifiers must match the prefixes to the numbers in ERROR_CODES (Errors/constants.ts)\n * (Which in turn must match the keys in the translations files)\n */\nconst fieldTypeToErrorCodeIdentifier = (fieldType: string): string => {\n let errorCodeIdentifier;\n switch (fieldType) {\n case ENCRYPTED_CARD_NUMBER:\n errorCodeIdentifier = ErrorCodePrefixes.CC_NUM;\n break;\n case ENCRYPTED_EXPIRY_DATE:\n errorCodeIdentifier = ErrorCodePrefixes.CC_DAT;\n break;\n case ENCRYPTED_EXPIRY_MONTH:\n errorCodeIdentifier = ErrorCodePrefixes.CC_MTH;\n break;\n case ENCRYPTED_EXPIRY_YEAR:\n errorCodeIdentifier = ErrorCodePrefixes.CC_YR;\n break;\n case ENCRYPTED_SECURITY_CODE:\n errorCodeIdentifier = ErrorCodePrefixes.CC_CVC;\n break;\n case ENCRYPTED_PWD_FIELD:\n errorCodeIdentifier = ErrorCodePrefixes.KCP_PWD;\n break;\n default:\n }\n return errorCodeIdentifier;\n};\n\n/**\n * sortErrorsByLayout - takes a list of errors and a layout, and returns a sorted array of error objects with translated error messages\n *\n * @param errors - an object containing errors, referenced by field type\n * @param layout - a string[] controlling how the output error objects will be ordered. Required when it is known that the way the error object is populated can vary e.g. Card comp, &/or anything with a country selector\n * @param i18n - our internal Language mechanism\n * @param countrySpecificLabels - some errors are region specific, e.g. in the US \"postal code\" = \"zip code\", so map the fieldType value accordingly (if it is being added to the errorMessage string)\n * @param fieldTypeMappingFn - a component specific lookup function that will tell us both if we need to prepend the field type to the SR panel message, and, if so, will retrieve the correct translation for the field type\n */\nexport const sortErrorsByLayout = ({ errors, i18n, layout, countrySpecificLabels, fieldTypeMappingFn }: SortErrorsObj): SortedErrorObject[] => {\n const SR_INDICATOR_PREFIX = process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test' ? '' : '-sr'; // Useful for testing whether SR is reading out aria-live errors (sr) or aria-describedby ones\n\n // Create array of error objects, sorted by layout\n const sortedErrors: SortedErrorObject[] = Object.entries(errors).reduce((acc, [key, value]) => {\n if (value) {\n const errObj: ValidationRuleResult | SFError | GenericError = errors[key];\n\n const TREAT_AS_SF_ERROR = 'errorI18n' in errObj && `rootNode` in errObj; // look for expected props, unique to an SFError\n\n // Some ValidationRuleResults can be passed an object in the 'errorMessage' prop (to give country specific errors)\n const ERROR_MSG_IS_OBJECT = typeof errObj.errorMessage === 'object';\n\n /**\n * Get error codes - these are used if we need to distinguish between showValidation & onBlur errors\n * - For a ValidationRuleResult or GenericError the error \"code\" is contained in the errorMessage prop.\n * - For an SFError the error \"code\" is contained in the error prop.\n */\n let errorCode: string;\n if (TREAT_AS_SF_ERROR) {\n errorCode = errObj.error;\n } else {\n /** Special handling for Address~postalCode (where the errorMessage is an object) */\n if (ERROR_MSG_IS_OBJECT) {\n /** is ValidationRuleResult w. country specific error */\n errorCode = (errObj.errorMessage as ErrorMessageObject).translationKey;\n } else {\n /** is ValidationRuleResult || GenericError || an as yet incorrectly formed error */\n errorCode = errObj.errorMessage as string;\n }\n }\n\n /**\n * Get corresponding error msg - a translated string we can place into the SRPanel\n * NOTE: the error object for a secured field already contains the error in a translated form (errorI18n).\n * For other fields we still need to translate it, so we use the errObj.errorMessage prop as a translation key\n */\n let errorMsg: string;\n if (TREAT_AS_SF_ERROR && 'errorI18n' in errObj) {\n errorMsg = errObj.errorI18n + SR_INDICATOR_PREFIX;\n } else {\n /**\n * For some fields, for a11y reasons (when the translated error msg doesn't contain a reference to the field it refers to), we need to\n * add the field type into the translated error message.\n *\n * This happens with generic errors\n * e.g. \"field.error.required\": \"Enter the %{label}\"\n * or \"invalid.format.expects\": \"%{label} Invalid format. Expected format: %{format}\"\n */\n const mappedLabel = fieldTypeMappingFn ? fieldTypeMappingFn(key, i18n, countrySpecificLabels) : ''; // Retrieve the translated field name, if required\n\n /** Special handling for Address~postalCode where the errorMessage object contains the details of the country specific format that should have been used for the postcode */\n if (ERROR_MSG_IS_OBJECT) {\n /** is ValidationRuleResult w. country specific error */\n const translationKey = (errObj.errorMessage as ErrorMessageObject).translationKey;\n const countrySpecificFormat = (errObj.errorMessage as ErrorMessageObject).translationObject.values.format;\n\n errorMsg = `${i18n.get(translationKey, { values: { label: mappedLabel, format: countrySpecificFormat } })}${SR_INDICATOR_PREFIX}`;\n } else {\n /** is ValidationRuleResult || GenericError || an as yet incorrectly formed error */\n errorMsg = i18n.get(errObj.errorMessage as string, { values: { label: mappedLabel } }) + SR_INDICATOR_PREFIX;\n }\n }\n\n acc.push({ field: key, errorMessage: errorMsg, errorCode });\n\n if (layout) acc.sort((a, b) => layout.indexOf(a.field) - layout.indexOf(b.field));\n }\n return acc;\n }, []);\n\n return sortedErrors;\n};\n\n/**\n * Implemented as a partial, with an object containing the first 6 arguments; then the final argument, errors, is passed to the partial\n *\n * NOTE: using this generic error setting fny is only suitable when errors for the SRPanel are *only* generated by showValidation().\n * When errors are also generated onBlur, as the user leaves the input, the SR message generation becomes more complex - see CardInput as an example\n */\nexport const setSRMessagesFromErrors = (\n { i18n, fieldTypeMappingFn, SRPanelRef },\n { errors, isValidating, layout, countrySpecificLabels }\n): SetSRMessagesReturnObject => {\n const currentErrorsSortedByLayout = sortErrorsByLayout({\n errors,\n i18n,\n fieldTypeMappingFn,\n countrySpecificLabels,\n layout\n });\n\n const doLog = false;\n\n if (doLog) console.log('### setSRMessagesFromErrors::currentErrorsSortedByLayout:: ', currentErrorsSortedByLayout);\n\n if (currentErrorsSortedByLayout.length) {\n /** If validating i.e. \"on submit\" type event - then display all errors in the SR panel */\n if (isValidating) {\n const errorMsgArr: string[] = currentErrorsSortedByLayout.map(errObj => errObj.errorMessage);\n if (doLog) console.log('### setSRMessagesFromErrors:: #1 multiple errors:: (validating) errorMsgArr=', errorMsgArr);\n SRPanelRef.setMessages(errorMsgArr);\n\n const fieldListArr: string[] = currentErrorsSortedByLayout.map(errObj => errObj.field);\n return { currentErrorsSortedByLayout, action: ERROR_ACTION_FOCUS_FIELD, fieldToFocus: fieldListArr[0] };\n } else {\n // prettier-ignore\n if (doLog) console.log('### setSRMessagesFromErrors:: #3 on blur scenario:: not validating but there might be an error, either to set or to clear');\n SRPanelRef?.setMessages(null);\n\n return { currentErrorsSortedByLayout, action: ERROR_ACTION_BLUR_SCENARIO }; // on blur scenario: not validating but there might be an error, either to set or to clear\n }\n } else {\n if (doLog) console.log('### setSRMessagesFromErrors::componentDidUpdate:: #4 clearing errors:: NO currentErrorsSortedByLayout');\n SRPanelRef?.setMessages(null); // no errors - so clear SR panel\n return { currentErrorsSortedByLayout, action: 'none' };\n }\n};\n\nexport const enhanceErrorObjectKeys = (errorObj, keyPrefix) => {\n if (!errorObj) return null;\n const enhancedObj = Object.entries(errorObj).reduce((acc, [key, value]) => {\n if (value) {\n const newKey = `${keyPrefix}${key}`;\n acc[newKey] = value;\n }\n return acc;\n }, {});\n\n return enhancedObj;\n};\n"],"names":["getTranslatedErrors","i18n","errorCodeIdentifier","Object","values","SF_ErrorCodes","reduce","acc","value","includes","get","addErrorTranslationsToObject","originalObj","fieldType","nuObj","fieldTypeToErrorCodeIdentifier","error","getErrorMessageFromCode","errorCode","codeMap","errMsg","key","entries","toLowerCase","replace","ENCRYPTED_CARD_NUMBER","ErrorCodePrefixes","CC_NUM","ENCRYPTED_EXPIRY_DATE","CC_DAT","ENCRYPTED_EXPIRY_MONTH","CC_MTH","ENCRYPTED_EXPIRY_YEAR","CC_YR","ENCRYPTED_SECURITY_CODE","CC_CVC","ENCRYPTED_PWD_FIELD","KCP_PWD","sortErrorsByLayout","errors","layout","countrySpecificLabels","fieldTypeMappingFn","errObj","TREAT_AS_SF_ERROR","ERROR_MSG_IS_OBJECT","errorMessage","errorMsg","translationKey","errorI18n","mappedLabel","countrySpecificFormat","translationObject","format","label","push","field","sort","a","b","indexOf","setSRMessagesFromErrors","SRPanelRef","isValidating","currentErrorsSortedByLayout","length","errorMsgArr","map","setMessages","fieldListArr","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","ERROR_ACTION_BLUR_SCENARIO","enhanceErrorObjectKeys","errorObj","keyPrefix"],"mappings":"6WAqBO,MAAMA,EAAsB,CAACC,EAAgBC,IAC/BC,OAAOC,OAAOC,GAAeC,OAAO,CAACC,EAAKC,KAEnDA,EAAMC,SAASP,KACfK,EAAIC,GAASP,EAAKS,IAAIF,IAEnBD,GACR,IAYMI,EAA+B,CAACC,EAA+BX,EAAgBY,KACxF,MAAMC,EAA0B,IAAKF,GAE/BV,EAAsBa,EAA+BF,GAG3D,OAFAC,EAAME,MAAQhB,EAAoBC,EAAMC,GAEjCY,GAGEG,EAA0B,CAACC,EAAmBC,KACvD,IAAIC,EAASF,EACb,IAAK,MAAOG,EAAKb,KAAUL,OAAOmB,QAAQH,GACtC,GAAIX,IAAUU,EAAW,CACrBE,EAASC,EACT,KACJ,CAEJ,OAAOD,GAAQG,cAAcC,QAAQ,UAAW,MAO9CT,EAAkCF,IACpC,IAAIX,EACJ,OAAQW,GACJ,KAAKY,EACDvB,EAAsBwB,EAAkBC,OACxC,MACJ,KAAKC,EACD1B,EAAsBwB,EAAkBG,OACxC,MACJ,KAAKC,EACD5B,EAAsBwB,EAAkBK,OACxC,MACJ,KAAKC,EACD9B,EAAsBwB,EAAkBO,MACxC,MACJ,KAAKC,EACDhC,EAAsBwB,EAAkBS,OACxC,MACJ,KAAKC,EACDlC,EAAsBwB,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A,EAAOG,cAE/EgB,EAAWM,YAAYF,GAEvB,MAAMG,EAAyBL,EAA4BG,IAAIxB,GAAUA,EAAOa,OAChF,MAAO,CAAEQ,8BAA6BM,OAAQC,EAA0BC,aAAcH,EAAa,IAMnG,OAFAP,GAAYM,YAAY,MAEjB,CAAEJ,8BAA6BM,OAAQG,GAKlD,OADAX,GAAYM,YAAY,MACjB,CAAEJ,8BAA6BM,OAAQ,SAIzCI,EAAyB,CAACC,EAAUC,KAC7C,IAAKD,EAAU,OAAO,KAStB,OARoBxE,OAAOmB,QAAQqD,GAAUrE,OAAO,CAACC,GAAMc,EAAKb,MAC5D,GAAIA,EAAO,CAEPD,EADe,GAAGqE,IAAYvD,KAChBb,CAClB,CACA,OAAOD,GACR"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/core/Errors/utils.ts"],"sourcesContent":["import { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD, ErrorCodePrefixes, SF_ErrorCodes } from './constants';\nimport { SFError } from '../../components/Card/components/CardInput/types';\nimport { SortErrorsObj, SortedErrorObject, GenericError, SetSRMessagesReturnObject } from './types';\nimport { ValidationRuleResult } from '../../utils/Validator/ValidationRuleResult';\nimport { ErrorMessageObject } from '../../utils/Validator/types';\nimport {\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_PWD_FIELD,\n ENCRYPTED_SECURITY_CODE\n} from '../../components/internal/SecuredFields/lib/constants';\nimport { AriaConfigObject } from '../../components/internal/SecuredFields/lib/types';\nimport type Language from '../../language';\n\n/**\n * Extract and translate all the errorCodes related to a specific securedField\n * @param i18n\n * @param errorCodeIdentifier - the identifier for which type of errorCodes we need to collect e.g. 'cc-num'\n */\nexport const getTranslatedErrors = (i18n: Language, errorCodeIdentifier: string): Record<SF_ErrorCodes, string> => {\n const transObj = Object.values(SF_ErrorCodes).reduce((acc, value) => {\n // Limit to errors related to specific sf\n if (value.includes(errorCodeIdentifier)) {\n acc[value] = i18n.get(value);\n }\n return acc;\n }, {}) as Record<SF_ErrorCodes, string>;\n\n return transObj;\n};\n\n/**\n * Adds a new error property to an object.\n * This error property is an object containing the translated errors, stored by code, that relate to the securedFields\n * @param originalObject - object we want to duplicate and enhance\n * @param i18n - an i18n object to use to get translations\n * @returns a duplicate of the original object with a new property: \"error\" whose value is a object containing the translated errors\n */\nexport const addErrorTranslationsToObject = (originalObj: AriaConfigObject, i18n: Language, fieldType: string): AriaConfigObject => {\n const nuObj: AriaConfigObject = { ...originalObj };\n\n const errorCodeIdentifier = fieldTypeToErrorCodeIdentifier(fieldType);\n nuObj.error = getTranslatedErrors(i18n, errorCodeIdentifier);\n\n return nuObj;\n};\n\nexport const getErrorMessageFromCode = (errorCode: string, codeMap: Record<string, string>): string => {\n let errMsg = errorCode;\n for (const [key, value] of Object.entries(codeMap)) {\n if (value === errorCode) {\n errMsg = key;\n break;\n }\n }\n return errMsg?.toLowerCase().replace(/[_.\\s]/g, '-');\n};\n\n/**\n * errorCodeIdentifiers must match the prefixes to the numbers in ERROR_CODES (Errors/constants.ts)\n * (Which in turn must match the keys in the translations files)\n */\nconst fieldTypeToErrorCodeIdentifier = (fieldType: string): string => {\n let errorCodeIdentifier;\n switch (fieldType) {\n case ENCRYPTED_CARD_NUMBER:\n errorCodeIdentifier = ErrorCodePrefixes.CC_NUM;\n break;\n case ENCRYPTED_EXPIRY_DATE:\n errorCodeIdentifier = ErrorCodePrefixes.CC_DAT;\n break;\n case ENCRYPTED_EXPIRY_MONTH:\n errorCodeIdentifier = ErrorCodePrefixes.CC_MTH;\n break;\n case ENCRYPTED_EXPIRY_YEAR:\n errorCodeIdentifier = ErrorCodePrefixes.CC_YR;\n break;\n case ENCRYPTED_SECURITY_CODE:\n errorCodeIdentifier = ErrorCodePrefixes.CC_CVC;\n break;\n case ENCRYPTED_PWD_FIELD:\n errorCodeIdentifier = ErrorCodePrefixes.KCP_PWD;\n break;\n default:\n }\n return errorCodeIdentifier;\n};\n\n/**\n * sortErrorsByLayout - takes a list of errors and a layout, and returns a sorted array of error objects with translated error messages\n *\n * @param errors - an object containing errors, referenced by field type\n * @param layout - a string[] controlling how the output error objects will be ordered. Required when it is known that the way the error object is populated can vary e.g. Card comp, &/or anything with a country selector\n * @param i18n - our internal Language mechanism\n * @param countrySpecificLabels - some errors are region specific, e.g. in the US \"postal code\" = \"zip code\", so map the fieldType value accordingly (if it is being added to the errorMessage string)\n * @param fieldTypeMappingFn - a component specific lookup function that will tell us both if we need to prepend the field type to the SR panel message, and, if so, will retrieve the correct translation for the field type\n */\nexport const sortErrorsByLayout = ({ errors, i18n, layout, countrySpecificLabels, fieldTypeMappingFn }: SortErrorsObj): SortedErrorObject[] => {\n const SR_INDICATOR_PREFIX = process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test' ? '' : '-sr'; // Useful for testing whether SR is reading out aria-live errors (sr) or aria-describedby ones\n\n // Create array of error objects, sorted by layout\n const sortedErrors: SortedErrorObject[] = Object.entries(errors).reduce((acc, [key, value]) => {\n if (value) {\n const errObj: ValidationRuleResult | SFError | GenericError = errors[key];\n\n const TREAT_AS_SF_ERROR = 'errorI18n' in errObj && `rootNode` in errObj; // look for expected props, unique to an SFError\n\n // Some ValidationRuleResults can be passed an object in the 'errorMessage' prop (to give country specific errors)\n const ERROR_MSG_IS_OBJECT = typeof errObj.errorMessage === 'object';\n\n /**\n * Get error codes - these are used if we need to distinguish between showValidation & onBlur errors\n * - For a ValidationRuleResult or GenericError the error \"code\" is contained in the errorMessage prop.\n * - For an SFError the error \"code\" is contained in the error prop.\n */\n let errorCode: string;\n if (TREAT_AS_SF_ERROR) {\n errorCode = errObj.error;\n } else {\n /** Special handling for Address~postalCode (where the errorMessage is an object) */\n if (ERROR_MSG_IS_OBJECT) {\n /** is ValidationRuleResult w. country specific error */\n errorCode = (errObj.errorMessage as ErrorMessageObject).translationKey;\n } else {\n /** is ValidationRuleResult || GenericError || an as yet incorrectly formed error */\n errorCode = errObj.errorMessage as string;\n }\n }\n\n /**\n * Get corresponding error msg - a translated string we can place into the SRPanel\n * NOTE: the error object for a secured field already contains the error in a translated form (errorI18n).\n * For other fields we still need to translate it, so we use the errObj.errorMessage prop as a translation key\n */\n let errorMsg: string;\n if (TREAT_AS_SF_ERROR && 'errorI18n' in errObj) {\n errorMsg = errObj.errorI18n + SR_INDICATOR_PREFIX;\n } else {\n /**\n * For some fields, for a11y reasons (when the translated error msg doesn't contain a reference to the field it refers to), we need to\n * add the field type into the translated error message.\n *\n * This happens with generic errors\n * e.g. \"field.error.required\": \"Enter the %{label}\"\n * or \"invalid.format.expects\": \"%{label} Invalid format. Expected format: %{format}\"\n */\n const mappedLabel = fieldTypeMappingFn ? fieldTypeMappingFn(key, i18n, countrySpecificLabels) : ''; // Retrieve the translated field name, if required\n\n /** Special handling for Address~postalCode where the errorMessage object contains the details of the country specific format that should have been used for the postcode */\n if (ERROR_MSG_IS_OBJECT) {\n /** is ValidationRuleResult w. country specific error */\n const translationKey = (errObj.errorMessage as ErrorMessageObject).translationKey;\n const countrySpecificFormat = (errObj.errorMessage as ErrorMessageObject).translationObject.values.format;\n\n errorMsg = `${i18n.get(translationKey, { values: { label: mappedLabel, format: countrySpecificFormat } })}${SR_INDICATOR_PREFIX}`;\n } else {\n /** is ValidationRuleResult || GenericError || an as yet incorrectly formed error */\n errorMsg = i18n.get(errObj.errorMessage as string, { values: { label: mappedLabel } }) + SR_INDICATOR_PREFIX;\n }\n }\n\n acc.push({ field: key, errorMessage: errorMsg, errorCode });\n\n if (layout) acc.sort((a, b) => layout.indexOf(a.field) - layout.indexOf(b.field));\n }\n return acc;\n }, []);\n\n return sortedErrors;\n};\n\n/**\n * Implemented as a partial, with an object containing the first 6 arguments; then the final argument, errors, is passed to the partial\n *\n * NOTE: using this generic error setting fny is only suitable when errors for the SRPanel are *only* generated by showValidation().\n * When errors are also generated onBlur, as the user leaves the input, the SR message generation becomes more complex - see CardInput as an example\n */\nexport const setSRMessagesFromErrors = (\n { i18n, fieldTypeMappingFn, SRPanelRef },\n { errors, isValidating, layout, countrySpecificLabels }\n): SetSRMessagesReturnObject => {\n const currentErrorsSortedByLayout = sortErrorsByLayout({\n errors,\n i18n,\n fieldTypeMappingFn,\n countrySpecificLabels,\n layout\n });\n\n const doLog = false;\n\n if (doLog) console.log('### setSRMessagesFromErrors::currentErrorsSortedByLayout:: ', currentErrorsSortedByLayout);\n\n if (currentErrorsSortedByLayout.length) {\n /** If validating i.e. \"on submit\" type event - then display all errors in the SR panel */\n if (isValidating) {\n const errorMsgArr: string[] = currentErrorsSortedByLayout.map(errObj => errObj.errorMessage);\n if (doLog) console.log('### setSRMessagesFromErrors:: #1 multiple errors:: (validating) errorMsgArr=', errorMsgArr);\n SRPanelRef.setMessages(errorMsgArr);\n\n const fieldListArr: string[] = currentErrorsSortedByLayout.map(errObj => errObj.field);\n return { currentErrorsSortedByLayout, action: ERROR_ACTION_FOCUS_FIELD, fieldToFocus: fieldListArr[0] };\n } else {\n // prettier-ignore\n if (doLog) console.log('### setSRMessagesFromErrors:: #3 on blur scenario:: not validating but there might be an error, either to set or to clear');\n SRPanelRef?.setMessages(null);\n\n return { currentErrorsSortedByLayout, action: ERROR_ACTION_BLUR_SCENARIO }; // on blur scenario: not validating but there might be an error, either to set or to clear\n }\n } else {\n if (doLog) console.log('### setSRMessagesFromErrors::componentDidUpdate:: #4 clearing errors:: NO currentErrorsSortedByLayout');\n SRPanelRef?.setMessages(null); // no errors - so clear SR panel\n return { currentErrorsSortedByLayout, action: 'none' };\n }\n};\n\nexport const enhanceErrorObjectKeys = (errorObj, keyPrefix) => {\n if (!errorObj) return null;\n const enhancedObj = Object.entries(errorObj).reduce((acc, [key, value]) => {\n if (value) {\n const newKey = `${keyPrefix}${key}`;\n acc[newKey] = value;\n }\n return acc;\n }, {});\n\n return enhancedObj;\n};\n"],"names":["getTranslatedErrors","i18n","errorCodeIdentifier","Object","values","SF_ErrorCodes","reduce","acc","value","includes","get","addErrorTranslationsToObject","originalObj","fieldType","nuObj","fieldTypeToErrorCodeIdentifier","error","getErrorMessageFromCode","errorCode","codeMap","errMsg","key","entries","toLowerCase","replace","ENCRYPTED_CARD_NUMBER","ErrorCodePrefixes","CC_NUM","ENCRYPTED_EXPIRY_DATE","CC_DAT","ENCRYPTED_EXPIRY_MONTH","CC_MTH","ENCRYPTED_EXPIRY_YEAR","CC_YR","ENCRYPTED_SECURITY_CODE","CC_CVC","ENCRYPTED_PWD_FIELD","KCP_PWD","sortErrorsByLayout","errors","layout","countrySpecificLabels","fieldTypeMappingFn","errObj","TREAT_AS_SF_ERROR","ERROR_MSG_IS_OBJECT","errorMessage","errorMsg","translationKey","errorI18n","mappedLabel","countrySpecificFormat","translationObject","format","label","push","field","sort","a","b","indexOf","setSRMessagesFromErrors","SRPanelRef","isValidating","currentErrorsSortedByLayout","length","errorMsgArr","map","setMessages","fieldListArr","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","ERROR_ACTION_BLUR_SCENARIO","enhanceErrorObjectKeys","errorObj","keyPrefix"],"mappings":"6WAqBO,MAAMA,EAAsB,CAACC,EAAgBC,IAC/BC,OAAOC,OAAOC,GAAeC,OAAO,CAACC,EAAKC,KAEnDA,EAAMC,SAASP,KACfK,EAAIC,GAASP,EAAKS,IAAIF,IAEnBD,GACR,CAAA,GAYMI,EAA+B,CAACC,EAA+BX,EAAgBY,KACxF,MAAMC,EAA0B,IAAKF,GAE/BV,EAAsBa,EAA+BF,GAG3D,OAFAC,EAAME,MAAQhB,EAAoBC,EAAMC,GAEjCY,GAGEG,EAA0B,CAACC,EAAmBC,KACvD,IAAIC,EAASF,EACb,IAAK,MAAOG,EAAKb,KAAUL,OAAOmB,QAAQH,GACtC,GAAIX,IAAUU,EAAW,CACrBE,EAASC,EACT,KACJ,CAEJ,OAAOD,GAAQG,cAAcC,QAAQ,UAAW,MAO9CT,EAAkCF,IACpC,IAAIX,EAC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H,OAC9E,CACA,OAAOjD,GACR,IAWMsD,EAA0B,EACjC5D,OAAMyC,qBAAoBoB,eAC1BvB,SAAQwB,eAAcvB,SAAQC,4BAEhC,MAAMuB,EAA8B1B,EAAmB,CACnDC,SACAtC,OACAyC,qBACAD,wBACAD,WAOJ,GAAIwB,EAA4BC,OAAQ,CAEpC,GAAIF,EAAc,CACd,MAAMG,EAAwBF,EAA4BG,IAAIxB,GAAUA,EAAOG,cAE/EgB,EAAWM,YAAYF,GAEvB,MAAMG,EAAyBL,EAA4BG,IAAIxB,GAAUA,EAAOa,OAChF,MAAO,CAAEQ,8BAA6BM,OAAQC,EAA0BC,aAAcH,EAAa,GACvG,CAKI,OAFAP,GAAYM,YAAY,MAEjB,CAAEJ,8BAA6BM,OAAQG,EAEtD,CAGI,OADAX,GAAYM,YAAY,MACjB,CAAEJ,8BAA6BM,OAAQ,SAIzCI,EAAyB,CAACC,EAAUC,KAC7C,IAAKD,EAAU,OAAO,KAStB,OARoBxE,OAAOmB,QAAQqD,GAAUrE,OAAO,CAACC,GAAMc,EAAKb,MAC5D,GAAIA,EAAO,CAEPD,EADe,GAAGqE,IAAYvD,KAChBb,CAClB,CACA,OAAOD,GACR,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";const o='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const n=({analyticsContext:n,clientKey:r,locale:i,analyticsPath:c,bundleType:a})=>{let l;const s={errorLevel:"fatal",loadingContext:n,path:`${c}?clientKey=${r}`};return n=>{const c={version:"6.
|
|
1
|
+
import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";const o='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const n=({analyticsContext:n,clientKey:r,locale:i,analyticsPath:c,bundleType:a})=>{let l;const s={errorLevel:"fatal",loadingContext:n,path:`${c}?clientKey=${r}`};return n=>{const c={version:"6.20.0",channel:"Web",platform:"Web",buildType:a,locale:i,referrer:window.location.href,screenWidth:window.screen.width,...n};if(l)return l;if(!r)return Promise.reject("no-client-key");const m=new t("checkout-attempt-id","sessionStorage"),d=m.get();return function(e){if(!e?.id)return!1;const t=Date.now()-9e5;return e.timestamp>t}(d)?Promise.resolve(d.id):(l=e(s,c).then(e=>{if(e?.checkoutAttemptId)return m.set({id:e.checkoutAttemptId,timestamp:Date.now()}),e.checkoutAttemptId}).catch(()=>Promise.reject(o)),l)}};export{o as FAILURE_MSG,n as default};
|
|
2
2
|
//# sourceMappingURL=collect-id.js.map
|
package/dist/es/core/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import s from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as e}from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as n,assertConfigurationPropertiesAreValid as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as c}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as m,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as g}from"./Analytics/constants.js";import{THREEDS2_FULL as C}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as w}from"../language/constants.js";import v from"./Services/get-translations.js";import{defaultProps as A}from"./core.defaultProps.js";import{formatLocale as j,formatCustomTranslations as E}from"../language/utils.js";import{resolveEnvironments as b}from"./Environment/Environment.js";import{AnalyticsLogEvent as P}from"./Analytics/AnalyticsLogEvent.js";import M from"./Errors/CancelError.js";function T(t,o,s){return o in t?Object.defineProperty(t,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[o]=s,t}class x{static setBundleType(t){x.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then(t=>{const{amount:o,shopperLocale:s,countryCode:e,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||s,countryCode:this.options.countryCode||e}),this.createPaymentMethodsList(i),this}).catch(t=>(this.options.onError&&this.options.onError(t),Promise.reject(t))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await v(this.cdnTranslationsUrl,x.metadata.version,this.options.locale)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:w}),this.options.locale=j(this.options.locale),this.options.translations=E(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise((o,s)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:s})})),this.session&&(o=this.session.submitDetails(t).catch(t=>(this.options.onError?.(t),Promise.reject(t)))),o?o.then(d).then(m).then(this.afterAdditionalDetails).then(t=>{u(t),this.options.onPaymentCompleted?.(t)}).catch(t=>{t instanceof M||(u(t),this.options.onPaymentFailed?.(t))}):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const s=t.type===C?`${t.type}${t.subtype}`:t.paymentMethodType,i=new P({type:g,subType:t.type,message:`${s} action was handled by the SDK`,component:s});this.modules.analytics.sendAnalytics(i);const n={...this.getCorePropsForComponent(),...o};return e(this,p,t,n)}return this.handleCreateError()}getCorePropsForComponent(){return{...n(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new s(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:i({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:x.metadata.bundleType}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new c(this,{...this.options.srConfig})})}constructor(t){T(this,"session",void 0),T(this,"paymentMethodsResponse",void 0),T(this,"modules",void 0),T(this,"options",void 0),T(this,"analyticsContext",void 0),T(this,"loadingContext",void 0),T(this,"cdnImagesUrl",void 0),T(this,"cdnTranslationsUrl",void 0),T(this,"components",[]),T(this,"afterAdditionalDetails",t=>{if(this.options.afterAdditionalDetails&&t?.action){const o=this.createFromAction(t.action);return this.options.afterAdditionalDetails(o),Promise.reject(new M("Handled by afterAdditionalDetails"))}return Promise.resolve(t)}),T(this,"update",(t={})=>(this.setOptions(t),this.initialize().then(()=>(this.components.forEach(o=>{const s={...t,...this.session&&{session:this.session}};o.update(s)}),this)))),T(this,"remove",t=>(this.components=this.components.filter(o=>o._id!==t._id),t.unmount(),this)),T(this,"setOptions",t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}}),a(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({...A,...t});const{apiUrl:o,analyticsUrl:s,cdnImagesUrl:e,cdnTranslationsUrl:i}=b(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=s,this.cdnImagesUrl=e,this.cdnTranslationsUrl=i,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const n=this.options.clientKey?.substring(0,4);if(("test"===n||"live"===n)&&!this.loadingContext.includes(n))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${n} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===n&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=x.metadata)}}T(x,"metadata",{version:"6.
|
|
1
|
+
import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import s from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as e}from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as n,assertConfigurationPropertiesAreValid as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as c}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as m,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as g}from"./Analytics/constants.js";import{THREEDS2_FULL as C}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as w}from"../language/constants.js";import v from"./Services/get-translations.js";import{defaultProps as A}from"./core.defaultProps.js";import{formatLocale as j,formatCustomTranslations as E}from"../language/utils.js";import{resolveEnvironments as b}from"./Environment/Environment.js";import{AnalyticsLogEvent as P}from"./Analytics/AnalyticsLogEvent.js";import M from"./Errors/CancelError.js";function T(t,o,s){return o in t?Object.defineProperty(t,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[o]=s,t}class x{static setBundleType(t){x.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then(t=>{const{amount:o,shopperLocale:s,countryCode:e,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||s,countryCode:this.options.countryCode||e}),this.createPaymentMethodsList(i),this}).catch(t=>(this.options.onError&&this.options.onError(t),Promise.reject(t))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await v(this.cdnTranslationsUrl,x.metadata.version,this.options.locale)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:w}),this.options.locale=j(this.options.locale),this.options.translations=E(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise((o,s)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:s})})),this.session&&(o=this.session.submitDetails(t).catch(t=>(this.options.onError?.(t),Promise.reject(t)))),o?o.then(d).then(m).then(this.afterAdditionalDetails).then(t=>{u(t),this.options.onPaymentCompleted?.(t)}).catch(t=>{t instanceof M||(u(t),this.options.onPaymentFailed?.(t))}):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const s=t.type===C?`${t.type}${t.subtype}`:t.paymentMethodType,i=new P({type:g,subType:t.type,message:`${s} action was handled by the SDK`,component:s});this.modules.analytics.sendAnalytics(i);const n={...this.getCorePropsForComponent(),...o};return e(this,p,t,n)}return this.handleCreateError()}getCorePropsForComponent(){return{...n(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new s(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:i({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:x.metadata.bundleType}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new c(this,{...this.options.srConfig})})}constructor(t){T(this,"session",void 0),T(this,"paymentMethodsResponse",void 0),T(this,"modules",void 0),T(this,"options",void 0),T(this,"analyticsContext",void 0),T(this,"loadingContext",void 0),T(this,"cdnImagesUrl",void 0),T(this,"cdnTranslationsUrl",void 0),T(this,"components",[]),T(this,"afterAdditionalDetails",t=>{if(this.options.afterAdditionalDetails&&t?.action){const o=this.createFromAction(t.action);return this.options.afterAdditionalDetails(o),Promise.reject(new M("Handled by afterAdditionalDetails"))}return Promise.resolve(t)}),T(this,"update",(t={})=>(this.setOptions(t),this.initialize().then(()=>(this.components.forEach(o=>{const s={...t,...this.session&&{session:this.session}};o.update(s)}),this)))),T(this,"remove",t=>(this.components=this.components.filter(o=>o._id!==t._id),t.unmount(),this)),T(this,"setOptions",t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}}),a(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({...A,...t});const{apiUrl:o,analyticsUrl:s,cdnImagesUrl:e,cdnTranslationsUrl:i}=b(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=s,this.cdnImagesUrl=e,this.cdnTranslationsUrl=i,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const n=this.options.clientKey?.substring(0,4);if(("test"===n||"live"===n)&&!this.loadingContext.includes(n))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${n} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===n&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=x.metadata)}}T(x,"metadata",{version:"6.20.0",bundleType:"esm"}),T(x,"registry",p);export{x as default};
|
|
2
2
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.registry.js","sources":["../../../src/core/core.registry.ts"],"sourcesContent":["import UIElement from '../components/internal/UIElement/UIElement';\nimport ThreeDS2Challenge from '../components/ThreeDS2/ThreeDS2Challenge';\nimport ThreeDS2DeviceFingerprint from '../components/ThreeDS2/ThreeDS2DeviceFingerprint';\nimport Redirect from '../components/Redirect';\nimport { TxVariants } from '../components/tx-variants';\nimport type { ICore } from './types';\n\nfunction assertClassHasType(Class: any): Class is typeof UIElement {\n const hasValidType = typeof Class.type === 'string' && !!Class.type;\n return hasValidType;\n}\n\nexport type NewableComponent = new (checkout: ICore, props?) => UIElement;\n\nexport interface IRegistry {\n add(...items: NewableComponent[]): void;\n getComponent(type: string): NewableComponent | undefined;\n}\n\nconst defaultComponents = {\n [TxVariants.redirect]: Redirect,\n [TxVariants.threeDS2Challenge]: ThreeDS2Challenge,\n [TxVariants.threeDS2DeviceFingerprint]: ThreeDS2DeviceFingerprint\n};\n\nclass Registry implements IRegistry {\n public componentsMap: Record<string, NewableComponent> = defaultComponents;\n\n public supportedTxVariants: Set<string> = new Set(Object.values(TxVariants));\n\n public add(...items: NewableComponent[]) {\n this.componentsMap = {\n ...this.componentsMap,\n ...this.createComponentsMap(items)\n };\n }\n\n public getComponent(type: string): NewableComponent | undefined {\n const Component = this.componentsMap[type];\n if (Component) {\n return Component;\n }\n\n if (this.supportedTxVariants.has(type)) {\n return;\n }\n\n return Redirect;\n }\n\n public createComponentsMap(components: NewableComponent[]) {\n const componentsMap = components.reduce((memo, component) => {\n const isValid = assertClassHasType(component);\n\n if (!isValid) {\n console.error('CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement');\n return memo;\n }\n if (component.type === 'dropin') {\n return memo;\n }\n\n const supportedTxVariants = [component.type, ...component.txVariants].filter(txVariant => txVariant);\n\n supportedTxVariants.forEach(txVariant => {\n memo = {\n ...memo,\n [txVariant]: component\n };\n });\n\n return memo;\n }, {});\n\n return componentsMap;\n }\n}\n\nexport default new Registry();\n"],"names":["defaultComponents","TxVariants","redirect","Redirect","threeDS2Challenge","ThreeDS2Challenge","threeDS2DeviceFingerprint","ThreeDS2DeviceFingerprint","registry","add","items","this","componentsMap","createComponentsMap","getComponent","type","Component","supportedTxVariants","has","components","reduce","memo","component","Class","console","error","txVariants","filter","txVariant","forEach","_define_property","Set","Object","values"],"mappings":"kWAmBA,MAAMA,EAAoB,CACtB,CAACC,EAAWC,UAAWC,EACvB,CAACF,EAAWG,mBAAoBC,EAChC,CAACJ,EAAWK,2BAA4BC,GAwD5C,IAAAC,EAAe,IArDf,MAKWC,GAAAA,IAAOC,GACVC,KAAKC,cAAgB,IACdD,KAAKC,iBACLD,KAAKE,oBAAoBH,GAEpC,CAEOI,YAAAA,CAAaC,GAChB,MAAMC,EAAYL,KAAKC,cAAcG,GACrC,OAAIC,IAIAL,KAAKM,oBAAoBC,IAAIH,QAAjC,EAIOZ,EACX,CAEOU,mBAAAA,CAAoBM,GAwBvB,OAvBsBA,EAAWC,OAAO,CAACC,EAAMC,KA5CvD,IAA4BC,EA+ChB,KA9CmC,iBADnBA,EA6CmBD,GA5CTP,QAAuBQ,EAAMR,MAgDnD,OADAS,QAAQC,MAAM,sFACPJ,EAEX,GAAuB,WAAnBC,EAAUP,KACV,OAAOM,EAYX,MAT4B,CAACC,EAAUP,QAASO,EAAUI,YAAYC,OAAOC,GAAaA,GAEtEC,QAAQD,IACxBP,EAAO,IACAA,EACHO,CAACA,GAAYN,KAIdD,GACR,
|
|
1
|
+
{"version":3,"file":"core.registry.js","sources":["../../../src/core/core.registry.ts"],"sourcesContent":["import UIElement from '../components/internal/UIElement/UIElement';\nimport ThreeDS2Challenge from '../components/ThreeDS2/ThreeDS2Challenge';\nimport ThreeDS2DeviceFingerprint from '../components/ThreeDS2/ThreeDS2DeviceFingerprint';\nimport Redirect from '../components/Redirect';\nimport { TxVariants } from '../components/tx-variants';\nimport type { ICore } from './types';\n\nfunction assertClassHasType(Class: any): Class is typeof UIElement {\n const hasValidType = typeof Class.type === 'string' && !!Class.type;\n return hasValidType;\n}\n\nexport type NewableComponent = new (checkout: ICore, props?) => UIElement;\n\nexport interface IRegistry {\n add(...items: NewableComponent[]): void;\n getComponent(type: string): NewableComponent | undefined;\n}\n\nconst defaultComponents = {\n [TxVariants.redirect]: Redirect,\n [TxVariants.threeDS2Challenge]: ThreeDS2Challenge,\n [TxVariants.threeDS2DeviceFingerprint]: ThreeDS2DeviceFingerprint\n};\n\nclass Registry implements IRegistry {\n public componentsMap: Record<string, NewableComponent> = defaultComponents;\n\n public supportedTxVariants: Set<string> = new Set(Object.values(TxVariants));\n\n public add(...items: NewableComponent[]) {\n this.componentsMap = {\n ...this.componentsMap,\n ...this.createComponentsMap(items)\n };\n }\n\n public getComponent(type: string): NewableComponent | undefined {\n const Component = this.componentsMap[type];\n if (Component) {\n return Component;\n }\n\n if (this.supportedTxVariants.has(type)) {\n return;\n }\n\n return Redirect;\n }\n\n public createComponentsMap(components: NewableComponent[]) {\n const componentsMap = components.reduce((memo, component) => {\n const isValid = assertClassHasType(component);\n\n if (!isValid) {\n console.error('CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement');\n return memo;\n }\n if (component.type === 'dropin') {\n return memo;\n }\n\n const supportedTxVariants = [component.type, ...component.txVariants].filter(txVariant => txVariant);\n\n supportedTxVariants.forEach(txVariant => {\n memo = {\n ...memo,\n [txVariant]: component\n };\n });\n\n return memo;\n }, {});\n\n return componentsMap;\n }\n}\n\nexport default new Registry();\n"],"names":["defaultComponents","TxVariants","redirect","Redirect","threeDS2Challenge","ThreeDS2Challenge","threeDS2DeviceFingerprint","ThreeDS2DeviceFingerprint","registry","add","items","this","componentsMap","createComponentsMap","getComponent","type","Component","supportedTxVariants","has","components","reduce","memo","component","Class","console","error","txVariants","filter","txVariant","forEach","_define_property","Set","Object","values"],"mappings":"kWAmBA,MAAMA,EAAoB,CACtB,CAACC,EAAWC,UAAWC,EACvB,CAACF,EAAWG,mBAAoBC,EAChC,CAACJ,EAAWK,2BAA4BC,GAwD5C,IAAAC,EAAe,IArDf,MAKWC,GAAAA,IAAOC,GACVC,KAAKC,cAAgB,IACdD,KAAKC,iBACLD,KAAKE,oBAAoBH,GAEpC,CAEOI,YAAAA,CAAaC,GAChB,MAAMC,EAAYL,KAAKC,cAAcG,GACrC,OAAIC,IAIAL,KAAKM,oBAAoBC,IAAIH,QAAjC,EAIOZ,EACX,CAEOU,mBAAAA,CAAoBM,GAwBvB,OAvBsBA,EAAWC,OAAO,CAACC,EAAMC,KA5CvD,IAA4BC,EA+ChB,KA9CmC,iBADnBA,EA6CmBD,GA5CTP,QAAuBQ,EAAMR,MAgDnD,OADAS,QAAQC,MAAM,sFACPJ,EAEX,GAAuB,WAAnBC,EAAUP,KACV,OAAOM,EAYX,MAT4B,CAACC,EAAUP,QAASO,EAAUI,YAAYC,OAAOC,GAAaA,GAEtEC,QAAQD,IACxBP,EAAO,IACAA,EACHO,CAACA,GAAYN,KAIdD,GACR,CAAA,EAGP,eAjDAS,EAAAnB,KAAOC,gBAAkDZ,GAEzD8B,EAAAnB,KAAOM,sBAAmC,IAAIc,IAAIC,OAAOC,OAAOhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/core/utils.ts"],"sourcesContent":["import { GENERIC_OPTIONS } from './config';\nimport type { CoreConfiguration } from './types';\n\n/**\n * Filter properties in a global configuration object from an allow list (GENERIC_OPTIONS)\n * @param globalOptions -\n * @returns any\n */\nexport function processGlobalOptions(globalOptions) {\n return Object.keys(globalOptions).reduce((r, e) => {\n if (GENERIC_OPTIONS.includes(e)) r[e] = globalOptions[e];\n return r;\n }, {});\n}\n\n/**\n * Validates that there is no unknown property as part of the CoreConfiguration.\n * The validator makes sure to throw a lint error in case a property is added to CoreConfiguration, but it is not added here\n *\n * @param props - AdyenCheckout props\n */\nexport function assertConfigurationPropertiesAreValid(propsSetByMerchant: CoreConfiguration): void {\n /** Helper that creates a function that validates the array contain ALL CoreConfiguration properties in it */\n function createConfigurationKeysValidator<T>() {\n const arrayOfAll =\n <T>() =>\n <U extends T[]>(array: U & ([T] extends [U[number]] ? unknown : 'Invalid')) =>\n array;\n const arrayWithAllKeys = arrayOfAll<T>();\n return arrayWithAllKeys;\n }\n\n const validator = createConfigurationKeysValidator<keyof CoreConfiguration>();\n const possibleFields = validator([\n 'session',\n 'environment',\n '_environmentUrls',\n 'showPayButton',\n 'clientKey',\n 'locale',\n 'translations',\n 'paymentMethodsResponse',\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'allowPaymentMethods',\n 'removePaymentMethods',\n 'srConfig',\n 'analytics',\n 'risk',\n 'order',\n 'exposeLibraryMetadata',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'onSubmit',\n 'onAdditionalDetails',\n 'onActionHandled',\n 'onChange',\n 'onError',\n 'onBalanceCheck',\n 'onOrderRequest',\n 'onPaymentMethodsRequest',\n 'onOrderCancel',\n 'onOrderUpdated',\n 'loadingContext',\n 'onEnterKeyPressed',\n 'afterAdditionalDetails'\n ]);\n\n Object.keys(propsSetByMerchant).forEach((prop: keyof CoreConfiguration) => {\n if (!possibleFields.includes(prop)) {\n console.warn(\n `AdyenCheckout - Configuration property \"${prop}\" is not a valid AdyenCheckout property. If it is a payment method configuration, make sure to pass it directly to the Component. If you are using Drop-in, make sure to pass it to \"paymentMethodsConfiguration\" object`\n );\n }\n });\n}\n\n/**\n * TODO: Check if this is correct place\n * Type guard for enums, helpful to make sure strings keep enum value\n * Comes from this: https://github.com/microsoft/TypeScript/issues/30611#issuecomment-570773496\n * @param enumVariable\n */\nexport function createEnumChecker<T extends string, TEnumValue extends string>(enumVariable: { [key in T]: TEnumValue }) {\n const enumValues = Object.values(enumVariable);\n return (value: string): value is TEnumValue => enumValues.includes(value);\n}\n"],"names":["processGlobalOptions","globalOptions","Object","keys","reduce","r","e","GENERIC_OPTIONS","includes","assertConfigurationPropertiesAreValid","propsSetByMerchant","possibleFields","array","validator","forEach","prop","console","warn","createEnumChecker","enumVariable","enumValues","values","value"],"mappings":"8CAQO,SAASA,EAAqBC,GACjC,OAAOC,OAAOC,KAAKF,GAAeG,OAAO,CAACC,EAAGC,KACrCC,EAAgBC,SAASF,KAAID,EAAEC,GAAKL,EAAcK,IAC/CD,GACR,
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/core/utils.ts"],"sourcesContent":["import { GENERIC_OPTIONS } from './config';\nimport type { CoreConfiguration } from './types';\n\n/**\n * Filter properties in a global configuration object from an allow list (GENERIC_OPTIONS)\n * @param globalOptions -\n * @returns any\n */\nexport function processGlobalOptions(globalOptions) {\n return Object.keys(globalOptions).reduce((r, e) => {\n if (GENERIC_OPTIONS.includes(e)) r[e] = globalOptions[e];\n return r;\n }, {});\n}\n\n/**\n * Validates that there is no unknown property as part of the CoreConfiguration.\n * The validator makes sure to throw a lint error in case a property is added to CoreConfiguration, but it is not added here\n *\n * @param props - AdyenCheckout props\n */\nexport function assertConfigurationPropertiesAreValid(propsSetByMerchant: CoreConfiguration): void {\n /** Helper that creates a function that validates the array contain ALL CoreConfiguration properties in it */\n function createConfigurationKeysValidator<T>() {\n const arrayOfAll =\n <T>() =>\n <U extends T[]>(array: U & ([T] extends [U[number]] ? unknown : 'Invalid')) =>\n array;\n const arrayWithAllKeys = arrayOfAll<T>();\n return arrayWithAllKeys;\n }\n\n const validator = createConfigurationKeysValidator<keyof CoreConfiguration>();\n const possibleFields = validator([\n 'session',\n 'environment',\n '_environmentUrls',\n 'showPayButton',\n 'clientKey',\n 'locale',\n 'translations',\n 'paymentMethodsResponse',\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'allowPaymentMethods',\n 'removePaymentMethods',\n 'srConfig',\n 'analytics',\n 'risk',\n 'order',\n 'exposeLibraryMetadata',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'onSubmit',\n 'onAdditionalDetails',\n 'onActionHandled',\n 'onChange',\n 'onError',\n 'onBalanceCheck',\n 'onOrderRequest',\n 'onPaymentMethodsRequest',\n 'onOrderCancel',\n 'onOrderUpdated',\n 'loadingContext',\n 'onEnterKeyPressed',\n 'afterAdditionalDetails'\n ]);\n\n Object.keys(propsSetByMerchant).forEach((prop: keyof CoreConfiguration) => {\n if (!possibleFields.includes(prop)) {\n console.warn(\n `AdyenCheckout - Configuration property \"${prop}\" is not a valid AdyenCheckout property. If it is a payment method configuration, make sure to pass it directly to the Component. If you are using Drop-in, make sure to pass it to \"paymentMethodsConfiguration\" object`\n );\n }\n });\n}\n\n/**\n * TODO: Check if this is correct place\n * Type guard for enums, helpful to make sure strings keep enum value\n * Comes from this: https://github.com/microsoft/TypeScript/issues/30611#issuecomment-570773496\n * @param enumVariable\n */\nexport function createEnumChecker<T extends string, TEnumValue extends string>(enumVariable: { [key in T]: TEnumValue }) {\n const enumValues = Object.values(enumVariable);\n return (value: string): value is TEnumValue => enumValues.includes(value);\n}\n"],"names":["processGlobalOptions","globalOptions","Object","keys","reduce","r","e","GENERIC_OPTIONS","includes","assertConfigurationPropertiesAreValid","propsSetByMerchant","possibleFields","array","validator","forEach","prop","console","warn","createEnumChecker","enumVariable","enumValues","values","value"],"mappings":"8CAQO,SAASA,EAAqBC,GACjC,OAAOC,OAAOC,KAAKF,GAAeG,OAAO,CAACC,EAAGC,KACrCC,EAAgBC,SAASF,KAAID,EAAEC,GAAKL,EAAcK,IAC/CD,GACR,CAAA,EACP,CAQO,SAASI,EAAsCC,GAWlD,MACMC,EAPE,CAAgBC,GACZA,EAMWC,CAAU,CAC7B,UACA,cACA,mBACA,gBACA,YACA,SACA,eACA,yBACA,SACA,kBACA,cACA,sBACA,uBACA,WACA,YACA,OACA,QACA,wBACA,iBACA,eACA,qBACA,kBACA,WACA,sBACA,kBACA,WACA,UACA,iBACA,iBACA,0BACA,gBACA,iBACA,iBACA,oBACA,2BAGJX,OAAOC,KAAKO,GAAoBI,QAASC,IAChCJ,EAAeH,SAASO,IACzBC,QAAQC,KACJ,2CAA2CF,8NAI3D,CAQO,SAASG,EAA+DC,GAC3E,MAAMC,EAAalB,OAAOmB,OAAOF,GACjC,OAAQG,GAAuCF,EAAWZ,SAASc,EACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat.js","sources":["../../../../../../../../node_modules/preact/compat/dist/compat.mjs"],"sourcesContent":["import{Component as n,createElement as t,options as e,toChildArray as r,Fragment as u,render as o,hydrate as i,createContext as c,createRef as l,cloneElement as f}from\"preact\";export{Component,Fragment,createContext,createElement,createRef}from\"preact\";import{useCallback as a,useContext as s,useDebugValue as h,useEffect as v,useId as d,useImperativeHandle as p,useLayoutEffect as m,useMemo as y,useReducer as _,useRef as b,useState as S}from\"preact/hooks\";export*from\"preact/hooks\";function g(n,t){for(var e in t)n[e]=t[e];return n}function E(n,t){for(var e in n)if(\"__source\"!==e&&!(e in t))return!0;for(var r in t)if(\"__source\"!==r&&n[r]!==t[r])return!0;return!1}function C(n,t){this.props=n,this.context=t}function x(n,e){function r(n){var t=this.props.ref,r=t==n.ref;return!r&&t&&(t.call?t(null):t.current=null),e?!e(this.props,n)||!r:E(this.props,n)}function u(e){return this.shouldComponentUpdate=r,t(n,e)}return u.displayName=\"Memo(\"+(n.displayName||n.name)+\")\",u.prototype.isReactComponent=!0,u.__f=!0,u}(C.prototype=new n).isPureReactComponent=!0,C.prototype.shouldComponentUpdate=function(n,t){return E(this.props,n)||E(this.state,t)};var R=e.__b;e.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),R&&R(n)};var w=\"undefined\"!=typeof Symbol&&Symbol.for&&Symbol.for(\"react.forward_ref\")||3911;function k(n){function t(t){var e=g({},t);return delete e.ref,n(e,t.ref||null)}return t.$$typeof=w,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName=\"ForwardRef(\"+(n.displayName||n.name)+\")\",t}var I=function(n,t){return null==n?null:r(r(n).map(t))},N={map:I,forEach:I,count:function(n){return n?r(n).length:0},only:function(n){var t=r(n);if(1!==t.length)throw\"Children.only\";return t[0]},toArray:r},M=e.__e;e.__e=function(n,t,e,r){if(n.then)for(var u,o=t;o=o.__;)if((u=o.__c)&&u.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),u.__c(n,t);M(n,t,e,r)};var T=e.unmount;function A(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){\"function\"==typeof n.__c&&n.__c()}),n.__c.__H=null),null!=(n=g({},n)).__c&&(n.__c.__P===e&&(n.__c.__P=t),n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return A(n,t,e)})),n}function D(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return D(n,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=e)),n}function L(){this.__u=0,this.t=null,this.__b=null}function O(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function F(n){var e,r,u;function o(o){if(e||(e=n()).then(function(n){r=n.default||n},function(n){u=n}),u)throw u;if(!r)throw e;return t(r,o)}return o.displayName=\"Lazy\",o.__f=!0,o}function U(){this.u=null,this.o=null}e.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),T&&T(n)},(L.prototype=new n).__c=function(n,t){var e=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(e);var u=O(r.__v),o=!1,i=function(){o||(o=!0,e.__R=null,u?u(c):c())};e.__R=i;var c=function(){if(!--r.__u){if(r.state.__a){var n=r.state.__a;r.__v.__k[0]=D(n,n.__c.__P,n.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(i,i)},L.prototype.componentWillUnmount=function(){this.t=[]},L.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var r=document.createElement(\"div\"),o=this.__v.__k[0].__c;this.__v.__k[0]=A(this.__b,r,o.__O=o.__P)}this.__b=null}var i=e.__a&&t(u,null,n.fallback);return i&&(i.__u&=-33),[t(u,null,e.__a?null:n.children),i]};var V=function(n,t,e){if(++e[1]===e[0]&&n.o.delete(t),n.props.revealOrder&&(\"t\"!==n.props.revealOrder[0]||!n.o.size))for(e=n.u;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.u=e=e[2]}};function W(n){return this.getChildContext=function(){return n.context},n.children}function P(n){var e=this,r=n.i;e.componentWillUnmount=function(){o(null,e.l),e.l=null,e.i=null},e.i&&e.i!==r&&e.componentWillUnmount(),e.l||(e.i=r,e.l={nodeType:1,parentNode:r,childNodes:[],contains:function(){return!0},appendChild:function(n){this.childNodes.push(n),e.i.appendChild(n)},insertBefore:function(n,t){this.childNodes.push(n),e.i.appendChild(n)},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),e.i.removeChild(n)}}),o(t(W,{context:e.context},n.__v),e.l)}function j(n,e){var r=t(P,{__v:n,i:e});return r.containerInfo=e,r}(U.prototype=new n).__a=function(n){var t=this,e=O(t.__v),r=t.o.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),V(t,n,r)):u()};e?e(o):o()}},U.prototype.render=function(n){this.u=null,this.o=new Map;var t=r(n.children);n.revealOrder&&\"b\"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return n.children},U.prototype.componentDidUpdate=U.prototype.componentDidMount=function(){var n=this;this.o.forEach(function(t,e){V(n,e,t)})};var z=\"undefined\"!=typeof Symbol&&Symbol.for&&Symbol.for(\"react.element\")||60103,B=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,H=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Z=/[A-Z0-9]/g,Y=\"undefined\"!=typeof document,$=function(n){return(\"undefined\"!=typeof Symbol&&\"symbol\"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(n)};function q(n,t,e){return null==t.__k&&(t.textContent=\"\"),o(n,t),\"function\"==typeof e&&e(),n?n.__c:null}function G(n,t,e){return i(n,t),\"function\"==typeof e&&e(),n?n.__c:null}n.prototype.isReactComponent={},[\"componentWillMount\",\"componentWillReceiveProps\",\"componentWillUpdate\"].forEach(function(t){Object.defineProperty(n.prototype,t,{configurable:!0,get:function(){return this[\"UNSAFE_\"+t]},set:function(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})});var J=e.event;function K(){}function Q(){return this.cancelBubble}function X(){return this.defaultPrevented}e.event=function(n){return J&&(n=J(n)),n.persist=K,n.isPropagationStopped=Q,n.isDefaultPrevented=X,n.nativeEvent=n};var nn,tn={enumerable:!1,configurable:!0,get:function(){return this.class}},en=e.vnode;e.vnode=function(n){\"string\"==typeof n.type&&function(n){var t=n.props,e=n.type,u={};for(var o in t){var i=t[o];if(!(\"value\"===o&&\"defaultValue\"in t&&null==i||Y&&\"children\"===o&&\"noscript\"===e||\"class\"===o||\"className\"===o)){var c=o.toLowerCase();\"defaultValue\"===o&&\"value\"in t&&null==t.value?o=\"value\":\"download\"===o&&!0===i?i=\"\":\"translate\"===c&&\"no\"===i?i=!1:\"ondoubleclick\"===c?o=\"ondblclick\":\"onchange\"!==c||\"input\"!==e&&\"textarea\"!==e||$(t.type)?\"onfocus\"===c?o=\"onfocusin\":\"onblur\"===c?o=\"onfocusout\":H.test(o)?o=c:-1===e.indexOf(\"-\")&&B.test(o)?o=o.replace(Z,\"-$&\").toLowerCase():null===i&&(i=void 0):c=o=\"oninput\",\"oninput\"===c&&u[o=c]&&(o=\"oninputCapture\"),u[o]=i}}\"select\"==e&&u.multiple&&Array.isArray(u.value)&&(u.value=r(t.children).forEach(function(n){n.props.selected=-1!=u.value.indexOf(n.props.value)})),\"select\"==e&&null!=u.defaultValue&&(u.value=r(t.children).forEach(function(n){n.props.selected=u.multiple?-1!=u.defaultValue.indexOf(n.props.value):u.defaultValue==n.props.value})),t.class&&!t.className?(u.class=t.class,Object.defineProperty(u,\"className\",tn)):(t.className&&!t.class||t.class&&t.className)&&(u.class=u.className=t.className),n.props=u}(n),n.$$typeof=z,en&&en(n)};var rn=e.__r;e.__r=function(n){rn&&rn(n),nn=n.__c};var un=e.diffed;e.diffed=function(n){un&&un(n);var t=n.props,e=n.__e;null!=e&&\"textarea\"===n.type&&\"value\"in t&&t.value!==e.value&&(e.value=null==t.value?\"\":t.value),nn=null};var on={ReactCurrentDispatcher:{current:{readContext:function(n){return nn.__n[n.__c].props.value},useCallback:a,useContext:s,useDebugValue:h,useDeferredValue:bn,useEffect:v,useId:d,useImperativeHandle:p,useInsertionEffect:gn,useLayoutEffect:m,useMemo:y,useReducer:_,useRef:b,useState:S,useSyncExternalStore:Cn,useTransition:Sn}}},cn=\"17.0.2\";function ln(n){return t.bind(null,n)}function fn(n){return!!n&&n.$$typeof===z}function an(n){return fn(n)&&n.type===u}function sn(n){return!!n&&!!n.displayName&&(\"string\"==typeof n.displayName||n.displayName instanceof String)&&n.displayName.startsWith(\"Memo(\")}function hn(n){return fn(n)?f.apply(null,arguments):n}function vn(n){return!!n.__k&&(o(null,n),!0)}function dn(n){return n&&(n.base||1===n.nodeType&&n)||null}var pn=function(n,t){return n(t)},mn=function(n,t){return n(t)},yn=u;function _n(n){n()}function bn(n){return n}function Sn(){return[!1,_n]}var gn=m,En=fn;function Cn(n,t){var e=t(),r=S({h:{__:e,v:t}}),u=r[0].h,o=r[1];return m(function(){u.__=e,u.v=t,xn(u)&&o({h:u})},[n,e,t]),v(function(){return xn(u)&&o({h:u}),n(function(){xn(u)&&o({h:u})})},[n]),e}function xn(n){var t,e,r=n.v,u=n.__;try{var o=r();return!((t=u)===(e=o)&&(0!==t||1/t==1/e)||t!=t&&e!=e)}catch(n){return!0}}var Rn={useState:S,useId:d,useReducer:_,useEffect:v,useLayoutEffect:m,useInsertionEffect:gn,useTransition:Sn,useDeferredValue:bn,useSyncExternalStore:Cn,startTransition:_n,useRef:b,useImperativeHandle:p,useMemo:y,useCallback:a,useContext:s,useDebugValue:h,version:\"17.0.2\",Children:N,render:q,hydrate:G,unmountComponentAtNode:vn,createPortal:j,createElement:t,createContext:c,createFactory:ln,cloneElement:hn,createRef:l,Fragment:u,isValidElement:fn,isElement:En,isFragment:an,isMemo:sn,findDOMNode:dn,Component:n,PureComponent:C,memo:x,forwardRef:k,flushSync:mn,unstable_batchedUpdates:pn,StrictMode:yn,Suspense:L,SuspenseList:U,lazy:F,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:on};export{N as Children,C as PureComponent,yn as StrictMode,L as Suspense,U as SuspenseList,on as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,hn as cloneElement,ln as createFactory,j as createPortal,Rn as default,dn as findDOMNode,mn as flushSync,k as forwardRef,G as hydrate,En as isElement,an as isFragment,sn as isMemo,fn as isValidElement,F as lazy,x as memo,q as render,_n as startTransition,vn as unmountComponentAtNode,pn as unstable_batchedUpdates,bn as useDeferredValue,gn as useInsertionEffect,Cn as useSyncExternalStore,Sn as useTransition,cn as version};\n//# sourceMappingURL=compat.module.js.map\n"],"names":["E","n","t","e","r","C","this","props","context","prototype","isPureReactComponent","shouldComponentUpdate","state","R","__b","type","__f","ref","M","__e","then","u","o","__","__c","__k","T","unmount","A","__H","forEach","g","__P","map","D","__v","appendChild","L","__u","O","__a","U","__R","push","i","c","__O","setState","pop","forceUpdate","componentWillUnmount","render","document","createElement","fallback","children","V","delete","revealOrder","size","length","W","getChildContext","P","l","nodeType","parentNode","childNodes","contains","insertBefore","removeChild","splice","indexOf","j","containerInfo","get","Map","reverse","set","componentDidUpdate","componentDidMount","z","Symbol","for","B","H","Z","Y","$","test","isReactComponent","Object","defineProperty","configurable","writable","value","J","event","K","Q","cancelBubble","X","defaultPrevented","persist","isPropagationStopped","isDefaultPrevented","nativeEvent","tn","enumerable","class","en","vnode","toLowerCase","replace","multiple","Array","isArray","selected","defaultValue","className","$$typeof","rn","__r","un","diffed"],"mappings":"wSAAshB,SAASA,EAAEC,EAAEC,GAAG,IAAI,IAAIC,KAAKF,EAAE,GAAG,aAAaE,KAAKA,KAAKD,GAAG,SAAS,IAAI,IAAIE,KAAKF,EAAE,GAAG,aAAaE,GAAGH,EAAEG,KAAKF,EAAEE,GAAG,OAAM,EAAG,OAAM,CAAE,CAAC,SAASC,EAAEJ,EAAEC,GAAGI,KAAKC,MAAMN,EAAEK,KAAKE,QAAQN,CAAC,EAAiTG,EAAEI,UAAU,IAAIR,GAAGS,sBAAqB,EAAGL,EAAEI,UAAUE,sBAAsB,SAASV,EAAEC,GAAG,OAAOF,EAAEM,KAAKC,MAAMN,IAAID,EAAEM,KAAKM,MAAMV,EAAE,EAAE,IAAIW,EAAEV,EAAEW,IAAIX,EAAEW,IAAI,SAASb,GAAGA,EAAEc,MAAMd,EAAEc,KAAKC,KAAKf,EAAEgB,MAAMhB,EAAEM,MAAMU,IAAIhB,EAAEgB,IAAIhB,EAAEgB,IAAI,MAAMJ,GAAGA,EAAEZ,EAAE,EAAuS,IAA2MiB,EAAEf,EAAEgB,IAAIhB,EAAEgB,IAAI,SAASlB,EAAEC,EAAEC,EAAEC,GAAG,GAAGH,EAAEmB,KAAK,IAAI,IAAIC,EAAEC,EAAEpB,EAAEoB,EAAEA,EAAEC,IAAI,IAAIF,EAAEC,EAAEE,MAAMH,EAAEG,IAAI,OAAO,MAAMtB,EAAEiB,MAAMjB,EAAEiB,IAAIhB,EAAEgB,IAAIjB,EAAEuB,IAAItB,EAAEsB,KAAKJ,EAAEG,IAAIvB,EAAEC,GAAGgB,EAAEjB,EAAEC,EAAEC,EAAEC,EAAE,EAAE,IAAIsB,EAAEvB,EAAEwB,QAAQ,SAASC,EAAE3B,EAAEC,EAAEC,GAAG,OAAOF,IAAIA,EAAEuB,KAAKvB,EAAEuB,IAAIK,MAAM5B,EAAEuB,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AevE,EAAE,YAAYsF,KAAMzG,EAAEqH,YAAYrH,EAAE2G,OAAO3G,EAAE2G,OAAO3G,EAAEqH,aAAalG,EAAEwF,MAAMxF,EAAEkG,UAAUrH,EAAEqH,WAAWtH,EAAEM,MAAMc,CAAC,CAAzmC,CAA2mCpB,GAAGA,EAAEuH,SAASvC,EAAE6B,GAAIA,EAAG7G,EAAE,EAAE,IAAIwH,EAAGtH,EAAEuH,IAAIvH,EAAEuH,IAAI,SAASzH,GAAGwH,GAAIA,EAAGxH,GAAMA,EAAEuB,GAAG,EAAE,IAAImG,EAAGxH,EAAEyH,OAAOzH,EAAEyH,OAAO,SAAS3H,GAAG0H,GAAIA,EAAG1H,GAAG,IAAIC,EAAED,EAAEM,MAAMJ,EAAEF,EAAEkB,IAAI,MAAMhB,GAAG,aAAaF,EAAEc,MAAM,UAAUb,GAAGA,EAAE6F,QAAQ5F,EAAE4F,QAAQ5F,EAAE4F,MAAM,MAAM7F,EAAE6F,MAAM,GAAG7F,EAAE6F,MAAc","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"compat.js","sources":["../../../../../../../../node_modules/preact/compat/dist/compat.mjs"],"sourcesContent":["import{Component as n,createElement as t,options as e,toChildArray as r,Fragment as u,render as o,hydrate as i,createContext as c,createRef as l,cloneElement as f}from\"preact\";export{Component,Fragment,createContext,createElement,createRef}from\"preact\";import{useCallback as a,useContext as s,useDebugValue as h,useEffect as v,useId as d,useImperativeHandle as p,useLayoutEffect as m,useMemo as y,useReducer as _,useRef as b,useState as S}from\"preact/hooks\";export*from\"preact/hooks\";function g(n,t){for(var e in t)n[e]=t[e];return n}function E(n,t){for(var e in n)if(\"__source\"!==e&&!(e in t))return!0;for(var r in t)if(\"__source\"!==r&&n[r]!==t[r])return!0;return!1}function C(n,t){this.props=n,this.context=t}function x(n,e){function r(n){var t=this.props.ref,r=t==n.ref;return!r&&t&&(t.call?t(null):t.current=null),e?!e(this.props,n)||!r:E(this.props,n)}function u(e){return this.shouldComponentUpdate=r,t(n,e)}return u.displayName=\"Memo(\"+(n.displayName||n.name)+\")\",u.prototype.isReactComponent=!0,u.__f=!0,u}(C.prototype=new n).isPureReactComponent=!0,C.prototype.shouldComponentUpdate=function(n,t){return E(this.props,n)||E(this.state,t)};var R=e.__b;e.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),R&&R(n)};var w=\"undefined\"!=typeof Symbol&&Symbol.for&&Symbol.for(\"react.forward_ref\")||3911;function k(n){function t(t){var e=g({},t);return delete e.ref,n(e,t.ref||null)}return t.$$typeof=w,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName=\"ForwardRef(\"+(n.displayName||n.name)+\")\",t}var I=function(n,t){return null==n?null:r(r(n).map(t))},N={map:I,forEach:I,count:function(n){return n?r(n).length:0},only:function(n){var t=r(n);if(1!==t.length)throw\"Children.only\";return t[0]},toArray:r},M=e.__e;e.__e=function(n,t,e,r){if(n.then)for(var u,o=t;o=o.__;)if((u=o.__c)&&u.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),u.__c(n,t);M(n,t,e,r)};var T=e.unmount;function A(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){\"function\"==typeof n.__c&&n.__c()}),n.__c.__H=null),null!=(n=g({},n)).__c&&(n.__c.__P===e&&(n.__c.__P=t),n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return A(n,t,e)})),n}function D(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return D(n,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=e)),n}function L(){this.__u=0,this.t=null,this.__b=null}function O(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function F(n){var e,r,u;function o(o){if(e||(e=n()).then(function(n){r=n.default||n},function(n){u=n}),u)throw u;if(!r)throw e;return t(r,o)}return o.displayName=\"Lazy\",o.__f=!0,o}function U(){this.u=null,this.o=null}e.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),T&&T(n)},(L.prototype=new n).__c=function(n,t){var e=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(e);var u=O(r.__v),o=!1,i=function(){o||(o=!0,e.__R=null,u?u(c):c())};e.__R=i;var c=function(){if(!--r.__u){if(r.state.__a){var n=r.state.__a;r.__v.__k[0]=D(n,n.__c.__P,n.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(i,i)},L.prototype.componentWillUnmount=function(){this.t=[]},L.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var r=document.createElement(\"div\"),o=this.__v.__k[0].__c;this.__v.__k[0]=A(this.__b,r,o.__O=o.__P)}this.__b=null}var i=e.__a&&t(u,null,n.fallback);return i&&(i.__u&=-33),[t(u,null,e.__a?null:n.children),i]};var V=function(n,t,e){if(++e[1]===e[0]&&n.o.delete(t),n.props.revealOrder&&(\"t\"!==n.props.revealOrder[0]||!n.o.size))for(e=n.u;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.u=e=e[2]}};function W(n){return this.getChildContext=function(){return n.context},n.children}function P(n){var e=this,r=n.i;e.componentWillUnmount=function(){o(null,e.l),e.l=null,e.i=null},e.i&&e.i!==r&&e.componentWillUnmount(),e.l||(e.i=r,e.l={nodeType:1,parentNode:r,childNodes:[],contains:function(){return!0},appendChild:function(n){this.childNodes.push(n),e.i.appendChild(n)},insertBefore:function(n,t){this.childNodes.push(n),e.i.appendChild(n)},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),e.i.removeChild(n)}}),o(t(W,{context:e.context},n.__v),e.l)}function j(n,e){var r=t(P,{__v:n,i:e});return r.containerInfo=e,r}(U.prototype=new n).__a=function(n){var t=this,e=O(t.__v),r=t.o.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),V(t,n,r)):u()};e?e(o):o()}},U.prototype.render=function(n){this.u=null,this.o=new Map;var t=r(n.children);n.revealOrder&&\"b\"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return n.children},U.prototype.componentDidUpdate=U.prototype.componentDidMount=function(){var n=this;this.o.forEach(function(t,e){V(n,e,t)})};var z=\"undefined\"!=typeof Symbol&&Symbol.for&&Symbol.for(\"react.element\")||60103,B=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,H=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Z=/[A-Z0-9]/g,Y=\"undefined\"!=typeof document,$=function(n){return(\"undefined\"!=typeof Symbol&&\"symbol\"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(n)};function q(n,t,e){return null==t.__k&&(t.textContent=\"\"),o(n,t),\"function\"==typeof e&&e(),n?n.__c:null}function G(n,t,e){return i(n,t),\"function\"==typeof e&&e(),n?n.__c:null}n.prototype.isReactComponent={},[\"componentWillMount\",\"componentWillReceiveProps\",\"componentWillUpdate\"].forEach(function(t){Object.defineProperty(n.prototype,t,{configurable:!0,get:function(){return this[\"UNSAFE_\"+t]},set:function(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})});var J=e.event;function K(){}function Q(){return this.cancelBubble}function X(){return this.defaultPrevented}e.event=function(n){return J&&(n=J(n)),n.persist=K,n.isPropagationStopped=Q,n.isDefaultPrevented=X,n.nativeEvent=n};var nn,tn={enumerable:!1,configurable:!0,get:function(){return this.class}},en=e.vnode;e.vnode=function(n){\"string\"==typeof n.type&&function(n){var t=n.props,e=n.type,u={};for(var o in t){var i=t[o];if(!(\"value\"===o&&\"defaultValue\"in t&&null==i||Y&&\"children\"===o&&\"noscript\"===e||\"class\"===o||\"className\"===o)){var c=o.toLowerCase();\"defaultValue\"===o&&\"value\"in t&&null==t.value?o=\"value\":\"download\"===o&&!0===i?i=\"\":\"translate\"===c&&\"no\"===i?i=!1:\"ondoubleclick\"===c?o=\"ondblclick\":\"onchange\"!==c||\"input\"!==e&&\"textarea\"!==e||$(t.type)?\"onfocus\"===c?o=\"onfocusin\":\"onblur\"===c?o=\"onfocusout\":H.test(o)?o=c:-1===e.indexOf(\"-\")&&B.test(o)?o=o.replace(Z,\"-$&\").toLowerCase():null===i&&(i=void 0):c=o=\"oninput\",\"oninput\"===c&&u[o=c]&&(o=\"oninputCapture\"),u[o]=i}}\"select\"==e&&u.multiple&&Array.isArray(u.value)&&(u.value=r(t.children).forEach(function(n){n.props.selected=-1!=u.value.indexOf(n.props.value)})),\"select\"==e&&null!=u.defaultValue&&(u.value=r(t.children).forEach(function(n){n.props.selected=u.multiple?-1!=u.defaultValue.indexOf(n.props.value):u.defaultValue==n.props.value})),t.class&&!t.className?(u.class=t.class,Object.defineProperty(u,\"className\",tn)):(t.className&&!t.class||t.class&&t.className)&&(u.class=u.className=t.className),n.props=u}(n),n.$$typeof=z,en&&en(n)};var rn=e.__r;e.__r=function(n){rn&&rn(n),nn=n.__c};var un=e.diffed;e.diffed=function(n){un&&un(n);var t=n.props,e=n.__e;null!=e&&\"textarea\"===n.type&&\"value\"in t&&t.value!==e.value&&(e.value=null==t.value?\"\":t.value),nn=null};var on={ReactCurrentDispatcher:{current:{readContext:function(n){return nn.__n[n.__c].props.value},useCallback:a,useContext:s,useDebugValue:h,useDeferredValue:bn,useEffect:v,useId:d,useImperativeHandle:p,useInsertionEffect:gn,useLayoutEffect:m,useMemo:y,useReducer:_,useRef:b,useState:S,useSyncExternalStore:Cn,useTransition:Sn}}},cn=\"17.0.2\";function ln(n){return t.bind(null,n)}function fn(n){return!!n&&n.$$typeof===z}function an(n){return fn(n)&&n.type===u}function sn(n){return!!n&&!!n.displayName&&(\"string\"==typeof n.displayName||n.displayName instanceof String)&&n.displayName.startsWith(\"Memo(\")}function hn(n){return fn(n)?f.apply(null,arguments):n}function vn(n){return!!n.__k&&(o(null,n),!0)}function dn(n){return n&&(n.base||1===n.nodeType&&n)||null}var pn=function(n,t){return n(t)},mn=function(n,t){return n(t)},yn=u;function _n(n){n()}function bn(n){return n}function Sn(){return[!1,_n]}var gn=m,En=fn;function Cn(n,t){var e=t(),r=S({h:{__:e,v:t}}),u=r[0].h,o=r[1];return m(function(){u.__=e,u.v=t,xn(u)&&o({h:u})},[n,e,t]),v(function(){return xn(u)&&o({h:u}),n(function(){xn(u)&&o({h:u})})},[n]),e}function xn(n){var t,e,r=n.v,u=n.__;try{var o=r();return!((t=u)===(e=o)&&(0!==t||1/t==1/e)||t!=t&&e!=e)}catch(n){return!0}}var Rn={useState:S,useId:d,useReducer:_,useEffect:v,useLayoutEffect:m,useInsertionEffect:gn,useTransition:Sn,useDeferredValue:bn,useSyncExternalStore:Cn,startTransition:_n,useRef:b,useImperativeHandle:p,useMemo:y,useCallback:a,useContext:s,useDebugValue:h,version:\"17.0.2\",Children:N,render:q,hydrate:G,unmountComponentAtNode:vn,createPortal:j,createElement:t,createContext:c,createFactory:ln,cloneElement:hn,createRef:l,Fragment:u,isValidElement:fn,isElement:En,isFragment:an,isMemo:sn,findDOMNode:dn,Component:n,PureComponent:C,memo:x,forwardRef:k,flushSync:mn,unstable_batchedUpdates:pn,StrictMode:yn,Suspense:L,SuspenseList:U,lazy:F,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:on};export{N as Children,C as PureComponent,yn as StrictMode,L as Suspense,U as SuspenseList,on as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,hn as cloneElement,ln as createFactory,j as createPortal,Rn as default,dn as findDOMNode,mn as flushSync,k as forwardRef,G as hydrate,En as isElement,an as isFragment,sn as isMemo,fn as isValidElement,F as lazy,x as memo,q as render,_n as startTransition,vn as unmountComponentAtNode,pn as unstable_batchedUpdates,bn as useDeferredValue,gn as useInsertionEffect,Cn as useSyncExternalStore,Sn as useTransition,cn as version};\n//# sourceMappingURL=compat.module.js.map\n"],"names":["E","n","t","e","r","C","this","props","context","prototype","isPureReactComponent","shouldComponentUpdate","state","R","__b","type","__f","ref","M","__e","then","u","o","__","__c","__k","T","unmount","A","__H","forEach","g","__P","map","D","__v","appendChild","L","__u","O","__a","U","__R","push","i","c","__O","setState","pop","forceUpdate","componentWillUnmount","render","document","createElement","fallback","children","V","delete","revealOrder","size","length","W","getChildContext","P","l","nodeType","parentNode","childNodes","contains","insertBefore","removeChild","splice","indexOf","j","containerInfo","get","Map","reverse","set","componentDidUpdate","componentDidMount","z","Symbol","for","B","H","Z","Y","$","test","isReactComponent","Object","defineProperty","configurable","writable","value","J","event","K","Q","cancelBubble","X","defaultPrevented","persist","isPropagationStopped","isDefaultPrevented","nativeEvent","tn","enumerable","class","en","vnode","toLowerCase","replace","multiple","Array","isArray","selected","defaultValue","className","$$typeof","rn","__r","un","diffed"],"mappings":"wSAAshB,SAASA,EAAEC,EAAEC,GAAG,IAAI,IAAIC,KAAKF,EAAE,GAAG,aAAaE,KAAKA,KAAKD,GAAG,SAAS,IAAI,IAAIE,KAAKF,EAAE,GAAG,aAAaE,GAAGH,EAAEG,KAAKF,EAAEE,GAAG,OAAM,EAAG,OAAM,CAAE,CAAC,SAASC,EAAEJ,EAAEC,GAAGI,KAAKC,MAAMN,EAAEK,KAAKE,QAAQN,CAAC,EAAiTG,EAAEI,UAAU,IAAIR,GAAGS,sBAAqB,EAAGL,EAAEI,UAAUE,sBAAsB,SAASV,EAAEC,GAAG,OAAOF,EAAEM,KAAKC,MAAMN,IAAID,EAAEM,KAAKM,MAAMV,EAAE,EAAE,IAAIW,EAAEV,EAAEW,IAAIX,EAAEW,IAAI,SAASb,GAAGA,EAAEc,MAAMd,EAAEc,KAAKC,KAAKf,EAAEgB,MAAMhB,EAAEM,MAAMU,IAA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