@adyen/adyen-web 6.0.0-alpha.8 → 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 +65 -65
- 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 +904 -1252
- package/dist/es/adyen.css +65 -65
- 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/BankTransfer/BankTransfer.js +1 -1
- package/dist/es/components/BankTransfer/BankTransfer.js.map +1 -1
- package/dist/es/components/Blik/Blik.js +1 -1
- package/dist/es/components/Blik/Blik.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/CardInput.js +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.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 +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/useSRPanelForCardInputErrors.js +2 -0
- package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -0
- 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/CashAppPay.js +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.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/PaymentMethodList.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
- package/dist/es/components/Dropin/elements/createElements.js.map +1 -1
- package/dist/es/components/Dropin/elements/createInstantPaymentElements.js.map +1 -1
- package/dist/es/components/Dropin/elements/createStoredElements.js.map +1 -1
- package/dist/es/components/Dropin/elements/filters.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/Giropay/Giropay.js +1 -1
- package/dist/es/components/Giropay/Giropay.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/Multibanco/Multibanco.js +1 -1
- package/dist/es/components/Multibanco/Multibanco.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/Redirect.js +1 -1
- package/dist/es/components/Redirect/Redirect.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/Trustly/Trustly.js +1 -1
- package/dist/es/components/Trustly/Trustly.js.map +1 -1
- package/dist/es/components/WeChat/config.js +1 -1
- package/dist/es/components/WeChat/config.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/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
- package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
- package/dist/es/components/index.js +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/CtPCards/CtPCards.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/models/ShopperCard.js +1 -1
- package/dist/es/components/internal/ClickToPay/models/ShopperCard.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/ClickToPay/services/sdks/SrciError.js +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/SrciError.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/utils.js +1 -1
- package/dist/es/components/internal/ClickToPay/services/utils.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/OpenInvoice/OpenInvoice.js +1 -1
- package/dist/es/components/internal/OpenInvoice/OpenInvoice.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/RedirectButton/RedirectButton.js +1 -1
- package/dist/es/components/internal/RedirectButton/RedirectButton.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/AdyenCheckout.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/CheckoutSession/CheckoutSession.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/ProcessResponse/PaymentAction/PaymentAction.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.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/analytics/collect-id.js.map +1 -1
- package/dist/es/core/Services/http.js +1 -1
- package/dist/es/core/Services/http.js.map +1 -1
- package/dist/es/core/Services/sessions/setup-session.js +1 -1
- package/dist/es/core/Services/sessions/setup-session.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/core.registry.js.map +1 -1
- package/dist/es/core/utils.js +1 -1
- package/dist/es/core/utils.js.map +1 -1
- package/dist/es/external/preact/dist/preact.js +1 -1
- package/dist/es/external/preact/dist/preact.js.map +1 -1
- package/dist/es/index.d.ts +904 -1252
- package/dist/es/index.js +1 -1
- package/dist/es/language/constants.js +1 -1
- package/dist/es/language/constants.js.map +1 -1
- 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 +65 -65
- 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/BankTransfer/BankTransfer.js +1 -1
- package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
- package/dist/es-legacy/components/Blik/Blik.js +1 -1
- package/dist/es-legacy/components/Blik/Blik.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/CardInput.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.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 +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/useSRPanelForCardInputErrors.js +2 -0
- package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -0
- 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/CashAppPay.js +1 -1
- package/dist/es-legacy/components/CashAppPay/CashAppPay.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/PaymentMethodList.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
- package/dist/es-legacy/components/Dropin/elements/createElements.js.map +1 -1
- package/dist/es-legacy/components/Dropin/elements/createInstantPaymentElements.js.map +1 -1
- package/dist/es-legacy/components/Dropin/elements/createStoredElements.js.map +1 -1
- package/dist/es-legacy/components/Dropin/elements/filters.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/Giropay/Giropay.js +1 -1
- package/dist/es-legacy/components/Giropay/Giropay.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/Multibanco/Multibanco.js +1 -1
- package/dist/es-legacy/components/Multibanco/Multibanco.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/Redirect.js +1 -1
- package/dist/es-legacy/components/Redirect/Redirect.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/Trustly/Trustly.js +1 -1
- package/dist/es-legacy/components/Trustly/Trustly.js.map +1 -1
- package/dist/es-legacy/components/WeChat/config.js +1 -1
- package/dist/es-legacy/components/WeChat/config.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/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
- package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
- package/dist/es-legacy/components/index.js +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/CtPCards/CtPCards.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/models/ShopperCard.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/models/ShopperCard.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/ClickToPay/services/sdks/SrciError.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/SrciError.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/utils.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/utils.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/OpenInvoice/OpenInvoice.js +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.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/RedirectButton/RedirectButton.js +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.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/AdyenCheckout.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/CheckoutSession/CheckoutSession.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/ProcessResponse/PaymentAction/PaymentAction.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.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/analytics/collect-id.js.map +1 -1
- package/dist/es-legacy/core/Services/http.js +1 -1
- package/dist/es-legacy/core/Services/http.js.map +1 -1
- package/dist/es-legacy/core/Services/sessions/setup-session.js +1 -1
- package/dist/es-legacy/core/Services/sessions/setup-session.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/core.registry.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/external/preact/dist/preact.js +1 -1
- package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
- package/dist/es-legacy/index.js +1 -1
- package/dist/es-legacy/language/constants.js +1 -1
- package/dist/es-legacy/language/constants.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 +36 -32
- package/dist/es/components/Ideal/index.js +0 -2
- package/dist/es/components/Ideal/index.js.map +0 -1
- package/dist/es/core/Services/analytics/log-event.js +0 -2
- package/dist/es/core/Services/analytics/log-event.js.map +0 -1
- package/dist/es-legacy/components/Ideal/index.js +0 -2
- package/dist/es-legacy/components/Ideal/index.js.map +0 -1
- package/dist/es-legacy/core/Services/analytics/log-event.js +0 -2
- package/dist/es-legacy/core/Services/analytics/log-event.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IssuerListContainer.js","sources":["../../../../../src/components/helpers/IssuerListContainer/IssuerListContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport IssuerList from '../../internal/IssuerList';\nimport getIssuerImageUrl from '../../../utils/get-issuer-image';\nimport { FALLBACK_CONTEXT } from '../../../core/config';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport RedirectButton from '../../internal/RedirectButton';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { IssuerListConfiguration, IssuerListData } from './types';\nimport type { ICore } from '../../../core/types';\n\nclass IssuerListContainer extends UIElement<IssuerListConfiguration> {\n protected static defaultProps = {\n showImage: true,\n issuers: [],\n highlightedIssuers: [],\n loadingContext: FALLBACK_CONTEXT,\n showPaymentMethodItemImages: false\n };\n\n constructor(checkout: ICore, props?: IssuerListConfiguration) {\n super(checkout, props);\n\n const getImage = props => this.resources.getImage(props);\n\n if (this.props.showImage) {\n const getIssuerIcon = getIssuerImageUrl({ loadingContext: this.props.loadingContext }, this.constructor['type'], getImage);\n\n this.props.issuers = this.props.issuers.map(item => ({\n ...item,\n icon: getIssuerIcon(item.id)\n }));\n }\n }\n\n formatProps(props) {\n const issuers = (props.details && props.details.length && (props.details.find(d => d.key === 'issuer') || {}).items) || props.issuers || [];\n return { ...props, issuers };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): IssuerListData {\n return {\n paymentMethod: {\n type: this.type,\n issuer: this.state?.data?.issuer\n }\n };\n }\n\n /**\n * Returns whether the component state is valid or not\n */\n get isValid() {\n if (this.props.issuers.length === 0) {\n return true;\n }\n return !!this.state?.isValid;\n }\n\n /**\n * Returns brands array (similar to card) depending on showPaymentMethodItemImages\n * This is used to show the brands in the PaymentMethodItem\n * Requires brands icons to be loaded in the payment method\n */\n get brands(): { icon: any; name: string }[] {\n if (this.props.showPaymentMethodItemImages) {\n return this.props.issuers.map(brand => {\n const brandIcon = brand.icon;\n return { icon: brandIcon, name: brand.id };\n });\n }\n\n return [];\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.issuers.length > 0 ? (\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <IssuerList\n ref={ref => {\n this.componentRef = ref;\n }}\n items={this.props.issuers}\n highlightedIds={this.props.highlightedIssuers}\n {...this.props}\n {...this.state}\n showImage={this.props.showImage}\n type={this.constructor['type']}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n contextualText={this.props.i18n.get('issuerList.selectField.contextualText')}\n onSubmitAnalytics={this.submitAnalytics}\n />\n </SRPanelProvider>\n ) : (\n this.props.showPayButton
|
|
1
|
+
{"version":3,"file":"IssuerListContainer.js","sources":["../../../../../src/components/helpers/IssuerListContainer/IssuerListContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport IssuerList from '../../internal/IssuerList';\nimport getIssuerImageUrl from '../../../utils/get-issuer-image';\nimport { FALLBACK_CONTEXT } from '../../../core/config';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport RedirectButton from '../../internal/RedirectButton';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { IssuerListConfiguration, IssuerListData } from './types';\nimport type { ICore } from '../../../core/types';\n\nclass IssuerListContainer extends UIElement<IssuerListConfiguration> {\n protected static defaultProps = {\n showImage: true,\n issuers: [],\n highlightedIssuers: [],\n loadingContext: FALLBACK_CONTEXT,\n showPaymentMethodItemImages: false\n };\n\n constructor(checkout: ICore, props?: IssuerListConfiguration) {\n super(checkout, props);\n\n const getImage = props => this.resources.getImage(props);\n\n if (this.props.showImage) {\n const getIssuerIcon = getIssuerImageUrl({ loadingContext: this.props.loadingContext }, this.constructor['type'], getImage);\n\n this.props.issuers = this.props.issuers.map(item => ({\n ...item,\n icon: getIssuerIcon(item.id)\n }));\n }\n }\n\n formatProps(props) {\n const issuers = (props.details && props.details.length && (props.details.find(d => d.key === 'issuer') || {}).items) || props.issuers || [];\n return { ...props, issuers };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): IssuerListData {\n return {\n paymentMethod: {\n type: this.type,\n issuer: this.state?.data?.issuer\n }\n };\n }\n\n /**\n * Returns whether the component state is valid or not\n */\n get isValid() {\n if (this.props.issuers.length === 0) {\n return true;\n }\n return !!this.state?.isValid;\n }\n\n /**\n * Returns brands array (similar to card) depending on showPaymentMethodItemImages\n * This is used to show the brands in the PaymentMethodItem\n * Requires brands icons to be loaded in the payment method\n */\n get brands(): { icon: any; name: string }[] {\n if (this.props.showPaymentMethodItemImages) {\n return this.props.issuers.map(brand => {\n const brandIcon = brand.icon;\n return { icon: brandIcon, name: brand.id };\n });\n }\n\n return [];\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.issuers.length > 0 ? (\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <IssuerList\n ref={ref => {\n this.componentRef = ref;\n }}\n items={this.props.issuers}\n highlightedIds={this.props.highlightedIssuers}\n {...this.props}\n {...this.state}\n showImage={this.props.showImage}\n type={this.constructor['type']}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n contextualText={this.props.i18n.get('issuerList.selectField.contextualText')}\n onSubmitAnalytics={this.submitAnalytics}\n />\n </SRPanelProvider>\n ) : (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.props.name}\n {...this.props}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default IssuerListContainer;\n"],"names":["IssuerListContainer","UIElement","formatProps","props","issuers","details","length","find","d","key","items","_object_spread_props","formatData","_this_state_data","_this_state","paymentMethod","type","this","issuer","state","data","isValid","brands","showPaymentMethodItemImages","map","brand","icon","name","id","render","h","CoreProvider","i18n","loadingContext","resources","SRPanelProvider","srPanel","modules","IssuerList","ref","componentRef","highlightedIds","highlightedIssuers","showImage","constructor","onChange","setState","onSubmit","submit","payButton","contextualText","get","onSubmitAnalytics","submitAnalytics","RedirectButton","showPayButton","checkout","super","getImage","getIssuerIcon","getIssuerImageUrl","item","_define_property","defaultProps","FALLBACK_CONTEXT"],"mappings":"0xCAWA,MAAMA,UAA4BC,EAwB9BC,WAAAA,CAAYC,GACR,MAAMC,EAAWD,EAAME,SAAWF,EAAME,QAAQC,SAAWH,EAAME,QAAQE,MAAKC,GAAe,WAAVA,EAAEC,OAAqB,CAAC,GAAGC,OAAUP,EAAMC,SAAW,GACzI,OAAOO,EAAKR,EAAAA,CAAAA,EAAAA,GAAAA,CAAOC,WACvB,CAKAQ,UAAAA,OAIoBC,EAAAC,EAHhB,MAAO,CACHC,cAAe,CACXC,KAAMC,KAAKD,KACXE,OAAkB,QAAVJ,EAAAG,KAAKE,aAAL,IAAAL,GAAA,QAAAD,EAAAC,EAAYM,YAAZ,IAAAP,OAAA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wB,SAASvD,GAElD,GAAIc,KAAKd,MAAMwC,UAAW,CACtB,MAAMgB,EAAgBC,EAAkB,CAAE3B,eAAgBhB,KAAKd,MAAM8B,gBAAkBhB,KAAK2B,iBAAqBc,GAEjHzC,KAAKd,MAAMC,QAAUa,KAAKd,MAAMC,QAAQoB,KAAIqC,GAASlD,EAC9CkD,EAAAA,CAAAA,EAAAA,GAAAA,CACHnC,KAAMiC,EAAcE,EAAKjC,OAEjC,CACJ,EArBAkC,EADE9D,EACe+D,eAAe,CAC5BpB,WAAW,EACXvC,QAAS,GACTsC,mBAAoB,GACpBT,eAAgB+B,EAChBzC,6BAA6B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as e}from"../../internal/UIElement/UIElement.js";import r from"../../internal/QRLoader/QRLoader.js";import{CoreProvider as o}from"../../../core/Context/CoreProvider.js";import n from"../../internal/RedirectButton/RedirectButton.js";import s from"../../../core/Errors/SRPanelProvider.js";function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function p(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){i(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}class c extends e{formatData(){return{paymentMethod:p({type:this.type},this.state.data)}}get isValid(){return!0}renderQRCode(){return t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(s,{srPanel:this.props.modules.srPanel},t(r,a(p({ref:t=>{this.componentRef=t}},this.props),{type:this.constructor.type,brandLogo:this.props.brandLogo||this.icon,delay:this.props.delay,onComplete:this.onComplete,countdownTime:this.props.countdownTime,instructions:this.props.instructions,onActionHandled:this.props.onActionHandled,brandName:this.displayName,onSubmitAnalytics:this.submitAnalytics}))))}render(){return this.props.paymentData?this.renderQRCode():this.props.showPayButton?t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(n,{name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}})):null}}i(c,"defaultProps",{qrCodeImage:"",amount:null,paymentData:null,onError:()=>{},onComplete:()=>{},onActionHandled:()=>{}});export{c as default};
|
|
1
|
+
import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as e}from"../../internal/UIElement/UIElement.js";import r from"../../internal/QRLoader/QRLoader.js";import{CoreProvider as o}from"../../../core/Context/CoreProvider.js";import n from"../../internal/RedirectButton/RedirectButton.js";import s from"../../../core/Errors/SRPanelProvider.js";function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function p(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){i(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}class c extends e{formatData(){return{paymentMethod:p({type:this.type},this.state.data)}}get isValid(){return!0}renderQRCode(){return t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(s,{srPanel:this.props.modules.srPanel},t(r,a(p({ref:t=>{this.componentRef=t}},this.props),{type:this.constructor.type,brandLogo:this.props.brandLogo||this.icon,delay:this.props.delay,onComplete:this.onComplete,countdownTime:this.props.countdownTime,instructions:this.props.instructions,onActionHandled:this.props.onActionHandled,brandName:this.displayName,onSubmitAnalytics:this.submitAnalytics}))))}render(){return this.props.paymentData?this.renderQRCode():this.props.showPayButton?t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(n,{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}})):null}}i(c,"defaultProps",{qrCodeImage:"",amount:null,paymentData:null,onError:()=>{},onComplete:()=>{},onActionHandled:()=>{}});export{c as default};
|
|
2
2
|
//# sourceMappingURL=QRLoaderContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRLoaderContainer.js","sources":["../../../../../src/components/helpers/QRLoaderContainer/QRLoaderContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport QRLoader from '../../internal/QRLoader';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport RedirectButton from '../../internal/RedirectButton';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { QRLoaderConfiguration } from './types';\n\nclass QRLoaderContainer<T extends QRLoaderConfiguration = QRLoaderConfiguration> extends UIElement<T> {\n // Using the generic here allow to fully extend the QRLoaderContainer (including it's props)\n protected static defaultProps = {\n qrCodeImage: '',\n amount: null,\n paymentData: null,\n onError: () => {},\n onComplete: () => {},\n onActionHandled: () => {}\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...this.state.data\n }\n };\n }\n\n get isValid() {\n return true;\n }\n\n // Makes possible to extend the final QR code step\n public renderQRCode() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <QRLoader\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n type={this.constructor['type']}\n brandLogo={this.props.brandLogo || this.icon}\n delay={this.props.delay}\n onComplete={this.onComplete}\n countdownTime={this.props.countdownTime}\n instructions={this.props.instructions}\n onActionHandled={this.props.onActionHandled}\n brandName={this.displayName}\n onSubmitAnalytics={this.submitAnalytics}\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n\n render() {\n if (this.props.paymentData) {\n return this.renderQRCode();\n }\n\n if (this.props.showPayButton) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <RedirectButton\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n </CoreProvider>\n );\n }\n\n return null;\n }\n}\n\nexport default QRLoaderContainer;\n"],"names":["QRLoaderContainer","UIElement","formatData","paymentMethod","_object_spread","type","this","state","data","isValid","renderQRCode","h","CoreProvider","i18n","props","loadingContext","resources","SRPanelProvider","srPanel","modules","QRLoader","ref","componentRef","constructor","brandLogo","icon","delay","onComplete","countdownTime","instructions","onActionHandled","brandName","displayName","onSubmitAnalytics","submitAnalytics","render","paymentData","showPayButton","RedirectButton","name","onSubmit","submit","payButton","_define_property","defaultProps","qrCodeImage","amount","onError"],"mappings":"yqCAQA,MAAMA,UAAmFC,EAWrFC,UAAAA,GACI,MAAO,CACHC,cAAeC,EAAA,CACXC,KAAMC,KAAKD,MACRC,KAAKC,MAAMC,MAG1B,CAEA,WAAIC,GACA,OAAO,CACX,CAGOC,YAAAA,GACH,OACIC,EAACC,EAAAA,CAAaC,KAAMP,KAAKQ,MAAMD,KAAME,eAAgBT,KAAKQ,MAAMC,eAAgBC,UAAWV,KAAKU,WAC5FL,EAACM,EAAAA,CAAgBC,QAASZ,KAAKQ,MAAMK,QAAQD,SACzCP,EAACS,EAAAA,EAAAA,EAAAA,CACGC,IAAKA,IACDf,KAAKgB,aAAeD,CAAAA,GAEpBf,KAAKQ,OAAK,CACdT,KAAMC,KAAKiB,YAAmB,KAC9BC,UAAWlB,KAAKQ,MAAMU,WAAalB,KAAKmB,KACxCC,MAAOpB,KAAKQ,MAAMY,MAClBC,WAAYrB,KAAKqB,WACjBC,cAAetB,KAAKQ,MAAMc,cAC1BC,aAAcvB,KAAKQ,MAAMe,aACzBC,gBAAiBxB,KAAKQ,MAAMgB,gBAC5BC,UAAWzB,KAAK0B,YAChBC,kBAAmB3B,KAAK4B,oBAK5C,CAEAC,MAAAA,GACI,OAAI7B,KAAKQ,MAAMsB,YACJ9B,KAAKI,eAGZJ,KAAKQ,MAAMuB,cAEP1B,EAACC,EAAAA,CAAaC,KAAMP,KAAKQ,MAAMD,KAAME,eAAgBT,KAAKQ,MAAMC,eAAgBC,UAAWV,KAAKU,WAC5FL,EAAC2B,EAAAA,
|
|
1
|
+
{"version":3,"file":"QRLoaderContainer.js","sources":["../../../../../src/components/helpers/QRLoaderContainer/QRLoaderContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport QRLoader from '../../internal/QRLoader';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport RedirectButton from '../../internal/RedirectButton';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { QRLoaderConfiguration } from './types';\n\nclass QRLoaderContainer<T extends QRLoaderConfiguration = QRLoaderConfiguration> extends UIElement<T> {\n // Using the generic here allow to fully extend the QRLoaderContainer (including it's props)\n protected static defaultProps = {\n qrCodeImage: '',\n amount: null,\n paymentData: null,\n onError: () => {},\n onComplete: () => {},\n onActionHandled: () => {}\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...this.state.data\n }\n };\n }\n\n get isValid() {\n return true;\n }\n\n // Makes possible to extend the final QR code step\n public renderQRCode() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <QRLoader\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n type={this.constructor['type']}\n brandLogo={this.props.brandLogo || this.icon}\n delay={this.props.delay}\n onComplete={this.onComplete}\n countdownTime={this.props.countdownTime}\n instructions={this.props.instructions}\n onActionHandled={this.props.onActionHandled}\n brandName={this.displayName}\n onSubmitAnalytics={this.submitAnalytics}\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n\n render() {\n if (this.props.paymentData) {\n return this.renderQRCode();\n }\n\n if (this.props.showPayButton) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n </CoreProvider>\n );\n }\n\n return null;\n }\n}\n\nexport default QRLoaderContainer;\n"],"names":["QRLoaderContainer","UIElement","formatData","paymentMethod","_object_spread","type","this","state","data","isValid","renderQRCode","h","CoreProvider","i18n","props","loadingContext","resources","SRPanelProvider","srPanel","modules","QRLoader","ref","componentRef","constructor","brandLogo","icon","delay","onComplete","countdownTime","instructions","onActionHandled","brandName","displayName","onSubmitAnalytics","submitAnalytics","render","paymentData","showPayButton","RedirectButton","name","onSubmit","submit","payButton","_define_property","defaultProps","qrCodeImage","amount","onError"],"mappings":"yqCAQA,MAAMA,UAAmFC,EAWrFC,UAAAA,GACI,MAAO,CACHC,cAAeC,EAAA,CACXC,KAAMC,KAAKD,MACRC,KAAKC,MAAMC,MAG1B,CAEA,WAAIC,GACA,OAAO,CACX,CAGOC,YAAAA,GACH,OACIC,EAACC,EAAAA,CAAaC,KAAMP,KAAKQ,MAAMD,KAAME,eAAgBT,KAAKQ,MAAMC,eAAgBC,UAAWV,KAAKU,WAC5FL,EAACM,EAAAA,CAAgBC,QAASZ,KAAKQ,MAAMK,QAAQD,SACzCP,EAACS,EAAAA,EAAAA,EAAAA,CACGC,IAAKA,IACDf,KAAKgB,aAAeD,CAAAA,GAEpBf,KAAKQ,OAAK,CACdT,KAAMC,KAAKiB,YAAmB,KAC9BC,UAAWlB,KAAKQ,MAAMU,WAAalB,KAAKmB,KACxCC,MAAOpB,KAAKQ,MAAMY,MAClBC,WAAYrB,KAAKqB,WACjBC,cAAetB,KAAKQ,MAAMc,cAC1BC,aAAcvB,KAAKQ,MAAMe,aACzBC,gBAAiBxB,KAAKQ,MAAMgB,gBAC5BC,UAAWzB,KAAK0B,YAChBC,kBAAmB3B,KAAK4B,oBAK5C,CAEAC,MAAAA,GACI,OAAI7B,KAAKQ,MAAMsB,YACJ9B,KAAKI,eAGZJ,KAAKQ,MAAMuB,cAEP1B,EAACC,EAAAA,CAAaC,KAAMP,KAAKQ,MAAMD,KAAME,eAAgBT,KAAKQ,MAAMC,eAAgBC,UAAWV,KAAKU,WAC5FL,EAAC2B,EAAAA,CACGD,cAAe/B,KAAKQ,MAAMuB,cAC1BE,KAAMjC,KAAK0B,YACXQ,SAAUlC,KAAKmC,OACfC,UAAWpC,KAAKoC,UAChBrB,IAAKA,IACDf,KAAKgB,aAAeD,CAAAA,KAOjC,IACX,EArEAsB,EAFE3C,EAEe4C,eAAe,CAC5BC,YAAa,GACbC,OAAQ,KACRV,YAAa,KACbW,QAAS,OACTpB,WAAY,OACZG,gBAAiB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{CardElement as Card}from"./Card/Card.js";export{default as Bancontact}from"./Card/Bancontact.js";export{CustomCard}from"./CustomCard/CustomCard.js";export{default as ThreeDS2Challenge}from"./ThreeDS2/ThreeDS2Challenge.js";export{default as ThreeDS2DeviceFingerprint}from"./ThreeDS2/ThreeDS2DeviceFingerprint.js";export{AchElement as Ach}from"./Ach/Ach.js";export{default as BacsDirectDebit}from"./BacsDD/BacsDD.js";export{default as SepaDirectDebit}from"./Sepa/Sepa.js";export{default as Affirm}from"./Affirm/Affirm.js";export{default as AfterPay}from"./AfterPay/AfterPay.js";export{default as AfterPayB2B}from"./AfterPay/AfterPayB2B.js";export{default as Atome}from"./Atome/Atome.js";export{default as FacilPay3x}from"./FacilyPay/FacilyPay3x.js";export{default as FacilPay4x}from"./FacilyPay/FacilyPay4x.js";export{default as FacilPay6x}from"./FacilyPay/FacilyPay6x.js";export{default as FacilPay10x}from"./FacilyPay/FacilyPay10x.js";export{default as FacilPay12x}from"./FacilyPay/FacilyPay12x.js";export{default as RatePay}from"./RatePay/RatePay.js";export{default as RatePayDirectDebit}from"./RatePay/RatePayDirectDebit.js";export{default as Riverty}from"./Riverty/Riverty.js";export{AmazonPayElement as AmazonPay}from"./AmazonPay/AmazonPay.js";export{default as ApplePay}from"./ApplePay/ApplePay.js";export{CashAppPay}from"./CashAppPay/CashAppPay.js";export{ClickToPayElement as ClickToPay}from"./ClickToPay/ClickToPay.js";export{default as GooglePay}from"./GooglePay/GooglePay.js";export{default as PayPal}from"./PayPal/Paypal.js";export{BoletoElement as Boleto}from"./Boleto/Boleto.js";export{DokuElement as Doku}from"./Doku/Doku.js";export{OxxoElement as Oxxo}from"./Oxxo/Oxxo.js";export{default as BillDeskOnline}from"./BillDesk/BillDeskOnline.js";export{default as BillDeskWallet}from"./BillDesk/BillDeskWallet.js";export{default as Dotpay}from"./Dotpay/index.js";export{default as EPS}from"./EPS/index.js";export{default as
|
|
1
|
+
export{CardElement as Card}from"./Card/Card.js";export{default as Bancontact}from"./Card/Bancontact.js";export{CustomCard}from"./CustomCard/CustomCard.js";export{default as ThreeDS2Challenge}from"./ThreeDS2/ThreeDS2Challenge.js";export{default as ThreeDS2DeviceFingerprint}from"./ThreeDS2/ThreeDS2DeviceFingerprint.js";export{AchElement as Ach}from"./Ach/Ach.js";export{default as BacsDirectDebit}from"./BacsDD/BacsDD.js";export{default as SepaDirectDebit}from"./Sepa/Sepa.js";export{default as Affirm}from"./Affirm/Affirm.js";export{default as AfterPay}from"./AfterPay/AfterPay.js";export{default as AfterPayB2B}from"./AfterPay/AfterPayB2B.js";export{default as Atome}from"./Atome/Atome.js";export{default as FacilPay3x}from"./FacilyPay/FacilyPay3x.js";export{default as FacilPay4x}from"./FacilyPay/FacilyPay4x.js";export{default as FacilPay6x}from"./FacilyPay/FacilyPay6x.js";export{default as FacilPay10x}from"./FacilyPay/FacilyPay10x.js";export{default as FacilPay12x}from"./FacilyPay/FacilyPay12x.js";export{default as RatePay}from"./RatePay/RatePay.js";export{default as RatePayDirectDebit}from"./RatePay/RatePayDirectDebit.js";export{default as Riverty}from"./Riverty/Riverty.js";export{AmazonPayElement as AmazonPay}from"./AmazonPay/AmazonPay.js";export{default as ApplePay}from"./ApplePay/ApplePay.js";export{CashAppPay}from"./CashAppPay/CashAppPay.js";export{ClickToPayElement as ClickToPay}from"./ClickToPay/ClickToPay.js";export{default as GooglePay}from"./GooglePay/GooglePay.js";export{default as PayPal}from"./PayPal/Paypal.js";export{BoletoElement as Boleto}from"./Boleto/Boleto.js";export{DokuElement as Doku}from"./Doku/Doku.js";export{OxxoElement as Oxxo}from"./Oxxo/Oxxo.js";export{default as BillDeskOnline}from"./BillDesk/BillDeskOnline.js";export{default as BillDeskWallet}from"./BillDesk/BillDeskWallet.js";export{default as Dotpay}from"./Dotpay/index.js";export{default as EPS}from"./EPS/index.js";export{default as MolPayEBankingMY}from"./MolPayEBanking/MolPayEBankingMY.js";export{default as MolPayEBankingTH}from"./MolPayEBanking/MolPayEBankingTH.js";export{default as MolPayEBankingVN}from"./MolPayEBanking/MolPayEBankingVN.js";export{default as OnlineBankingCZ}from"./OnlineBankingCZ/index.js";export{default as OnlineBankingIN}from"./OnlineBankingIN/index.js";export{default as OnlineBankingPL}from"./OnlineBankingPL/OnlineBankingPL.js";export{default as OnlineBankingSK}from"./OnlineBankingSK/index.js";export{default as OnlineBankingFI}from"./OnlineBankingFI/OnlineBankingFI.js";export{default as PayByBank}from"./PayByBank/PayByBank.js";export{default as PayuCashcard}from"./PayU/PayuCashcard.js";export{default as PayuNetBanking}from"./PayU/PayuNetBanking.js";export{default as WalletIN}from"./WalletIN/index.js";export{DragonpayElement as Dragonpay}from"./Dragonpay/Dragonpay.js";export{EcontextElement as Econtext}from"./Econtext/Econtext.js";export{default as Giropay}from"./Giropay/Giropay.js";export{MultibancoElement as Multibanco}from"./Multibanco/Multibanco.js";export{default as Redirect}from"./Redirect/Redirect.js";export{default as Twint}from"./Twint/Twint.js";export{default as Vipps}from"./Vipps/Vipps.js";export{default as Trustly}from"./Trustly/Trustly.js";export{default as Klarna}from"./Klarna/KlarnaPayments.js";export{default as BcmcMobile}from"./BcmcMobile/BcmcMobile.js";export{default as Pix}from"./Pix/Pix.js";export{default as Swish}from"./Swish/Swish.js";export{default as WeChat}from"./WeChat/WeChat.js";export{default as PromptPay}from"./PromptPay/PromptPay.js";export{default as PayNow}from"./PayNow/PayNow.js";export{default as DuitNow}from"./DuitNow/DuitNow.js";export{default as PayMe}from"./PayMe/PayMe.js";export{default as Blik}from"./Blik/Blik.js";export{MBWayElement as MBWay}from"./MBWay/MBWay.js";export{default as UPI}from"./UPI/UPI.js";export{ANCVElement as ANCV}from"./ANCV/ANCV.js";export{GiftcardElement as Giftcard}from"./Giftcard/Giftcard.js";export{MealVoucherFRElement as MealVoucherFR}from"./MealVoucherFR/MealVoucherFR.js";export{AddressElement as Address}from"./Address/Address.js";export{BankTransferElement as BankTransfer}from"./BankTransfer/BankTransfer.js";export{default as Donation}from"./Donation/Donation.js";export{default as Dropin}from"./Dropin/Dropin.js";export{PersonalDetailsElement as PersonalDetails}from"./PersonalDetails/PersonalDetails.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -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,KAAEA,EAAIC,eAAEA,GAAmB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IAAK9D,EAAMiE,UAAWD,IAAKhE,EAAMwC,KAAMoB,UAAU,sCAE1EF,EAACC,MAAAA,CAAIC,UAAU,mCAAmC5D,EAAM2E,aAExDjB,EAACC,MAAAA,CAAIC,UAAU,2CACXF,EAACC,MAAAA,CAAIC,UAAU,4CACXF,EAACQ,EAAAA,CAAQC,QAAQ,EAAOC,KAAK,YAEjCV,EAACC,MAAAA,CAAIC,UAAU,yCAAyC5D,EAAM4E,YAGjE5E,EAAM6E,oBACHnB,EAACC,MAAAA,CAAIC,UAAU,2CACXF,EAACC,MAAAA,CAAIC,UAAU,mCACXF,EAACoB,OAAAA,CAAKlB,UAAU,oCAAoCmB,MAAO,CAAEC,MAAO,GAAG/D,SAG3EyC,EAACC,MAAAA,CAAIC,UAAU,oCACVS,EAAgB,GAAG,IACpBX,EAACuB,EAAAA,CAAUC,eAAgBlF,EAAMmF,cAAeC,OAzKpDC,IACZnE,EAAcmE,EAAKpE,WAAU,EAwKmDqE,YA/KnE,KACb5E,GAAW,GACX0C,aAAa7B,GACbvB,EAAMiC,QAAQ,IAAIC,EAAmB,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
|
+
{"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 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,CAAEH,QAASD,EAAO1B,MAAM2B,SAC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ClFmC,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,CAAjCK,YAAWC,aACnBN,EAAcG,e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EzB,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,OAAAA,EAAAA,KACkBA,QAAAA,E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Q,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":"CtPCards.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPCards/CtPCards.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPSingleCard from './CtPSingleCard/CtPSingleCard';\nimport PayButton from '../../../PayButton';\nimport { amountLabel } from '../../../PayButton/utils';\nimport CtPCardsList from './CtPCardsList';\nimport ShopperCard from '../../models/ShopperCard';\nimport SrciError from '../../services/sdks/SrciError';\nimport CtPSection from '../CtPSection';\nimport { CTP_IFRAME_NAME } from '../../services/utils';\nimport Iframe from '../../../../internal/IFrame';\nimport useImage from '../../../../../core/Context/useImage';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport isMobile from '../../../../../utils/isMobile';\nimport Language from '../../../../../language';\nimport { PaymentAmount } from '../../../../../types/global-types';\nimport './CtPCards.scss';\nimport AdyenCheckoutError from '../../../../../core/Errors/AdyenCheckoutError';\nimport { PREFIX } from '../../../Icon/constants';\n\
|
|
1
|
+
{"version":3,"file":"CtPCards.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPCards/CtPCards.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPSingleCard from './CtPSingleCard/CtPSingleCard';\nimport PayButton from '../../../PayButton';\nimport { amountLabel } from '../../../PayButton/utils';\nimport CtPCardsList from './CtPCardsList';\nimport ShopperCard from '../../models/ShopperCard';\nimport SrciError from '../../services/sdks/SrciError';\nimport CtPSection from '../CtPSection';\nimport { CTP_IFRAME_NAME } from '../../services/utils';\nimport Iframe from '../../../../internal/IFrame';\nimport useImage from '../../../../../core/Context/useImage';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport isMobile from '../../../../../utils/isMobile';\nimport Language from '../../../../../language';\nimport { PaymentAmount } from '../../../../../types/global-types';\nimport './CtPCards.scss';\nimport AdyenCheckoutError from '../../../../../core/Errors/AdyenCheckoutError';\nimport { PREFIX } from '../../../Icon/constants';\n\ntype CtPCardsProps = {\n onDisplayCardComponent?(): void;\n};\n\nfunction getErrorLabel(errorCode: string, i18n: Language): string {\n if (!errorCode) return null;\n\n const errorLabel = i18n.get(`ctp.errors.${errorCode}`);\n if (errorLabel.includes('ctp.errors')) return i18n.get(`ctp.errors.UNKNOWN_ERROR`);\n return errorLabel;\n}\n\nfunction getPayButtonLabel(i18n: Language, amount: PaymentAmount, checkoutCard?: ShopperCard): string | null {\n if (!checkoutCard) return i18n.get('payButton');\n if (!isMobile())\n return i18n.get('payButton.with', {\n values: { value: amountLabel(i18n, amount), maskedData: `•••• ${checkoutCard?.panLastFour}` }\n });\n return null;\n}\n\nconst CtPCards = ({ onDisplayCardComponent }: CtPCardsProps) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const { amount, cards, checkout, isCtpPrimaryPaymentMethod, status, onSubmit, onSetStatus, onError } = useClickToPayContext();\n const [checkoutCard, setCheckoutCard] = useState<ShopperCard | undefined>(cards.find(card => !card.isExpired) || cards[0]);\n const [errorCode, setErrorCode] = useState<string>(null);\n const isEveryCardExpired = cards.every(card => card.isExpired);\n const [isShopperCheckingOutWithCtp, setIsShopperCheckingOutWithCtp] = useState<boolean>(false);\n\n useEffect(() => {\n if (cards.length === 0 || isEveryCardExpired) {\n onDisplayCardComponent?.();\n }\n }, [onDisplayCardComponent, isEveryCardExpired, cards]);\n\n const doCheckout = useCallback(async () => {\n if (!checkoutCard) return;\n\n try {\n setIsShopperCheckingOutWithCtp(true);\n setErrorCode(null);\n onSetStatus('loading');\n const payload = await checkout(checkoutCard);\n onSubmit(payload);\n } catch (error: unknown) {\n if (error instanceof SrciError) {\n setErrorCode(error?.reason);\n console.warn(`CtP - Checkout: Reason: ${error?.reason} / Source: ${error?.source} / Scheme: ${error?.scheme}`);\n }\n setIsShopperCheckingOutWithCtp(false);\n\n if (error instanceof AdyenCheckoutError) onError(error);\n else onError(new AdyenCheckoutError('ERROR', 'Error during ClickToPay checkout', { cause: error }));\n }\n }, [checkout, checkoutCard]);\n\n const handleOnChangeCard = useCallback((card: ShopperCard) => {\n setCheckoutCard(card);\n }, []);\n\n /**\n * If shopper submits the payment using the default Card component while CtP is rendered, the status here will be updated\n * and that can potentially display an iframe.\n *\n * Therefore, we use the flag 'isShopperCheckingOutWithCtp' to flag that the iframe should be displayed only in case the\n * Shopper is checking out with Click to Pay.\n */\n const displayNetworkDcf = isShopperCheckingOutWithCtp && status === 'loading' && checkoutCard?.isDcfPopupEmbedded;\n const displayCardCheckoutView = status !== 'loading' || !displayNetworkDcf;\n\n return (\n <Fragment>\n <Iframe name={CTP_IFRAME_NAME} height=\"380\" width=\"100%\" classNameModifiers={[displayNetworkDcf ? '' : 'hidden']} />\n\n {displayCardCheckoutView && (\n <Fragment>\n <CtPSection.Title>{i18n.get('ctp.cards.title')}</CtPSection.Title>\n <CtPSection.Text>{i18n.get('ctp.cards.subtitle')}</CtPSection.Text>\n\n {cards.length === 0 && <div className=\"adyen-checkout-ctp__empty-cards\">{i18n.get('ctp.emptyProfile.message')}</div>}\n {cards.length === 1 && <CtPSingleCard card={cards[0]} errorMessage={getErrorLabel(errorCode, i18n)} />}\n {cards.length > 1 && (\n <CtPCardsList\n cardSelected={checkoutCard}\n cards={cards}\n onChangeCard={handleOnChangeCard}\n errorMessage={getErrorLabel(errorCode, i18n)}\n />\n )}\n\n <PayButton\n disabled={isEveryCardExpired}\n amount={amount}\n label={getPayButtonLabel(i18n, amount, checkoutCard)}\n status={status}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n icon={\n cards.length !== 0 &&\n getImage({ imageFolder: 'components/' })(isCtpPrimaryPaymentMethod ? `${PREFIX}lock` : `${PREFIX}lock_black`)\n }\n onClick={doCheckout}\n />\n </Fragment>\n )}\n </Fragment>\n );\n};\n\nexport default CtPCards;\n"],"names":["getErrorLabel","errorCode","i18n","errorLabel","get","includes","getPayButtonLabel","amount","checkoutCard","isMobile","values","value","amountLabel","maskedData","panLastFour","CtPCards","onDisplayCardComponent","useCoreContext","getImage","useImage","cards","checkout","isCtpPrimaryPaymentMethod","status","onSubmit","onSetStatus","onError","useClickToPayContext","setCheckoutCard","useState","find","card","isExpired","setErrorCode","isEveryCardExpired","every","isShopperCheckingOutWithCtp","setIsShopperCheckingOutWithCtp","useEffect","length","doCheckout","useCallback","async","payload","error","SrciError","reason","console","warn","source","scheme","AdyenCheckoutError","cause","handleOnChangeCard","displayNetworkDcf","isDcfPopupEmbedded","displayCardCheckoutView","h","Fragment","Iframe","name","CTP_IFRAME_NAME","height","width","classNameModifiers","CtPSection","Title","Text","div","className","CtPSingleCard","errorMessage","CtPCardsList","cardSelected","onChangeCard","PayButton","disabled","label","variant","icon","imageFolder","PREFIX","onClick"],"mappings":"46BAyBA,SAASA,EAAcC,EAAmBC,GACtC,IAAKD,EAAW,OAAO,KAEvB,MAAME,EAAaD,EAAKE,IAAI,cAAcH,KAC1C,OAAIE,EAAWE,SAAS,cAAsBH,EAAKE,IAAI,4BAChDD,CACX,CAEA,SAASG,EAAkBJ,EAAgBK,EAAuBC,GAC9D,OAAKA,EACAC,IAIE,KAHIP,EAAKE,IAAI,iBAAkB,CAC9BM,OAAQ,CAAEC,MAAOC,EAAYV,EAAMK,GAASM,WAAY,QAAQL,eAAAA,EAAcM,iBAH5DZ,EAAKE,IAAI,YAMvC,CAEA,MAAMW,EAAW,EAAGC,6BAChB,MAAMd,KAAEA,GAASe,IACXC,EAAWC,KACXZ,OAAEA,EAAMa,MAAEA,EAAKC,SAAEA,EAAQC,0BAAEA,EAAyBC,OAAEA,EAAMC,SAAEA,EAAQC,YAAEA,EAAWC,QAAEA,GAAYC,KAChGnB,EAAcoB,GAAmBC,EAAkCT,EAAMU,MAAKC,IAASA,EAAKC,aAAcZ,EAAM,KAChHnB,EAAWgC,GAAgBJ,EAAiB,MAC7CK,EAAqBd,EAAMe,OAAMJ,GAAQA,EAAKC,aAC7CI,EAA6BC,GAAkCR,GAAkB,GAExFS,GAAU,MACe,IAAjBlB,EAAMmB,QAAgBL,KACtBlB,SAAAA,IACJ,GACD,CAACA,EAAwBkB,EAAoBd,IAEhD,MAAMoB,EAAaC,GAAYC,UAC3B,GAAKlC,EAEL,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ACqB,IAAjB3D,EAAMmB,QACNrB,EAAS,CAAE8D,YAAa,eAAxB9D,CAAyCI,EAA4B,GAAG2D,QAAe,GAAGA,eAE9FC,QAAS1C"}
|
|
@@ -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,oB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ChBY,mBACKjD,EAAMkD,qBACHL,EAACM,EAAAA,CAAiBC,SAAUpD,EAAMqD,gBAAiBC,QAASpB,EAAwBD,aAAcD,IAG1GuB,aAAc/B,EAAiBlB,GAAkBN,EAAMuD,gBAAkB1C,EAAOe,IAAM,KACtF4B,mBAAoB,CAAC,QAErBX,EAACY,EAAAA,CACGV,KAAM,MACNW,YAAa,MACbC,YAAY,EACZC,MAAOlD,EAAKkB,IACZwB,SAAUpD,EAAMoD,SAChBS,QAASpD,EAAgB,MAAO,SAChCqD,OAAQrD,EAAgB,MAAO,QAC/BsD,QAASzB,EACT0B,WAAYtB,EACZuB,OAASC,IACL3C,EAASM,QAAUqC,CAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CtPResendOtpLink.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport classnames from 'classnames';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport Icon from '../../../../Icon';\nimport { isSrciError } from '../../../services/utils';\nimport { PREFIX } from '../../../../Icon/constants';\n\
|
|
1
|
+
{"version":3,"file":"CtPResendOtpLink.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport classnames from 'classnames';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport Icon from '../../../../Icon';\nimport { isSrciError } from '../../../services/utils';\nimport { PREFIX } from '../../../../Icon/constants';\n\nconst CONFIRMATION_SHOWING_TIME = 2000;\n\ninterface CtPResendOtpLinkProps {\n onError(errorCode: string): void;\n onResendCode(): void;\n disabled: boolean;\n}\n\nconst CtPResendOtpLink = ({ onError, onResendCode, disabled }: CtPResendOtpLinkProps): h.JSX.Element => {\n const [counter, setCounter] = useState<number>(null);\n const [showConfirmation, setShowConfirmation] = useState<boolean>(false);\n const { i18n } = useCoreContext();\n const { startIdentityValidation } = useClickToPayContext();\n\n useEffect(() => {\n let timeout = null;\n if (counter > 0) {\n timeout = setTimeout(() => setCounter(counter - 1), 1000);\n }\n return () => clearTimeout(timeout);\n }, [counter]);\n\n useEffect(() => {\n let timeout = null;\n\n if (showConfirmation) {\n timeout = setTimeout(() => {\n setShowConfirmation(false);\n setCounter(60);\n }, CONFIRMATION_SHOWING_TIME);\n }\n return () => clearTimeout(timeout);\n }, [showConfirmation]);\n\n const handleResendCodeClick = useCallback(\n async event => {\n event.preventDefault();\n\n try {\n onResendCode();\n setShowConfirmation(true);\n await startIdentityValidation();\n } catch (error: unknown) {\n setCounter(0);\n setShowConfirmation(false);\n\n if (!isSrciError(error)) {\n console.error(error);\n return;\n }\n\n onError(error.reason);\n }\n },\n [startIdentityValidation, onError, onResendCode]\n );\n\n if (showConfirmation) {\n return (\n <div className=\"adyen-checkout-ctp__otp-resend-code--confirmation\">\n {i18n.get('ctp.otp.codeResent')}\n <Icon type={`${PREFIX}checkmark`} height={14} width={14} />\n </div>\n );\n }\n\n if (counter > 0) {\n return (\n <div className=\"adyen-checkout-ctp__otp-resend-code--disabled\">\n {i18n.get('ctp.otp.resendCode')} -{' '}\n <span className=\"adyen-checkout-ctp__otp-resend-code-counter\"> {counter > 0 && `${counter}s`} </span>\n </div>\n );\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <div\n role=\"link\"\n tabIndex={0}\n className={classnames('adyen-checkout-ctp__otp-resend-code', { 'adyen-checkout-ctp__otp-resend-code--disabled': disabled })}\n onClick={handleResendCodeClick}\n >\n {i18n.get('ctp.otp.resendCode')}\n </div>\n );\n};\n\nexport default CtPResendOtpLink;\n"],"names":["CtPResendOtpLink","onError","onResendCode","disabled","counter","setCounter","useState","showConfirmation","setShowConfirmation","i18n","useCoreContext","startIdentityValidation","useClickToPayContext","useEffect","timeout","setTimeout","clearTimeout","handleResendCodeClick","useCallback","async","event","preventDefault","error","isSrciError","console","reason","h","div","className","get","Icon","type","PREFIX","height","width","span","role","tabIndex","classnames","onClick"],"mappings":"giBASA,MAQMA,EAAmB,EAAGC,UAASC,eAAcC,eAC/C,MAAOC,EAASC,GAAcC,EAAiB,OACxCC,EAAkBC,GAAuBF,GAAkB,IAC5DG,KAAEA,GAASC,KACXC,wBAAEA,GAA4BC,IAEpCC,GAAU,KACN,IAAIC,EAAU,KAId,OAHIV,EAAU,IACVU,EAAUC,YAAW,IAAMV,EAAWD,EAAU,IAAI,MAEjD,IAAMY,aAAaF,EAAAA,GAC3B,CAACV,IAEJS,GAAU,KACN,IAAIC,EAAU,KAQd,OANIP,IACAO,EAAUC,YAAW,KACjBP,GAAoB,GACpBH,EAAW,GAAA,GA5BO,MA+BnB,IAAMW,aAAaF,EAAAA,GAC3B,CAACP,IAEJ,MAAMU,EAAwBC,GAC1BC,MAAMC,IACFA,EAAMC,iBAEN,IACInB,IACAM,GAAoB,SACdG,GACV,CAAE,MAAOW,GAIL,GAHAjB,EAAW,GACXG,GAAoB,IAEfe,EAAYD,GAEb,YADAE,QAAQF,MAAMA,GAIlBrB,EAAQqB,EAAMG,OAClB,IAEJ,CAACd,EAAyBV,EAASC,IAGvC,OAAIK,EAEImB,EAACC,MAAAA,CAAIC,UAAU,qDACVnB,EAAKoB,IAAI,sBACVH,EAACI,EAAAA,CAAKC,KAAM,GAAGC,aAAmBC,OAAQ,GAAIC,MAAO,MAK7D9B,EAAU,EAENsB,EAACC,MAAAA,CAAIC,UAAU,iDACVnB,EAAKoB,IAAI,sBAAsB,KAAG,IACnCH,EAACS,OAAAA,CAAKP,UAAU,+CAA8C,IAAExB,EAAU,GAAK,GAAGA,KAAW,MAOrGsB,EAACC,MAAAA,CACGS,KAAK,OACLC,SAAU,EACVT,UAAWU,EAAW,sCAAuC,CAAE,gDAAiDnC,IAChHoC,QAAStB,GAERR,EAAKoB,IAAI,sBAAA"}
|
package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CtPLogoutLink.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.tsx"],"sourcesContent":["import { h } from 'preact';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport { CtpState } from '../../services/ClickToPayService';\nimport classnames from 'classnames';\nimport { useMemo } from 'preact/hooks';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport './CtPLogoutLink.scss';\n\nconst CtPLogoutLink = () => {\n const { ctpState, logoutShopper, status, cards } = useClickToPayContext();\n const { i18n } = useCoreContext();\n\n if ([CtpState.Ready, CtpState.OneTimePassword].includes(ctpState) === false) {\n return null;\n }\n\n const label = useMemo(() => {\n if (ctpState === CtpState.Ready && cards.length > 1) return i18n.get('ctp.logout.notYourCards');\n if (ctpState === CtpState.Ready && cards.length === 1) return i18n.get('ctp.logout.notYourCard');\n if (ctpState === CtpState.Ready && cards.length === 0) return i18n.get('ctp.logout.notYourProfile');\n return i18n.get('ctp.logout.notYou');\n }, [i18n, ctpState]);\n\n return (\n <span\n role=\"button\"\n tabIndex={0}\n className={classnames('adyen-checkout-ctp__section-logout-button', {\n 'adyen-checkout-ctp__section-logout-button--disabled': status === 'loading'\n })}\n onClick={logoutShopper}\n >\n {label}\n </span>\n );\n};\n\nexport default CtPLogoutLink;\n"],"names":["CtPLogoutLink","ctpState","logoutShopper","status","cards","useClickToPayContext","i18n","useCoreContext","CtpState","Ready","OneTimePassword","includes","label","useMemo","length","get","h","span","role","tabIndex","className","classnames","onClick"],"mappings":"uZAQA,MAAMA,EAAgB,KAClB,MAAMC,SAAEA,EAAQC,cAAEA,EAAaC,OAAEA,EAAMC,MAAEA,GAAUC,KAC7CC,KAAEA,GAASC,IAEjB,IAAsE,IAAlE,CAACC,EAASC,MAAOD,EAASE,iBAAiBC,SAASV,GACpD,OAAO,KAGX,MAAMW,EAAQC,GAAQ,IACdZ,IAAaO,EAASC,OAASL,EAAMU,OAAS,EAAUR,EAAKS,IAAI,2BACjEd,IAAaO,EAASC,OAA0B,IAAjBL,EAAMU,OAAqBR,EAAKS,IAAI,0BACnEd,IAAaO,EAASC,OAA0B,IAAjBL,EAAMU,OAAqBR,EAAKS,IAAI,6BAChET,EAAKS,IAAI,sBACjB,CAACT,EAAML,IAEV,
|
|
1
|
+
{"version":3,"file":"CtPLogoutLink.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.tsx"],"sourcesContent":["import { h } from 'preact';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport { CtpState } from '../../services/ClickToPayService';\nimport classnames from 'classnames';\nimport { useMemo } from 'preact/hooks';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport './CtPLogoutLink.scss';\n\nconst CtPLogoutLink = () => {\n const { ctpState, logoutShopper, status, cards } = useClickToPayContext();\n const { i18n } = useCoreContext();\n\n if ([CtpState.Ready, CtpState.OneTimePassword].includes(ctpState) === false) {\n return null;\n }\n\n const label = useMemo(() => {\n if (ctpState === CtpState.Ready && cards.length > 1) return i18n.get('ctp.logout.notYourCards');\n if (ctpState === CtpState.Ready && cards.length === 1) return i18n.get('ctp.logout.notYourCard');\n if (ctpState === CtpState.Ready && cards.length === 0) return i18n.get('ctp.logout.notYourProfile');\n return i18n.get('ctp.logout.notYou');\n }, [i18n, ctpState]);\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n role=\"button\"\n tabIndex={0}\n className={classnames('adyen-checkout-ctp__section-logout-button', {\n 'adyen-checkout-ctp__section-logout-button--disabled': status === 'loading'\n })}\n onClick={logoutShopper}\n >\n {label}\n </span>\n );\n};\n\nexport default CtPLogoutLink;\n"],"names":["CtPLogoutLink","ctpState","logoutShopper","status","cards","useClickToPayContext","i18n","useCoreContext","CtpState","Ready","OneTimePassword","includes","label","useMemo","length","get","h","span","role","tabIndex","className","classnames","onClick"],"mappings":"uZAQA,MAAMA,EAAgB,KAClB,MAAMC,SAAEA,EAAQC,cAAEA,EAAaC,OAAEA,EAAMC,MAAEA,GAAUC,KAC7CC,KAAEA,GAASC,IAEjB,IAAsE,IAAlE,CAACC,EAASC,MAAOD,EAASE,iBAAiBC,SAASV,GACpD,OAAO,KAGX,MAAMW,EAAQC,GAAQ,IACdZ,IAAaO,EAASC,OAASL,EAAMU,OAAS,EAAUR,EAAKS,IAAI,2BACjEd,IAAaO,EAASC,OAA0B,IAAjBL,EAAMU,OAAqBR,EAAKS,IAAI,0BACnEd,IAAaO,EAASC,OAA0B,IAAjBL,EAAMU,OAAqBR,EAAKS,IAAI,6BAChET,EAAKS,IAAI,sBACjB,CAACT,EAAML,IAEV,OAEIe,EAACC,OAAAA,CACGC,KAAK,SACLC,SAAU,EACVC,UAAWC,EAAW,4CAA6C,CAC/D,sDAAkE,YAAXlB,IAE3DmB,QAASpB,GAERU,EAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class r extends Error{constructor(r){super(r),this.name="TimeoutError"}}export{r as default};
|
|
1
|
+
class r extends Error{toString(){return`Message: ${this.message}`}constructor(r){super(r),this.name="TimeoutError"}}export{r as default};
|
|
2
2
|
//# sourceMappingURL=TimeoutError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeoutError.js","sources":["../../../../../../src/components/internal/ClickToPay/errors/TimeoutError.ts"],"sourcesContent":["class TimeoutError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n\nexport default TimeoutError;\n"],"names":["TimeoutError","Error","
|
|
1
|
+
{"version":3,"file":"TimeoutError.js","sources":["../../../../../../src/components/internal/ClickToPay/errors/TimeoutError.ts"],"sourcesContent":["class TimeoutError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'TimeoutError';\n }\n\n toString() {\n return `Message: ${this.message}`;\n }\n}\n\nexport default TimeoutError;\n"],"names":["TimeoutError","Error","toString","this","message","constructor","super","name"],"mappings":"AAAA,MAAMA,UAAqBC,MAMvBC,QAAAA,GACI,MAAO,YAAYC,KAAKC,SAC5B,CAPAC,WAAAA,CAAYD,GACRE,MAAMF,GACND,KAAKI,KAAO,cAChB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{SchemeNames as t}from"../services/sdks/utils.js";function i(t,i,a){return i in t?Object.defineProperty(t,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[i]=a,t}class a{get title(){return"visa"===this.scheme?t[this.scheme]:this.descriptorName||t[this.scheme]}get isDcfPopupEmbedded(){return"mc"===this.scheme}confirmCardIsExpired(){if("ACTIVE"!==this.status)return!0;if(!this.panExpirationYear&&!this.panExpirationMonth)return!1;const[t,i]=[(new Date).getMonth()+1,(new Date).getFullYear()];return!(Number(this.panExpirationYear)>i)&&!(Number(this.panExpirationYear)===i&&Number(this.panExpirationMonth)>=t)}constructor(t,a,r){i(this,"dateOfCardLastUsed",void 0),i(this,"panLastFour",void 0),i(this,"srcDigitalCardId",void 0),i(this,"scheme",void 0),i(this,"artUri",void 0),i(this,"srcCorrelationId",void 0),i(this,"tokenId",void 0),i(this,"isExpired",void 0),i(this,"panExpirationMonth",void 0),i(this,"panExpirationYear",void 0),i(this,"descriptorName",void 0),i(this,"status",null),this.dateOfCardLastUsed=t.dateOfCardLastUsed,this.panLastFour=t.panLastFour,this.srcDigitalCardId=t.srcDigitalCardId,this.descriptorName=t.digitalCardData.descriptorName,this.tokenId=t.tokenId,this.scheme=a,this.artUri=t.digitalCardData.artUri,this.srcCorrelationId=r,this.panExpirationMonth=t.panExpirationMonth,this.panExpirationYear=t.panExpirationYear,this.status=t.digitalCardData.status,this.isExpired=this.confirmCardIsExpired()}}export{a as default};
|
|
1
|
+
import{SchemeNames as t}from"../services/sdks/utils.js";function i(t,i,a){return i in t?Object.defineProperty(t,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[i]=a,t}class a{get title(){return"visa"===this.scheme?t[this.scheme]:this.descriptorName||t[this.scheme]}get isDcfPopupEmbedded(){return"mc"===this.scheme}confirmCardIsExpired(){if("ACTIVE"!==this.status)return!0;if(!this.panExpirationYear&&!this.panExpirationMonth)return!1;const[t,i]=[(new Date).getMonth()+1,(new Date).getFullYear()];return!(Number(this.panExpirationYear)>i)&&!(Number(this.panExpirationYear)===i&&Number(this.panExpirationMonth)>=t)}constructor(t,a,r){i(this,"dateOfCardLastUsed",void 0),i(this,"dateOfCardCreated",void 0),i(this,"panLastFour",void 0),i(this,"srcDigitalCardId",void 0),i(this,"scheme",void 0),i(this,"artUri",void 0),i(this,"srcCorrelationId",void 0),i(this,"tokenId",void 0),i(this,"isExpired",void 0),i(this,"panExpirationMonth",void 0),i(this,"panExpirationYear",void 0),i(this,"descriptorName",void 0),i(this,"status",null),this.dateOfCardLastUsed=t.dateOfCardLastUsed,this.dateOfCardCreated=t.dateOfCardCreated,this.panLastFour=t.panLastFour,this.srcDigitalCardId=t.srcDigitalCardId,this.descriptorName=t.digitalCardData.descriptorName,this.tokenId=t.tokenId,this.scheme=a,this.artUri=t.digitalCardData.artUri,this.srcCorrelationId=r,this.panExpirationMonth=t.panExpirationMonth,this.panExpirationYear=t.panExpirationYear,this.status=t.digitalCardData.status,this.isExpired=this.confirmCardIsExpired()}}export{a as default};
|
|
2
2
|
//# sourceMappingURL=ShopperCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShopperCard.js","sources":["../../../../../../src/components/internal/ClickToPay/models/ShopperCard.ts"],"sourcesContent":["import { DigitalCardStatus, SrcCard } from '../services/sdks/types';\nimport { SchemeNames } from '../services/sdks/utils';\nimport { ClickToPayScheme } from '../types';\n\nclass ShopperCard {\n public dateOfCardLastUsed: string;\n public panLastFour: string;\n public srcDigitalCardId: string;\n public scheme: ClickToPayScheme;\n public artUri: string;\n public srcCorrelationId: string;\n public tokenId?: string;\n public isExpired: boolean;\n\n private readonly panExpirationMonth: string;\n private readonly panExpirationYear: string;\n private readonly descriptorName?: string;\n private readonly status?: DigitalCardStatus = null;\n\n constructor(maskedCard: SrcCard, scheme: ClickToPayScheme, srcCorrelationId: string) {\n this.dateOfCardLastUsed = maskedCard.dateOfCardLastUsed;\n this.panLastFour = maskedCard.panLastFour;\n this.srcDigitalCardId = maskedCard.srcDigitalCardId;\n this.descriptorName = maskedCard.digitalCardData.descriptorName;\n this.tokenId = maskedCard.tokenId;\n this.scheme = scheme;\n this.artUri = maskedCard.digitalCardData.artUri;\n this.srcCorrelationId = srcCorrelationId;\n this.panExpirationMonth = maskedCard.panExpirationMonth;\n this.panExpirationYear = maskedCard.panExpirationYear;\n this.status = maskedCard.digitalCardData.status;\n\n this.isExpired = this.confirmCardIsExpired();\n }\n\n get title() {\n return this.scheme === 'visa' ? SchemeNames[this.scheme] : this.descriptorName || SchemeNames[this.scheme];\n }\n\n get isDcfPopupEmbedded(): boolean {\n return this.scheme === 'mc';\n }\n\n private confirmCardIsExpired(): boolean {\n if (this.status !== 'ACTIVE') return true;\n if (!this.panExpirationYear && !this.panExpirationMonth) return false;\n\n const [currentMonth, currentYear] = [new Date().getMonth() + 1, new Date().getFullYear()];\n if (Number(this.panExpirationYear) > currentYear) return false;\n if (Number(this.panExpirationYear) === currentYear && Number(this.panExpirationMonth) >= currentMonth) return false;\n\n return true;\n }\n}\n\nexport default ShopperCard;\n"],"names":["ShopperCard","title","this","scheme","SchemeNames","descriptorName","isDcfPopupEmbedded","confirmCardIsExpired","status","panExpirationYear","panExpirationMonth","currentMonth","currentYear","Date","getMonth","getFullYear","Number","constructor","maskedCard","srcCorrelationId","_define_property","dateOfCardLastUsed","panLastFour","srcDigitalCardId","artUri","tokenId","isExpired","digitalCardData"],"mappings":"gLAIA,MAAMA,
|
|
1
|
+
{"version":3,"file":"ShopperCard.js","sources":["../../../../../../src/components/internal/ClickToPay/models/ShopperCard.ts"],"sourcesContent":["import { DigitalCardStatus, SrcCard } from '../services/sdks/types';\nimport { SchemeNames } from '../services/sdks/utils';\nimport { ClickToPayScheme } from '../types';\n\nclass ShopperCard {\n public dateOfCardLastUsed?: string;\n public dateOfCardCreated: string;\n public panLastFour: string;\n public srcDigitalCardId: string;\n public scheme: ClickToPayScheme;\n public artUri: string;\n public srcCorrelationId: string;\n public tokenId?: string;\n public isExpired: boolean;\n\n private readonly panExpirationMonth: string;\n private readonly panExpirationYear: string;\n private readonly descriptorName?: string;\n private readonly status?: DigitalCardStatus = null;\n\n constructor(maskedCard: SrcCard, scheme: ClickToPayScheme, srcCorrelationId: string) {\n this.dateOfCardLastUsed = maskedCard.dateOfCardLastUsed;\n this.dateOfCardCreated = maskedCard.dateOfCardCreated;\n this.panLastFour = maskedCard.panLastFour;\n this.srcDigitalCardId = maskedCard.srcDigitalCardId;\n this.descriptorName = maskedCard.digitalCardData.descriptorName;\n this.tokenId = maskedCard.tokenId;\n this.scheme = scheme;\n this.artUri = maskedCard.digitalCardData.artUri;\n this.srcCorrelationId = srcCorrelationId;\n this.panExpirationMonth = maskedCard.panExpirationMonth;\n this.panExpirationYear = maskedCard.panExpirationYear;\n this.status = maskedCard.digitalCardData.status;\n\n this.isExpired = this.confirmCardIsExpired();\n }\n\n get title() {\n return this.scheme === 'visa' ? SchemeNames[this.scheme] : this.descriptorName || SchemeNames[this.scheme];\n }\n\n get isDcfPopupEmbedded(): boolean {\n return this.scheme === 'mc';\n }\n\n private confirmCardIsExpired(): boolean {\n if (this.status !== 'ACTIVE') return true;\n if (!this.panExpirationYear && !this.panExpirationMonth) return false;\n\n const [currentMonth, currentYear] = [new Date().getMonth() + 1, new Date().getFullYear()];\n if (Number(this.panExpirationYear) > currentYear) return false;\n if (Number(this.panExpirationYear) === currentYear && Number(this.panExpirationMonth) >= currentMonth) return false;\n\n return true;\n }\n}\n\nexport default ShopperCard;\n"],"names":["ShopperCard","title","this","scheme","SchemeNames","descriptorName","isDcfPopupEmbedded","confirmCardIsExpired","status","panExpirationYear","panExpirationMonth","currentMonth","currentYear","Date","getMonth","getFullYear","Number","constructor","maskedCard","srcCorrelationId","_define_property","dateOfCardLastUsed","dateOfCardCreated","panLastFour","srcDigitalCardId","artUri","tokenId","isExpired","digitalCardData"],"mappings":"gLAIA,MAAMA,EAiCF,SAAIC,GACA,MAAuB,SAAhBC,KAAKC,OAAoBC,EAAYF,KAAKC,QAAUD,KAAKG,gBAAkBD,EAAYF,KAAKC,OACvG,CAEA,sBAAIG,GACA,MAAuB,OAAhBJ,KAAKC,MAChB,CAEQI,oBAAAA,GACJ,GAAoB,WAAhBL,KAAKM,OAAqB,OAAO,EACrC,IAAKN,KAAKO,oBAAsBP,KAAKQ,mBAAoB,OAAO,EAEhE,MAAOC,EAAcC,GAAe,EAAC,IAAIC,MAAOC,WAAa,GAAG,IAAID,MAAOE,eAC3E,QAAIC,OAAOd,KAAKO,mBAAqBG,MACjCI,OAAOd,KAAKO,qBAAuBG,GAAeI,OAAOd,KAAKQ,qBAAuBC,EAG7F,CAlCAM,WAAAA,CAAYC,EAAqBf,EAA0BgB,GAf3DC,EAAAlB,KAAOmB,0BAAP,GACAD,EAAAlB,KAAOoB,yBAAP,GACAF,EAAAlB,KAAOqB,mBAAP,GACAH,EAAAlB,KAAOsB,wBAAP,GACAJ,EAAAlB,KAAOC,cAAP,GACAiB,EAAAlB,KAAOuB,cAAP,GACAL,EAAAlB,KAAOiB,wBAAP,GACAC,EAAAlB,KAAOwB,eAAP,GACAN,EAAAlB,KAAOyB,iBAAP,GAEAP,EAAAlB,KAAiBQ,0BAAjB,GACAU,EAAAlB,KAAiBO,yBAAjB,GACAW,EAAAlB,KAAiBG,sBAAjB,GACAe,EAAAlB,KAAiBM,SAA6B,MAG1CN,KAAKmB,mBAAqBH,EAAWG,mBACrCnB,KAAKoB,kBAAoBJ,EAAWI,kBACpCpB,KAAKqB,YAAcL,EAAWK,YAC9BrB,K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