@adyen/adyen-web 6.0.0-beta.0 → 6.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -182
- package/dist/cjs/adyen.css +6 -6
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +57 -23
- package/dist/es/adyen.css +6 -6
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/Ach/Ach.js +1 -1
- package/dist/es/components/Ach/Ach.js.map +1 -1
- package/dist/es/components/Ach/components/AchInput/AchInput.js +1 -1
- package/dist/es/components/Ach/components/AchInput/AchInput.js.map +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es/components/AmazonPay/components/SignOutButton.js.map +1 -1
- package/dist/es/components/ApplePay/ApplePayService.js.map +1 -1
- package/dist/es/components/ApplePay/components/ApplePayButton.js.map +1 -1
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/DualBrandingIcon/DualBrandingIcon.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/handlers.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.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/Dropin/components/DropinComponent.js +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
- package/dist/es/components/Giftcard/Giftcard.js +1 -1
- package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
- package/dist/es/components/GooglePay/components/GooglePayButton.js.map +1 -1
- package/dist/es/components/GooglePay/requests.js.map +1 -1
- package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
- package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
- package/dist/es/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
- package/dist/es/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
- package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
- package/dist/es/components/PayPal/Paypal.js +1 -1
- package/dist/es/components/PayPal/Paypal.js.map +1 -1
- package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js +1 -1
- package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
- package/dist/es/components/components-name-map.js +1 -1
- package/dist/es/components/components-name-map.js.map +1 -1
- package/dist/es/components/internal/Address/components/AddressSearch.js +1 -1
- package/dist/es/components/internal/Address/components/AddressSearch.js.map +1 -1
- package/dist/es/components/internal/Await/Await.js.map +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js +1 -1
- package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
- package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
- package/dist/es/components/internal/Modal/Modal.js.map +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/utilities/commonUtils.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/utilities/dom.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/utilities/dom.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/utilities/logger.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/utils.js.map +1 -1
- package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
- package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.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/tx-variants.js +1 -1
- package/dist/es/components/tx-variants.js.map +1 -1
- package/dist/es/core/Analytics/Analytics.js +1 -1
- package/dist/es/core/Analytics/Analytics.js.map +1 -1
- package/dist/es/core/Environment/Environment.js +1 -1
- package/dist/es/core/Environment/Environment.js.map +1 -1
- package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
- package/dist/es/core/Services/analytics/collect-id.js +1 -1
- package/dist/es/core/Services/http.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/core/config.js.map +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/core.js.map +1 -1
- package/dist/es/core/utils.js +1 -1
- package/dist/es/core/utils.js.map +1 -1
- package/dist/es/index.d.ts +57 -23
- package/dist/es/utils/browserInfo.js +1 -1
- package/dist/es/utils/browserInfo.js.map +1 -1
- package/dist/es/utils/listenerUtils.js +2 -0
- package/dist/es/utils/listenerUtils.js.map +1 -0
- package/dist/es/utils/regex.js.map +1 -1
- package/dist/es-legacy/adyen.css +6 -6
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/Ach/Ach.js +1 -1
- package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
- package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js +1 -1
- package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePayService.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/components/ApplePayButton.js.map +1 -1
- package/dist/es-legacy/components/Card/Card.js +1 -1
- package/dist/es-legacy/components/Card/Card.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandingIcon/DualBrandingIcon.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/types.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.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/Dropin/components/DropinComponent.js +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
- package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
- package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
- package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
- package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js +1 -1
- package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
- package/dist/es-legacy/components/components-name-map.js +1 -1
- package/dist/es-legacy/components/components-name-map.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/components/AddressSearch.js +1 -1
- package/dist/es-legacy/components/internal/Address/components/AddressSearch.js.map +1 -1
- package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/errors/TimeoutError.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/errors/TimeoutError.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
- package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.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/CSF.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/commonUtils.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/dom.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/dom.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/logger.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
- package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.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/tx-variants.js +1 -1
- package/dist/es-legacy/components/tx-variants.js.map +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
- package/dist/es-legacy/core/Environment/Environment.js +1 -1
- package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
- package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
- package/dist/es-legacy/core/Services/http.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/config.js.map +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/dist/es-legacy/core/utils.js +1 -1
- package/dist/es-legacy/core/utils.js.map +1 -1
- package/dist/es-legacy/utils/browserInfo.js +1 -1
- package/dist/es-legacy/utils/browserInfo.js.map +1 -1
- package/dist/es-legacy/utils/listenerUtils.js +2 -0
- package/dist/es-legacy/utils/listenerUtils.js.map +1 -0
- package/dist/es-legacy/utils/regex.js.map +1 -1
- package/package.json +8 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paypal.js","sources":["../../../../src/components/PayPal/Paypal.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PaypalComponent from './components/PaypalComponent';\nimport defaultProps from './defaultProps';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { ERRORS } from './constants';\nimport { TxVariants } from '../tx-variants';\nimport { formatPaypalOrderContactToAdyenFormat } from './utils/format-paypal-order-contact-to-adyen-format';\n\nimport type { ICore } from '../../core/types';\nimport type { PaymentAction } from '../../types/global-types';\nimport type { Intent, PayPalConfiguration } from './types';\n\nimport './Paypal.scss';\nimport { SendAnalyticsObject } from '../../core/Analytics/types';\n\nclass PaypalElement extends UIElement<PayPalConfiguration> {\n public static type = TxVariants.paypal;\n public static subtype = 'sdk';\n\n public paymentData: string = null;\n\n private resolve = null;\n private reject = null;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: PayPalConfiguration) {\n super(checkout, props);\n this.handleSubmit = this.handleSubmit.bind(this);\n this.handleOnShippingAddressChange = this.handleOnShippingAddressChange.bind(this);\n this.handleOnShippingOptionsChange = this.handleOnShippingOptionsChange.bind(this);\n }\n\n formatProps(props: PayPalConfiguration): PayPalConfiguration {\n const merchantId = props.configuration?.merchantId;\n const intentFromConfig = props.configuration?.intent;\n const isZeroAuth = props.amount?.value === 0;\n const intent: Intent = isZeroAuth ? 'tokenize' : props.intent || intentFromConfig;\n const vault = intent === 'tokenize' || props.vault;\n\n const displayContinueToReviewPageButton = props.userAction === 'continue';\n\n return {\n ...props,\n commit: displayContinueToReviewPageButton ? false : props.commit,\n vault,\n configuration: {\n intent,\n merchantId\n }\n };\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n // Analytics will need to know about this.props.isExpress & this.props.expressPage\n super.submitAnalytics({ ...analyticsObj }, this.props);\n }\n\n public submit = () => {\n this.handleError(new AdyenCheckoutError('IMPLEMENTATION_ERROR', ERRORS.SUBMIT_NOT_SUPPORTED));\n };\n\n /**\n * Updates the paymentData value. It must be used in the PayPal Express flow, when patching the amount\n * @param paymentData - Payment data value\n */\n public updatePaymentData(paymentData: string): void {\n if (!paymentData) console.warn('PayPal - Updating payment data with an invalid value');\n this.paymentData = paymentData;\n }\n\n /**\n * Formats the component data output\n */\n protected formatData() {\n const { isExpress, userAction } = this.props;\n\n return {\n paymentMethod: {\n type: PaypalElement.type,\n userAction,\n subtype: isExpress ? 'express' : PaypalElement.subtype\n }\n };\n }\n\n public handleAction = (action: PaymentAction) => {\n return this.updateWithAction(action);\n };\n\n public updateWithAction = (action: PaymentAction) => {\n if (action.paymentMethodType !== this.type) throw new Error('Invalid Action');\n\n if (action.paymentData) {\n this.paymentData = action.paymentData;\n }\n\n if (action.sdkData && action.sdkData.token) {\n this.handleResolve(action.sdkData.token);\n } else {\n this.handleReject(ERRORS.NO_TOKEN_PROVIDED);\n }\n\n return null;\n };\n\n /**\n * Dropin Validation\n *\n * @remarks\n * Paypal does not require any specific Dropin validation\n */\n get isValid() {\n return true;\n }\n\n private handleOnApprove = (data: any, actions: any): Promise<void> | void => {\n const { onAuthorized } = this.props;\n const state = { data: { details: data, paymentData: this.paymentData } };\n\n if (!onAuthorized) {\n this.handleAdditionalDetails(state);\n return;\n }\n\n return actions.order\n .get()\n .then((paypalOrder: any) => {\n const billingAddress = formatPaypalOrderContactToAdyenFormat(paypalOrder?.payer);\n const deliveryAddress = formatPaypalOrderContactToAdyenFormat(paypalOrder?.purchase_units?.[0].shipping, true);\n\n this.setState({\n authorizedEvent: paypalOrder,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n return new Promise<void>((resolve, reject) =>\n onAuthorized(\n {\n authorizedEvent: paypalOrder,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n },\n { resolve, reject }\n )\n );\n })\n .then(() => this.handleAdditionalDetails(state))\n .catch(error => this.handleError(new AdyenCheckoutError('ERROR', 'Something went wrong while parsing PayPal Order', { cause: error })));\n };\n\n handleResolve(token: string) {\n if (!this.resolve) return this.handleError(new AdyenCheckoutError('ERROR', ERRORS.WRONG_INSTANCE));\n this.resolve(token);\n }\n\n handleReject(errorMessage: string) {\n if (!this.reject) return this.handleError(new AdyenCheckoutError('ERROR', ERRORS.WRONG_INSTANCE));\n this.reject(new Error(errorMessage));\n }\n\n private handleSubmit(): Promise<void> {\n super.submit();\n\n return new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n\n /**\n * If the merchant provides the 'onShippingAddressChange' callback, then this method is used as a wrapper to it, in order\n * to expose to the merchant the 'component' instance. The merchant needs the 'component' in order to manipulate the\n * paymentData\n *\n * @param data - PayPal data\n * @param actions - PayPal actions.\n */\n private handleOnShippingAddressChange(data: any, actions: any): Promise<void> {\n return this.props.onShippingAddressChange(data, actions, this);\n }\n\n /**\n * If the merchant provides the 'onShippingOptionsChange' callback, then this method is used as a wrapper to it, in order\n * to expose to the merchant the 'component' instance. The merchant needs the 'component' in order to manipulate the\n * paymentData\n *\n * @param data - PayPal data\n * @param actions - PayPal actions.\n */\n private handleOnShippingOptionsChange(data: any, actions: any): Promise<void> {\n return this.props.onShippingOptionsChange(data, actions, this);\n }\n\n render() {\n if (!this.props.showPayButton) return null;\n\n const { onShippingAddressChange, onShippingOptionsChange, ...rest } = this.props;\n\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <PaypalComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n {...rest}\n {...(onShippingAddressChange && { onShippingAddressChange: this.handleOnShippingAddressChange })}\n {...(onShippingOptionsChange && { onShippingOptionsChange: this.handleOnShippingOptionsChange })}\n onCancel={() => this.handleError(new AdyenCheckoutError('CANCEL'))}\n onChange={this.setState}\n onApprove={this.handleOnApprove}\n onError={error => {\n this.handleError(new AdyenCheckoutError('ERROR', error.toString(), { cause: error }));\n }}\n onScriptLoadFailure={error => this.handleError(error)}\n onSubmit={this.handleSubmit}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default PaypalElement;\n"],"names":["PaypalElement","UIElement","formatProps","props","merchantId","configuration","intentFromConfig","intent","amount","value","vault","displayContinueToReviewPageButton","userAction","_object_spread_props","commit","submitAnalytics","analyticsObj","super","_object_spread","this","updatePaymentData","paymentData","console","warn","formatData","isExpress","paymentMethod","type","subtype","isValid","handleResolve","token","resolve","handleError","AdyenCheckoutError","ERRORS","WRONG_INSTANCE","handleReject","errorMessage","reject","Error","handleSubmit","submit","Promise","handleOnShippingAddressChange","data","actions","onShippingAddressChange","handleOnShippingOptionsChange","onShippingOptionsChange","render","showPayButton","_this_props","rest","_object_without_properties","h","CoreProvider","i18n","loadingContext","resources","PaypalComponent","ref","componentRef","onCancel","onChange","setState","onApprove","handleOnApprove","onError","error","toString","cause","onScriptLoadFailure","onSubmit","constructor","checkout","_define_property","SUBMIT_NOT_SUPPORTED","handleAction","action","updateWithAction","paymentMethodType","sdkData","NO_TOKEN_PROVIDED","onAuthorized","state","details","order","get","then","paypalOrder","billingAddress","formatPaypalOrderContactToAdyenFormat","payer","deliveryAddress","purchase_units","shipping","authorizedEvent","handleAdditionalDetails","catch","bind","TxVariants","paypal","defaultProps"],"mappings":"wrDAiBA,MAAMA,UAAsBC,EAkBxBC,WAAAA,CAAYC,GACWA,IAAAA,EACMA,EACNA,EAFnB,MAAMC,EAAaD,QAAAA,EAAAA,EAAME,qBAANF,IAAAA,OAAAA,EAAAA,EAAqBC,WAClCE,EAAmBH,QAAAA,EAAAA,EAAME,qBAANF,IAAAA,OAAAA,EAAAA,EAAqBI,OAExCA,EADqC,KAAxBJ,QAAAA,EAAAA,EAAMK,cAANL,IAAAA,OAAAA,EAAAA,EAAcM,OACG,WAAaN,EAAMI,QAAUD,EAC3DI,EAAmB,aAAXH,GAAyBJ,EAAMO,MAEvCC,EAAyD,aAArBR,EAAMS,WAEhD,OAAOC,EACAV,EAAAA,CAAAA,EAAAA,GAAAA,CACHW,QAAQH,GAA4CR,EAAMW,OAC1DJ,QACAL,cAAe,CACXE,SACAH,eAGZ,CAEUW,eAAAA,CAAgBC,GAEtBC,MAAMF,gBAAgBG,EAAA,CAAA,EAAKF,GAAgBG,KAAKhB,MACpD,CAUOiB,iBAAAA,CAAkBC,GAChBA,GAAaC,QAAQC,KAAK,wDAC/BJ,KAAKE,YAAcA,CACvB,CAKA,UAAAG,GACI,MAAMC,UAAEA,EAASb,WAAEA,GAAeO,KAAKhB,MAEvC,MAAO,CACHuB,cAAe,CACXC,KAAM3B,EAAc2B,KACpBf,aACAgB,QAASH,EAAY,UAAYzB,EAAc4B,SAG3D,CA4BA,WAAIC,GACA,OAAO,CACX,CAsCAC,aAAAA,CAAcC,GACV,IAAKZ,KAAKa,QAAS,OAAOb,KAAKc,YAAY,IAAIC,EAAmB,QAASC,EAAOC,iBAClFjB,KAAKa,QAAQD,EACjB,CAEAM,YAAAA,CAAaC,GACT,IAAKnB,KAAKoB,OAAQ,OAAOpB,KAAKc,YAAY,IAAIC,EAA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7HlD,KAAK+E,wBAAwBb,EA4BsG,IAzHvIlE,KAAKsB,aAAetB,KAAKsB,aAAa2D,KAAKjF,MAC3CA,KAAKyB,8BAAgCzB,KAAKyB,8BAA8BwD,KAAKjF,MAC7EA,KAAK6B,8BAAgC7B,KAAK6B,8BAA8BoD,KAAKjF,KACjF,EAfAyD,EADE5E,EACY2B,OAAO0E,EAAWC,QAChC1B,EAFE5E,EAEY4B,UAAU,OAOxBgD,EATE5E,EASeuG,eAAeA"}
|
|
1
|
+
{"version":3,"file":"Paypal.js","sources":["../../../../src/components/PayPal/Paypal.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PaypalComponent from './components/PaypalComponent';\nimport defaultProps from './defaultProps';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { ERRORS } from './constants';\nimport { TxVariants } from '../tx-variants';\nimport { formatPaypalOrderContactToAdyenFormat } from './utils/format-paypal-order-contact-to-adyen-format';\n\nimport type { ICore } from '../../core/types';\nimport type { PaymentAction } from '../../types/global-types';\nimport type { Intent, PayPalConfiguration } from './types';\n\nimport './Paypal.scss';\nimport { SendAnalyticsObject } from '../../core/Analytics/types';\n\nclass PaypalElement extends UIElement<PayPalConfiguration> {\n public static type = TxVariants.paypal;\n public static subtype = 'sdk';\n\n public paymentData: string = null;\n\n private resolve = null;\n private reject = null;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: PayPalConfiguration) {\n super(checkout, props);\n this.handleSubmit = this.handleSubmit.bind(this);\n this.handleOnShippingAddressChange = this.handleOnShippingAddressChange.bind(this);\n this.handleOnShippingOptionsChange = this.handleOnShippingOptionsChange.bind(this);\n }\n\n formatProps(props: PayPalConfiguration): PayPalConfiguration {\n const merchantId = props.configuration?.merchantId;\n const intentFromConfig = props.configuration?.intent;\n const isZeroAuth = props.amount?.value === 0;\n const intent: Intent = isZeroAuth ? 'tokenize' : props.intent || intentFromConfig;\n const vault = intent === 'tokenize' || props.vault;\n\n const displayContinueToReviewPageButton = props.userAction === 'continue';\n\n return {\n ...props,\n commit: displayContinueToReviewPageButton ? false : props.commit,\n vault,\n configuration: {\n intent,\n merchantId\n }\n };\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n // Analytics will need to know about this.props.isExpress & this.props.expressPage\n super.submitAnalytics({ ...analyticsObj }, this.props);\n }\n\n public submit = () => {\n this.handleError(new AdyenCheckoutError('IMPLEMENTATION_ERROR', ERRORS.SUBMIT_NOT_SUPPORTED));\n };\n\n /**\n * Updates the paymentData value. It must be used in the PayPal Express flow, when patching the amount\n * @param paymentData - Payment data value\n */\n public updatePaymentData(paymentData: string): void {\n if (!paymentData) console.warn('PayPal - Updating payment data with an invalid value');\n this.paymentData = paymentData;\n }\n\n /**\n * Formats the component data output\n */\n protected formatData() {\n const { isExpress, userAction } = this.props;\n\n return {\n paymentMethod: {\n type: PaypalElement.type,\n userAction,\n subtype: isExpress ? 'express' : PaypalElement.subtype\n }\n };\n }\n\n public handleAction = (action: PaymentAction) => {\n return this.updateWithAction(action);\n };\n\n public updateWithAction = (action: PaymentAction) => {\n if (action.paymentMethodType !== this.type) throw new Error('Invalid Action');\n\n if (action.paymentData) {\n this.paymentData = action.paymentData;\n }\n\n if (action.sdkData && action.sdkData.token) {\n this.handleResolve(action.sdkData.token);\n } else {\n this.handleReject(ERRORS.NO_TOKEN_PROVIDED);\n }\n\n return null;\n };\n\n /**\n * Dropin Validation\n *\n * @remarks\n * Paypal does not require any specific Dropin validation\n */\n get isValid() {\n return true;\n }\n\n private handleOnApprove = (data: any, actions: any): Promise<void> | void => {\n const { onAuthorized } = this.props;\n const state = { data: { details: data, paymentData: this.paymentData } };\n\n if (!onAuthorized) {\n this.handleAdditionalDetails(state);\n return;\n }\n\n return actions.order\n .get()\n .then((paypalOrder: any) => {\n const billingAddress = formatPaypalOrderContactToAdyenFormat(paypalOrder?.payer);\n const deliveryAddress = formatPaypalOrderContactToAdyenFormat(paypalOrder?.purchase_units?.[0].shipping, true);\n\n this.setState({\n authorizedEvent: paypalOrder,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n return new Promise<void>((resolve, reject) =>\n onAuthorized(\n {\n authorizedEvent: paypalOrder,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n },\n { resolve, reject }\n )\n );\n })\n .then(() => this.handleAdditionalDetails(state))\n .catch(error => this.handleError(new AdyenCheckoutError('ERROR', 'Something went wrong while parsing PayPal Order', { cause: error })));\n };\n\n handleResolve(token: string) {\n if (!this.resolve) return this.handleError(new AdyenCheckoutError('ERROR', ERRORS.WRONG_INSTANCE));\n this.resolve(token);\n }\n\n handleReject(errorMessage: string) {\n if (!this.reject) return this.handleError(new AdyenCheckoutError('ERROR', ERRORS.WRONG_INSTANCE));\n this.reject(new Error(errorMessage));\n }\n\n private handleSubmit(): Promise<void> {\n super.submit();\n\n return new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n\n /**\n * If the merchant provides the 'onShippingAddressChange' callback, then this method is used as a wrapper to it, in order\n * to expose to the merchant the 'component' instance. The merchant needs the 'component' in order to manipulate the\n * paymentData\n *\n * @param data - PayPal data\n * @param actions - PayPal actions.\n */\n private handleOnShippingAddressChange(data: any, actions: any): Promise<void> {\n return this.props.onShippingAddressChange(data, actions, this);\n }\n\n /**\n * If the merchant provides the 'onShippingOptionsChange' callback, then this method is used as a wrapper to it, in order\n * to expose to the merchant the 'component' instance. The merchant needs the 'component' in order to manipulate the\n * paymentData\n *\n * @param data - PayPal data\n * @param actions - PayPal actions.\n */\n private handleOnShippingOptionsChange(data: any, actions: any): Promise<void> {\n return this.props.onShippingOptionsChange(data, actions, this);\n }\n\n render() {\n if (!this.props.showPayButton) return null;\n\n const { onShippingAddressChange, onShippingOptionsChange, ...rest } = this.props;\n\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <PaypalComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n {...rest}\n {...(onShippingAddressChange && { onShippingAddressChange: this.handleOnShippingAddressChange })}\n {...(onShippingOptionsChange && { onShippingOptionsChange: this.handleOnShippingOptionsChange })}\n onCancel={() => this.handleError(new AdyenCheckoutError('CANCEL'))}\n onChange={this.setState}\n onApprove={void this.handleOnApprove}\n onError={error => {\n this.handleError(new AdyenCheckoutError('ERROR', error.toString(), { cause: error }));\n }}\n onScriptLoadFailure={error => this.handleError(error)}\n onSubmit={this.handleSubmit}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default PaypalElement;\n"],"names":["PaypalElement","UIElement","formatProps","props","merchantId","configuration","intentFromConfig","intent","amount","value","vault","displayContinueToReviewPageButton","userAction","_object_spread_props","commit","submitAnalytics","analyticsObj","super","_object_spread","this","updatePaymentData","paymentData","console","warn","formatData","isExpress","paymentMethod","type","subtype","isValid","handleResolve","token","resolve","handleError","AdyenCheckoutError","ERRORS","WRONG_INSTANCE","handleReject","errorMessage","reject","Error","handleSubmit","submit","Promise","handleOnShippingAddressChange","data","actions","onShippingAddressChange","handleOnShippingOptionsChange","onShippingOptionsChange","render","showPayButton","_this_props","rest","_object_without_properties","h","CoreProvider","i18n","loadingContext","resources","PaypalComponent","ref","componentRef","onCancel","onChange","setState","onApprove","handleOnApprove","onError","error","toString","cause","onScriptLoadFailure","onSubmit","constructor","checkout","_define_property","SUBMIT_NOT_SUPPORTED","handleAction","action","updateWithAction","paymentMethodType","sdkData","NO_TOKEN_PROVIDED","onAuthorized","state","details","order","get","then","paypalOrder","billingAddress","formatPaypalOrderContactToAdyenFormat","payer","deliveryAddress","purchase_units","shipping","authorizedEvent","handleAdditionalDetails","catch","bind","TxVariants","paypal","defaultProps"],"mappings":"wrDAiBA,MAAMA,UAAsBC,EAkBxBC,WAAAA,CAAYC,GACWA,IAAAA,EACMA,EACNA,EAFnB,MAAMC,EAAaD,QAAAA,EAAAA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ChC1B,EAFE5E,EAEY4B,UAAU,OAOxBgD,EATE5E,EASeuG,eAAeA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as t,createElement as e}from"../../../../external/preact/dist/preact.js";import r from"../../../../utils/detectInIframeInSameOrigin.js";function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){o(t,e,r[e])}))}return t}class s extends t{componentDidMount(){new Promise(((t,e)=>this.props.beforeRedirect(t,e,n({url:this.props.url,method:this.props.method},this.props.data?{data:this.props.data}:{})))).then((()=>{var t,e;this.postForm?this.postForm.submit():this.props.redirectFromTopWhenInIframe&&r()?null===(t=(e=window.top.location).assign)||void 0===t||t.call(e,this.props.url):window.location.assign(this.props.url)})).catch((()=>{}))}render({url:t,method:o,data:s={}}){return"POST"===o?e("form",n({method:"post",action:t,style:{display:"none"},ref:t=>{this.postForm=t}},this.props.redirectFromTopWhenInIframe&&r()&&{target:"_top"}),Object.keys(s).map((t=>e("input",{type:"hidden",name:t,key:t,value:s[t]})))):null}constructor(...t){super(...t),o(this,"postForm",void 0)}}o(s,"defaultProps",{beforeRedirect:t=>t(),method:"GET"});export{s as default};
|
|
1
|
+
import{Component as t,createElement as e}from"../../../../external/preact/dist/preact.js";import r from"../../../../utils/detectInIframeInSameOrigin.js";function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){o(t,e,r[e])}))}return t}class s extends t{componentDidMount(){new Promise(((t,e)=>{this.props.beforeRedirect(t,e,n({url:this.props.url,method:this.props.method},this.props.data?{data:this.props.data}:{}))})).then((()=>{var t,e;this.postForm?this.postForm.submit():this.props.redirectFromTopWhenInIframe&&r()?null===(t=(e=window.top.location).assign)||void 0===t||t.call(e,this.props.url):window.location.assign(this.props.url)})).catch((()=>{}))}render({url:t,method:o,data:s={}}){return"POST"===o?e("form",n({method:"post",action:t,style:{display:"none"},ref:t=>{this.postForm=t}},this.props.redirectFromTopWhenInIframe&&r()&&{target:"_top"}),Object.keys(s).map((t=>e("input",{type:"hidden",name:t,key:t,value:s[t]})))):null}constructor(...t){super(...t),o(this,"postForm",void 0)}}o(s,"defaultProps",{beforeRedirect:t=>t(),method:"GET"});export{s as default};
|
|
2
2
|
//# sourceMappingURL=RedirectShopper.js.map
|
package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectShopper.js","sources":["../../../../../../src/components/Redirect/components/RedirectShopper/RedirectShopper.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport detectInIframeInSameOrigin from '../../../../utils/detectInIframeInSameOrigin';\n\ninterface RedirectShopperProps {\n beforeRedirect: (resolve, reject, url) => Promise<void>;\n url: string;\n method: 'GET' | 'POST';\n data?: any;\n redirectFromTopWhenInIframe?: boolean;\n}\n\nclass RedirectShopper extends Component<RedirectShopperProps> {\n private postForm;\n public static defaultProps = {\n beforeRedirect: resolve => resolve(),\n method: 'GET'\n };\n\n componentDidMount() {\n const doRedirect = () => {\n if (this.postForm) {\n this.postForm.submit();\n } else {\n if (this.props.redirectFromTopWhenInIframe && detectInIframeInSameOrigin()) {\n // if in an iframe and the config prop allows it - try to redirect from the top level window\n window.top.location.assign?.(this.props.url);\n } else {\n window.location.assign(this.props.url);\n }\n }\n };\n\n const dispatchEvent = new Promise((resolve, reject) =>\n
|
|
1
|
+
{"version":3,"file":"RedirectShopper.js","sources":["../../../../../../src/components/Redirect/components/RedirectShopper/RedirectShopper.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport detectInIframeInSameOrigin from '../../../../utils/detectInIframeInSameOrigin';\n\ninterface RedirectShopperProps {\n beforeRedirect: (resolve, reject, url) => Promise<void>;\n url: string;\n method: 'GET' | 'POST';\n data?: any;\n redirectFromTopWhenInIframe?: boolean;\n}\n\nclass RedirectShopper extends Component<RedirectShopperProps> {\n private postForm;\n public static defaultProps = {\n beforeRedirect: resolve => resolve(),\n method: 'GET'\n };\n\n componentDidMount() {\n const doRedirect = () => {\n if (this.postForm) {\n this.postForm.submit();\n } else {\n if (this.props.redirectFromTopWhenInIframe && detectInIframeInSameOrigin()) {\n // if in an iframe and the config prop allows it - try to redirect from the top level window\n window.top.location.assign?.(this.props.url);\n } else {\n window.location.assign(this.props.url);\n }\n }\n };\n\n const dispatchEvent = new Promise(\n (resolve, reject) =>\n void this.props.beforeRedirect(resolve, reject, {\n url: this.props.url,\n method: this.props.method,\n ...(this.props.data ? { data: this.props.data } : {})\n })\n );\n\n dispatchEvent.then(doRedirect).catch(() => {});\n }\n\n render({ url, method, data = {} }) {\n if (method === 'POST') {\n return (\n <form\n method=\"post\"\n action={url}\n style={{ display: 'none' }}\n ref={ref => {\n this.postForm = ref;\n }}\n {...(this.props.redirectFromTopWhenInIframe && detectInIframeInSameOrigin() && { target: '_top' })}\n >\n {Object.keys(data).map(key => (\n <input type=\"hidden\" name={key} key={key} value={data[key]} />\n ))}\n </form>\n );\n }\n\n return null;\n }\n}\n\nexport default RedirectShopper;\n"],"names":["RedirectShopper","Component","componentDidMount","Promise","resolve","reject","this","props","beforeRedirect","_object_spread","url","method","data","then","window","postForm","submit","redirectFromTopWhenInIframe","detectInIframeInSameOrigin","top","location","assign","catch","render","h","form","action","style","display","ref","target","Object","keys","map","key","input","type","name","value","_define_property","defaultProps"],"mappings":"ylBAWA,MAAMA,UAAwBC,EAO1BC,iBAAAA,GAc0B,IAAIC,SACtB,CAACC,EAASC,KACDC,KAAKC,MAAMC,eAAeJ,EAASC,EAAQI,EAAA,CAC5CC,IAAKJ,KAAKC,MAAMG,IAChBC,OAAQL,KAAKC,MAAMI,QACfL,KAAKC,MAAMK,KAAO,CAAEA,KAAMN,KAAKC,MAAMK,MAAS,CAAA,GAAC,IAIjDC,MAtBK,SAMPC,EAAAA,EALJR,KAAKS,SACLT,KAAKS,SAASC,SAEVV,KAAKC,MAAMU,6BAA+BC,IAE1CJ,QAAAA,GAAAA,EAAAA,OAAOK,IAAIC,UAASC,cAApBP,IAAAA,GAAAA,OAAAA,EAA6BR,KAAKC,MAAMG,KAExCI,OAAOM,SAASC,OAAOf,KAAKC,MAAMG,IAE1C,IAY2BY,OAAM,QACzC,CAEAC,MAAAA,EAAOb,IAAEA,EAAGC,OAAEA,EAAMC,KAAEA,EAAO,CAAE,IAC3B,MAAe,SAAXD,EAEIa,EAACC,OAAAA,EAAAA,CACGd,OAAO,OACPe,OAAQhB,EACRiB,MAAO,CAAEC,QAAS,QAClBC,IAAKA,IACDvB,KAAKS,SAAWc,CAAAA,GAEfvB,KAAKC,MAAMU,6BAA+BC,KAAgC,CAAEY,OAAQ,SAExFC,OAAOC,KAAKpB,GAAMqB,KAAIC,GACnBV,EAACW,QAAAA,CAAMC,KAAK,SAASC,KAAMH,EAAKA,IAAKA,EAAKI,MAAO1B,EAAKsB,QAM/D,IACX,+BApDAK,EAAAjC,KAAQS,gBAAR,IACAwB,EAFEvC,EAEYwC,eAAe,CACzBhC,eAAgBJ,GAAWA,IAC3BO,OAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoChallenge3DS2.js","sources":["../../../../../../src/components/ThreeDS2/components/Challenge/DoChallenge3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport Iframe from '../../../internal/IFrame';\nimport Spinner from '../../../internal/Spinner';\nimport ThreeDS2Form from '../Form';\nimport getProcessMessageHandler from '../../../../utils/get-process-message-handler';\nimport { encodeBase64URL } from '../utils';\nimport promiseTimeout from '../../../../utils/promiseTimeout';\nimport { CHALLENGE_TIMEOUT, CHALLENGE_TIMEOUT_REJECT_OBJECT, THREEDS2_NUM } from '../../constants';\nimport { DoChallenge3DS2Props, DoChallenge3DS2State } from './types';\nimport { ThreeDS2FlowObject } from '../../types';\n\nconst iframeName = 'threeDSIframe';\n\nclass DoChallenge3DS2 extends Component<DoChallenge3DS2Props, DoChallenge3DS2State> {\n private processMessageHandler;\n private challengePromise: { cancel: () => void; promise: Promise<any> };\n\n constructor(props) {\n super(props);\n\n /**\n * Create and Base64Url encode a JSON object containing the serverTransactionID & threeDSMethodNotificationURL\n */\n const jsonStr = JSON.stringify(this.props.cReqData);\n const base64URLencodedData = encodeBase64URL(jsonStr);\n this.state = { base64URLencodedData, status: 'init' };\n }\n\n private iframeCallback = () => {\n this.setState({ status: 'iframeLoaded' });\n // On Test - actually calls-back 3 times: once for challenge screen, once again as challenge.html reloads after the challenge is submitted, and once for redirect to threeDSNotificationURL.\n // But for the purposes of calling the merchant defined onActionHandled callback - we only want to do it once\n if (this.state.status === 'init') {\n this.props.onActionHandled({ componentType: '3DS2Challenge', actionDescription: `${THREEDS2_NUM} challenge iframe loaded` });\n }\n };\n\n private get3DS2ChallengePromise(): Promise<any> {\n return new Promise((resolve, reject) => {\n /**\n * Listen for postMessage responses from the notification url\n */\n this.processMessageHandler = getProcessMessageHandler(this.props.postMessageDomain, resolve, reject, 'challengeResult');\n\n
|
|
1
|
+
{"version":3,"file":"DoChallenge3DS2.js","sources":["../../../../../../src/components/ThreeDS2/components/Challenge/DoChallenge3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport Iframe from '../../../internal/IFrame';\nimport Spinner from '../../../internal/Spinner';\nimport ThreeDS2Form from '../Form';\nimport getProcessMessageHandler from '../../../../utils/get-process-message-handler';\nimport { encodeBase64URL } from '../utils';\nimport promiseTimeout from '../../../../utils/promiseTimeout';\nimport { CHALLENGE_TIMEOUT, CHALLENGE_TIMEOUT_REJECT_OBJECT, THREEDS2_NUM } from '../../constants';\nimport { DoChallenge3DS2Props, DoChallenge3DS2State } from './types';\nimport { ThreeDS2FlowObject } from '../../types';\n\nconst iframeName = 'threeDSIframe';\n\nclass DoChallenge3DS2 extends Component<DoChallenge3DS2Props, DoChallenge3DS2State> {\n private processMessageHandler;\n private challengePromise: { cancel: () => void; promise: Promise<any> };\n\n constructor(props) {\n super(props);\n\n /**\n * Create and Base64Url encode a JSON object containing the serverTransactionID & threeDSMethodNotificationURL\n */\n const jsonStr = JSON.stringify(this.props.cReqData);\n const base64URLencodedData = encodeBase64URL(jsonStr);\n this.state = { base64URLencodedData, status: 'init' };\n }\n\n private iframeCallback = () => {\n this.setState({ status: 'iframeLoaded' });\n // On Test - actually calls-back 3 times: once for challenge screen, once again as challenge.html reloads after the challenge is submitted, and once for redirect to threeDSNotificationURL.\n // But for the purposes of calling the merchant defined onActionHandled callback - we only want to do it once\n if (this.state.status === 'init') {\n this.props.onActionHandled({ componentType: '3DS2Challenge', actionDescription: `${THREEDS2_NUM} challenge iframe loaded` });\n }\n };\n\n private get3DS2ChallengePromise(): Promise<any> {\n return new Promise((resolve, reject) => {\n /**\n * Listen for postMessage responses from the notification url\n */\n this.processMessageHandler = getProcessMessageHandler(this.props.postMessageDomain, resolve, reject, 'challengeResult');\n\n \n window.addEventListener('message', this.processMessageHandler);\n });\n }\n\n componentDidMount() {\n // Render challenge\n this.challengePromise = promiseTimeout(CHALLENGE_TIMEOUT, this.get3DS2ChallengePromise(), CHALLENGE_TIMEOUT_REJECT_OBJECT);\n this.challengePromise.promise\n .then((resolveObject: ThreeDS2FlowObject) => {\n window.removeEventListener('message', this.processMessageHandler);\n this.props.onCompleteChallenge(resolveObject);\n })\n /** Catch, for when Challenge times-out */\n .catch((rejectObject: ThreeDS2FlowObject) => {\n window.removeEventListener('message', this.processMessageHandler);\n this.props.onErrorChallenge(rejectObject);\n });\n }\n\n componentWillUnmount() {\n if (this.challengePromise) this.challengePromise.cancel();\n window.removeEventListener('message', this.processMessageHandler);\n }\n\n render({ acsURL, cReqData, iframeSizeArr, onFormSubmit }, { base64URLencodedData, status }) {\n const [width, height] = iframeSizeArr;\n\n return (\n <div\n className={classNames([\n 'adyen-checkout__threeds2__challenge',\n `adyen-checkout__threeds2__challenge--${cReqData.challengeWindowSize}`\n ])}\n >\n {status !== 'iframeLoaded' && <Spinner />}\n\n <Iframe name={iframeName} width={width} height={height} callback={this.iframeCallback} />\n <ThreeDS2Form\n name={'cReqForm'}\n action={acsURL}\n target={iframeName}\n inputName={'creq'}\n inputValue={base64URLencodedData}\n onFormSubmit={onFormSubmit}\n />\n </div>\n );\n }\n}\n\nexport default DoChallenge3DS2;\n"],"names":["iframeName","DoChallenge3DS2","Component","get3DS2ChallengePromise","Promise","resolve","reject","this","processMessageHandler","getProcessMessageHandler","props","postMessageDomain","window","addEventListener","componentDidMount","challengePromise","promiseTimeout","CHALLENGE_TIMEOUT","CHALLENGE_TIMEOUT_REJECT_OBJECT","promise","then","resolveObject","removeEventListener","onCompleteChallenge","catch","rejectObject","onErrorChallenge","componentWillUnmount","cancel","render","acsURL","cReqData","iframeSizeArr","onFormSubmit","base64URLencodedData","status","width","height","h","div","className","classNames","challengeWindowSize","Spinner","Iframe","name","callback","iframeCallback","ThreeDS2Form","action","target","inputName","inputValue","constructor","super","_define_property","setState","state","onActionHandled","componentType","actionDescription","THREEDS2_NUM","jsonStr","JSON","stringify","encodeBase64URL"],"mappings":"sqBAYA,MAAMA,EAAa,gBAEnB,MAAMC,UAAwBC,EAwBlBC,uBAAAA,GACJ,OAAO,IAAIC,SAAQ,CAACC,EAASC,KAIzBC,KAAKC,sBAAwBC,EAAyBF,KAAKG,MAAMC,kBAAmBN,EAASC,EAAQ,mBAGrGM,OAAOC,iBAAiB,UAAWN,KAAKC,sB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AKkD,MAAQ,CAAEvB,uBAAsBC,OAAQ,OACjD"}
|
package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoFingerprint3DS2.js","sources":["../../../../../../src/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport Iframe from '../../../internal/IFrame';\nimport Spinner from '../../../internal/Spinner';\nimport ThreeDS2Form from '../Form';\nimport promiseTimeout from '../../../../utils/promiseTimeout';\nimport getProcessMessageHandler from '../../../../utils/get-process-message-handler';\nimport { THREEDS_METHOD_TIMEOUT, FAILED_METHOD_STATUS_RESOLVE_OBJECT_TIMEOUT, THREEDS2_NUM } from '../../constants';\nimport { encodeBase64URL } from '../utils';\nimport { DoFingerprint3DS2Props, DoFingerprint3DS2State } from './types';\n\nconst iframeName = 'threeDSMethodIframe';\n\n/**\n * Create and Base64URL encode a JSON object containing the serverTransactionID & threeDSMethodNotificationURL.\n * This Base64URL string will be added to the <form> in the ThreeDS2Form component.\n * The ThreeDS2Form component will submit the <form> when it mounts, using the ThreeDS2Iframe as the <form> target.\n * getProcessMessageHandler will listen for the postMessage response from the notificationURL and will settle the\n * promise accordingly causing this component to call the appropriate callback.\n * The callbacks exist in the parent component: ThreeDS2DeviceFingerprint where they ultimately call the onComplete\n * function passed as a prop when checkout.create('threeDS2DeviceFingerprint') is called.\n */\nclass DoFingerprint3DS2 extends Component<DoFingerprint3DS2Props, DoFingerprint3DS2State> {\n private processMessageHandler;\n private fingerPrintPromise: any;\n public static defaultProps = {\n showSpinner: true\n };\n\n constructor(props) {\n super(props);\n\n /**\n * Create and Base64URL encode a JSON object\n */\n const { threeDSServerTransID, threeDSMethodNotificationURL } = this.props;\n\n const jsonStr = JSON.stringify({\n threeDSServerTransID,\n threeDSMethodNotificationURL\n });\n const base64URLencodedData = encodeBase64URL(jsonStr);\n this.state = { base64URLencodedData };\n }\n\n get3DS2MethodPromise() {\n return new Promise((resolve, reject) => {\n /**\n * Listen for postMessage responses from the notification url\n */\n this.processMessageHandler = getProcessMessageHandler(this.props.postMessageDomain, resolve, reject, 'fingerPrintResult');\n\n
|
|
1
|
+
{"version":3,"file":"DoFingerprint3DS2.js","sources":["../../../../../../src/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport Iframe from '../../../internal/IFrame';\nimport Spinner from '../../../internal/Spinner';\nimport ThreeDS2Form from '../Form';\nimport promiseTimeout from '../../../../utils/promiseTimeout';\nimport getProcessMessageHandler from '../../../../utils/get-process-message-handler';\nimport { THREEDS_METHOD_TIMEOUT, FAILED_METHOD_STATUS_RESOLVE_OBJECT_TIMEOUT, THREEDS2_NUM } from '../../constants';\nimport { encodeBase64URL } from '../utils';\nimport { DoFingerprint3DS2Props, DoFingerprint3DS2State } from './types';\n\nconst iframeName = 'threeDSMethodIframe';\n\n/**\n * Create and Base64URL encode a JSON object containing the serverTransactionID & threeDSMethodNotificationURL.\n * This Base64URL string will be added to the <form> in the ThreeDS2Form component.\n * The ThreeDS2Form component will submit the <form> when it mounts, using the ThreeDS2Iframe as the <form> target.\n * getProcessMessageHandler will listen for the postMessage response from the notificationURL and will settle the\n * promise accordingly causing this component to call the appropriate callback.\n * The callbacks exist in the parent component: ThreeDS2DeviceFingerprint where they ultimately call the onComplete\n * function passed as a prop when checkout.create('threeDS2DeviceFingerprint') is called.\n */\nclass DoFingerprint3DS2 extends Component<DoFingerprint3DS2Props, DoFingerprint3DS2State> {\n private processMessageHandler;\n private fingerPrintPromise: any;\n public static defaultProps = {\n showSpinner: true\n };\n\n constructor(props) {\n super(props);\n\n /**\n * Create and Base64URL encode a JSON object\n */\n const { threeDSServerTransID, threeDSMethodNotificationURL } = this.props;\n\n const jsonStr = JSON.stringify({\n threeDSServerTransID,\n threeDSMethodNotificationURL\n });\n const base64URLencodedData = encodeBase64URL(jsonStr);\n this.state = { base64URLencodedData };\n }\n\n get3DS2MethodPromise() {\n return new Promise((resolve, reject) => {\n /**\n * Listen for postMessage responses from the notification url\n */\n this.processMessageHandler = getProcessMessageHandler(this.props.postMessageDomain, resolve, reject, 'fingerPrintResult');\n\n \n window.addEventListener('message', this.processMessageHandler);\n });\n }\n\n componentDidMount() {\n // Check 3DS2 Device fingerprint\n this.fingerPrintPromise = promiseTimeout(THREEDS_METHOD_TIMEOUT, this.get3DS2MethodPromise(), FAILED_METHOD_STATUS_RESOLVE_OBJECT_TIMEOUT);\n this.fingerPrintPromise.promise\n .then(resolveObject => {\n window.removeEventListener('message', this.processMessageHandler);\n this.props.onCompleteFingerprint(resolveObject);\n })\n .catch(rejectObject => {\n window.removeEventListener('message', this.processMessageHandler);\n this.props.onErrorFingerprint(rejectObject);\n });\n }\n\n componentWillUnmount() {\n if (this.fingerPrintPromise) this.fingerPrintPromise.cancel();\n window.removeEventListener('message', this.processMessageHandler);\n }\n\n render({ threeDSMethodURL, onActionHandled, onFormSubmit }, { base64URLencodedData }) {\n return (\n <div className=\"adyen-checkout__3ds2-device-fingerprint\">\n {this.props.showSpinner && <Spinner />}\n <div style={{ display: 'none' }}>\n <Iframe\n name={iframeName}\n callback={() => {\n onActionHandled({ componentType: '3DS2Fingerprint', actionDescription: `${THREEDS2_NUM} fingerprint iframe loaded` });\n }}\n />\n <ThreeDS2Form\n name={'threeDSMethodForm'}\n action={threeDSMethodURL}\n target={iframeName}\n inputName={'threeDSMethodData'}\n inputValue={base64URLencodedData}\n onFormSubmit={onFormSubmit}\n />\n </div>\n </div>\n );\n }\n}\n\nexport default DoFingerprint3DS2;\n"],"names":["iframeName","DoFingerprint3DS2","Component","get3DS2MethodPromise","Promise","resolve","reject","this","processMessageHandler","getProcessMessageHandler","props","postMessageDomain","window","addEventListener","componentDidMount","fingerPrintPromise","promiseTimeout","THREEDS_METHOD_TIMEOUT","FAILED_METHOD_STATUS_RESOLVE_OBJECT_TIMEOUT","promise","then","resolveObject","removeEventListener","onCompleteFingerprint","catch","rejectObject","onErrorFingerprint","componentWillUnmount","cancel","render","threeDSMethodURL","onActionHandled","onFormSubmit","base64URLencodedData","h","div","className","showSpinner","Spinner","style","display","Iframe","name","callback","componentType","actionDescription","THREEDS2_NUM","ThreeDS2Form","action","target","inputName","inputValue","constructor","super","_define_property","threeDSServerTransID","threeDSMethodNotificationURL","jsonStr","JSON","stringify","encodeBase64URL","state","defaultProps"],"mappings":"+nBAUA,MAAMA,EAAa,sBAWnB,MAAMC,UAA0BC,EAuB5BC,oBAAAA,GACI,OAAO,IAAIC,SAAQ,CAACC,EAASC,KAIzBC,KAAKC,sBAAwBC,EAAyBF,KAAKG,MAAMC,kBAAmBN,EAASC,EAAQ,qBAGrGM,OAAOC,iBAAiB,UAAWN,KAAKC,sBAAqB,GAErE,CAEAM,iBAAAA,GAEIP,KAAKQ,mBAAqBC,EAAeC,EAAwBV,KAAKJ,uBAAwBe,GAC9FX,KAAKQ,mBAAmBI,QACnBC,MAAKC,IACFT,OAAOU,oBAAoB,UAAWf,KAAKC,uBAC3CD,KAAKG,MAAMa,sBAAsBF,EAAAA,IAEpCG,OAAMC,IACHb,OAAOU,oBAAoB,UAAWf,KAAKC,uBAC3CD,KAAKG,MAAMgB,mBAAmBD,EAAAA,GAE1C,CAEAE,oBAAAA,GACQpB,KAAKQ,oBAAoBR,KAAKQ,mBAAmBa,SACrDhB,OAAOU,oBAAoB,UAAWf,KAAKC,sBAC/C,CAEAqB,MAAAA,EAAOC,iBAAEA,EAAgBC,gBAAEA,EAAeC,aAAEA,IAAgBC,qBAAEA,IAC1D,OACIC,EAACC,MAAAA,CAAIC,UAAU,2CACV7B,KAAKG,MAAM2B,aAAeH,EAACI,QAC5BJ,EAACC,MAAAA,CAAII,MAAO,CAAEC,QAAS,SACnBN,EAACO,EAAAA,CACGC,KAAM1C,EACN2C,SAAU,KACNZ,EAAgB,CAAEa,cAAe,kBAAmBC,kBAAmB,GAAGC,+BAAyC,IAG3HZ,EAACa,EAAAA,CACGL,KAAM,oBACNM,OAAQlB,EACRmB,OAAQjD,EACRkD,UAAW,oBACXC,WAAYlB,EACZD,aAAcA,KAKlC,CArEAoB,WAAAA,CAAY1C,GACR2C,MAAM3C,GAPV4C,EAAA/C,KAAQC,6BAAR,GACA8C,EAAA/C,KAAQQ,0BAAR,GAWI,MAAMwC,qBAAEA,EAAoBC,6BAAEA,GAAiCjD,KAAKG,MAE9D+C,EAAUC,KAAKC,UAAU,CAC3BJ,uBACAC,iCAEEvB,EAAuB2B,EAAgBH,GAC7ClD,KAAKsD,MAAQ,CAAE5B,uBACnB,EAlBAqB,EAHErD,EAGY6D,eAAe,CACzBzB,aAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{TxVariants as a}from"./tx-variants.js";const o={[a.address]:"Address",[a.bankTransfer_IBAN]:"BankTransfer",[a.donation]:"Donation",[a.personal_details]:"PersonalDetails",[a.bcmc]:"Bancontact",[a.card]:"Card",[a.scheme]:"Card",[a.storedCard]:"Card",[a.customCard]:"CustomCard",[a.ach]:"Ach",[a.directdebit_GB]:"BacsDD",[a.sepadirectdebit]:"Sepa",[a.affirm]:"Affirm",[a.afterpay]:"AfterPay",[a.afterpay_default]:"AfterPay",[a.afterpay_b2b]:"AfterPayB2B",[a.atome]:"Atome",[a.facilypay_3x]:"FacilyPay3x",[a.facilypay_4x]:"FacilyPay4x",[a.facilypay_6x]:"FacilyPay6x",[a.facilypay_10x]:"FacilyPay10x",[a.facilypay_12x]:"FacilyPay12x",[a.ratepay]:"RatePay",[a.ratepay_directdebit]:"RatePayDirectDebit",[a.riverty]:"Riverty",[a.amazonpay]:"AmazonPay",[a.applepay]:"ApplePay",[a.cashapp]:"CashAppPay",[a.clicktopay]:"ClickToPay",[a.googlepay]:"GooglePay",[a.paypal]:"PayPal",[a.paywithgoogle]:"GooglePay",[a.boletobancario]:"Boleto",[a.boletobancario_itau]:"Boleto",[a.boletobancario_santander]:"Boleto",[a.doku]:"Doku",[a.doku_alfamart]:"Doku",[a.doku_permata_lite_atm]:"Doku",[a.doku_indomaret]:"Doku",[a.doku_atm_mandiri_va]:"Doku",[a.doku_sinarmas_va]:"Doku",[a.doku_mandiri_va]:"Doku",[a.doku_cimb_va]:"Doku",[a.doku_danamon_va]:"Doku",[a.doku_bri_va]:"Doku",[a.doku_bni_va]:"Doku",[a.doku_bca_va]:"Doku",[a.doku_wallet]:"Doku",[a.oxxo]:"Oxxo",[a.primeiropay_boleto]:"Boleto",[a.billdesk_online]:"BillDeskOnline",[a.billdesk_wallet]:"BillDeskWallet",[a.dotpay]:"Dotpay",[a.eps]:"Eps",[a.molpay_ebanking_fpx_MY]:"MolPayEBankingMY",[a.molpay_ebanking_TH]:"MolPayEBankingTH",[a.molpay_ebanking_VN]:"MolPayEBankingVN",[a.onlineBanking_CZ]:"OnlineBankingCZ",[a.onlinebanking_IN]:"OnlineBankingIN",[a.onlineBanking_PL]:"OnlineBankingPL",[a.onlineBanking_SK]:"OnlineBankingSK",[a.paybybank]:"PayByBank",[a.payu_IN_cashcard]:"PayuCashcard",[a.payu_IN_nb]:"PayuNetBanking",[a.wallet_IN]:"WalletINElement",[a.dragonpay_ebanking]:"Dragonpay",[a.dragonpay_otc_banking]:"Dragonpay",[a.dragonpay_otc_non_banking]:"Dragonpay",[a.dragonpay_otc_philippines]:"Dragonpay",[a.econtext_atm]:"Econtext",[a.econtext_online]:"Econtext",[a.econtext_seven_eleven]:"Econtext",[a.econtext_stores]:"Econtext",[a.giropay]:"Giropay",[a.multibanco]:"Multibanco",[a.redirect]:"Redirect",[a.twint]:"Twint",[a.vipps]:"Vipps",[a.trustly]:"Trustly",[a.klarna]:"Klarna",[a.klarna_account]:"Klarna",[a.klarna_paynow]:"Klarna",[a.bcmc_mobile]:"BcmcMobile",[a.bcmc_mobile_QR]:"BcmcMobile",[a.pix]:"Pix",[a.swish]:"Swish",[a.wechatpay]:"WeChat",[a.wechatpayQR]:"WeChat",[a.promptpay]:"PromptPay",[a.paynow]:"PayNow",[a.duitnow]:"Duitnow",[a.blik]:"Blik",[a.mbway]:"MBWay",[a.ancv]:"ANCV",[a.upi]:"UPI",[a.upi_qr]:"UPI",[a.upi_collect]:"UPI",[a.giftcard]:"Giftcard",[a.mealVoucher_FR_natixis]:"MealVoucherFR",[a.mealVoucher_FR_sodexo]:"MealVoucherFR",[a.mealVoucher_FR_groupeup]:"MealVoucherFR"};function
|
|
1
|
+
import{TxVariants as a}from"./tx-variants.js";const o={[a.address]:"Address",[a.bankTransfer_IBAN]:"BankTransfer",[a.donation]:"Donation",[a.personal_details]:"PersonalDetails",[a.bcmc]:"Bancontact",[a.card]:"Card",[a.scheme]:"Card",[a.storedCard]:"Card",[a.customCard]:"CustomCard",[a.ach]:"Ach",[a.directdebit_GB]:"BacsDD",[a.sepadirectdebit]:"Sepa",[a.affirm]:"Affirm",[a.afterpay]:"AfterPay",[a.afterpay_default]:"AfterPay",[a.afterpay_b2b]:"AfterPayB2B",[a.atome]:"Atome",[a.facilypay_3x]:"FacilyPay3x",[a.facilypay_4x]:"FacilyPay4x",[a.facilypay_6x]:"FacilyPay6x",[a.facilypay_10x]:"FacilyPay10x",[a.facilypay_12x]:"FacilyPay12x",[a.ratepay]:"RatePay",[a.ratepay_directdebit]:"RatePayDirectDebit",[a.riverty]:"Riverty",[a.amazonpay]:"AmazonPay",[a.applepay]:"ApplePay",[a.cashapp]:"CashAppPay",[a.clicktopay]:"ClickToPay",[a.googlepay]:"GooglePay",[a.paypal]:"PayPal",[a.paywithgoogle]:"GooglePay",[a.boletobancario]:"Boleto",[a.boletobancario_itau]:"Boleto",[a.boletobancario_santander]:"Boleto",[a.doku]:"Doku",[a.doku_alfamart]:"Doku",[a.doku_permata_lite_atm]:"Doku",[a.doku_indomaret]:"Doku",[a.doku_atm_mandiri_va]:"Doku",[a.doku_sinarmas_va]:"Doku",[a.doku_mandiri_va]:"Doku",[a.doku_cimb_va]:"Doku",[a.doku_danamon_va]:"Doku",[a.doku_bri_va]:"Doku",[a.doku_bni_va]:"Doku",[a.doku_bca_va]:"Doku",[a.doku_wallet]:"Doku",[a.oxxo]:"Oxxo",[a.primeiropay_boleto]:"Boleto",[a.billdesk_online]:"BillDeskOnline",[a.billdesk_wallet]:"BillDeskWallet",[a.dotpay]:"Dotpay",[a.eps]:"Eps",[a.molpay_ebanking_fpx_MY]:"MolPayEBankingMY",[a.molpay_ebanking_TH]:"MolPayEBankingTH",[a.molpay_ebanking_VN]:"MolPayEBankingVN",[a.onlineBanking_CZ]:"OnlineBankingCZ",[a.onlinebanking_IN]:"OnlineBankingIN",[a.onlineBanking_PL]:"OnlineBankingPL",[a.onlineBanking_SK]:"OnlineBankingSK",[a.paybybank]:"PayByBank",[a.payu_IN_cashcard]:"PayuCashcard",[a.payu_IN_nb]:"PayuNetBanking",[a.wallet_IN]:"WalletINElement",[a.dragonpay_ebanking]:"Dragonpay",[a.dragonpay_otc_banking]:"Dragonpay",[a.dragonpay_otc_non_banking]:"Dragonpay",[a.dragonpay_otc_philippines]:"Dragonpay",[a.econtext_atm]:"Econtext",[a.econtext_online]:"Econtext",[a.econtext_seven_eleven]:"Econtext",[a.econtext_stores]:"Econtext",[a.giropay]:"Giropay",[a.multibanco]:"Multibanco",[a.redirect]:"Redirect",[a.twint]:"Twint",[a.vipps]:"Vipps",[a.trustly]:"Trustly",[a.klarna]:"Klarna",[a.klarna_account]:"Klarna",[a.klarna_paynow]:"Klarna",[a.klarna_b2b]:"Klarna",[a.bcmc_mobile]:"BcmcMobile",[a.bcmc_mobile_QR]:"BcmcMobile",[a.pix]:"Pix",[a.swish]:"Swish",[a.wechatpay]:"WeChat",[a.wechatpayQR]:"WeChat",[a.promptpay]:"PromptPay",[a.paynow]:"PayNow",[a.duitnow]:"Duitnow",[a.blik]:"Blik",[a.mbway]:"MBWay",[a.ancv]:"ANCV",[a.upi]:"UPI",[a.upi_qr]:"UPI",[a.upi_collect]:"UPI",[a.giftcard]:"Giftcard",[a.mealVoucher_FR_natixis]:"MealVoucherFR",[a.mealVoucher_FR_sodexo]:"MealVoucherFR",[a.mealVoucher_FR_groupeup]:"MealVoucherFR"};function n(a){return o[a]}export{n as default};
|
|
2
2
|
//# sourceMappingURL=components-name-map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-name-map.js","sources":["../../../src/components/components-name-map.ts"],"sourcesContent":["import { TxVariants } from './tx-variants';\n\n/**\n * Maps each payment type with the string name of its Component element.\n *\n * It is used to give nicer error messages when creating components using Drop-in.\n * Example: paymentMethods response contains blik, but Blik component is not configured. So it warns that 'Blik' must be imported and added to the Drop-in configuration.\n */\nconst ComponentsNameMap = {\n /** internal */\n [TxVariants.address]: 'Address',\n [TxVariants.bankTransfer_IBAN]: 'BankTransfer',\n [TxVariants.donation]: 'Donation',\n [TxVariants.personal_details]: 'PersonalDetails',\n /** internal */\n\n /** Card */\n [TxVariants.bcmc]: 'Bancontact',\n [TxVariants.card]: 'Card',\n [TxVariants.scheme]: 'Card',\n [TxVariants.storedCard]: 'Card',\n [TxVariants.customCard]: 'CustomCard',\n /** Card */\n\n /** Direct debit */\n [TxVariants.ach]: 'Ach',\n [TxVariants.directdebit_GB]: 'BacsDD',\n [TxVariants.sepadirectdebit]: 'Sepa',\n /** Direct debit */\n\n /** Open Invoice */\n [TxVariants.affirm]: 'Affirm',\n [TxVariants.afterpay]: 'AfterPay',\n [TxVariants.afterpay_default]: 'AfterPay',\n [TxVariants.afterpay_b2b]: 'AfterPayB2B',\n [TxVariants.atome]: 'Atome',\n [TxVariants.facilypay_3x]: 'FacilyPay3x',\n [TxVariants.facilypay_4x]: 'FacilyPay4x',\n [TxVariants.facilypay_6x]: 'FacilyPay6x',\n [TxVariants.facilypay_10x]: 'FacilyPay10x',\n [TxVariants.facilypay_12x]: 'FacilyPay12x',\n [TxVariants.ratepay]: 'RatePay',\n [TxVariants.ratepay_directdebit]: 'RatePayDirectDebit',\n [TxVariants.riverty]: 'Riverty',\n /** Open Invoice */\n\n /** Wallets */\n [TxVariants.amazonpay]: 'AmazonPay',\n [TxVariants.applepay]: 'ApplePay',\n [TxVariants.cashapp]: 'CashAppPay',\n [TxVariants.clicktopay]: 'ClickToPay',\n [TxVariants.googlepay]: 'GooglePay',\n [TxVariants.paypal]: 'PayPal',\n [TxVariants.paywithgoogle]: 'GooglePay',\n /** Wallets */\n\n /** Voucher */\n [TxVariants.boletobancario]: 'Boleto',\n [TxVariants.boletobancario_itau]: 'Boleto',\n [TxVariants.boletobancario_santander]: 'Boleto',\n [TxVariants.doku]: 'Doku',\n [TxVariants.doku_alfamart]: 'Doku',\n [TxVariants.doku_permata_lite_atm]: 'Doku',\n [TxVariants.doku_indomaret]: 'Doku',\n [TxVariants.doku_atm_mandiri_va]: 'Doku',\n [TxVariants.doku_sinarmas_va]: 'Doku',\n [TxVariants.doku_mandiri_va]: 'Doku',\n [TxVariants.doku_cimb_va]: 'Doku',\n [TxVariants.doku_danamon_va]: 'Doku',\n [TxVariants.doku_bri_va]: 'Doku',\n [TxVariants.doku_bni_va]: 'Doku',\n [TxVariants.doku_bca_va]: 'Doku',\n [TxVariants.doku_wallet]: 'Doku',\n [TxVariants.oxxo]: 'Oxxo',\n [TxVariants.primeiropay_boleto]: 'Boleto',\n /** Voucher */\n\n /** issuerList */\n [TxVariants.billdesk_online]: 'BillDeskOnline',\n [TxVariants.billdesk_wallet]: 'BillDeskWallet',\n [TxVariants.dotpay]: 'Dotpay',\n [TxVariants.eps]: 'Eps',\n [TxVariants.molpay_ebanking_fpx_MY]: 'MolPayEBankingMY',\n [TxVariants.molpay_ebanking_TH]: 'MolPayEBankingTH',\n [TxVariants.molpay_ebanking_VN]: 'MolPayEBankingVN',\n [TxVariants.onlineBanking_CZ]: 'OnlineBankingCZ',\n [TxVariants.onlinebanking_IN]: 'OnlineBankingIN', // NOTE: the txVariant does have a lowercase \"b\"\n [TxVariants.onlineBanking_PL]: 'OnlineBankingPL',\n [TxVariants.onlineBanking_SK]: 'OnlineBankingSK',\n [TxVariants.paybybank]: 'PayByBank',\n [TxVariants.payu_IN_cashcard]: 'PayuCashcard',\n [TxVariants.payu_IN_nb]: 'PayuNetBanking',\n [TxVariants.wallet_IN]: 'WalletINElement',\n /** issuerList */\n\n /** Dragonpay */\n [TxVariants.dragonpay_ebanking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_non_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_philippines]: 'Dragonpay',\n /** Dragonpay */\n\n /** Econtext */\n [TxVariants.econtext_atm]: 'Econtext',\n [TxVariants.econtext_online]: 'Econtext',\n [TxVariants.econtext_seven_eleven]: 'Econtext',\n [TxVariants.econtext_stores]: 'Econtext',\n /** Econtext */\n\n /** Redirect */\n [TxVariants.giropay]: 'Giropay',\n [TxVariants.multibanco]: 'Multibanco',\n [TxVariants.redirect]: 'Redirect',\n [TxVariants.twint]: 'Twint',\n [TxVariants.vipps]: 'Vipps',\n [TxVariants.trustly]: 'Trustly',\n /** Redirect */\n\n /** Klarna */\n [TxVariants.klarna]: 'Klarna',\n [TxVariants.klarna_account]: 'Klarna',\n [TxVariants.klarna_paynow]: 'Klarna',\n /** Klarna */\n\n /** QRLoader */\n [TxVariants.bcmc_mobile]: 'BcmcMobile',\n [TxVariants.bcmc_mobile_QR]: 'BcmcMobile',\n [TxVariants.pix]: 'Pix',\n [TxVariants.swish]: 'Swish',\n [TxVariants.wechatpay]: 'WeChat',\n [TxVariants.wechatpayQR]: 'WeChat',\n [TxVariants.promptpay]: 'PromptPay',\n [TxVariants.paynow]: 'PayNow',\n [TxVariants.duitnow]: 'Duitnow',\n /** QRLoader */\n\n /** Await */\n [TxVariants.blik]: 'Blik',\n [TxVariants.mbway]: 'MBWay',\n [TxVariants.ancv]: 'ANCV',\n [TxVariants.upi]: 'UPI', // also QR\n [TxVariants.upi_qr]: 'UPI', // also QR\n [TxVariants.upi_collect]: 'UPI', // also QR\n /** Await */\n\n /** Giftcard */\n [TxVariants.giftcard]: 'Giftcard',\n [TxVariants.mealVoucher_FR_natixis]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_sodexo]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_groupeup]: 'MealVoucherFR'\n /** Giftcard */\n};\n\n/**\n * Returns the Component name based on the payment type\n * @param paymentType\n */\nfunction getComponentNameOfPaymentType(paymentType: string): string {\n return ComponentsNameMap[paymentType];\n}\n\nexport default getComponentNameOfPaymentType;\n"],"names":["ComponentsNameMap","TxVariants","address","bankTransfer_IBAN","donation","personal_details","bcmc","card","scheme","storedCard","customCard","ach","directdebit_GB","sepadirectdebit","affirm","afterpay","afterpay_default","afterpay_b2b","atome","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","ratepay","ratepay_directdebit","riverty","amazonpay","applepay","cashapp","clicktopay","googlepay","paypal","paywithgoogle","boletobancario","boletobancario_itau","boletobancario_santander","doku","doku_alfamart","doku_permata_lite_atm","doku_indomaret","doku_atm_mandiri_va","doku_sinarmas_va","doku_mandiri_va","doku_cimb_va","doku_danamon_va","doku_bri_va","doku_bni_va","doku_bca_va","doku_wallet","oxxo","primeiropay_boleto","billdesk_online","billdesk_wallet","dotpay","eps","molpay_ebanking_fpx_MY","molpay_ebanking_TH","molpay_ebanking_VN","onlineBanking_CZ","onlinebanking_IN","onlineBanking_PL","onlineBanking_SK","paybybank","payu_IN_cashcard","payu_IN_nb","wallet_IN","dragonpay_ebanking","dragonpay_otc_banking","dragonpay_otc_non_banking","dragonpay_otc_philippines","econtext_atm","econtext_online","econtext_seven_eleven","econtext_stores","giropay","multibanco","redirect","twint","vipps","trustly","klarna","klarna_account","klarna_paynow","bcmc_mobile","bcmc_mobile_QR","pix","swish","wechatpay","wechatpayQR","promptpay","paynow","duitnow","blik","mbway","ancv","upi","upi_qr","upi_collect","giftcard","mealVoucher_FR_natixis","mealVoucher_FR_sodexo","mealVoucher_FR_groupeup","getComponentNameOfPaymentType","paymentType"],"mappings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aAAc,aAC1B,CAACnF,EAAWoF,gBAAiB,aAC7B,CAACpF,EAAWqF,KAAM,MAClB,CAACrF,EAAWsF,OAAQ,QACpB,CAACtF,EAAWuF,WAAY,SACxB,CAACvF,EAAWwF,aAAc,SAC1B,CAACxF,EAAWyF,WAAY,YACxB,CAACzF,EAAW0F,QAAS,SACrB,CAAC1F,EAAW2F,SAAU,UAItB,CAAC3F,EAAW4F,MAAO,OACnB,CAAC5F,EAAW6F,OAAQ,QACpB,CAAC7F,EAAW8F,MAAO,OACnB,CAAC9F,EAAW+F,KAAM,MAClB,CAAC/F,EAAWgG,QAAS,MACrB,CAAChG,EAAWiG,aAAc,MAI1B,CAACjG,EAAWkG,UAAW,WACvB,CAAClG,EAAWmG,wBAAyB,gBACrC,CAACnG,EAAWoG,uBAAwB,gBACpC,CAACpG,EAAWqG,yBAA0B,iBAQ1C,SAASC,EAA8BC,GACnC,OAAOxG,EAAkBwG,EAC7B"}
|
|
1
|
+
{"version":3,"file":"components-name-map.js","sources":["../../../src/components/components-name-map.ts"],"sourcesContent":["import { TxVariants } from './tx-variants';\n\n/**\n * Maps each payment type with the string name of its Component element.\n *\n * It is used to give nicer error messages when creating components using Drop-in.\n * Example: paymentMethods response contains blik, but Blik component is not configured. So it warns that 'Blik' must be imported and added to the Drop-in configuration.\n */\nconst ComponentsNameMap = {\n /** internal */\n [TxVariants.address]: 'Address',\n [TxVariants.bankTransfer_IBAN]: 'BankTransfer',\n [TxVariants.donation]: 'Donation',\n [TxVariants.personal_details]: 'PersonalDetails',\n /** internal */\n\n /** Card */\n [TxVariants.bcmc]: 'Bancontact',\n [TxVariants.card]: 'Card',\n [TxVariants.scheme]: 'Card',\n [TxVariants.storedCard]: 'Card',\n [TxVariants.customCard]: 'CustomCard',\n /** Card */\n\n /** Direct debit */\n [TxVariants.ach]: 'Ach',\n [TxVariants.directdebit_GB]: 'BacsDD',\n [TxVariants.sepadirectdebit]: 'Sepa',\n /** Direct debit */\n\n /** Open Invoice */\n [TxVariants.affirm]: 'Affirm',\n [TxVariants.afterpay]: 'AfterPay',\n [TxVariants.afterpay_default]: 'AfterPay',\n [TxVariants.afterpay_b2b]: 'AfterPayB2B',\n [TxVariants.atome]: 'Atome',\n [TxVariants.facilypay_3x]: 'FacilyPay3x',\n [TxVariants.facilypay_4x]: 'FacilyPay4x',\n [TxVariants.facilypay_6x]: 'FacilyPay6x',\n [TxVariants.facilypay_10x]: 'FacilyPay10x',\n [TxVariants.facilypay_12x]: 'FacilyPay12x',\n [TxVariants.ratepay]: 'RatePay',\n [TxVariants.ratepay_directdebit]: 'RatePayDirectDebit',\n [TxVariants.riverty]: 'Riverty',\n /** Open Invoice */\n\n /** Wallets */\n [TxVariants.amazonpay]: 'AmazonPay',\n [TxVariants.applepay]: 'ApplePay',\n [TxVariants.cashapp]: 'CashAppPay',\n [TxVariants.clicktopay]: 'ClickToPay',\n [TxVariants.googlepay]: 'GooglePay',\n [TxVariants.paypal]: 'PayPal',\n [TxVariants.paywithgoogle]: 'GooglePay',\n /** Wallets */\n\n /** Voucher */\n [TxVariants.boletobancario]: 'Boleto',\n [TxVariants.boletobancario_itau]: 'Boleto',\n [TxVariants.boletobancario_santander]: 'Boleto',\n [TxVariants.doku]: 'Doku',\n [TxVariants.doku_alfamart]: 'Doku',\n [TxVariants.doku_permata_lite_atm]: 'Doku',\n [TxVariants.doku_indomaret]: 'Doku',\n [TxVariants.doku_atm_mandiri_va]: 'Doku',\n [TxVariants.doku_sinarmas_va]: 'Doku',\n [TxVariants.doku_mandiri_va]: 'Doku',\n [TxVariants.doku_cimb_va]: 'Doku',\n [TxVariants.doku_danamon_va]: 'Doku',\n [TxVariants.doku_bri_va]: 'Doku',\n [TxVariants.doku_bni_va]: 'Doku',\n [TxVariants.doku_bca_va]: 'Doku',\n [TxVariants.doku_wallet]: 'Doku',\n [TxVariants.oxxo]: 'Oxxo',\n [TxVariants.primeiropay_boleto]: 'Boleto',\n /** Voucher */\n\n /** issuerList */\n [TxVariants.billdesk_online]: 'BillDeskOnline',\n [TxVariants.billdesk_wallet]: 'BillDeskWallet',\n [TxVariants.dotpay]: 'Dotpay',\n [TxVariants.eps]: 'Eps',\n [TxVariants.molpay_ebanking_fpx_MY]: 'MolPayEBankingMY',\n [TxVariants.molpay_ebanking_TH]: 'MolPayEBankingTH',\n [TxVariants.molpay_ebanking_VN]: 'MolPayEBankingVN',\n [TxVariants.onlineBanking_CZ]: 'OnlineBankingCZ',\n [TxVariants.onlinebanking_IN]: 'OnlineBankingIN', // NOTE: the txVariant does have a lowercase \"b\"\n [TxVariants.onlineBanking_PL]: 'OnlineBankingPL',\n [TxVariants.onlineBanking_SK]: 'OnlineBankingSK',\n [TxVariants.paybybank]: 'PayByBank',\n [TxVariants.payu_IN_cashcard]: 'PayuCashcard',\n [TxVariants.payu_IN_nb]: 'PayuNetBanking',\n [TxVariants.wallet_IN]: 'WalletINElement',\n /** issuerList */\n\n /** Dragonpay */\n [TxVariants.dragonpay_ebanking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_non_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_philippines]: 'Dragonpay',\n /** Dragonpay */\n\n /** Econtext */\n [TxVariants.econtext_atm]: 'Econtext',\n [TxVariants.econtext_online]: 'Econtext',\n [TxVariants.econtext_seven_eleven]: 'Econtext',\n [TxVariants.econtext_stores]: 'Econtext',\n /** Econtext */\n\n /** Redirect */\n [TxVariants.giropay]: 'Giropay',\n [TxVariants.multibanco]: 'Multibanco',\n [TxVariants.redirect]: 'Redirect',\n [TxVariants.twint]: 'Twint',\n [TxVariants.vipps]: 'Vipps',\n [TxVariants.trustly]: 'Trustly',\n /** Redirect */\n\n /** Klarna */\n [TxVariants.klarna]: 'Klarna',\n [TxVariants.klarna_account]: 'Klarna',\n [TxVariants.klarna_paynow]: 'Klarna',\n [TxVariants.klarna_b2b]: 'Klarna',\n /** Klarna */\n\n /** QRLoader */\n [TxVariants.bcmc_mobile]: 'BcmcMobile',\n [TxVariants.bcmc_mobile_QR]: 'BcmcMobile',\n [TxVariants.pix]: 'Pix',\n [TxVariants.swish]: 'Swish',\n [TxVariants.wechatpay]: 'WeChat',\n [TxVariants.wechatpayQR]: 'WeChat',\n [TxVariants.promptpay]: 'PromptPay',\n [TxVariants.paynow]: 'PayNow',\n [TxVariants.duitnow]: 'Duitnow',\n /** QRLoader */\n\n /** Await */\n [TxVariants.blik]: 'Blik',\n [TxVariants.mbway]: 'MBWay',\n [TxVariants.ancv]: 'ANCV',\n [TxVariants.upi]: 'UPI', // also QR\n [TxVariants.upi_qr]: 'UPI', // also QR\n [TxVariants.upi_collect]: 'UPI', // also QR\n /** Await */\n\n /** Giftcard */\n [TxVariants.giftcard]: 'Giftcard',\n [TxVariants.mealVoucher_FR_natixis]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_sodexo]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_groupeup]: 'MealVoucherFR'\n /** Giftcard */\n};\n\n/**\n * Returns the Component name based on the payment type\n * @param paymentType\n */\nfunction getComponentNameOfPaymentType(paymentType: string): string {\n return ComponentsNameMap[paymentType];\n}\n\nexport default getComponentNameOfPaymentType;\n"],"names":["ComponentsNameMap","TxVariants","address","bankTransfer_IBAN","donation","personal_details","bcmc","card","scheme","storedCard","customCard","ach","directdebit_GB","sepadirectdebit","affirm","afterpay","afterpay_default","afterpay_b2b","atome","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","ratepay","ratepay_directdebit","riverty","amazonpay","applepay","cashapp","clicktopay","googlepay","paypal","paywithgoogle","boletobancario","boletobancario_itau","boletobancario_santander","doku","doku_alfamart","doku_permata_lite_atm","doku_indomaret","doku_atm_mandiri_va","doku_sinarmas_va","doku_mandiri_va","doku_cimb_va","doku_danamon_va","doku_bri_va","doku_bni_va","doku_bca_va","doku_wallet","oxxo","primeiropay_boleto","billdesk_online","billdesk_wallet","dotpay","eps","molpay_ebanking_fpx_MY","molpay_ebanking_TH","molpay_ebanking_VN","onlineBanking_CZ","onlinebanking_IN","onlineBanking_PL","onlineBanking_SK","paybybank","payu_IN_cashcard","payu_IN_nb","wallet_IN","dragonpay_ebanking","dragonpay_otc_banking","dragonpay_otc_non_banking","dragonpay_otc_philippines","econtext_atm","econtext_online","econtext_seven_eleven","econtext_stores","giropay","multibanco","redirect","twint","vipps","trustly","klarna","klarna_account","klarna_paynow","klarna_b2b","bcmc_mobile","bcmc_mobile_QR","pix","swish","wechatpay","wechatpayQR","promptpay","paynow","duitnow","blik","mbway","ancv","upi","upi_qr","upi_collect","giftcard","mealVoucher_FR_natixis","mealVoucher_FR_sodexo","mealVoucher_FR_groupeup","getComponentNameOfPaymentType","paymentType"],"mappings":"8CAQA,MAAMA,EAAoB,CAEtB,CAACC,EAAWC,SAAU,UACtB,CAACD,EAAWE,mBAAoB,eAChC,CAACF,EAAWG,UAAW,WACvB,CAACH,EAAWI,kBAAmB,kBAI/B,CAACJ,EAAWK,MAAO,aACnB,CAACL,EAAWM,MAAO,OACnB,CAACN,EAAWO,QAAS,OACrB,CAACP,EAAWQ,YAAa,OACzB,CAACR,EAAWS,YAAa,aAIzB,CAACT,EAAWU,KAAM,MAClB,CAACV,EAAWW,gBAAiB,SAC7B,CAACX,EAAWY,iBAAkB,OAI9B,CAACZ,EAAWa,QAAS,SACrB,CAACb,EAAWc,UAAW,WACvB,CAACd,EAAWe,kBAAmB,WAC/B,CAACf,EAAWgB,cAAe,cAC3B,CAAChB,EAAWiB,OAAQ,QACpB,CAACjB,EAAWkB,cAAe,cAC3B,CAAClB,EAAWmB,cAAe,cAC3B,CAACnB,EAAWoB,cAAe,cAC3B,CAACpB,EAAWqB,eAAgB,eAC5B,CAACrB,EAAWsB,eAAgB,eAC5B,CAACtB,EAAWuB,SAAU,UACtB,CAACvB,EAAWwB,qBAAsB,qBAClC,CAACxB,EAAWyB,SAAU,UAItB,CAACzB,EAAW0B,WAAY,YACxB,CAAC1B,EAAW2B,UAAW,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E,EAAWoE,2BAA4B,YACxC,CAACpE,EAAWqE,2BAA4B,YAIxC,CAACrE,EAAWsE,cAAe,WAC3B,CAACtE,EAAWuE,iBAAkB,WAC9B,CAACvE,EAAWwE,uBAAwB,WACpC,CAACxE,EAAWyE,iBAAkB,WAI9B,CAACzE,EAAW0E,SAAU,UACtB,CAAC1E,EAAW2E,YAAa,aACzB,CAAC3E,EAAW4E,UAAW,WACvB,CAAC5E,EAAW6E,OAAQ,QACpB,CAAC7E,EAAW8E,OAAQ,QACpB,CAAC9E,EAAW+E,SAAU,UAItB,CAAC/E,EAAWgF,QAAS,SACrB,CAAChF,EAAWiF,gBAAiB,SAC7B,CAACjF,EAAWkF,eAAgB,SAC5B,CAAClF,EAAWmF,YAAa,SAIzB,CAACnF,EAAWoF,aAAc,aAC1B,CAACpF,EAAWqF,gBAAiB,aAC7B,CAACrF,EAAWsF,KAAM,MAClB,CAACtF,EAAWuF,OAAQ,QACpB,CAACvF,EAAWwF,WAAY,SACxB,CAACxF,EAAWyF,aAAc,SAC1B,CAACzF,EAAW0F,WAAY,YACxB,CAAC1F,EAAW2F,QAAS,SACrB,CAAC3F,EAAW4F,SAAU,UAItB,CAAC5F,EAAW6F,MAAO,OACnB,CAAC7F,EAAW8F,OAAQ,QACpB,CAAC9F,EAAW+F,MAAO,OACnB,CAAC/F,EAAWgG,KAAM,MAClB,CAAChG,EAAWiG,QAAS,MACrB,CAACjG,EAAWkG,aAAc,MAI1B,CAAClG,EAAWmG,UAAW,WACvB,CAACnG,EAAWoG,wBAAyB,gBACrC,CAACpG,EAAWqG,uBAAwB,gBACpC,CAACrG,EAAWsG,yBAA0B,iBAQ1C,SAASC,EAA8BC,GACnC,OAAOzG,EAAkByG,EAC7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"../../FormFields/Field/Field.js";import{createElement as s}from"../../../../external/preact/dist/preact.js";import{useState as a,useCallback as t,useEffect as r,useMemo as o}from"../../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as n}from"../../../../core/Context/CoreProvider.js";import{debounce as d}from"../../../../utils/debounce.js";import c from"../../FormFields/Select/Select.js";function l({onAddressLookup:l,onAddressSelected:u,onSelect:i,onManualAddress:m,externalErrorMessage:h,hideManualButton:_,showContextualElement:p,contextualText:f,placeholder:k,addressSearchDebounceMs:
|
|
1
|
+
import e from"../../FormFields/Field/Field.js";import{createElement as s}from"../../../../external/preact/dist/preact.js";import{useState as a,useCallback as t,useEffect as r,useMemo as o}from"../../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as n}from"../../../../core/Context/CoreProvider.js";import{debounce as d}from"../../../../utils/debounce.js";import c from"../../FormFields/Select/Select.js";function l({onAddressLookup:l,onAddressSelected:u,onSelect:i,onManualAddress:m,externalErrorMessage:h,hideManualButton:_,showContextualElement:p,contextualText:f,placeholder:k,addressSearchDebounceMs:b}){const[x,g]=a([]),[y,M]=a([]),[v,j]=a(""),{i18n:C}=n(),F=t((e=>{(null==e?void 0:e.errorMessage)&&j(e.errorMessage)}),[]),S=t((e=>{new Promise(((s,a)=>{l(e,{resolve:s,reject:a})})).then((e=>{M(e),g(e.map((({id:e,name:s})=>({id:e,name:s})))),j("")})).catch((e=>F(e)))}),[l]);r((()=>{j(h)}),[h]);const w=o((()=>d(S,b)),[]);return s("div",{className:"adyen-checkout__address-search adyen-checkout__field-group"},s(e,{label:C.get("address"),classNameModifiers:["address-search"],errorMessage:v,name:"address-search",showContextualElement:p,contextualText:f},s(c,{name:"address-search",className:"adyen-checkout__address-search__dropdown",placeholder:k,onInput:w,items:x,onChange:e=>{if(!e.target.value)return void j(C.get("address.errors.incomplete"));const s=y.find((s=>s.id===e.target.value));if("function"!=typeof u)return i(s),void g([]);new Promise(((e,a)=>{u(s,{resolve:e,reject:a})})).then((e=>{i(e),g([])})).catch((e=>F(e)))},disableTextFilter:!0,blurOnClose:!0})),!_&&s("span",{className:"adyen-checkout__address-search__manual-add"},s("button",{type:"button",className:"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link adyen-checkout__address-search__manual-add__button",onClick:m},"+ "+C.get("address.enterManually"))))}export{l as default};
|
|
2
2
|
//# sourceMappingURL=AddressSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressSearch.js","sources":["../../../../../../src/components/internal/Address/components/AddressSearch.tsx"],"sourcesContent":["import Field from '../../FormFields/Field';\nimport { h } from 'preact';\nimport { AddressLookupItem } from '../types';\nimport { useCallback, useEffect, useState, useMemo } from 'preact/hooks';\nimport './AddressSearch.scss';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { debounce } from '../../../../utils/debounce';\nimport Select from '../../FormFields/Select';\nimport { AddressData } from '../../../../types';\n\nexport type OnAddressLookupType = (\n value: string,\n actions: {\n resolve: (value: Array<AddressLookupItem>) => void;\n reject: (reason?: any) => void;\n }\n) => Promise<void>;\n\nexport type OnAddressSelectedType = (\n value: string,\n actions: {\n resolve: (value: AddressLookupItem) => void;\n reject: (reason?: any) => void;\n }\n) => Promise<void>;\n\ninterface AddressSearchProps {\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n onSelect: (addressItem: AddressData) => void;\n onManualAddress: any;\n externalErrorMessage: string;\n hideManualButton: boolean;\n showContextualElement?: boolean;\n contextualText?: string;\n placeholder?: string;\n addressSearchDebounceMs?: number;\n}\n\ninterface RejectionReason {\n errorMessage: string;\n}\n\nexport default function AddressSearch({\n onAddressLookup,\n onAddressSelected,\n onSelect,\n onManualAddress,\n externalErrorMessage,\n hideManualButton,\n showContextualElement,\n contextualText,\n placeholder,\n addressSearchDebounceMs\n}: Readonly<AddressSearchProps>) {\n const [formattedData, setFormattedData] = useState([]);\n const [originalData, setOriginalData] = useState([]);\n\n const [errorMessage, setErrorMessage] = useState('');\n\n const { i18n } = useCoreContext();\n const mapDataToSelect = data => data.map(({ id, name }) => ({ id, name }));\n\n const handlePromiseReject = useCallback((reason: RejectionReason) => {\n if (reason?.errorMessage) {\n setErrorMessage(reason.errorMessage);\n }\n }, []);\n\n const onTextInput = useCallback(\n
|
|
1
|
+
{"version":3,"file":"AddressSearch.js","sources":["../../../../../../src/components/internal/Address/components/AddressSearch.tsx"],"sourcesContent":["import Field from '../../FormFields/Field';\nimport { h } from 'preact';\nimport { AddressLookupItem } from '../types';\nimport { useCallback, useEffect, useState, useMemo } from 'preact/hooks';\nimport './AddressSearch.scss';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { debounce } from '../../../../utils/debounce';\nimport Select from '../../FormFields/Select';\nimport { AddressData } from '../../../../types';\n\nexport type OnAddressLookupType = (\n value: string,\n actions: {\n resolve: (value: Array<AddressLookupItem>) => void;\n reject: (reason?: any) => void;\n }\n) => Promise<void>;\n\nexport type OnAddressSelectedType = (\n value: string,\n actions: {\n resolve: (value: AddressLookupItem) => void;\n reject: (reason?: any) => void;\n }\n) => Promise<void>;\n\ninterface AddressSearchProps {\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n onSelect: (addressItem: AddressData) => void;\n onManualAddress: any;\n externalErrorMessage: string;\n hideManualButton: boolean;\n showContextualElement?: boolean;\n contextualText?: string;\n placeholder?: string;\n addressSearchDebounceMs?: number;\n}\n\ninterface RejectionReason {\n errorMessage: string;\n}\n\nexport default function AddressSearch({\n onAddressLookup,\n onAddressSelected,\n onSelect,\n onManualAddress,\n externalErrorMessage,\n hideManualButton,\n showContextualElement,\n contextualText,\n placeholder,\n addressSearchDebounceMs\n}: Readonly<AddressSearchProps>) {\n const [formattedData, setFormattedData] = useState([]);\n const [originalData, setOriginalData] = useState([]);\n\n const [errorMessage, setErrorMessage] = useState('');\n\n const { i18n } = useCoreContext();\n const mapDataToSelect = data => data.map(({ id, name }) => ({ id, name }));\n\n const handlePromiseReject = useCallback((reason: RejectionReason) => {\n if (reason?.errorMessage) {\n setErrorMessage(reason.errorMessage);\n }\n }, []);\n\n const onTextInput = useCallback(\n (inputValue: string) => {\n new Promise<Array<AddressLookupItem>>((resolve, reject) => {\n void onAddressLookup(inputValue, { resolve, reject });\n })\n .then(searchArray => {\n setOriginalData(searchArray);\n setFormattedData(mapDataToSelect(searchArray));\n setErrorMessage('');\n })\n .catch(reason => handlePromiseReject(reason));\n },\n [onAddressLookup]\n );\n\n // update error message when there's a new one\n useEffect(() => {\n setErrorMessage(externalErrorMessage);\n }, [externalErrorMessage]);\n\n const onSelectItem = event => {\n if (!event.target.value) {\n setErrorMessage(i18n.get('address.errors.incomplete'));\n return;\n }\n const value = originalData.find(item => item.id === event.target.value);\n\n // 1. in case we don't get a function just select item\n if (typeof onAddressSelected !== 'function') {\n onSelect(value);\n setFormattedData([]);\n return;\n }\n\n // 2. in case callback is provided, create and call onAddressSelected\n new Promise<AddressLookupItem>((resolve, reject) => {\n void onAddressSelected(value, { resolve, reject });\n })\n .then(fullData => {\n onSelect(fullData);\n setFormattedData([]);\n })\n .catch(reason => handlePromiseReject(reason));\n };\n\n const debounceInputHandler = useMemo(() => debounce(onTextInput, addressSearchDebounceMs), []);\n\n return (\n <div className={'adyen-checkout__address-search adyen-checkout__field-group'}>\n <Field\n label={i18n.get('address')}\n classNameModifiers={['address-search']}\n errorMessage={errorMessage}\n name={'address-search'}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <Select\n name={'address-search'}\n className={'adyen-checkout__address-search__dropdown'}\n placeholder={placeholder}\n onInput={debounceInputHandler}\n items={formattedData}\n onChange={onSelectItem}\n disableTextFilter={true}\n blurOnClose={true}\n />\n </Field>\n {!hideManualButton && (\n <span className=\"adyen-checkout__address-search__manual-add\">\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link adyen-checkout__address-search__manual-add__button\"\n onClick={onManualAddress}\n >\n {'+ ' + i18n.get('address.enterManually')}\n </button>\n </span>\n )}\n </div>\n );\n}\n"],"names":["AddressSearch","onAddressLookup","onAddressSelected","onSelect","onManualAddress","externalErrorMessage","hideManualButton","showContextualElement","contextualText","placeholder","addressSearchDebounceMs","formattedData","setFormattedData","useState","originalData","setOriginalData","errorMessage","setErrorMessage","i18n","useCoreContext","handlePromiseReject","useCallback","reason","onTextInput","inputValue","Promise","resolve","reject","then","searchArray","map","id","name","catch","useEffect","debounceInputHandler","useMemo","debounce","h","div","className","Field","label","get","classNameModifiers","Select","onInput","items","onChange","event","target","value","find","item","fullData","disableTextFilter","blurOnClose","span","button","type","onClick"],"mappings":"saA2Ce,SAASA,GAAcC,gBAClCA,EAAeC,kBACfA,EAAiBC,SACjBA,EAAQC,gBACRA,EAAeC,qBACfA,EAAoBC,iBACpBA,EAAgBC,sBAChBA,EAAqBC,eACrBA,EAAcC,YACdA,EAAWC,wBACXA,IAEA,MAAOC,EAAeC,GAAoBC,EAAS,KAC5CC,EAAcC,GAAmBF,EAAS,KAE1CG,EAAcC,GAAmBJ,EAAS,KAE3CK,KAAEA,GAASC,IAGXC,EAAsBC,GAAaC,KACjCA,aAAAA,EAAAA,EAAQN,eACRC,EAAgBK,EAAON,aAC3B,GACD,IAEGO,EAAcF,GACfG,IACG,IAAIC,SAAkC,CAACC,EAASC,KACvC1B,EAAgBuB,EAAY,CAAEE,UAASC,UAAO,IAElDC,MAAKC,IACFd,EAAgBc,GAChBjB,EAAiCiB,EAfZC,KAAI,EAAGC,KAAIC,WAAY,CAAED,KAAIC,YAgBlDf,EAAgB,GAAA,IAEnBgB,OAAMX,GAAUF,EAAoBE,IAAAA,GAE7C,CAACrB,IAILiC,GAAU,KACNjB,EAAgBZ,EAAAA,GACjB,CAACA,IAEJ,MAyBM8B,EAAuBC,GAAQ,IAAMC,EAASd,EAAab,IAA0B,IAE3F,OACI4B,EAACC,MAAAA,CAAIC,UAAW,8DACZF,EAACG,EAAAA,CACGC,MAAOxB,EAAKyB,IAAI,WAChBC,mBAAoB,CAAC,kBACrB5B,aAAcA,EACdgB,KAAM,iBACNzB,sBAAuBA,EACvBC,eAAgBA,GAEhB8B,EAACO,EAAAA,CACGb,KAAM,iBACNQ,UAAW,2CACX/B,YAAaA,EACbqC,QAASX,EACTY,MAAOpC,EACPqC,SA3CKC,IACjB,IAAKA,EAAMC,OAAOC,MAEd,YADAlC,EAAgBC,EAAKyB,IAAI,8BAG7B,MAAMQ,EAAQrC,EAAasC,MAAKC,GAAQA,EAAKtB,KAAOkB,EAAMC,OAAOC,QAGjE,GAAiC,mBAAtBjD,EAGP,OAFAC,EAASgD,QACTvC,EAAiB,IAKrB,IAAIa,SAA2B,CAACC,EAASC,KAChCzB,EAAkBiD,EAAO,CAAEzB,UAASC,UAAO,IAE/CC,MAAK0B,IACFnD,EAASmD,GACT1C,EAAiB,GAAE,IAEtBqB,OAAMX,GAAUF,EAAoBE,IAAAA,EAsB7BiC,mBAAmB,EACnBC,aAAa,MAGnBlD,GACEgC,EAACmB,OAAAA,CAAKjB,UAAU,8CACZF,EAACoB,SAAAA,CACGC,KAAK,SACLnB,UAAU,wIACVoB,QAASxD,GAER,KAAOc,EAAKyB,IAAI,2BAMzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Await.js","sources":["../../../../../src/components/internal/Await/Await.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport classnames from 'classnames';\nimport checkPaymentStatus from '../../../core/Services/payment-status';\nimport processResponse from '../../../core/ProcessResponse';\n\nimport Spinner from '../../internal/Spinner';\nimport Countdown from '../Countdown';\nimport Button from '../Button';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { AwaitComponentProps, StatusObject } from './types';\nimport './Await.scss';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport ContentSeparator from '../ContentSeparator';\nimport useImage from '../../../core/Context/useImage';\n\nfunction Await(props: AwaitComponentProps) {\n const { i18n, loadingContext } = useCoreContext();\n const getImage = useImage();\n const [completed, setCompleted] = useState(false);\n const [expired, setExpired] = useState(false);\n const [loading, setLoading] = useState(true);\n const [hasCalledActionHandled, setHasCalledActionHandled] = useState(false);\n const [delay, setDelay] = useState(props.delay);\n const [percentage, setPercentage] = useState(100);\n const [timePassed, setTimePassed] = useState(0);\n const [hasAdjustedTime, setHasAdjustedTime] = useState(false);\n const [storedTimeout, setStoredTimeout] = useState(null);\n\n const onTimeUp = (): void => {\n setExpired(true);\n clearTimeout(storedTimeout);\n props.onError(new AdyenCheckoutError('ERROR', 'Payment Expired'));\n };\n\n const onTick = (time): void => {\n setPercentage(time.percentage);\n };\n\n const onComplete = (status: StatusObject): void => {\n // Only make details call if we have a payload\n if (status.props.payload) {\n setCompleted(true);\n const state = {\n data: {\n details: { payload: status.props.payload },\n paymentData: props.paymentData\n }\n };\n // Send success response to onAdditionalDetails\n return props.onComplete(state, this);\n }\n\n // Show error state & call merchant defined error callback if we do not have a payload\n setExpired(true);\n props.onError(new AdyenCheckoutError('ERROR', 'successful result, but no payload in response'));\n };\n\n const onError = (status: StatusObject): void => {\n setExpired(true);\n\n // Only make details call if we have a payload\n if (status.props.payload) {\n const state = {\n data: {\n details: { payload: status.props.payload },\n paymentData: props.paymentData\n }\n };\n // Send error response to onAdditionalDetails\n return props.onComplete(state, this);\n }\n\n // Call merchant defined error callback if we do not have a payload\n props.onError(new AdyenCheckoutError('ERROR', 'error result with no payload in response'));\n };\n\n const checkStatus = (): void => {\n const { paymentData, clientKey, throttleInterval } = props;\n\n if (!hasCalledActionHandled) {\n props.onActionHandled({ componentType: props.type, actionDescription: 'polling-started' });\n setHasCalledActionHandled(true);\n }\n\n checkPaymentStatus(paymentData, clientKey, loadingContext, throttleInterval)\n .then(processResponse)\n .catch(({ message, ...response }) => ({\n type: 'network-error',\n props: {\n ...(message && { message: i18n.get(message) }),\n ...response\n }\n }))\n .then((status: StatusObject) => {\n switch (status.type) {\n case 'success':\n onComplete(status);\n break;\n\n case 'error':\n onError(status);\n break;\n\n default:\n setLoading(false);\n }\n });\n };\n\n const redirectToApp = (url): void => {\n window.location.assign(url);\n };\n\n useEffect(() => {\n checkStatus();\n return (): void => {\n clearTimeout(storedTimeout);\n };\n }, []);\n\n useEffect(() => {\n if (expired) return clearTimeout(storedTimeout);\n\n if (completed) return clearTimeout(storedTimeout);\n\n if (!loading) {\n // Retry until getting a complete response from the server OR it times out\n // Changes setTimeout time to new value (throttleInterval) after a certain amount of time (throttleTime) has passed\n const statusInterval = (): void => {\n checkStatus();\n\n const actualTimePassed = timePassed + delay;\n // timePassed is the value that is the main \"engine\" that drives this useEffect/polling\n setTimePassed(actualTimePassed);\n\n if (actualTimePassed >= props.throttleTime && !hasAdjustedTime) {\n setDelay(props.throttleInterval);\n setHasAdjustedTime(true);\n }\n };\n\n // Create (another) interval to poll for a result\n setStoredTimeout(setTimeout(statusInterval, delay));\n }\n }, [loading, expired, completed, timePassed]);\n\n const finalState = (image, message) => (\n <div className=\"adyen-checkout__await adyen-checkout__await--result\">\n <img\n className=\"adyen-checkout__await__icon adyen-checkout__await__icon--result\"\n src={getImage({ imageFolder: 'components/' })(image)}\n alt={i18n.get(message)}\n />\n <div className=\"adyen-checkout__await__subtitle adyen-checkout__await__subtitle--result\">{i18n.get(message)}</div>\n </div>\n );\n\n if (expired) {\n return finalState('error', 'error.subtitle.payment');\n }\n\n if (completed) {\n return finalState('success', 'creditCard.success');\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__await\">\n {props.brandLogo && <img src={props.brandLogo} alt={props.type} className=\"adyen-checkout__await__brand-logo\" />}\n <Spinner inline={false} size=\"large\" />\n </div>\n );\n }\n\n const timeToPayString = i18n.get('wechatpay.timetopay').split('%@');\n\n return (\n <div\n className={classnames(\n 'adyen-checkout__await',\n `adyen-checkout__await--${props.type}`,\n props.classNameModifiers.map(m => `adyen-checkout__await--${m}`)\n )}\n >\n {props.brandLogo && <img src={props.brandLogo} alt={props.type} className=\"adyen-checkout__await__brand-logo\" />}\n\n <div className=\"adyen-checkout__await__subtitle\">{props.messageText}</div>\n\n <div className=\"adyen-checkout__await__indicator-holder\">\n <div className=\"adyen-checkout__await__indicator-spinner\">\n <Spinner inline={false} size=\"medium\" />\n </div>\n <div className=\"adyen-checkout__await__indicator-text\">{props.awaitText}</div>\n </div>\n\n {props.showCountdownTimer && (\n <div className=\"adyen-checkout__await__countdown-holder\">\n <div className=\"adyen-checkout__await__progress\">\n <span className=\"adyen-checkout__await__percentage\" style={{ width: `${percentage}%` }} />\n </div>\n\n <div className=\"adyen-checkout__await__countdown\">\n {timeToPayString[0]} \n <Countdown minutesFromNow={props.countdownTime} onTick={onTick} onCompleted={onTimeUp} />\n {timeToPayString[1]}\n </div>\n </div>\n )}\n\n {props.url && (\n <div className=\"adyen-checkout__await__app-link\">\n <ContentSeparator />\n <Button classNameModifiers={['await']} onClick={() => redirectToApp(props.url)} label={i18n.get('openApp')} />\n </div>\n )}\n </div>\n );\n}\n\nAwait.defaultProps = {\n countdownTime: 15,\n onError: () => {},\n onComplete: () => {},\n onActionHandled: () => {},\n delay: 2000,\n throttleTime: 60000,\n throttleInterval: 10000,\n showCountdownTimer: true,\n classNameModifiers: [],\n url: null\n};\n\nexport default Await;\n"],"names":["Await","props","i18n","loadingContext","useCoreContext","getImage","useImage","completed","setCompleted","useState","expired","setExpired","loading","setLoading","hasCalledActionHandled","setHasCalledActionHandled","delay","setDelay","percentage","setPercentage","timePassed","setTimePassed","hasAdjustedTime","setHasAdjustedTime","storedTimeout","setStoredTimeout","onComplete","status","payload","state","data","details","paymentData","this","onError","AdyenCheckoutError","checkStatus","clientKey","throttleInterval","onActionHandled","componentType","type","actionDescription","checkPaymentStatus","then","processResponse","catch","_param","message","response","_object_spread","get","useEffect","clearTimeout","setTimeout","actualTimePassed","throttleTime","finalState","image","h","div","className","img","src","imageFolder","alt","brandLogo","Spinner","inline","size","timeToPayString","split","classnames","classNameModifiers","map","m","messageText","awaitText","showCountdownTimer","span","style","width","Countdown","minutesFromNow","countdownTime","onTick","time","onCompleted","url","ContentSeparator","Button","onClick","redirectToApp","window","location","assign","label","defaultProps"],"mappings":"0+CAgBA,SAASA,EAAMC,GACX,MAAMC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esContent":["import { h } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport classnames from 'classnames';\nimport checkPaymentStatus from '../../../core/Services/payment-status';\nimport processResponse from '../../../core/ProcessResponse';\n\nimport Spinner from '../../internal/Spinner';\nimport Countdown from '../Countdown';\nimport Button from '../Button';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { AwaitComponentProps, StatusObject } from './types';\nimport './Await.scss';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport ContentSeparator from '../ContentSeparator';\nimport useImage from '../../../core/Context/useImage';\n\nfunction Await(props: AwaitComponentProps) {\n const { i18n, loadingContext } = useCoreContext();\n const getImage = useImage();\n const [completed, setCompleted] = useState(false);\n const [expired, setExpired] = useState(false);\n const [loading, setLoading] = useState(true);\n const [hasCalledActionHandled, setHasCalledActionHandled] = useState(false);\n const [delay, setDelay] = useState(props.delay);\n const [percentage, setPercentage] = useState(100);\n const [timePassed, setTimePassed] = useState(0);\n const [hasAdjustedTime, setHasAdjustedTime] = useState(false);\n const [storedTimeout, setStoredTimeout] = useState(null);\n\n const onTimeUp = (): void => {\n setExpired(true);\n clearTimeout(storedTimeout);\n props.onError(new AdyenCheckoutError('ERROR', 'Payment Expired'));\n };\n\n const onTick = (time): void => {\n setPercentage(time.percentage);\n };\n\n const onComplete = (status: StatusObject): void => {\n // Only make details call if we have a payload\n if (status.props.payload) {\n setCompleted(true);\n const state = {\n data: {\n details: { payload: status.props.payload },\n paymentData: props.paymentData\n }\n };\n // Send success response to onAdditionalDetails\n return props.onComplete(state, this);\n }\n\n // Show error state & call merchant defined error callback if we do not have a payload\n setExpired(true);\n props.onError(new AdyenCheckoutError('ERROR', 'successful result, but no payload in response'));\n };\n\n const onError = (status: StatusObject): void => {\n setExpired(true);\n\n // Only make details call if we have a payload\n if (status.props.payload) {\n const state = {\n data: {\n details: { payload: status.props.payload },\n paymentData: props.paymentData\n }\n };\n // Send error response to onAdditionalDetails\n return props.onComplete(state, this);\n }\n\n // Call merchant defined error callback if we do not have a payload\n props.onError(new AdyenCheckoutError('ERROR', 'error result with no payload in response'));\n };\n\n const checkStatus = (): void => {\n const { paymentData, clientKey, throttleInterval } = props;\n\n if (!hasCalledActionHandled) {\n props.onActionHandled({ componentType: props.type, actionDescription: 'polling-started' });\n setHasCalledActionHandled(true);\n }\n\n void checkPaymentStatus(paymentData, clientKey, loadingContext, throttleInterval)\n .then(processResponse)\n .catch(({ message, ...response }) => ({\n type: 'network-error',\n props: {\n ...(message && { message: i18n.get(message) }),\n ...response\n }\n }))\n .then((status: StatusObject) => {\n switch (status.type) {\n case 'success':\n onComplete(status);\n break;\n\n case 'error':\n onError(status);\n break;\n\n default:\n setLoading(false);\n }\n });\n };\n\n const redirectToApp = (url): void => {\n window.location.assign(url);\n };\n\n useEffect(() => {\n checkStatus();\n return (): void => {\n clearTimeout(storedTimeout);\n };\n }, []);\n\n useEffect(() => {\n if (expired) return clearTimeout(storedTimeout);\n\n if (completed) return clearTimeout(storedTimeout);\n\n if (!loading) {\n // Retry until getting a complete response from the server OR it times out\n // Changes setTimeout time to new value (throttleInterval) after a certain amount of time (throttleTime) has passed\n const statusInterval = (): void => {\n checkStatus();\n\n const actualTimePassed = timePassed + delay;\n // timePassed is the value that is the main \"engine\" that drives this useEffect/polling\n setTimePassed(actualTimePassed);\n\n if (actualTimePassed >= props.throttleTime && !hasAdjustedTime) {\n setDelay(props.throttleInterval);\n setHasAdjustedTime(true);\n }\n };\n\n // Create (another) interval to poll for a result\n setStoredTimeout(setTimeout(statusInterval, delay));\n }\n }, [loading, expired, completed, timePassed]);\n\n const finalState = (image, message) => (\n <div className=\"adyen-checkout__await adyen-checkout__await--result\">\n <img\n className=\"adyen-checkout__await__icon adyen-checkout__await__icon--result\"\n src={getImage({ imageFolder: 'components/' })(image)}\n alt={i18n.get(message)}\n />\n <div className=\"adyen-checkout__await__subtitle adyen-checkout__await__subtitle--result\">{i18n.get(message)}</div>\n </div>\n );\n\n if (expired) {\n return finalState('error', 'error.subtitle.payment');\n }\n\n if (completed) {\n return finalState('success', 'creditCard.success');\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__await\">\n {props.brandLogo && <img src={props.brandLogo} alt={props.type} className=\"adyen-checkout__await__brand-logo\" />}\n <Spinner inline={false} size=\"large\" />\n </div>\n );\n }\n\n const timeToPayString = i18n.get('wechatpay.timetopay').split('%@');\n\n return (\n <div\n className={classnames(\n 'adyen-checkout__await',\n `adyen-checkout__await--${props.type}`,\n props.classNameModifiers.map(m => `adyen-checkout__await--${m}`)\n )}\n >\n {props.brandLogo && <img src={props.brandLogo} alt={props.type} className=\"adyen-checkout__await__brand-logo\" />}\n\n <div className=\"adyen-checkout__await__subtitle\">{props.messageText}</div>\n\n <div className=\"adyen-checkout__await__indicator-holder\">\n <div className=\"adyen-checkout__await__indicator-spinner\">\n <Spinner inline={false} size=\"medium\" />\n </div>\n <div className=\"adyen-checkout__await__indicator-text\">{props.awaitText}</div>\n </div>\n\n {props.showCountdownTimer && (\n <div className=\"adyen-checkout__await__countdown-holder\">\n <div className=\"adyen-checkout__await__progress\">\n <span className=\"adyen-checkout__await__percentage\" style={{ width: `${percentage}%` }} />\n </div>\n\n <div className=\"adyen-checkout__await__countdown\">\n {timeToPayString[0]} \n <Countdown minutesFromNow={props.countdownTime} onTick={onTick} onCompleted={onTimeUp} />\n {timeToPayString[1]}\n </div>\n </div>\n )}\n\n {props.url && (\n <div className=\"adyen-checkout__await__app-link\">\n <ContentSeparator />\n <Button classNameModifiers={['await']} onClick={() => redirectToApp(props.url)} label={i18n.get('openApp')} />\n </div>\n )}\n </div>\n );\n}\n\nAwait.defaultProps = {\n countdownTime: 15,\n onError: () => {},\n onComplete: () => {},\n onActionHandled: () => {},\n delay: 2000,\n throttleTime: 60000,\n throttleInterval: 10000,\n showCountdownTimer: true,\n classNameModifiers: [],\n url: null\n};\n\nexport default Await;\n"],"names":["Await","props","i18n","loadingContext","useCoreContext","getImage","useImage","completed","setCompleted","useState","expired","setExpired","loading","setLoading","hasCalledActionHandled","setHasCalledActionHandled","delay","setDelay","percentage","setPercentage","timePassed","setTimePassed","hasAdjustedTime","setHasAdjustedTime","storedTimeout","setStoredTimeout","onComplete","status","payload","state","data","details","paymentData","this","onError","AdyenCheckoutError","checkStatus","clientKey","throttleInterval","onActionHandled","componentType","type","actionDescription","checkPaymentStatus","then","processResponse","catch","_param","message","response","_object_spread","get","useEffect","clearTimeout","setTimeout","actualTimePassed","throttleTime","finalState","image","h","div","className","img","src","imageFolder","alt","brandLogo","Spinner","inline","size","timeToPayString","split","classnames","classNameModifiers","map","m","messageText","awaitText","showCountdownTimer","span","style","width","Countdown","minutesFromNow","countdownTime","onTick","time","onCompleted","url","ContentSeparator","Button","onClick","redirectToApp","window","location","assign","label","defaultProps"],"mappings":"0+CAgBA,SAASA,EAAMC,GACX,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,IAC3BC,EAAWC,KACVC,EAAWC,GAAgBC,GAAS,IACpCC,EAASC,GAAcF,GAAS,IAChCG,EAASC,GAAcJ,GAAS,IAChCK,EAAwBC,GAA6BN,GAAS,IAC9DO,EAAOC,GAAYR,EAASR,EAAMe,QAClCE,EAAYC,GAAiBV,EAAS,MACtCW,EAAYC,GAAiBZ,EAAS,IACtCa,EAAiBC,GAAsBd,GAAS,IAChDe,EAAeC,GAAoBhB,EAAS,MAY7CiB,EAAcC,IAEhB,GAAIA,EAAO1B,MAAM2B,QAAS,CACtBpB,GAAa,GACb,MAAMqB,EAAQ,CACVC,KAAM,CACFC,QAAS,CAAEH,QAASD,EAAO1B,MAAM2B,SACjCI,YAAa/B,EAAM+B,cAI3B,OAAO/B,EAAMyB,WAAWG,EAAOI,KACnC,CAGAtB,GAAW,GACXV,EAAMiC,QAAQ,IAAIC,EAAmB,QAAS,iDAAA,EAG5CD,EAAWP,IAIb,GAHAhB,GAAW,GAGPgB,EAAO1B,MAAM2B,QAAS,CACtB,MAAMC,EAAQ,CACVC,KAAM,CACFC,QAAS,CAA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AmB,QAAS,mBAAA,IA4K2D,IAClFmC,EAAgB,KAKlCrE,EAAMuF,KACH7B,EAACC,MAAAA,CAAIC,UAAU,mCACXF,EAAC8B,QACD9B,EAAC+B,EAAAA,CAAOjB,mBAAoB,CAAC,SAAUkB,QAAS,KAAMC,OAvG/CJ,EAuG6DvF,EAAMuF,SAtGtFK,OAAOC,SAASC,OAAOP,GADL,IAACA,CAuGsE,EAAGQ,MAAO9F,EAAKiD,IAAI,cAKpH,CAEAnD,EAAMiG,aAAe,CACjBb,cAAe,GACflD,QAAS,OACTR,WAAY,OACZa,gBAAiB,OACjBvB,MAAO,IACPwC,aAAc,IACdlB,iBAAkB,IAClBwC,oBAAoB,EACpBL,mBAAoB,GACpBe,IAAK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/getProp.js";import r from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{ANALYTICS_RENDERED_STR as n}from"../../../core/Analytics/constants.js";function
|
|
1
|
+
import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/getProp.js";import r from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{ANALYTICS_RENDERED_STR as n}from"../../../core/Analytics/constants.js";import{on as s,off as i}from"../../../utils/listenerUtils.js";function p(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),o.forEach((function(e){p(t,e,r[e])}))}return t}function a(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r.push.apply(r,o)}return r}(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})),t}function u(t,e){if(null==t)return{};var r,o,n=function(t,e){if(null==t)return{};var r,o,n={},s=Object.keys(t);for(o=0;o<s.length;o++)r=s[o],e.indexOf(r)>=0||(n[r]=t[r]);return n}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(o=0;o<s.length;o++)r=s[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}class l{buildElementProps(t){this.props=this.formatProps(c({},this.constructor.defaultProps,t))}formatProps(t){return t}formatData(){return{}}setUpAnalytics(t){return null}submitAnalytics(t){return null}handleKeyPress(t){return null}setState(t){this.state=c({},this.state,t)}get data(){var t,r;const o=e(this.props,"modules.risk.data"),n=!!(null===(t=e(this.props,"modules.analytics.getEnabled"))||void 0===t?void 0:t())?null===(r=e(this.props,"modules.analytics.getCheckoutAttemptId"))||void 0===r?void 0:r():"do-not-track",s=this.state.order||this.props.order,i=this.formatData();if(i.paymentMethod&&n&&(i.paymentMethod.checkoutAttemptId=n),"riverty"!==this.props.type&&i.billingAddress){const t=u(i.billingAddress,["firstName","lastName"]);i.billingAddress=c({},t)}return a(c({},o&&{riskData:{clientData:o}},s&&{order:{orderData:s.orderData,pspReference:s.pspReference}},i),{clientStateDataIndicator:!0})}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const r="string"==typeof e?document.querySelector(e):e;if(!r)throw new Error("Component could not mount. Root node was not found.");const o=!this._node;var i;(this._node&&this.unmount(),this._node=r,s(this._node,"keypress",this.handleKeyPress),this._component=this.render(),t(this._component,r),o)&&(this.props.modules&&this.props.modules.analytics&&this.setUpAnalytics({containerWidth:r&&r.offsetWidth,component:this.props.isDropin?"dropin":null!==(i=this.constructor.analyticsType)&&void 0!==i?i:this.constructor.type,flavor:this.props.isDropin?"dropin":"components"}).then((()=>{this.props.isDropin||this.submitAnalytics({type:n})})));return this}update(t){return this.props=this.formatProps(c({},this.props,t)),this.state={},this.unmount().mount(this._node)}unmount(){return i(this._node,"keypress",this.handleKeyPress),this._node&&t(null,this._node),this}remove(){this.unmount(),this.core&&this.core.remove(this)}constructor(t,e){p(this,"_id",`${this.constructor.type}-${r()}`),p(this,"core",void 0),p(this,"props",void 0),p(this,"state",{}),p(this,"_component",void 0),p(this,"_node",null);const n=function(t){return!!t&&("function"==typeof t.initialize&&"function"==typeof t.createFromAction)}(t);if(!n)throw new o("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=t,this.buildElementProps(e),this.handleKeyPress=this.handleKeyPress.bind(this)}}p(l,"defaultProps",{});export{l as default};
|
|
2
2
|
//# sourceMappingURL=BaseElement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, render } from 'preact';\nimport getProp from '../../../utils/getProp';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { ANALYTICS_RENDERED_STR } from '../../../core/Analytics/constants';\n\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport type { AnalyticsInitialEvent, SendAnalyticsObject } from '../../../core/Analytics/types';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps> implements IBaseElement {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: any = {};\n public _component;\n\n protected _node: HTMLElement = null;\n\n protected static defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): any {\n return {};\n }\n\n /* eslint-disable-next-line */\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj?: SendAnalyticsObject) {\n return null;\n }\n\n protected setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const clientData = getProp(this.props, 'modules.risk.data');\n const useAnalytics = !!getProp(this.props, 'modules.analytics.getEnabled')?.();\n const checkoutAttemptId = useAnalytics ? getProp(this.props, 'modules.analytics.getCheckoutAttemptId')?.() : 'do-not-track';\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n // Workaround, to be fixed properly\n // Remove the firstName & lastName in the billingAddress for non Riverty components\n // @ts-ignore type exists\n if (this.props.type !== 'riverty' && componentData.billingAddress) {\n const { firstName, lastName, ...rest } = componentData.billingAddress;\n componentData.billingAddress = { ...rest };\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n const setupAnalytics = !this._node;\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n this._component = this.render();\n\n render(this._component, node);\n\n // Set up analytics (once, since this._node is currently undefined) now that we have mounted and rendered\n if (setupAnalytics) {\n if (this.props.modules && this.props.modules.analytics) {\n this.setUpAnalytics({\n containerWidth: node && (node as HTMLElement).offsetWidth,\n component: !this.props.isDropin ? this.constructor['analyticsType'] ?? this.constructor['type'] : 'dropin',\n flavor: !this.props.isDropin ? 'components' : 'dropin'\n }).then(() => {\n // Once the initial analytics set up call has been made...\n // ...create an analytics event declaring that the component has been rendered\n // (The dropin will do this itself from DropinComponent once the PM list has rendered)\n if (!this.props.isDropin) {\n this.submitAnalytics({ type: ANALYTICS_RENDERED_STR });\n }\n });\n }\n }\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {};\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","_object_spread","constructor","formatData","setUpAnalytics","setUpAnalyticsObj","submitAnalytics","analyticsObj","setState","newState","state","data","getProp","clientData","checkoutAttemptId","order","componentData","paymentMethod","type","billingAddress","rest","firstName","lastName","_object_spread_props","riskData","orderData","pspReference","clientStateDataIndicator","render","Error","mount","domNode","node","document","querySelector","setupAnalytics","_node","_this_constructor_analyticsType","unmount","_component","modules","analytics","containerWidth","offsetWidth","component","isDropin","flavor","then","ANALYTICS_RENDERED_STR","update","remove","core","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","defaultProps"],"mappings":"67CAsBA,MAAeA,EA0BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAYC,EAAA,CAAA,EAAKH,KAAKI,yBAAgCL,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,CAMA,UAAAI,GACI,MAAO,EACX,CAGUC,cAAAA,CAAeC,GACrB,OAAO,IACX,CAGUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACfX,KAAKY,MAAQT,KAAKH,KAAKY,MAAUD,EACrC,CAMA,QAAWE,OAEgBC,EACkBA,EAFzC,MAAMC,EAAaD,EAAQd,KAAKC,MAAO,qBAEjCe,KADqC,QAApBF,EAAAA,EAAQd,KAAKC,MAAO,uCAApBa,IAAAA,OAAAA,EAAAA,KACkBA,QAAAA,EAAAA,EAAQd,KAAKC,MAAO,iDAApBa,IAAAA,OAAAA,EAAAA,IAAoE,eACvGG,EAAQjB,KAAKY,MAAMK,OAASjB,KAAKC,MAAMgB,MACvCC,EAAgBlB,KAAKK,aAS3B,GAPIa,EAAcC,eAAiBH,IAC/BE,EAAcC,cAAcH,kBAAoBA,GAM5B,YAApBhB,KAAKC,MAAMmB,MAAsBF,EAAcG,eAAgB,CACtBH,MAATI,EAASJ,EAAAA,EAAcG,eAAdH,CA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D,KAAKqD,KAAKD,OAAOpD,KAEzB,CAnKAI,WAAAA,CAAYkD,EAAiBrD,GAX7BsD,EAAAvD,KAAgBwD,MAAM,GAAGxD,KAAKI,YAAY,QAAWqD,OACrDF,EAAAvD,KAAgBqD,YAAhB,GAEAE,EAAAvD,KAAOC,aAAP,GACAsD,EAAAvD,KAAOY,QAAa,CAAA,GACpB2C,EAAAvD,KAAOyC,kBAAP,GAEAc,EAAAvD,KAAUsC,QAAqB,MAK3B,MAAMoB,EAnBd,SAA8BJ,GAC1B,QAAKA,IAC+C,mBAAxBA,EAASK,YAAkE,mBAA9BL,EAASM,iBAEtF,CAe+BC,CAAqBP,GAE5C,IAAKI,EACD,MAAM,IAAII,EACN,uBACA,uCAAuC9D,KAAKI,YAAmB,6DAIvEJ,KAAKqD,KAAOC,EACZtD,KAAKF,kBAAkBG,EAC3B,EAdAsD,EAVW1D,EAUMkE,eAAe"}
|
|
1
|
+
{"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render } from 'preact';\nimport getProp from '../../../utils/getProp';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { ANALYTICS_RENDERED_STR } from '../../../core/Analytics/constants';\n\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport type { AnalyticsInitialEvent, SendAnalyticsObject } from '../../../core/Analytics/types';\nimport { off, on } from '../../../utils/listenerUtils';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps> implements IBaseElement {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: any = {};\n public _component;\n\n protected _node: HTMLElement = null;\n\n protected static defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyPress = this.handleKeyPress.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): any {\n return {};\n }\n\n /* eslint-disable-next-line */\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj?: SendAnalyticsObject) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const clientData = getProp(this.props, 'modules.risk.data');\n const useAnalytics = !!getProp(this.props, 'modules.analytics.getEnabled')?.();\n const checkoutAttemptId = useAnalytics ? getProp(this.props, 'modules.analytics.getCheckoutAttemptId')?.() : 'do-not-track';\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n // Workaround, to be fixed properly\n // Remove the firstName & lastName in the billingAddress for non Riverty components\n // @ts-ignore type exists\n if (this.props.type !== 'riverty' && componentData.billingAddress) {\n const { firstName, lastName, ...rest } = componentData.billingAddress;\n componentData.billingAddress = { ...rest };\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n const setupAnalytics = !this._node;\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key press events, notably 'Enter' key presses\n on(this._node, 'keypress', this.handleKeyPress);\n\n this._component = this.render();\n\n render(this._component, node);\n\n // Set up analytics (once, since this._node is currently undefined) now that we have mounted and rendered\n if (setupAnalytics) {\n if (this.props.modules && this.props.modules.analytics) {\n this.setUpAnalytics({\n containerWidth: node && node.offsetWidth,\n component: !this.props.isDropin ? this.constructor['analyticsType'] ?? this.constructor['type'] : 'dropin',\n flavor: !this.props.isDropin ? 'components' : 'dropin'\n }).then(() => {\n // Once the initial analytics set up call has been made...\n // ...create an analytics event declaring that the component has been rendered\n // (The dropin will do this itself from DropinComponent once the PM list has rendered)\n if (!this.props.isDropin) {\n this.submitAnalytics({ type: ANALYTICS_RENDERED_STR });\n }\n });\n }\n }\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {};\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keypress', this.handleKeyPress);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","_object_spread","constructor","formatData","setUpAnalytics","setUpAnalyticsObj","submitAnalytics","analyticsObj","handleKeyPress","e","setState","newState","state","data","getProp","clientData","checkoutAttemptId","order","componentData","paymentMethod","type","billingAddress","rest","firstName","lastName","_object_spread_props","riskData","orderData","pspReference","clientStateDataIndicator","render","Error","mount","domNode","node","document","querySelector","setupAnalytics","_node","_this_constructor_analyticsType","unmount","on","_component","modules","analytics","containerWidth","offsetWidth","component","isDropin","flavor","then","ANALYTICS_RENDERED_STR","update","off","remove","core","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"2/CAuBA,MAAeA,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAYC,EAAA,CAAA,EAAKH,KAAKI,yBAAgCL,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,CAMA,UAAAI,GACI,MAAO,EACX,CAGUC,cAAAA,CAAeC,GACrB,OAAO,IACX,CAGUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAGUC,cAAAA,CAAeC,GACrB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACfb,KAAKc,MAAQX,KAAKH,KAAKc,MAAUD,EACrC,CAMA,QAAWE,OAEgBC,EACkBA,EAFzC,MAAMC,EAAaD,EAAQhB,KAAKC,MAAO,qBAEjCiB,KADqC,QAApBF,EAAAA,EAAQhB,KAAKC,MAAO,uCAApBe,IAAAA,O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,KAAKC,MAAMiD,UACZlD,KAAKQ,gBAAgB,CAAEc,KAAM+B,GACjC,KAKZ,OAAOrD,IACX,CAQOsD,MAAAA,CAAOrD,GAIV,OAHAD,KAAKC,MAAQD,KAAKE,YAAYC,EAAK,CAAA,EAAAH,KAAKC,MAAUA,IAClDD,KAAKc,MAAQ,GAENd,KAAK0C,UAAUR,MAAMlC,KAAKwC,MACrC,CAKA,OAAAE,GAQI,OANAa,EAAIvD,KAAKwC,MAAO,WAAYxC,KAAKU,gBAE7BV,KAAKwC,OACLR,EAAO,KAAMhC,KAAKwC,OAGfxC,IACX,CAMA,MAAAwD,GACIxD,KAAK0C,UAED1C,KAAKyD,MACLzD,KAAKyD,KAAKD,OAAOxD,KAEzB,CAhLAI,WAAAA,CAAYsD,EAAiBzD,GAX7B0D,EAAA3D,KAAgB4D,MAAM,GAAG5D,KAAKI,YAAY,QAAWyD,OACrDF,EAAA3D,KAAgByD,YAAhB,GAEAE,EAAA3D,KAAOC,aAAP,GACA0D,EAAA3D,KAAOc,QAAa,CAAA,GACpB6C,EAAA3D,KAAO4C,kBAAP,GAEAe,EAAA3D,KAAUwC,QAAqB,MAK3B,MAAMsB,EAnBd,SAA8BJ,GAC1B,QAAKA,IAC+C,mBAAxBA,EAASK,YAAkE,mBAA9BL,EAASM,iBAEtF,CAe+BC,CAAqBP,GAE5C,IAAKI,EACD,MAAM,IAAII,EACN,uBACA,uCAAuClE,KAAKI,YAAmB,6DAIvEJ,KAAKyD,KAAOC,EACZ1D,KAAKF,kBAAkBG,GAEvBD,KAAKU,eAAiBV,KAAKU,eAAeyD,KAAKnE,KACnD,EAhBA2D,EAVW9D,EAUMuE,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickToPayComponent.js","sources":["../../../../../src/components/internal/ClickToPay/ClickToPayComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport { CtpState } from './services/ClickToPayService';\nimport useClickToPayContext from './context/useClickToPayContext';\nimport CtPOneTimePassword from './components/CtPOneTimePassword';\nimport CtPCards from './components/CtPCards';\nimport CtPSection from './components/CtPSection';\nimport CtPLoader from './components/CtPLoader';\nimport CtPLogin from './components/CtPLogin';\nimport SrciError from './services/sdks/SrciError';\n\ntype ClickToPayComponentProps = {\n onDisplayCardComponent?(): void;\n};\n\nconst ClickToPayComponent = ({ onDisplayCardComponent }: ClickToPayComponentProps): h.JSX.Element => {\n const { ctpState, onReady, startIdentityValidation, logoutShopper } = useClickToPayContext();\n\n useEffect(() => {\n if ([CtpState.OneTimePassword, CtpState.Login, CtpState.Ready].includes(ctpState)) {\n onReady();\n }\n }, [ctpState, onReady]);\n\n useEffect(() => {\n async function sendOneTimePassword() {\n try {\n await startIdentityValidation();\n } catch (error) {\n if (error instanceof SrciError) console.warn(`CtP - Identity Validation error: ${error.toString()}`);\n await logoutShopper();\n }\n }\n if (ctpState === CtpState.ShopperIdentified) {\n sendOneTimePassword();\n }\n }, [ctpState]);\n\n if (ctpState === CtpState.NotAvailable) {\n return null;\n }\n\n return (\n <CtPSection>\n {[CtpState.Loading, CtpState.ShopperIdentified].includes(ctpState) && <CtPLoader />}\n {ctpState === CtpState.OneTimePassword && <CtPOneTimePassword onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Ready && <CtPCards onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Login && <CtPLogin />}\n </CtPSection>\n );\n};\n\nexport default ClickToPayComponent;\n"],"names":["ClickToPayComponent","onDisplayCardComponent","ctpState","onReady","startIdentityValidation","logoutShopper","useClickToPayContext","useEffect","CtpState","OneTimePassword","Login","Ready","includes","ShopperIdentified","async","error","SrciError","console","warn","toString","sendOneTimePassword","NotAvailable","h","CtPSection","Loading","CtPLoader","CtPOneTimePassword","CtPCards","CtPLogin"],"mappings":"wjBAeA,MAAMA,EAAsB,EAAGC,6BAC3B,MAAMC,SAAEA,EAAQC,QAAEA,EAAOC,wBAAEA,EAAuBC,cAAEA,GAAkBC,IAsBtE,OApBAC,GAAU,KACF,CAACC,EAASC,gBAAiBD,EAASE,MAAOF,EAASG,OAAOC,SAASV,IACpEC,GACJ,GACD,CAACD,EAAUC,IAEdI,GAAU,KASFL,IAAaM,EAASK,mBAR1BC,iBACI,UACUV,GACV,CAAE,MAAOW,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,oCAAoCH,EAAMI,oBACjFd,GACV,CACJ,
|
|
1
|
+
{"version":3,"file":"ClickToPayComponent.js","sources":["../../../../../src/components/internal/ClickToPay/ClickToPayComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport { CtpState } from './services/ClickToPayService';\nimport useClickToPayContext from './context/useClickToPayContext';\nimport CtPOneTimePassword from './components/CtPOneTimePassword';\nimport CtPCards from './components/CtPCards';\nimport CtPSection from './components/CtPSection';\nimport CtPLoader from './components/CtPLoader';\nimport CtPLogin from './components/CtPLogin';\nimport SrciError from './services/sdks/SrciError';\n\ntype ClickToPayComponentProps = {\n onDisplayCardComponent?(): void;\n};\n\nconst ClickToPayComponent = ({ onDisplayCardComponent }: ClickToPayComponentProps): h.JSX.Element => {\n const { ctpState, onReady, startIdentityValidation, logoutShopper } = useClickToPayContext();\n\n useEffect(() => {\n if ([CtpState.OneTimePassword, CtpState.Login, CtpState.Ready].includes(ctpState)) {\n onReady();\n }\n }, [ctpState, onReady]);\n\n useEffect(() => {\n async function sendOneTimePassword() {\n try {\n await startIdentityValidation();\n } catch (error) {\n if (error instanceof SrciError) console.warn(`CtP - Identity Validation error: ${error.toString()}`);\n await logoutShopper();\n }\n }\n if (ctpState === CtpState.ShopperIdentified) {\n void sendOneTimePassword();\n }\n }, [ctpState]);\n\n if (ctpState === CtpState.NotAvailable) {\n return null;\n }\n\n return (\n <CtPSection>\n {[CtpState.Loading, CtpState.ShopperIdentified].includes(ctpState) && <CtPLoader />}\n {ctpState === CtpState.OneTimePassword && <CtPOneTimePassword onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Ready && <CtPCards onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Login && <CtPLogin />}\n </CtPSection>\n );\n};\n\nexport default ClickToPayComponent;\n"],"names":["ClickToPayComponent","onDisplayCardComponent","ctpState","onReady","startIdentityValidation","logoutShopper","useClickToPayContext","useEffect","CtpState","OneTimePassword","Login","Ready","includes","ShopperIdentified","async","error","SrciError","console","warn","toString","sendOneTimePassword","NotAvailable","h","CtPSection","Loading","CtPLoader","CtPOneTimePassword","CtPCards","CtPLogin"],"mappings":"wjBAeA,MAAMA,EAAsB,EAAGC,6BAC3B,MAAMC,SAAEA,EAAQC,QAAEA,EAAOC,wBAAEA,EAAuBC,cAAEA,GAAkBC,IAsBtE,OApBAC,GAAU,KACF,CAACC,EAASC,gBAAiBD,EAASE,MAAOF,EAASG,OAAOC,SAASV,IACpEC,GACJ,GACD,CAACD,EAAUC,IAEdI,GAAU,KASFL,IAAaM,EAASK,mBAR1BC,iBACI,UACUV,GACV,CAAE,MAAOW,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,oCAAoCH,EAAMI,oBACjFd,GACV,CACJ,CAESe,EACT,GACD,CAAClB,IAEAA,IAAaM,EAASa,aACf,KAIPC,EAACC,EACI,KAAA,CAACf,EAASgB,QAAShB,EAASK,mBAAmBD,SAASV,IAAaoB,EAACG,QACtEvB,IAAaM,EAASC,iBAAmBa,EAACI,EAAAA,CAAmBzB,uBAAwBA,IACrFC,IAAaM,EAASG,OAASW,EAACK,EAAAA,CAAS1B,uBAAwBA,IACjEC,IAAaM,EAASE,OAASY,EAACM,EAAAA,MAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CtPOneTimePasswordInput.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { otpValidationRules } from './validate';\nimport CtPResendOtpLink from './CtPResendOtpLink';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport useForm from '../../../../../../utils/useForm';\nimport Field from '../../../../FormFields/Field';\nimport './CtPOneTimePasswordInput.scss';\nimport InputText from '../../../../FormFields/InputText';\n\ntype OnChangeProps = { data: CtPOneTimePasswordInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPOneTimePasswordInputProps {\n hideResendOtpButton: boolean;\n disabled: boolean;\n isValidatingOtp: boolean;\n errorMessage?: string;\n onSetInputHandlers(handlers: CtPOneTimePasswordInputHandlers): void;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onResendCode(): void;\n}\n\ninterface CtPOneTimePasswordInputDataState {\n otp?: string;\n}\n\nexport type CtPOneTimePasswordInputHandlers = {\n validateInput(): void;\n};\n\nconst CtPOneTimePasswordInput = (props: CtPOneTimePasswordInputProps): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const {\n configuration: { disableOtpAutoFocus }\n } = useClickToPayContext();\n\n const formSchema = ['otp'];\n const [resendOtpError, setResendOtpError] = useState<string>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid, setData } = useForm<CtPOneTimePasswordInputDataState>({\n schema: formSchema,\n rules: otpValidationRules\n });\n const otpInputHandlersRef = useRef<CtPOneTimePasswordInputHandlers>({ validateInput: null });\n const inputRef = useRef<HTMLInputElement>(null);\n const [isOtpFielDirty, setIsOtpFieldDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsOtpFieldDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n /**\n * If shopper changes the value of the OTP fields, input becomes dirty\n */\n useEffect(() => {\n if (data.otp) setIsOtpFieldDirty(true);\n }, [data.otp]);\n\n useEffect(() => {\n if (!disableOtpAutoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef.current, disableOtpAutoFocus]);\n\n useEffect(() => {\n otpInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(otpInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnResendOtp = useCallback(() => {\n setData('otp', '');\n setResendOtpError(null);\n if (!disableOtpAutoFocus) {\n inputRef.current.focus();\n }\n props.onResendCode();\n }, [props.onResendCode, inputRef.current, disableOtpAutoFocus]);\n\n const handleOnResendOtpError = useCallback(\n (errorCode: string) => {\n const message = i18n.get(`ctp.errors.${errorCode}`);\n if (message) setResendOtpError(message);\n },\n [i18n]\n );\n\n const handleOnKeyUp = useCallback(\n (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n const handleOnKeyPress = useCallback((event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n // Prevent <form> submission if Component is placed inside an form\n if (event.key === 'Enter') event.preventDefault();\n }, []);\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <Field\n name=\"oneTimePassword\"\n label={i18n.get('ctp.otp.fieldLabel')}\n labelEndAdornment={\n !props.hideResendOtpButton && (\n <CtPResendOtpLink disabled={props.isValidatingOtp} onError={handleOnResendOtpError} onResendCode={handleOnResendOtp} />\n )\n }\n errorMessage={isOtpFielDirty ? resendOtpError || props.errorMessage || !!errors.otp : null}\n classNameModifiers={['otp']}\n >\n <InputText\n name={'otp'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.otp}\n disabled={props.disabled}\n onInput={handleChangeFor('otp', 'input')}\n onBlur={handleChangeFor('otp', 'blur')}\n onKeyUp={handleOnKeyUp}\n onKeyPress={handleOnKeyPress}\n setRef={(ref: HTMLInputElement) => {\n inputRef.current = ref;\n }}\n />\n </Field>\n );\n};\n\nexport default CtPOneTimePasswordInput;\n"],"names":["CtPOneTimePasswordInput","props","i18n","useCoreContext","configuration","disableOtpAutoFocus","useClickToPayContext","resendOtpError","setResendOtpError","useState","handleChangeFor","data","triggerValidation","valid","errors","isValid","setData","useForm","schema","rules","otpValidationRules","otpInputHandlersRef","useRef","validateInput","inputRef","isOtpFielDirty","setIsOtpFieldDirty","useCallback","useEffect","otp","current","focus","onSetInputHandlers","handleOnResendOtp","onResendCode","handleOnResendOtpError","errorCode","message","get","handleOnKeyUp","event","key","onPressEnter","handleOnKeyPress","preventDefault","onChange","h","Field","name","label","labelEndAdornment","hideResendOtpButton","CtPResendOtpLink","disabled","isValidatingOtp","onError","errorMessage","classNameModifiers","InputText","autocorrect","spellcheck","value","onInput","onBlur","onKeyUp","onKeyPress","setRef","ref"],"mappings":"glBAgCA,MAAMA,EAA2BC,IAC7B,MAAMC,KAAEA,GAASC,KAEbC,eAAeC,oBAAEA,IACjBC,KAGGC,EAAgBC,GAAqBC,EAAiB,OACvDC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,QAAEA,GAAYC,EAA0C,CAC5HC,OAHe,CAAC,OAIhBC,MAAOC,IAELC,EAAsBC,EAAwC,CAAEC,cAAe,OAC/EC,EAAWF,EAAyB,OACnCG,EAAgBC,GAAsBjB,GAAkB,GAEzDc,EAAgBI,GAAY,KAC9BD,GAAmB,GACnBd,GAAAA,GACD,CAACA,IAKJgB,GAAU,KACFjB,EAAKkB,KAAKH,GAAmB,EAAA,GAClC,CAACf,EAAKkB,MAETD,GAAU,MACDvB,GAAuBmB,EAASM,SACjCN,EAASM,QAAQC,OACrB,GACD,CAACP,EAASM,QAASzB,IAEtBuB,GAAU,KACNP,EAAoBS,QAAQP,cAAgBA,EAC5CtB,EAAM+B,mBAAmBX,EAAoBS,QAAO,GACrD,CAACP,EAAetB,EAAM+B,qBAEzB,MAAMC,EAAoBN,GAAY,KAClCX,EAAQ,MAAO,IACfR,EAAkB,MACbH,GACDmB,EAASM,QAAQC,QAErB9B,EAAMiC,cAAY,GACnB,CAACjC,EAAMiC,aAAcV,EAASM,QAASzB,IAEpC8B,EAAyBR,GAC1BS,IACG,MAAMC,EAAUnC,EAAKoC,IAAI,cAAcF,KACnCC,GAAS7B,EAAkB6B,EAAAA,GAEnC,CAACnC,IAGCqC,EAAgBZ,GACjBa,IACqB,UAAdA,EAAMC,
|
|
1
|
+
{"version":3,"file":"CtPOneTimePasswordInput.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { otpValidationRules } from './validate';\nimport CtPResendOtpLink from './CtPResendOtpLink';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport useForm from '../../../../../../utils/useForm';\nimport Field from '../../../../FormFields/Field';\nimport './CtPOneTimePasswordInput.scss';\nimport InputText from '../../../../FormFields/InputText';\n\ntype OnChangeProps = { data: CtPOneTimePasswordInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPOneTimePasswordInputProps {\n hideResendOtpButton: boolean;\n disabled: boolean;\n isValidatingOtp: boolean;\n errorMessage?: string;\n onSetInputHandlers(handlers: CtPOneTimePasswordInputHandlers): void;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onResendCode(): void;\n}\n\ninterface CtPOneTimePasswordInputDataState {\n otp?: string;\n}\n\nexport type CtPOneTimePasswordInputHandlers = {\n validateInput(): void;\n};\n\nconst CtPOneTimePasswordInput = (props: CtPOneTimePasswordInputProps): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const {\n configuration: { disableOtpAutoFocus }\n } = useClickToPayContext();\n\n const formSchema = ['otp'];\n const [resendOtpError, setResendOtpError] = useState<string>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid, setData } = useForm<CtPOneTimePasswordInputDataState>({\n schema: formSchema,\n rules: otpValidationRules\n });\n const otpInputHandlersRef = useRef<CtPOneTimePasswordInputHandlers>({ validateInput: null });\n const inputRef = useRef<HTMLInputElement>(null);\n const [isOtpFielDirty, setIsOtpFieldDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsOtpFieldDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n /**\n * If shopper changes the value of the OTP fields, input becomes dirty\n */\n useEffect(() => {\n if (data.otp) setIsOtpFieldDirty(true);\n }, [data.otp]);\n\n useEffect(() => {\n if (!disableOtpAutoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef.current, disableOtpAutoFocus]);\n\n useEffect(() => {\n otpInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(otpInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnResendOtp = useCallback(() => {\n setData('otp', '');\n setResendOtpError(null);\n if (!disableOtpAutoFocus) {\n inputRef.current.focus();\n }\n props.onResendCode();\n }, [props.onResendCode, inputRef.current, disableOtpAutoFocus]);\n\n const handleOnResendOtpError = useCallback(\n (errorCode: string) => {\n const message = i18n.get(`ctp.errors.${errorCode}`);\n if (message) setResendOtpError(message);\n },\n [i18n]\n );\n\n const handleOnKeyUp = useCallback(\n (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n const handleOnKeyPress = useCallback((event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n // Prevent <form> submission if Component is placed inside an form\n if (event.key === 'Enter') event.preventDefault();\n }, []);\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <Field\n name=\"oneTimePassword\"\n label={i18n.get('ctp.otp.fieldLabel')}\n labelEndAdornment={\n !props.hideResendOtpButton && (\n <CtPResendOtpLink disabled={props.isValidatingOtp} onError={handleOnResendOtpError} onResendCode={handleOnResendOtp} />\n )\n }\n errorMessage={isOtpFielDirty ? resendOtpError || props.errorMessage || !!errors.otp : null}\n classNameModifiers={['otp']}\n >\n <InputText\n name={'otp'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.otp}\n disabled={props.disabled}\n onInput={handleChangeFor('otp', 'input')}\n onBlur={handleChangeFor('otp', 'blur')}\n onKeyUp={handleOnKeyUp}\n onKeyPress={handleOnKeyPress}\n setRef={(ref: HTMLInputElement) => {\n inputRef.current = ref;\n }}\n />\n </Field>\n );\n};\n\nexport default CtPOneTimePasswordInput;\n"],"names":["CtPOneTimePasswordInput","props","i18n","useCoreContext","configuration","disableOtpAutoFocus","useClickToPayContext","resendOtpError","setResendOtpError","useState","handleChangeFor","data","triggerValidation","valid","errors","isValid","setData","useForm","schema","rules","otpValidationRules","otpInputHandlersRef","useRef","validateInput","inputRef","isOtpFielDirty","setIsOtpFieldDirty","useCallback","useEffect","otp","current","focus","onSetInputHandlers","handleOnResendOtp","onResendCode","handleOnResendOtpError","errorCode","message","get","handleOnKeyUp","event","key","onPressEnter","handleOnKeyPress","preventDefault","onChange","h","Field","name","label","labelEndAdornment","hideResendOtpButton","CtPResendOtpLink","disabled","isValidatingOtp","onError","errorMessage","classNameModifiers","InputText","autocorrect","spellcheck","value","onInput","onBlur","onKeyUp","onKeyPress","setRef","ref"],"mappings":"glBAgCA,MAAMA,EAA2BC,IAC7B,MAAMC,KAAEA,GAASC,KAEbC,eAAeC,oBAAEA,IACjBC,KAGGC,EAAgBC,GAAqBC,EAAiB,OACvDC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,QAAEA,GAAYC,EAA0C,CAC5HC,OAHe,CAAC,OAIhBC,MAAOC,IAELC,EAAsBC,EAAwC,CAAEC,cAAe,OAC/EC,EAAWF,EAAyB,OACnCG,EAAgBC,GAAsBjB,GAAkB,GAEzDc,EAAgBI,GAAY,KAC9BD,GAAm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