@adyen/adyen-web 6.30.0 → 6.31.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 +1 -1
- package/dist/cjs/adyen.css +2 -2
- 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 +802 -714
- package/dist/es/adyen.css +2 -2
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/ANCV/ANCV.js.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/AccountTypeSelector.js.map +1 -1
- package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
- package/dist/es/components/Affirm/Affirm.js.map +1 -1
- package/dist/es/components/AfterPay/AfterPay.js.map +1 -1
- package/dist/es/components/AfterPay/AfterPayB2B.js.map +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es/components/AmazonPay/components/OrderButton.js +1 -1
- package/dist/es/components/AmazonPay/components/OrderButton.js.map +1 -1
- package/dist/es/components/AmazonPay/utils.js +1 -1
- package/dist/es/components/AmazonPay/utils.js.map +1 -1
- package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
- package/dist/es/components/ApplePay/services/ApplePayService.js +1 -1
- package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
- package/dist/es/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -1
- package/dist/es/components/ApplePay/utils/payment-request.js.map +1 -1
- package/dist/es/components/Atome/Atome.js.map +1 -1
- package/dist/es/components/BacsDD/BacsDD.js +1 -1
- package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
- package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.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/Boleto/components/BoletoInput/BoletoInput.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.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.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.map +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es/components/Card/components/ClickToPayWrapper.js +1 -1
- package/dist/es/components/Card/components/ClickToPayWrapper.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/services/CashAppSdkLoader.js.map +1 -1
- package/dist/es/components/CashAppPay/services/CashAppService.js +1 -1
- package/dist/es/components/CashAppPay/services/CashAppService.js.map +1 -1
- package/dist/es/components/CashAppPay/services/types.js.map +1 -1
- package/dist/es/components/ClickToPay/ClickToPay.js +1 -1
- package/dist/es/components/ClickToPay/ClickToPay.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
- package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.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/DropinSuccessState.js +2 -0
- package/dist/es/components/Dropin/components/DropinSuccessState.js.map +1 -0
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
- package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +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/Giftcard/components/GiftcardResult.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardResult.js.map +1 -1
- package/dist/es/components/Giftcard/components/useSRPanelForGiftcardErrors.js +1 -1
- package/dist/es/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
- package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
- package/dist/es/components/Iris/Iris.js +1 -1
- package/dist/es/components/Iris/Iris.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/KlarnaContainer/KlarnaContainer.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/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es/components/PayByBankPix/components/StoredPayment/StoredPayment.js +1 -1
- package/dist/es/components/PayByBankPix/components/StoredPayment/StoredPayment.js.map +1 -1
- package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
- package/dist/es/components/PayByBankPix/services/PasskeyService.js.map +1 -1
- package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
- package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
- package/dist/es/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
- package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
- package/dist/es/components/PayTo/PayTo.js +1 -1
- package/dist/es/components/PayTo/PayTo.js.map +1 -1
- package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es/components/PayTo/components/PayToNameFields.js +1 -1
- package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
- package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
- package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
- package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
- package/dist/es/components/Twint/Twint.js +1 -1
- package/dist/es/components/Twint/Twint.js.map +1 -1
- package/dist/es/components/UPI/UPI.js +1 -1
- package/dist/es/components/UPI/UPI.js.map +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
- package/dist/es/components/internal/Address/Specifications.js.map +1 -1
- package/dist/es/components/internal/Await/Await.js +1 -1
- package/dist/es/components/internal/Await/Await.js.map +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/Button/Button.js +1 -1
- package/dist/es/components/internal/Button/Button.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/context/ClickToPayContext.js +1 -1
- package/dist/es/components/internal/ClickToPay/context/ClickToPayContext.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
- package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +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/AbstractSrcInitiator.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
- package/dist/es/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es/components/internal/PayButton/utils.js +1 -1
- package/dist/es/components/internal/PayButton/utils.js.map +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.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/lib/CSF/AbstractCSF.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/userAgent.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/userAgent.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.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/utils.js.map +1 -1
- package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
- package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.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/core/Analytics/Analytics.js.map +1 -1
- package/dist/es/core/Analytics/AnalyticsService.js.map +1 -1
- package/dist/es/core/Analytics/events/AbstractAnalyticsEvent.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
- package/dist/es/core/Analytics/utils.js +1 -1
- package/dist/es/core/Analytics/utils.js.map +1 -1
- package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
- package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
- package/dist/es/core/Context/AmountProvider.js +2 -0
- package/dist/es/core/Context/AmountProvider.js.map +1 -0
- package/dist/es/core/Context/Resources.js.map +1 -1
- package/dist/es/core/Errors/SRPanel.js.map +1 -1
- package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/core.js.map +1 -1
- package/dist/es/external/preact/compat/dist/compat.js +1 -1
- package/dist/es/external/preact/compat/dist/compat.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/external/preact/hooks/dist/hooks.js +1 -1
- package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
- package/dist/es/index.d.ts +802 -714
- package/dist/es/language/Language.js.map +1 -1
- package/dist/es/utils/Script.js.map +1 -1
- package/dist/es/utils/Storage.js +1 -1
- package/dist/es/utils/Storage.js.map +1 -1
- package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
- package/dist/es/utils/Validator/Validator.js.map +1 -1
- package/dist/es/utils/amount-util.js +1 -1
- package/dist/es/utils/amount-util.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/constants/currency-minor-units.js.map +1 -1
- package/dist/es/utils/createSdkData.js.map +1 -1
- package/dist/es/utils/getErrorMessage.js.map +1 -1
- package/dist/es/utils/getProp.js +1 -1
- package/dist/es/utils/getProp.js.map +1 -1
- package/dist/es/utils/hasOwnProperty.js.map +1 -1
- package/dist/es/utils/isValidURL.js.map +1 -1
- package/dist/es/utils/listenerUtils.js.map +1 -1
- package/dist/es/utils/promiseTimeout.js.map +1 -1
- package/dist/es/utils/setFocus.js +1 -1
- package/dist/es/utils/setFocus.js.map +1 -1
- package/dist/es/utils/textUtils.js.map +1 -1
- package/dist/es/utils/validator-utils.js.map +1 -1
- package/dist/es/utils/windowScrollTo.js +2 -0
- package/dist/es/utils/windowScrollTo.js.map +1 -0
- package/dist/es-legacy/adyen.css +2 -2
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js.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/AccountTypeSelector.js.map +1 -1
- package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
- package/dist/es-legacy/components/Affirm/Affirm.js.map +1 -1
- package/dist/es-legacy/components/AfterPay/AfterPay.js.map +1 -1
- package/dist/es-legacy/components/AfterPay/AfterPayB2B.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/OrderButton.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/OrderButton.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
- package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/services/ApplePayService.js +1 -1
- package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
- package/dist/es-legacy/components/Atome/Atome.js.map +1 -1
- package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
- package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.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/Boleto/components/BoletoInput/BoletoInput.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.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.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.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
- package/dist/es-legacy/components/Card/components/Fastlane/USOnlyPhoneInput.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/services/CashAppSdkLoader.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/services/CashAppService.js +1 -1
- package/dist/es-legacy/components/CashAppPay/services/CashAppService.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
- package/dist/es-legacy/components/ClickToPay/ClickToPay.js +1 -1
- package/dist/es-legacy/components/ClickToPay/ClickToPay.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.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/DropinSuccessState.js +2 -0
- package/dist/es-legacy/components/Dropin/components/DropinSuccessState.js.map +1 -0
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +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/Giftcard/components/GiftcardResult.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/useSRPanelForGiftcardErrors.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/useSRPanelForGiftcardErrors.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/Iris/Iris.js +1 -1
- package/dist/es-legacy/components/Iris/Iris.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/KlarnaContainer/KlarnaContainer.js.map +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
- package/dist/es-legacy/components/MBWay/MBWay.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/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/components/StoredPayment/StoredPayment.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/components/StoredPayment/StoredPayment.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/services/PasskeyService.js.map +1 -1
- package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
- package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
- package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
- package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
- package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
- package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
- package/dist/es-legacy/components/Twint/Twint.js +1 -1
- package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
- package/dist/es-legacy/components/UPI/UPI.js +1 -1
- package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/Specifications.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
- package/dist/es-legacy/components/internal/Await/Await.js +1 -1
- package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayContext.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayContext.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +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/create-clicktopay-service.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +1 -1
- package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.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/binLookup/extensions.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.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/userAgent.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/userAgent.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.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/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
- package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.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/Tooltip/Tooltip.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/core/Analytics/Analytics.js.map +1 -1
- package/dist/es-legacy/core/Analytics/AnalyticsService.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AbstractAnalyticsEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js +1 -1
- package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
- package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js +1 -1
- package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js.map +1 -1
- package/dist/es-legacy/core/Context/AmountProvider.js +2 -0
- package/dist/es-legacy/core/Context/AmountProvider.js.map +1 -0
- package/dist/es-legacy/core/Context/Resources.js.map +1 -1
- package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
- package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
- package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
- package/dist/es-legacy/core/Services/http.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
- package/dist/es-legacy/external/preact/compat/dist/compat.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/external/preact/hooks/dist/hooks.js +1 -1
- package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
- package/dist/es-legacy/language/Language.js.map +1 -1
- package/dist/es-legacy/utils/Script.js.map +1 -1
- package/dist/es-legacy/utils/Storage.js +1 -1
- package/dist/es-legacy/utils/Storage.js.map +1 -1
- package/dist/es-legacy/utils/Validator/ValidationRuleResult.js.map +1 -1
- package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
- package/dist/es-legacy/utils/amount-util.js +1 -1
- package/dist/es-legacy/utils/amount-util.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/constants/currency-minor-units.js.map +1 -1
- package/dist/es-legacy/utils/createSdkData.js.map +1 -1
- package/dist/es-legacy/utils/getConsentUrl.js.map +1 -1
- package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
- package/dist/es-legacy/utils/getProp.js +1 -1
- package/dist/es-legacy/utils/getProp.js.map +1 -1
- package/dist/es-legacy/utils/hasOwnProperty.js.map +1 -1
- package/dist/es-legacy/utils/isValidURL.js.map +1 -1
- package/dist/es-legacy/utils/listenerUtils.js.map +1 -1
- package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
- package/dist/es-legacy/utils/setFocus.js +1 -1
- package/dist/es-legacy/utils/setFocus.js.map +1 -1
- package/dist/es-legacy/utils/textUtils.js.map +1 -1
- package/dist/es-legacy/utils/useAutoFocus.js.map +1 -1
- package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
- package/dist/es-legacy/utils/validator-utils.js.map +1 -1
- package/dist/es-legacy/utils/windowScrollTo.js +2 -0
- package/dist/es-legacy/utils/windowScrollTo.js.map +1 -0
- package/package.json +11 -11
- package/styles/adyen.css +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{options as _}from"../../dist/preact.js";var n,t,r,o
|
|
1
|
+
import{options as _}from"../../dist/preact.js";var n,t,u,r,o=0,e=[],c=_,i=c.__b,f=c.__r,a=c.diffed,h=c.__c,s=c.unmount,l=c.__;function v(_,n){c.__h&&c.__h(t,_,o||n),o=0;var u=t.__H||(t.__H={__:[],__h:[]});return _>=u.__.length&&u.__.push({}),u.__[_]}function m(_){return o=1,p(x,_)}function p(_,u,r){var o=v(n++,2);if(o.t=_,!o.__c&&(o.__=[r?r(u):x(void 0,u),function(_){var n=o.__N?o.__N[0]:o.__[0],t=o.t(n,_);n!==t&&(o.__N=[t,o.__[1]],o.__c.setState({}))}],o.__c=t,!t.__f)){var e=function(_,n,t){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(_){return!!_.__c});if(u.every(function(_){return!_.__N}))return!c||c.call(this,_,n,t);var r=o.__c.props!==_;return u.forEach(function(_){if(_.__N){var n=_.__[0];_.__=_.__N,_.__N=void 0,n!==_.__[0]&&(r=!0)}}),c&&c.call(this,_,n,t)||r};t.__f=!0;var c=t.shouldComponentUpdate,i=t.componentWillUpdate;t.componentWillUpdate=function(_,n,t){if(this.__e){var u=c;c=void 0,e(_,n,t),c=u}i&&i.call(this,_,n,t)},t.shouldComponentUpdate=e}return o.__N||o.__}function H(_,u){var r=v(n++,3);!c.__s&&U(r.__H,u)&&(r.__=_,r.u=u,t.__H.__h.push(r))}function d(_,u){var r=v(n++,4);!c.__s&&U(r.__H,u)&&(r.__=_,r.u=u,t.__h.push(r))}function E(_){return o=5,y(function(){return{current:_}},[])}function N(_,n,t){o=6,d(function(){if("function"==typeof _){var t=_(n());return function(){_(null),t&&"function"==typeof t&&t()}}if(_)return _.current=n(),function(){return _.current=null}},null==t?t:t.concat(_))}function y(_,t){var u=v(n++,7);return U(u.__H,t)&&(u.__=_(),u.__H=t,u.__h=_),u.__}function A(_,n){return o=8,y(function(){return _},n)}function F(_){var u=t.context[_.__c],r=v(n++,9);return r.c=_,u?(null==r.__&&(r.__=!0,u.sub(t)),u.props.value):_.__}function b(){for(var _;_=e.shift();)if(_.__P&&_.__H)try{_.__H.__h.forEach(q),_.__H.__h.forEach(C),_.__H.__h=[]}catch(n){_.__H.__h=[],c.__e(n,_.__v)}}c.__b=function(_){t=null,i&&i(_)},c.__=function(_,n){_&&n.__k&&n.__k.__m&&(_.__m=n.__k.__m),l&&l(_,n)},c.__r=function(_){f&&f(_),n=0;var r=(t=_.__c).__H;r&&(u===t?(r.__h=[],t.__h=[],r.__.forEach(function(_){_.__N&&(_.__=_.__N),_.u=_.__N=void 0})):(r.__h.forEach(q),r.__h.forEach(C),r.__h=[],n=0)),u=t},c.diffed=function(_){a&&a(_);var n=_.__c;n&&n.__H&&(n.__H.__h.length&&(1!==e.push(n)&&r===c.requestAnimationFrame||((r=c.requestAnimationFrame)||k)(b)),n.__H.__.forEach(function(_){_.u&&(_.__H=_.u),_.u=void 0})),u=t=null},c.__c=function(_,n){n.some(function(_){try{_.__h.forEach(q),_.__h=_.__h.filter(function(_){return!_.__||C(_)})}catch(t){n.some(function(_){_.__h&&(_.__h=[])}),n=[],c.__e(t,_.__v)}}),h&&h(_,n)},c.unmount=function(_){s&&s(_);var n,t=_.__c;t&&t.__H&&(t.__H.__.forEach(function(_){try{q(_)}catch(_){n=_}}),t.__H=void 0,n&&c.__e(n,t.__v))};var g="function"==typeof requestAnimationFrame;function k(_){var n,t=function(){clearTimeout(u),g&&cancelAnimationFrame(n),setTimeout(_)},u=setTimeout(t,35);g&&(n=requestAnimationFrame(t))}function q(_){var n=t,u=_.__c;"function"==typeof u&&(_.__c=void 0,u()),t=n}function C(_){var n=t;_.__c=_.__(),t=n}function U(_,n){return!_||_.length!==n.length||n.some(function(n,t){return n!==_[t]})}function x(_,n){return"function"==typeof n?n(_):n}export{A as useCallback,F as useContext,H as useEffect,N as useImperativeHandle,d as useLayoutEffect,y as useMemo,p as useReducer,E as useRef,m as useState};
|
|
2
2
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":["../../../../../../../../node_modules/preact/hooks/dist/hooks.mjs"],"sourcesContent":["import{options as n}from\"preact\";var t,r,u,i,o=0,f=[],c=n,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":["../../../../../../../../node_modules/preact/hooks/dist/hooks.mjs"],"sourcesContent":["import{options as n}from\"preact\";var t,r,u,i,o=0,f=[],c=n,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function p(n,t){c.__h&&c.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function d(n){return o=1,h(D,n)}function h(n,u,i){var o=p(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.__f)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return!!n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=o.__c.props!==n;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),c&&c.call(this,n,t,r)||i};r.__f=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function y(n,u){var i=p(t++,3);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__H.__h.push(i))}function _(n,u){var i=p(t++,4);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__h.push(i))}function A(n){return o=5,T(function(){return{current:n}},[])}function F(n,t,r){o=6,_(function(){if(\"function\"==typeof n){var r=n(t());return function(){n(null),r&&\"function\"==typeof r&&r()}}if(n)return n.current=t(),function(){return n.current=null}},null==r?r:r.concat(n))}function T(n,r){var u=p(t++,7);return C(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function q(n,t){return o=8,T(function(){return n},t)}function x(n){var u=r.context[n.__c],i=p(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function P(n,t){c.useDebugValue&&c.useDebugValue(t?t(n):n)}function b(n){var u=p(t++,10),i=d();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function g(){var n=p(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__=\"P\"+i[0]+\"-\"+i[1]++}return n.__}function j(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B),n.__H.__h=[]}catch(t){n.__H.__h=[],c.__e(t,n.__v)}}c.__b=function(n){r=null,e&&e(n)},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),s&&s(n,t)},c.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(i.__h.forEach(z),i.__h.forEach(B),i.__h=[],t=0)),u=r},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),u=r=null},c.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return!n.__||B(n)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],c.__e(r,n.__v)}}),l&&l(n,t)},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n)}catch(n){t=n}}),r.__H=void 0,t&&c.__e(t,r.__v))};var k=\"function\"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,35);k&&(t=requestAnimationFrame(r))}function z(n){var t=r,u=n.__c;\"function\"==typeof u&&(n.__c=void 0,u()),r=t}function B(n){var t=r;n.__c=n.__(),r=t}function C(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return\"function\"==typeof t?t(n):t}export{q as useCallback,x as useContext,P as useDebugValue,y as useEffect,b as useErrorBoundary,g as useId,F as useImperativeHandle,_ as useLayoutEffect,T as useMemo,h as useReducer,A as useRef,d as useState};\n//# sourceMappingURL=hooks.module.js.map\n"],"names":["t","r","u","i","o","f","c","n","e","__b","a","__r","v","diffed","l","__c","m","unmount","s","__","p","__h","__H","length","push","d","h","D","__N","setState","__f","filter","every","call","this","props","forEach","shouldComponentUpdate","componentWillUpdate","__e","y","__s","C","_","A","T","current","F","concat","q","x","context","sub","value","j","shift","__P","z","B","__v","__k","__m","requestAnimationFrame","w","some","k","clearTimeout","cancelAnimationFrame","setTimeout"],"mappings":"+CAAiC,IAAIA,EAAEC,EAAEC,EAAEC,EAAEC,EAAE,EAAEC,EAAE,GAAGC,EAAEC,EAAEC,EAAEF,EAAEG,IAAIC,EAAEJ,EAAEK,IAAIC,EAAEN,EAAEO,OAAOC,EAAER,EAAES,IAAIC,EAAEV,EAAEW,QAAQC,EAAEZ,EAAEa,GAAG,SAASC,EAAEb,EAAEP,GAAGM,EAAEe,KAAKf,EAAEe,IAAIpB,EAAEM,EAAEH,GAAGJ,GAAGI,EAAE,EAAE,IAAIF,EAAED,EAAEqB,MAAMrB,EAAEqB,IAAI,CAACH,GAAG,GAAGE,IAAI,KAAK,OAAOd,GAAGL,EAAEiB,GAAGI,QAAQrB,EAAEiB,GAAGK,KAAK,CAAA,GAAItB,EAAEiB,GAAGZ,EAAE,CAAC,SAASkB,EAAElB,GAAG,OAAOH,EAAE,EAAEsB,EAAEC,EAAEpB,EAAE,CAAC,SAASmB,EAAEnB,EAAEL,EAAEC,GAAG,IAAIC,EAAEgB,EAAEpB,IAAI,GAAG,GAAGI,EAAEJ,EAAEO,GAAGH,EAAEW,MAAMX,EAAEe,GAAG,CAAChB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AI,mBAAmBb,IAAIK,EAAEQ,SAAI,EAAOb,KAAKD,EAAED,CAAC,CAAC,SAAS0D,EAAEnD,GAAG,IAAIP,EAAEC,EAAEM,EAAEQ,IAAIR,EAAEY,KAAKlB,EAAED,CAAC,CAAC,SAAS0C,EAAEnC,EAAEP,GAAG,OAAOO,GAAGA,EAAEgB,SAASvB,EAAEuB,QAAQvB,EAAEgE,KAAK,SAAShE,EAAEC,GAAG,OAAOD,IAAIO,EAAEN,EAAE,EAAE,CAAC,SAAS0B,EAAEpB,EAAEP,GAAG,MAAM,mBAAmBA,EAAEA,EAAEO,GAAGP,CAAC","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaymentStatusTimer.js","sources":["../../../../src/hooks/usePaymentStatusTimer/usePaymentStatusTimer.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from 'preact/hooks';\nimport checkPaymentStatus from '../../core/Services/payment-status';\nimport { processPaymentStatusResponse } from '../../core/ProcessResponse/PaymentStatus';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { CountdownTime } from '../../components/internal/Countdown/types';\nimport { PaymentStatusTimerActions, PaymentStatusTimerState, UsePaymentStatusTimerProps } from './types';\nimport {\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from './constants';\nimport { AdditionalDetailsData, ProcessedPaymentStatusResponse } from '../../types';\n\nexport function usePaymentStatusTimer(props: UsePaymentStatusTimerProps): { state: PaymentStatusTimerState; actions: PaymentStatusTimerActions } {\n const [completed, setCompleted] = useState(false);\n const [expired, setExpired] = useState(false);\n const [loading, setLoading] = useState(true);\n const [delay, setDelay] = useState(props.delay ?? DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS);\n const [percentage, setPercentage] = useState(100);\n const [timePassed, setTimePassed] = useState(0);\n const [onPollingStartedActionHandled, setOnPollingStartedActionHandled] = useState(false);\n const timeoutRef = useRef<NodeJS.Timeout | number | null>(null);\n\n const onTick = (time: CountdownTime): void => {\n setPercentage(time.percentage);\n };\n\n const onTimeUp = (): void => {\n setExpired(true);\n props.onError(new AdyenCheckoutError('ERROR', 'Payment Expired'));\n };\n\n const onComplete = (status: ProcessedPaymentStatusResponse): void => {\n setCompleted(true);\n setLoading(false);\n\n if (status.props.payload) {\n const additionalDetailsData: AdditionalDetailsData = {\n data: {\n details: { payload: status.props.payload },\n paymentData: props.paymentData\n }\n };\n props.onComplete(additionalDetailsData);\n } else {\n setExpired(true);\n props.onError(new AdyenCheckoutError('ERROR', 'successful result, but no payload in response'));\n }\n };\n\n const onError = (status: ProcessedPaymentStatusResponse): void => {\n setExpired(true);\n setLoading(false);\n\n if (status.props.payload) {\n const additionalDetailsData: AdditionalDetailsData = {\n data: {\n details: { payload: status.props.payload },\n paymentData: props.paymentData\n }\n };\n props.onComplete(additionalDetailsData);\n } else {\n const error = new AdyenCheckoutError('ERROR', 'error result with no payload in response');\n props.onError(error);\n }\n };\n\n const checkStatus = async (): Promise<void> => {\n const { paymentData, clientKey, throttleInterval, pollStatus } = props;\n\n const pollStatusFunction = pollStatus ?? (() => checkPaymentStatus(paymentData, clientKey, props.loadingContext, throttleInterval));\n\n if (!onPollingStartedActionHandled) {\n props.onActionHandled?.({ componentType: props.type, actionDescription: 'polling-started' });\n setOnPollingStartedActionHandled(true);\n }\n\n return pollStatusFunction()\n .then(processPaymentStatusResponse)\n .catch(\n (error: unknown) =>\n ({\n type: 'network-error',\n props: error\n }) as ProcessedPaymentStatusResponse\n )\n .then((status: ProcessedPaymentStatusResponse) => {\n switch (status.type) {\n case 'success':\n onComplete(status);\n break;\n case 'error':\n onError(status);\n break;\n default:\n setLoading(false);\n }\n });\n };\n\n useEffect(() => {\n void checkStatus();\n }, []);\n\n useEffect(() => {\n if (expired || completed || loading) {\n return;\n }\n\n const statusInterval = async (): Promise<void> => {\n const start = performance.now();\n await checkStatus();\n const end = performance.now();\n const responseTime = Math.round(end - start);\n\n const actualTimePassed = timePassed + responseTime + delay;\n setTimePassed(actualTimePassed);\n\n if (\n actualTimePassed >= (props.throttleTime ?? DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS) &&\n delay !== (props.throttleInterval ?? DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS)\n ) {\n setDelay(props.throttleInterval ?? DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS);\n }\n };\n\n timeoutRef.current = setTimeout(() => {\n void statusInterval();\n }, delay);\n\n return () => {\n clearTimeout(timeoutRef.current);\n };\n }, [expired, completed, loading, delay, props.throttleTime, props.throttleInterval, timePassed]);\n\n const state: PaymentStatusTimerState = {\n completed,\n expired,\n loading,\n percentage,\n timePassed\n };\n\n const actions: PaymentStatusTimerActions = {\n onTick,\n onTimeUp\n };\n\n return { state, actions };\n}\n"],"names":["usePaymentStatusTimer","props","completed","setCompleted","useState","expired","setExpired","loading","setLoading","delay","setDelay","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","percentage","setPercentage","timePassed","setTimePassed","onPollingStartedActionHandled","setOnPollingStartedActionHandled","timeoutRef","useRef","checkStatus","async","paymentData","clientKey","throttleInterval","pollStatus","pollStatusFunction","checkPaymentStatus","loadingContext","onActionHandled","componentType","type","actionDescription","then","processPaymentStatusResponse","catch","error","status","payload","additionalDetailsData","data","details","onComplete","onError","AdyenCheckoutError","useEffect","current","setTimeout","start","performance","now","end","responseTime","Math","round","actualTimePassed","throttleTime","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS","statusInterval","clearTimeout","state","actions","onTick","time","onTimeUp"],"mappings":"seAaO,SAASA,EAAsBC,GAICA,IAAAA,EAHnC,MAAOC,EAAWC,GAAgBC,GAAS,IACpCC,EAASC,GAA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AAQP,EAClB,GA4BgBO,CAAQN,GACR,MACJ,QACI7B,GAAW,OAK/BqC,EAAU,KACDzB,KACN,IAEHyB,EAAU,KACN,GAAIxC,GAAWH,GAAaK,EACxB,OAwBJ,OAJAW,EAAW4B,QAAUC,WAAW,KAjBT1B,eAUMpB,EACVA,EAVf,MAAM+C,EAAQC,YAAYC,YACpB9B,IACN,MAAM+B,EAAMF,YAAYC,MAClBE,EAAeC,KAAKC,MAAMH,EAAMH,GAEhCO,EAAmBzC,EAAasC,EAAe3C,EAOxCR,IAAAA,EANbc,EAAcwC,GAGVA,YAAqBtD,EAAAA,EAAMuD,
|
|
1
|
+
{"version":3,"file":"usePaymentStatusTimer.js","sources":["../../../../src/hooks/usePaymentStatusTimer/usePaymentStatusTimer.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from 'preact/hooks';\nimport checkPaymentStatus from '../../core/Services/payment-status';\nimport { processPaymentStatusResponse } from '../../core/ProcessResponse/PaymentStatus';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { CountdownTime } from '../../components/internal/Countdown/types';\nimport { PaymentStatusTimerActions, PaymentStatusTimerState, UsePaymentStatusTimerProps } from './types';\nimport {\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from './constants';\nimport { AdditionalDetailsData, ProcessedPaymentStatusResponse } from '../../types';\n\nexport function usePaymentStatusTimer(props: UsePaymentStatusTimerProps): { state: PaymentStatusTimerState; actions: PaymentStatusTimerActions } {\n const [completed, setCompleted] = useState(false);\n const [expired, setExpired] = useState(false);\n const [loading, setLoading] = useState(true);\n const [delay, setDelay] = useState(props.delay ?? DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS);\n const [percentage, setPercentage] = useState(100);\n const [timePassed, setTimePassed] = useState(0);\n const [onPollingStartedActionHandled, setOnPollingStartedActionHandled] = useState(false);\n const timeoutRef = useRef<NodeJS.Timeout | number | null>(null);\n\n const onTick = (time: CountdownTime): void => {\n setPercentage(time.percentage);\n };\n\n const onTimeUp = (): void => {\n setExpired(true);\n props.onError(new AdyenCheckoutError('ERROR', 'Payment Expired'));\n };\n\n const onComplete = (status: ProcessedPaymentStatusResponse): void => {\n setCompleted(true);\n setLoading(false);\n\n if (status.props.payload) {\n const additionalDetailsData: AdditionalDetailsData = {\n data: {\n details: { payload: status.props.payload },\n paymentData: props.paymentData\n }\n };\n props.onComplete(additionalDetailsData);\n } else {\n setExpired(true);\n props.onError(new AdyenCheckoutError('ERROR', 'successful result, but no payload in response'));\n }\n };\n\n const onError = (status: ProcessedPaymentStatusResponse): void => {\n setExpired(true);\n setLoading(false);\n\n if (status.props.payload) {\n const additionalDetailsData: AdditionalDetailsData = {\n data: {\n details: { payload: status.props.payload },\n paymentData: props.paymentData\n }\n };\n props.onComplete(additionalDetailsData);\n } else {\n const error = new AdyenCheckoutError('ERROR', 'error result with no payload in response');\n props.onError(error);\n }\n };\n\n const checkStatus = async (): Promise<void> => {\n const { paymentData, clientKey, throttleInterval, pollStatus } = props;\n\n const pollStatusFunction = pollStatus ?? (() => checkPaymentStatus(paymentData, clientKey, props.loadingContext, throttleInterval));\n\n if (!onPollingStartedActionHandled) {\n props.onActionHandled?.({ componentType: props.type, actionDescription: 'polling-started' });\n setOnPollingStartedActionHandled(true);\n }\n\n return pollStatusFunction()\n .then(processPaymentStatusResponse)\n .catch(\n (error: unknown) =>\n ({\n type: 'network-error',\n props: error\n }) as ProcessedPaymentStatusResponse\n )\n .then((status: ProcessedPaymentStatusResponse) => {\n switch (status.type) {\n case 'success':\n onComplete(status);\n break;\n case 'error':\n onError(status);\n break;\n default:\n setLoading(false);\n }\n });\n };\n\n useEffect(() => {\n void checkStatus();\n }, []);\n\n useEffect(() => {\n if (expired || completed || loading) {\n return;\n }\n\n const statusInterval = async (): Promise<void> => {\n const start = performance.now();\n await checkStatus();\n const end = performance.now();\n const responseTime = Math.round(end - start);\n\n const actualTimePassed = timePassed + responseTime + delay;\n setTimePassed(actualTimePassed);\n\n if (\n actualTimePassed >= (props.throttleTime ?? DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS) &&\n delay !== (props.throttleInterval ?? DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS)\n ) {\n setDelay(props.throttleInterval ?? DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS);\n }\n };\n\n timeoutRef.current = setTimeout(() => {\n void statusInterval();\n }, delay);\n\n return () => {\n clearTimeout(timeoutRef.current);\n };\n }, [expired, completed, loading, delay, props.throttleTime, props.throttleInterval, timePassed]);\n\n const state: PaymentStatusTimerState = {\n completed,\n expired,\n loading,\n percentage,\n timePassed\n };\n\n const actions: PaymentStatusTimerActions = {\n onTick,\n onTimeUp\n };\n\n return { state, actions };\n}\n"],"names":["usePaymentStatusTimer","props","completed","setCompleted","useState","expired","setExpired","loading","setLoading","delay","setDelay","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","percentage","setPercentage","timePassed","setTimePassed","onPollingStartedActionHandled","setOnPollingStartedActionHandled","timeoutRef","useRef","checkStatus","async","paymentData","clientKey","throttleInterval","pollStatus","pollStatusFunction","checkPaymentStatus","loadingContext","onActionHandled","componentType","type","actionDescription","then","processPaymentStatusResponse","catch","error","status","payload","additionalDetailsData","data","details","onComplete","onError","AdyenCheckoutError","useEffect","current","setTimeout","start","performance","now","end","responseTime","Math","round","actualTimePassed","throttleTime","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS","statusInterval","clearTimeout","state","actions","onTick","time","onTimeUp"],"mappings":"seAaO,SAASA,EAAsBC,GAICA,IAAAA,EAHnC,MAAOC,EAAWC,GAAgBC,GAAS,IACpCC,EAASC,GAAcF,GAAS,IAChCG,EAASC,GAAcJ,GAAS,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,QACI7B,GAAW,OAK/BqC,EAAU,KACDzB,KACN,IAEHyB,EAAU,KACN,GAAIxC,GAAWH,GAAaK,EACxB,OAwBJ,OAJAW,EAAW4B,QAAUC,WAAW,KAjBT1B,eAUMpB,EACVA,EAVf,MAAM+C,EAAQC,YAAYC,YACpB9B,IACN,MAAM+B,EAAMF,YAAYC,MAClBE,EAAeC,KAAKC,MAAMH,EAAMH,GAEhCO,EAAmBzC,EAAasC,EAAe3C,EAOxCR,IAAAA,EANbc,EAAcwC,GAGVA,YAAqBtD,EAAAA,EAAMuD,wBAANvD,EAAAA,EAAsBwD,IAC3ChD,KAAiC,QAAtBR,EAAAA,EAAMuB,wBAANvB,IAAAA,EAAAA,EAA0ByD,IAErChD,EAA+B,QAAtBT,EAAAA,EAAMuB,4BAANvB,EAAAA,EAA0ByD,IAKlCC,IACNlD,GAEI,KACHmD,aAAa1C,EAAW4B,WAE7B,CAACzC,EAASH,EAAWK,EAASE,EAAOR,EAAMuD,aAAcvD,EAAMuB,iBAAkBV,IAepF,MAAO,CAAE+C,MAb8B,CACnC3D,YACAG,UACAE,UACAK,aACAE,cAQYgD,QAL2B,CACvCC,OA1HYC,IACZnD,EAAcmD,EAAKpD,aA0HnBqD,SAvHa,KACb3D,GAAW,GACXL,EAAM0C,QAAQ,IAAIC,EAAmB,QAAS,sBAyHtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Language.js","sources":["../../../src/language/Language.ts"],"sourcesContent":["import { getTranslation } from './utils';\nimport { getLocalisedAmount } from '../utils/amount-util';\nimport AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport type { CustomTranslations, LanguageOptions, Translations } from './types';\n\nexport class Language {\n public readonly locale: string;\n public readonly languageCode: string;\n\n private readonly translations: Translations;\n private readonly customTranslations: CustomTranslations;\n\n public readonly timeFormatOptions: Intl.DateTimeFormatOptions = {\n hour: 'numeric',\n minute: 'numeric'\n };\n public readonly timeAndDateFormatOptions: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n ...this.timeFormatOptions\n };\n public readonly timeAndDateFormatter: Intl.DateTimeFormat;\n\n constructor(props: LanguageOptions) {\n const { locale, translations, customTranslations } = props;\n\n if (!locale) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'Language: \"locale\" property is not defined');\n }\n\n this.locale = locale;\n this.languageCode = this.locale.split('-')[0];\n this.customTranslations = customTranslations || {};\n\n this.timeAndDateFormatter = Intl.DateTimeFormat(this.locale, this.timeAndDateFormatOptions);\n\n this.translations = {\n ...translations,\n ...(!!this.customTranslations[this.locale] && this.customTranslations[this.locale])\n };\n }\n\n /**\n * Returns a translated string from a key in the current {@link Language.locale}\n * @param key - Translation key\n * @param options - Translation options\n * @returns Translated string\n */\n public get(key: string, options?): string {\n const translation = getTranslation(this.translations, key, options);\n if (translation !== null) {\n return translation;\n }\n\n return key;\n }\n\n /**\n * Returns a localized string for an amount\n * @param amount - Amount to be converted\n * @param currencyCode - Currency code of the amount\n * @param options - Options for String.prototype.toLocaleString\n */\n public amount(amount: number, currencyCode: string, options?: object): string {\n return getLocalisedAmount(amount, this.locale, currencyCode, options);\n }\n\n /**\n * Returns a localized string for a date\n * @param date - Date to be localized\n * @param options - Options for {@link Intl.DateTimeFormatOptions}\n */\n public date(date: string, options: Intl.DateTimeFormatOptions = {}) {\n if (date === undefined) return '';\n const dateOptions: Intl.DateTimeFormatOptions = { year: 'numeric', month: '2-digit', day: '2-digit', ...options };\n return new Date(date).toLocaleDateString(this.locale, dateOptions);\n }\n\n /**\n * Returns a localized string for a date and time\n * @param date - Date to be localized\n */\n public dateTime(date: string) {\n if (date === undefined) return '';\n return this.timeAndDateFormatter.format(new Date(date));\n }\n}\n\nexport default Language;\n"],"names":["Language","get","key","options","translation","getTranslation","this","translations","amount","currencyCode","getLocalisedAmount","locale","date","undefined","dateOptions","_object_spread","year","month","day","Date","toLocaleDateString","dateTime","timeAndDateFormatter","format","constructor","props","_define_property","languageCode","customTranslations","timeFormatOptions","hour","minute","timeAndDateFormatOptions","AdyenCheckoutError","split","Intl","DateTimeFormat"],"mappings":"ylBAKO,MAAMA,EA4CT,GAAAC,CAAWC,EAAaC,GACpB,MAAMC,EAAcC,EAAeC,KAAKC,aAAcL,EAAKC,GAC3D,OAAoB,OAAhBC,EACOA,EAGJF,CACX,CAQA,MAAAM,CAAcA,EAAgBC,EAAsBN,GAChD,OAAOO,EAAmBF,EAAQF,KAAKK,OAAQF,EAAcN,EACjE,CAOA,IAAAS,CAAYA,EAAcT,EAAsC,IAC5D,QAAaU,IAATD,EAAoB,MAAO,GAC/B,MAAME,EAA0CC,EAAA,CAAEC,KAAM,UAAWC,MAAO,UAAWC,IAAK,WAAcf,GACxG,OAAO,IAAIgB,KAAKP,GAAMQ,mBAAmBd,KAAKK,OAAQG,EAC1D,CAMOO,QAAAA,CAAST,GACZ,YAAaC,IAATD,EAA2B,GACxBN,KAAKgB,qBAAqBC,OAAO,IAAIJ,KAAKP,GACrD,CA9DA,WAAAY,CAAYC,GAlBZC,EAAApB,KAAgBK,
|
|
1
|
+
{"version":3,"file":"Language.js","sources":["../../../src/language/Language.ts"],"sourcesContent":["import { getTranslation } from './utils';\nimport { getLocalisedAmount } from '../utils/amount-util';\nimport AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport type { CustomTranslations, LanguageOptions, Translations } from './types';\n\nexport class Language {\n public readonly locale: string;\n public readonly languageCode: string;\n\n private readonly translations: Translations;\n private readonly customTranslations: CustomTranslations;\n\n public readonly timeFormatOptions: Intl.DateTimeFormatOptions = {\n hour: 'numeric',\n minute: 'numeric'\n };\n public readonly timeAndDateFormatOptions: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n ...this.timeFormatOptions\n };\n public readonly timeAndDateFormatter: Intl.DateTimeFormat;\n\n constructor(props: LanguageOptions) {\n const { locale, translations, customTranslations } = props;\n\n if (!locale) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'Language: \"locale\" property is not defined');\n }\n\n this.locale = locale;\n this.languageCode = this.locale.split('-')[0];\n this.customTranslations = customTranslations || {};\n\n this.timeAndDateFormatter = Intl.DateTimeFormat(this.locale, this.timeAndDateFormatOptions);\n\n this.translations = {\n ...translations,\n ...(!!this.customTranslations[this.locale] && this.customTranslations[this.locale])\n };\n }\n\n /**\n * Returns a translated string from a key in the current {@link Language.locale}\n * @param key - Translation key\n * @param options - Translation options\n * @returns Translated string\n */\n public get(key: string, options?): string {\n const translation = getTranslation(this.translations, key, options);\n if (translation !== null) {\n return translation;\n }\n\n return key;\n }\n\n /**\n * Returns a localized string for an amount\n * @param amount - Amount to be converted\n * @param currencyCode - Currency code of the amount\n * @param options - Options for String.prototype.toLocaleString\n */\n public amount(amount: number, currencyCode: string, options?: object): string {\n return getLocalisedAmount(amount, this.locale, currencyCode, options);\n }\n\n /**\n * Returns a localized string for a date\n * @param date - Date to be localized\n * @param options - Options for {@link Intl.DateTimeFormatOptions}\n */\n public date(date: string, options: Intl.DateTimeFormatOptions = {}) {\n if (date === undefined) return '';\n const dateOptions: Intl.DateTimeFormatOptions = { year: 'numeric', month: '2-digit', day: '2-digit', ...options };\n return new Date(date).toLocaleDateString(this.locale, dateOptions);\n }\n\n /**\n * Returns a localized string for a date and time\n * @param date - Date to be localized\n */\n public dateTime(date: string) {\n if (date === undefined) return '';\n return this.timeAndDateFormatter.format(new Date(date));\n }\n}\n\nexport default Language;\n"],"names":["Language","get","key","options","translation","getTranslation","this","translations","amount","currencyCode","getLocalisedAmount","locale","date","undefined","dateOptions","_object_spread","year","month","day","Date","toLocaleDateString","dateTime","timeAndDateFormatter","format","constructor","props","_define_property","languageCode","customTranslations","timeFormatOptions","hour","minute","timeAndDateFormatOptions","AdyenCheckoutError","split","Intl","DateTimeFormat"],"mappings":"ylBAKO,MAAMA,EA4CT,GAAAC,CAAWC,EAAaC,GACpB,MAAMC,EAAcC,EAAeC,KAAKC,aAAcL,EAAKC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ts"],"sourcesContent":["import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport { AnalyticsInfoEvent, InfoEventType } from '../core/Analytics/events/AnalyticsInfoEvent';\nimport type { IAnalytics } from '../core/Analytics/Analytics';\n\ninterface IScript {\n load(): Promise<void>;\n remove(): void;\n}\n\ninterface IScriptProps {\n src: string;\n component: string;\n analytics: IAnalytics;\n node?: string;\n attributes?: Partial<HTMLScriptElement>;\n dataAttributes?: Record<string, string | undefined>;\n}\n\n// Returns Base URL of the resource without any query parameters (e.g. merchant ID, token, etc). Used for Analytics\nfunction getBaseURL(src: string): string {\n const url = new URL(src);\n return url.origin + url.pathname;\n}\n\nclass Script implements IScript {\n private readonly src: string;\n private readonly component: string;\n private readonly node: string;\n private readonly attributes: Partial<HTMLScriptElement>;\n private readonly dataAttributes: Record<string, string | undefined>;\n private readonly analytics: IAnalytics;\n private readonly baseUrl: string;\n\n private script: HTMLScriptElement;\n private loadPromise: Promise<void> | null = null;\n private rejectLoadPromise: (reason?: any) => void | null = null;\n private resolveLoadScript: (() => void) | null = null;\n private rejectLoadScript: ((reason?: any) => void) | null = null;\n\n private readonly handleOnLoad = () => {\n this.script?.setAttribute('data-script-loaded', 'true');\n this.cleanupListeners();\n this.resolveLoadScript?.();\n };\n\n private readonly handleOnError = (errorEvent: ErrorEvent) => {\n this.cleanupListeners();\n const error = new AdyenCheckoutError(\n 'SCRIPT_ERROR',\n `Unable to load script ${this.src}.${errorEvent?.message && `Message: ${errorEvent.message}`}`,\n {\n cause: errorEvent?.error || errorEvent\n }\n );\n this.rejectLoadScript?.(error);\n };\n\n public static readonly RETRY_DELAY = 1000;\n public static readonly MAX_NUMBER_OF_RETRIES = 3;\n\n constructor({ src, component, node = 'body', attributes, dataAttributes, analytics }: IScriptProps) {\n this.src = src;\n this.component = component;\n this.node = node;\n this.attributes = attributes;\n this.dataAttributes = dataAttributes;\n this.analytics = analytics;\n this.baseUrl = getBaseURL(this.src);\n }\n\n public load = (): Promise<void> => {\n if (this.loadPromise !== null) {\n if (process.env.NODE_ENV === 'development') console.warn(`[Warning] script.load called more than once for ${this.src}`);\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise((resolve, reject) => {\n this.rejectLoadPromise = reject;\n let attempts = 0;\n\n this.trackEvent(InfoEventType.sdkDownloadInitiated);\n\n const loadScriptWithRetry = async (): Promise<void> => {\n try {\n attempts++;\n await this.loadScript();\n this.trackEvent(InfoEventType.sdkDownloadCompleted);\n resolve();\n } catch (error: unknown) {\n if (this.loadPromise === null) {\n return;\n }\n\n this.trackEvent(InfoEventType.sdkDownloadFailed);\n\n this.removeScript();\n\n if (attempts < Script.MAX_NUMBER_OF_RETRIES) {\n setTimeout(() => void loadScriptWithRetry(), Script.RETRY_DELAY);\n } else {\n this.trackEvent(InfoEventType.sdkDownloadAborted);\n this.loadPromise = null;\n this.rejectLoadPromise = null;\n reject(error);\n }\n }\n };\n\n void loadScriptWithRetry();\n });\n\n return this.loadPromise;\n };\n\n public remove = () => {\n this.rejectLoadPromise?.(new AdyenCheckoutError('CANCEL', 'Script loading cancelled.'));\n this.removeScript();\n this.loadPromise = null;\n };\n\n private removeScript() {\n this.cleanupListeners();\n this.script?.parentNode?.removeChild(this.script);\n this.script = null;\n }\n\n private cleanupListeners() {\n if (!this.script) return;\n this.script.removeEventListener('load', this.handleOnLoad);\n this.script.removeEventListener('error', this.handleOnError);\n }\n\n private attachListeners() {\n if (!this.script) return;\n this.cleanupListeners();\n this.script.addEventListener('load', this.handleOnLoad);\n this.script.addEventListener('error', this.handleOnError);\n }\n\n private loadScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n const scriptContainer = document.querySelector(this.node);\n\n if (!scriptContainer) {\n reject(new AdyenCheckoutError('SCRIPT_ERROR', `Unable to find script container node: ${this.node}`));\n return;\n }\n\n this.resolveLoadScript = resolve;\n this.rejectLoadScript = reject;\n\n this.script = scriptContainer.querySelector(`script[src=\"${this.src}\"]`);\n\n // Script element exists in the browser and is already loaded\n if (this.script?.getAttribute('data-script-loaded')) {\n this.resolveLoadScript();\n return;\n }\n\n // Script element exists in the browser, but it is not loaded yet\n // Use-case: Multiple PayPal standalone components being loaded in different parts of the screen.\n if (this.script) {\n this.attachListeners();\n return;\n }\n\n // Script element doesn't exist in the browser, so we create it and append to the DOM tree\n this.script = document.createElement('script');\n\n Object.assign(this.script, this.attributes);\n Object.assign(this.script.dataset, this.dataAttributes);\n\n this.script.src = this.src;\n this.script.async = true;\n\n this.attachListeners();\n\n scriptContainer.appendChild(this.script);\n });\n }\n\n private trackEvent(eventType: InfoEventType) {\n const event = new AnalyticsInfoEvent({\n type: eventType,\n component: this.component,\n cdnUrl: this.baseUrl\n });\n this.analytics?.sendAnalytics(event);\n }\n}\n\nexport default Script;\n"],"names":["Script","removeScript","_this_script_parentNode","_this_script","this","cleanupListeners","script","parentNode","removeChild","removeEventListener","handleOnLoad","handleOnError","attachListeners","addEventListener","loadScript","Promise","resolve","reject","scriptContainer","document","querySelector","node","resolveLoadScript","rejectLoadScript","src","getAttribute","createElement","Object","assign","attributes","dataset","dataAttributes","async","appendChild","AdyenCheckoutError","trackEvent","eventType","_this_analytics","event","AnalyticsInfoEvent","type","component","cdnUrl","baseUrl","analytics","sendAnalytics","constructor","_define_property","loadPromise","rejectLoadPromise","_this_resolveLoadScript","setAttribute","call","errorEvent","_this_rejectLoadScript","error","message","cause","load","attempts","InfoEventType","sdkDownloadInitiated","loadScriptWithRetry","sdkDownloadCompleted","sdkDownloadFailed","MAX_NUMBER_OF_RETRIES","setTimeout","RETRY_DELAY","sdkDownloadAborted","remove","_this_rejectLoadPromise","url","URL","origin","pathname","getBaseURL"],"mappings":"mRAwBA,MAAMA,EAgGMC,YAAAA,OAEJC,EAAAC,EADAC,KAAKC,mBACM,QAAXF,EAAAC,KAAKE,kBAALH,GAAuB,QAAvBD,EAAAC,EAAaI,sBAAbL,GAAAA,EAAyBM,YAAYJ,KAAKE,QAC1CF,KAAKE,OAAS,IAClB,CAEQD,gBAAAA,GACC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I,mBAE9B5D,KAAKH,eAED0D,EAAW3D,EAAOiE,sBAClBC,WAAW,KAAWJ,KAAuB9D,EAAOmE,cAEpD/D,KAAK+B,WAAWyB,EAAcQ,oBAC9BhE,KAAK4C,YAAc,KACnB5C,KAAK6C,kBAAoB,KACzBhC,EAAOsC,GAEf,GAGCO,OAnCE1D,KAAK4C,cAyCpBD,EAAA3C,KAAOiE,SAAS,SACZC,EAAsB,QAAtBA,EAAAlE,KAAK6C,yBAAL,IAAAqB,GAAAA,EAAAlB,KAAAhD,KAAyB,IAAI8B,EAAmB,SAAU,8BAC1D9B,KAAKH,eACLG,KAAK4C,YAAc,OAxDnB5C,KAAKoB,IAAMA,EACXpB,KAAKqC,UAAYA,EACjBrC,KAAKiB,KAAOA,EACZjB,KAAKyB,WAAaA,EAClBzB,KAAK2B,eAAiBA,EACtB3B,KAAKwC,UAAYA,EACjBxC,KAAKuC,QAhDb,SAAoBnB,GAChB,MAAM+C,EAAM,IAAIC,IAAIhD,GACpB,OAAO+C,EAAIE,OAASF,EAAIG,QAC5B,CA6CuBC,CAAWvE,KAAKoB,IACnC,EAXAuB,EAjCE/C,EAiCqBmE,cAAc,KACrCpB,EAlCE/C,EAkCqBiE,wBAAwB"}
|
|
1
|
+
{"version":3,"file":"Script.js","sources":["../../../src/utils/Script.ts"],"sourcesContent":["import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport { AnalyticsInfoEvent, InfoEventType } from '../core/Analytics/events/AnalyticsInfoEvent';\nimport type { IAnalytics } from '../core/Analytics/Analytics';\n\ninterface IScript {\n load(): Promise<void>;\n remove(): void;\n}\n\ninterface IScriptProps {\n src: string;\n component: string;\n analytics: IAnalytics;\n node?: string;\n attributes?: Partial<HTMLScriptElement>;\n dataAttributes?: Record<string, string | undefined>;\n}\n\n// Returns Base URL of the resource without any query parameters (e.g. merchant ID, token, etc). Used for Analytics\nfunction getBaseURL(src: string): string {\n const url = new URL(src);\n return url.origin + url.pathname;\n}\n\nclass Script implements IScript {\n private readonly src: string;\n private readonly component: string;\n private readonly node: string;\n private readonly attributes: Partial<HTMLScriptElement>;\n private readonly dataAttributes: Record<string, string | undefined>;\n private readonly analytics: IAnalytics;\n private readonly baseUrl: string;\n\n private script: HTMLScriptElement;\n private loadPromise: Promise<void> | null = null;\n private rejectLoadPromise: (reason?: any) => void | null = null;\n private resolveLoadScript: (() => void) | null = null;\n private rejectLoadScript: ((reason?: any) => void) | null = null;\n\n private readonly handleOnLoad = () => {\n this.script?.setAttribute('data-script-loaded', 'true');\n this.cleanupListeners();\n this.resolveLoadScript?.();\n };\n\n private readonly handleOnError = (errorEvent: ErrorEvent) => {\n this.cleanupListeners();\n const error = new AdyenCheckoutError(\n 'SCRIPT_ERROR',\n `Unable to load script ${this.src}.${errorEvent?.message && `Message: ${errorEvent.message}`}`,\n {\n cause: errorEvent?.error || errorEvent\n }\n );\n this.rejectLoadScript?.(error);\n };\n\n public static readonly RETRY_DELAY = 1000;\n public static readonly MAX_NUMBER_OF_RETRIES = 3;\n\n constructor({ src, component, node = 'body', attributes, dataAttributes, analytics }: IScriptProps) {\n this.src = src;\n this.component = component;\n this.node = node;\n this.attributes = attributes;\n this.dataAttributes = dataAttributes;\n this.analytics = analytics;\n this.baseUrl = getBaseURL(this.src);\n }\n\n public load = (): Promise<void> => {\n if (this.loadPromise !== null) {\n if (process.env.NODE_ENV === 'development') console.warn(`[Warning] script.load called more than once for ${this.src}`);\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise((resolve, reject) => {\n this.rejectLoadPromise = reject;\n let attempts = 0;\n\n this.trackEvent(InfoEventType.sdkDownloadInitiated);\n\n const loadScriptWithRetry = async (): Promise<void> => {\n try {\n attempts++;\n await this.loadScript();\n this.trackEvent(InfoEventType.sdkDownloadCompleted);\n resolve();\n } catch (error: unknown) {\n if (this.loadPromise === null) {\n return;\n }\n\n this.trackEvent(InfoEventType.sdkDownloadFailed);\n\n this.removeScript();\n\n if (attempts < Script.MAX_NUMBER_OF_RETRIES) {\n setTimeout(() => void loadScriptWithRetry(), Script.RETRY_DELAY);\n } else {\n this.trackEvent(InfoEventType.sdkDownloadAborted);\n this.loadPromise = null;\n this.rejectLoadPromise = null;\n reject(error);\n }\n }\n };\n\n void loadScriptWithRetry();\n });\n\n return this.loadPromise;\n };\n\n public remove = () => {\n this.rejectLoadPromise?.(new AdyenCheckoutError('CANCEL', 'Script loading cancelled.'));\n this.removeScript();\n this.loadPromise = null;\n };\n\n private removeScript() {\n this.cleanupListeners();\n this.script?.parentNode?.removeChild(this.script);\n this.script = null;\n }\n\n private cleanupListeners() {\n if (!this.script) return;\n this.script.removeEventListener('load', this.handleOnLoad);\n this.script.removeEventListener('error', this.handleOnError);\n }\n\n private attachListeners() {\n if (!this.script) return;\n this.cleanupListeners();\n this.script.addEventListener('load', this.handleOnLoad);\n this.script.addEventListener('error', this.handleOnError);\n }\n\n private loadScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n const scriptContainer = document.querySelector(this.node);\n\n if (!scriptContainer) {\n reject(new AdyenCheckoutError('SCRIPT_ERROR', `Unable to find script container node: ${this.node}`));\n return;\n }\n\n this.resolveLoadScript = resolve;\n this.rejectLoadScript = reject;\n\n this.script = scriptContainer.querySelector(`script[src=\"${this.src}\"]`);\n\n // Script element exists in the browser and is already loaded\n if (this.script?.getAttribute('data-script-loaded')) {\n this.resolveLoadScript();\n return;\n }\n\n // Script element exists in the browser, but it is not loaded yet\n // Use-case: Multiple PayPal standalone components being loaded in different parts of the screen.\n if (this.script) {\n this.attachListeners();\n return;\n }\n\n // Script element doesn't exist in the browser, so we create it and append to the DOM tree\n this.script = document.createElement('script');\n\n Object.assign(this.script, this.attributes);\n Object.assign(this.script.dataset, this.dataAttributes);\n\n this.script.src = this.src;\n this.script.async = true;\n\n this.attachListeners();\n\n scriptContainer.appendChild(this.script);\n });\n }\n\n private trackEvent(eventType: InfoEventType) {\n const event = new AnalyticsInfoEvent({\n type: eventType,\n component: this.component,\n cdnUrl: this.baseUrl\n });\n this.analytics?.sendAnalytics(event);\n }\n}\n\nexport default Script;\n"],"names":["Script","removeScript","_this_script_parentNode","_this_script","this","cleanupListeners","script","parentNode","removeChild","removeEventListener","handleOnLoad","handleOnError","attachListeners","addEventListener","loadScript","Promise","resolve","reject","scriptContainer","document","querySelector","node","resolveLoadScript","rejectLoadScript","src","getAttribute","createElement","Object","assign","attributes","dataset","dataAttributes","async","appendChild","AdyenCheckoutError","trackEvent","eventType","_this_analytics","event","AnalyticsInfoEvent","type","component","cdnUrl","baseUrl","analytics","sendAnalytics","constructor","_define_property","loadPromise","rejectLoadPromise","_this_resolveLoadScript","setAttribute","call","errorEvent","_this_rejectLoadScript","error","message","cause","load","attempts","InfoEventType","sdkDownloadInitiated","loadScriptWithRetry","sdkDownloadCompleted","sdkDownloadFailed","MAX_NUMBER_OF_RETRIES","setTimeout","RETRY_DELAY","sdkDownloadAborted","remove","_this_rejectLoadPromise","url","URL","origin","pathname","getBaseURL"],"mappings":"mRAwBA,MAAMA,EAgGMC,YAAAA,OAEJC,EAAAC,EADAC,KAAKC,mBACM,QAAXF,EAAAC,KAAKE,kBAALH,GAAuB,QAAvBD,EAAAC,EAAaI,sBAAbL,GAAAA,EAAyBM,YAAYJ,KAAKE,QAC1CF,KAAKE,OAAS,IAClB,CAEQD,gBAAAA,GACCD,KAAKE,SACVF,KAAKE,OAAOG,oBAAoB,OAAQL,KAAKM,cAC7CN,KAAKE,OAAOG,oBAAoB,QAASL,KAAKO,eAClD,CAEQC,eAAAA,GACCR,KAAKE,SACVF,KAAKC,mBACLD,KAAKE,OAAOO,iBAAiB,OAAQT,KAAKM,cAC1CN,KAAKE,OAAOO,iBAAiB,QAAST,KAAKO,eAC/C,CAEQG,UAAAA,GACJ,OAAO,IAAIC,QAAQ,CAACC,EAASC,KAcrB,IAAAd,EAbJ,MAAMe,EAAkBC,SAASC,cAAchB,KAAKiB,MAE/CH,GAKLd,KAAKkB,kBAAoBN,EACzBZ,KAAKmB,iBAAmBN,EAExBb,KA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KyB,WAAaA,EAClBzB,KAAK2B,eAAiBA,EACtB3B,KAAKwC,UAAYA,EACjBxC,KAAKuC,QAhDb,SAAoBnB,GAChB,MAAM+C,EAAM,IAAIC,IAAIhD,GACpB,OAAO+C,EAAIE,OAASF,EAAIG,QAC5B,CA6CuBC,CAAWvE,KAAKoB,IACnC,EAXAuB,EAjCE/C,EAiCqBmE,cAAc,KACrCpB,EAlCE/C,EAkCqBiE,wBAAwB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class e{get length(){return Object.keys(this.storage).length}key(t){return Object.keys(this.storage)[t]}getItem(t){return this.storage[t]||null}setItem(t,e){
|
|
1
|
+
function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class e{get length(){return Object.keys(this.storage).length}key(t){var e;return null!==(e=Object.keys(this.storage)[t])&&void 0!==e?e:null}getItem(t){return this.storage[t]||null}setItem(t,e){this.storage[t]=e}removeItem(t){delete this.storage[t]}clear(){this.storage={}}constructor(){t(this,"storage",void 0),this.storage={}}}class r{get(){try{const t=this.storage.getItem(this.key);return t?JSON.parse(t):null}catch(t){return null}}set(t){this.storage.setItem(this.key,JSON.stringify(t))}remove(){this.storage.removeItem(this.key)}clear(){this.storage.clear()}keyByIndex(t){return this.storage.key(t)}get length(){return this.storage.length}constructor(r,s){t(this,"prefix","adyen-checkout__"),t(this,"key",void 0),t(this,"storage",void 0);try{if(this.storage=s?window[s]:window.localStorage,!this.storage)throw new Error("storage does not exist")}catch(t){this.storage=new e}this.key=this.prefix+r}}export{r as default};
|
|
2
2
|
//# sourceMappingURL=Storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.js","sources":["../../../src/utils/Storage.ts"],"sourcesContent":["class NonPersistentStorage {\n private storage
|
|
1
|
+
{"version":3,"file":"Storage.js","sources":["../../../src/utils/Storage.ts"],"sourcesContent":["class NonPersistentStorage {\n private storage: Record<string, string>;\n\n constructor() {\n this.storage = {};\n }\n\n public get length(): number {\n return Object.keys(this.storage).length;\n }\n\n public key(index: number): string | null {\n return Object.keys(this.storage)[index] ?? null;\n }\n\n public getItem(keyName: string): string | null {\n return this.storage[keyName] || null;\n }\n\n public setItem(keyName: string, keyValue: string): void {\n this.storage[keyName] = keyValue;\n }\n\n public removeItem(keyName: string): void {\n delete this.storage[keyName];\n }\n\n public clear(): void {\n this.storage = {};\n }\n}\n\nclass Storage<T> {\n private readonly prefix = 'adyen-checkout__';\n private readonly key: string;\n private storage: globalThis.Storage | NonPersistentStorage;\n\n constructor(key: string, storageType: 'sessionStorage' | 'localStorage') {\n try {\n this.storage = storageType ? window[storageType] : window.localStorage;\n if (!this.storage) {\n throw new Error('storage does not exist');\n }\n } catch (e) {\n this.storage = new NonPersistentStorage();\n }\n this.key = this.prefix + key;\n }\n\n public get(): T | null {\n try {\n const item = this.storage.getItem(this.key);\n return item ? JSON.parse(item) : null;\n } catch (err) {\n return null;\n }\n }\n\n public set(value: T): void {\n this.storage.setItem(this.key, JSON.stringify(value));\n }\n\n public remove(): void {\n this.storage.removeItem(this.key);\n }\n\n public clear(): void {\n this.storage.clear();\n }\n\n public keyByIndex(index: number): string | null {\n return this.storage.key(index);\n }\n\n public get length(): number {\n return this.storage.length;\n }\n}\n\nexport default Storage;\n"],"names":["NonPersistentStorage","length","Object","keys","this","storage","key","index","getItem","keyName","setItem","keyValue","removeItem","clear","constructor","_define_property","Storage","get","item","JSON","parse","err","set","value","stringify","remove","keyByIndex","storageType","prefix","window","localStorage","Error","e"],"mappings":"wHAAA,MAAMA,EAOF,UAAWC,GACP,OAAOC,OAAOC,KAAKC,KAAKC,SAASJ,MACrC,CAEOK,GAAAA,CAAIC,GACAL,IAAAA,EAAP,OAAuC,QAAhCA,EAAAA,OAAOC,KAAKC,KAAKC,SAASE,UAA1BL,IAAAA,EAAAA,EAAoC,IAC/C,CAEOM,OAAAA,CAAQC,GACX,OAAOL,KAAKC,QAAQI,IAAY,IACpC,CAEOC,OAAAA,CAAQD,EAAiBE,GAC5BP,KAAKC,QAAQI,GAAWE,CAC5B,CAEOC,UAAAA,CAAWH,UACPL,KAAKC,QAAQI,EACxB,CAEOI,KAAAA,GACHT,KAAKC,QAAU,CAAA,CACnB,CA1BA,WAAAS,GAFAC,EAAAX,KAAQC,kBAGJD,KAAKC,QAAU,CAAA,CACnB,EA2BJ,MAAMW,EAiBKC,GAAAA,GACH,IACI,MAAMC,EAAOd,KAAKC,QAAQG,QAAQJ,KAAKE,KACvC,OAAOY,EAAOC,KAAKC,MAAMF,GAAQ,IACrC,CAAE,MAAOG,GACL,OAAO,IACX,CACJ,CAEOC,GAAAA,CAAIC,GACPnB,KAAKC,QAAQK,QAAQN,KAAKE,IAAKa,KAAKK,UAAUD,GAClD,CAEOE,MAAAA,GACHrB,KAAKC,QAAQO,WAAWR,KAAKE,IACjC,CAEOO,KAAAA,GACHT,KAAKC,QAAQQ,OACjB,CAEOa,UAAAA,CAAWnB,GACd,OAAOH,KAAKC,QAAQC,IAAIC,EAC5B,CAEA,UAAWN,GACP,OAAOG,KAAKC,QAAQJ,MACxB,CAvCA,WAAAa,CAAYR,EAAaqB,GAJzBZ,EAAAX,KAAiBwB,SAAS,oBAC1Bb,EAAAX,KAAiBE,cACjBS,EAAAX,KAAQC,kBAGJ,IAEI,GADAD,KAAKC,QAAUsB,EAAcE,OAAOF,GAAeE,OAAOC,cACrD1B,KAAKC,QACN,MAAM,IAAI0B,MAAM,yBAExB,CAAE,MAAOC,GACL5B,KAAKC,QAAU,IAAIL,CACvB,CACAI,KAAKE,IAAMF,KAAKwB,OAAStB,CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationRuleResult.js","sources":["../../../../src/utils/Validator/ValidationRuleResult.ts"],"sourcesContent":["import { ErrorMessageObject, ValidatorRule, ValidatorMode } from './types';\n\n/**\n * Holds the result of a validation\n */\nexport class ValidationRuleResult {\n private readonly shouldValidate: boolean;\n public isValid: boolean;\n public errorMessage: string | ErrorMessageObject;\n\n constructor(rule: ValidatorRule, value: string, mode: ValidatorMode, context) {\n this.shouldValidate = rule.modes.includes(mode);\n this.isValid = rule.validate(value, context);\n this.errorMessage = rule.errorMessage;\n }\n\n /**\n * Whether the validation is considered an error.\n * A field is only considered to be an error if the validation rule applies to the current mode i.e. 'blur' or 'input'.\n * Also, if a validation function returns a null value e.g. when the field is empty, then the field will not be considered to be in error\n * unless the whole form is being validated\n */\n hasError(isValidatingForm = false): boolean {\n return isValidatingForm ? !this.isValid && this.shouldValidate : this.isValid != null && !this.isValid && this.shouldValidate;\n }\n}\n"],"names":["ValidationRuleResult","hasError","isValidatingForm","this","isValid","shouldValidate","constructor","rule","value","mode","context","_define_property","errorMessage","modes","includes","validate"],"mappings":"wHAKO,MAAMA,EAiBTC,QAAAA,CAASC,GAAmB,GACxB,OAAOA,GAAoBC,KAAKC,SAAWD,KAAKE,eAAiC,MAAhBF,KAAKC,UAAoBD,KAAKC,SAAWD,KAAKE,cACnH,CAdA,WAAAC,CAAYC,EAAqBC,EAAeC,EAAqBC,GAJrEC,EAAAR,KAAiBE,
|
|
1
|
+
{"version":3,"file":"ValidationRuleResult.js","sources":["../../../../src/utils/Validator/ValidationRuleResult.ts"],"sourcesContent":["import { ErrorMessageObject, ValidatorRule, ValidatorMode } from './types';\n\n/**\n * Holds the result of a validation\n */\nexport class ValidationRuleResult {\n private readonly shouldValidate: boolean;\n public isValid: boolean;\n public errorMessage: string | ErrorMessageObject;\n\n constructor(rule: ValidatorRule, value: string, mode: ValidatorMode, context) {\n this.shouldValidate = rule.modes.includes(mode);\n this.isValid = rule.validate(value, context);\n this.errorMessage = rule.errorMessage;\n }\n\n /**\n * Whether the validation is considered an error.\n * A field is only considered to be an error if the validation rule applies to the current mode i.e. 'blur' or 'input'.\n * Also, if a validation function returns a null value e.g. when the field is empty, then the field will not be considered to be in error\n * unless the whole form is being validated\n */\n hasError(isValidatingForm = false): boolean {\n return isValidatingForm ? !this.isValid && this.shouldValidate : this.isValid != null && !this.isValid && this.shouldValidate;\n }\n}\n"],"names":["ValidationRuleResult","hasError","isValidatingForm","this","isValid","shouldValidate","constructor","rule","value","mode","context","_define_property","errorMessage","modes","includes","validate"],"mappings":"wHAKO,MAAMA,EAiBTC,QAAAA,CAASC,GAAmB,GACxB,OAAOA,GAAoBC,KAAKC,SAAWD,KAAKE,eAAiC,MAAhBF,KAAKC,UAAoBD,KAAKC,SAAWD,KAAKE,cACnH,CAdA,WAAAC,CAAYC,EAAqBC,EAAeC,EAAqBC,GAJrEC,EAAAR,KAAiBE,yBACjBM,EAAAR,KAAOC,kBACPO,EAAAR,KAAOS,uBAGHT,KAAKE,eAAiBE,EAAKM,MAAMC,SAASL,GAC1CN,KAAKC,QAAUG,EAAKQ,SAASP,EAAOE,GACpCP,KAAKS,aAAeL,EAAKK,YAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.js","sources":["../../../../src/utils/Validator/Validator.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule, FieldContext, FieldData } from './types';\nimport { ValidationRuleResult } from './ValidationRuleResult';\n\nclass ValidationResult {\n private validationResults: ValidationRuleResult[];\n\n constructor(results: ValidationRuleResult[]) {\n this.validationResults = results;\n }\n\n /** Checks if all validation rules have passed */\n get isValid(): boolean {\n return this.validationResults.reduce((acc, result) => acc && result.isValid, true);\n }\n\n /** Checks if any validation rule returned an error */\n hasError(isValidatingForm = false): boolean {\n return Boolean(this.getError(isValidatingForm));\n }\n\n /** Returns the first validation result that returned an error */\n getError(isValidatingForm = false) {\n return this.validationResults.find(result => result.hasError(isValidatingForm));\n }\n\n /** Returns all validation results that returned an error */\n getAllErrors() {\n return this.validationResults.filter(result => result.hasError());\n }\n}\n\nclass Validator {\n public rules: ValidatorRules = {\n default: {\n validate: () => true,\n modes: ['blur', 'input']\n }\n };\n\n constructor(rules) {\n this.setRules(rules);\n }\n\n setRules(newRules) {\n this.rules = {\n ...this.rules,\n ...newRules\n };\n }\n\n /**\n * Get all validation rules for a field\n */\n private getRulesFor(field: string): ValidatorRule[] {\n let fieldRules: ValidatorRule | ValidatorRule[] = this.rules[field] ?? this.rules['default'];\n\n if (!Array.isArray(fieldRules)) {\n fieldRules = [fieldRules];\n }\n\n return fieldRules;\n }\n\n /**\n * Validates a field\n */\n validate({ key, value, mode = 'blur' }: FieldData, context?: FieldContext) {\n const fieldRules = this.getRulesFor(key);\n // create an ValidationRuleResult, we run the actual validation inside of it\n // validate is called in the constructor of ValidationRuleResult\n // line rule.validate(value, context);\n //\n const validationRulesResult = fieldRules.map(rule => new ValidationRuleResult(rule, value, mode, context));\n\n return new ValidationResult(validationRulesResult);\n }\n}\n\nexport default Validator;\n"],"names":["ValidationResult","isValid","this","validationResults","reduce","acc","result","hasError","isValidatingForm","Boolean","getError","find","getAllErrors","filter","constructor","results","_define_property","Validator","setRules","newRules","rules","_object_spread","getRulesFor","field","_this_rules_field","fieldRules","Array","isArray","validate","key","value","mode","context","validationRulesResult","map","rule","ValidationRuleResult","default","modes"],"mappings":"yLAGA,MAAMA,EAQF,WAAIC,GACA,OAAOC,KAAKC,kBAAkBC,OAAO,CAACC,EAAKC,IAAWD,GAAOC,EAAOL,SAAS,EACjF,CAGAM,QAAAA,CAASC,GAAmB,GACxB,OAAOC,QAAQP,KAAKQ,SAASF,GACjC,CAGAE,QAAAA,CAASF,GAAmB,GACxB,OAAON,KAAKC,kBAAkBQ,KAAKL,GAAUA,EAAOC,SAASC,GACjE,CAGAI,YAAAA,GACI,OAAOV,KAAKC,kBAAkBU,OAAOP,GAAUA,EAAOC,WAC1D,CAtBA,WAAAO,CAAYC,GAFZC,EAAAd,KAAQC,
|
|
1
|
+
{"version":3,"file":"Validator.js","sources":["../../../../src/utils/Validator/Validator.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule, FieldContext, FieldData } from './types';\nimport { ValidationRuleResult } from './ValidationRuleResult';\n\nclass ValidationResult {\n private validationResults: ValidationRuleResult[];\n\n constructor(results: ValidationRuleResult[]) {\n this.validationResults = results;\n }\n\n /** Checks if all validation rules have passed */\n get isValid(): boolean {\n return this.validationResults.reduce((acc, result) => acc && result.isValid, true);\n }\n\n /** Checks if any validation rule returned an error */\n hasError(isValidatingForm = false): boolean {\n return Boolean(this.getError(isValidatingForm));\n }\n\n /** Returns the first validation result that returned an error */\n getError(isValidatingForm = false) {\n return this.validationResults.find(result => result.hasError(isValidatingForm));\n }\n\n /** Returns all validation results that returned an error */\n getAllErrors() {\n return this.validationResults.filter(result => result.hasError());\n }\n}\n\nclass Validator {\n public rules: ValidatorRules = {\n default: {\n validate: () => true,\n modes: ['blur', 'input']\n }\n };\n\n constructor(rules) {\n this.setRules(rules);\n }\n\n setRules(newRules) {\n this.rules = {\n ...this.rules,\n ...newRules\n };\n }\n\n /**\n * Get all validation rules for a field\n */\n private getRulesFor(field: string): ValidatorRule[] {\n let fieldRules: ValidatorRule | ValidatorRule[] = this.rules[field] ?? this.rules['default'];\n\n if (!Array.isArray(fieldRules)) {\n fieldRules = [fieldRules];\n }\n\n return fieldRules;\n }\n\n /**\n * Validates a field\n */\n validate({ key, value, mode = 'blur' }: FieldData, context?: FieldContext) {\n const fieldRules = this.getRulesFor(key);\n // create an ValidationRuleResult, we run the actual validation inside of it\n // validate is called in the constructor of ValidationRuleResult\n // line rule.validate(value, context);\n //\n const validationRulesResult = fieldRules.map(rule => new ValidationRuleResult(rule, value, mode, context));\n\n return new ValidationResult(validationRulesResult);\n }\n}\n\nexport default Validator;\n"],"names":["ValidationResult","isValid","this","validationResults","reduce","acc","result","hasError","isValidatingForm","Boolean","getError","find","getAllErrors","filter","constructor","results","_define_property","Validator","setRules","newRules","rules","_object_spread","getRulesFor","field","_this_rules_field","fieldRules","Array","isArray","validate","key","value","mode","context","validationRulesResult","map","rule","ValidationRuleResult","default","modes"],"mappings":"yLAGA,MAAMA,EAQF,WAAIC,GACA,OAAOC,KAAKC,kBAAkBC,OAAO,CAACC,EAAKC,IAAWD,GAAOC,EAAOL,SAAS,EACjF,CAGAM,QAAAA,CAASC,GAAmB,GACxB,OAAOC,QAAQP,KAAKQ,SAASF,GACjC,CAGAE,QAAAA,CAASF,GAAmB,GACxB,OAAON,KAAKC,kBAAkBQ,KAAKL,GAAUA,EAAOC,SAASC,GACjE,CAGAI,YAAAA,GACI,OAAOV,KAAKC,kBAAkBU,OAAOP,GAAUA,EAAOC,WAC1D,CAtBA,WAAAO,CAAYC,GAFZC,EAAAd,KAAQC,4BAGJD,KAAKC,kBAAoBY,CAC7B,EAuBJ,MAAME,EAYFC,QAAAA,CAASC,GACLjB,KAAKkB,wUAAQC,IACNnB,KAAKkB,MACLD,EAEX,CAKQG,WAAAA,CAAYC,GACkC,IAAAC,EAAlD,IAAIC,EAA+D,QAAjBD,EAAAtB,KAAKkB,MAAMG,UAAX,IAAAC,EAAAA,EAAqBtB,KAAKkB,MAAM,QAMlF,OAJKM,MAAMC,QAAQF,KACfA,EAAa,CAACA,IAGXA,CACX,CAKAG,QAAAA,EAASC,IAAEA,EAAGC,MAAEA,EAAKC,KAAEA,EAAO,QAAqBC,GAC/C,MAKMC,EALa/B,KAAKoB,YAAYO,GAKKK,IAAIC,GAAQ,IAAIC,EAAqBD,EAAML,EAAOC,EAAMC,IAEjG,OAAO,IAAIhC,EAAiBiC,EAChC,CApCA,WAAAnB,CAAYM,GAPZJ,EAAAd,KAAOkB,QAAwB,CAC3BiB,QAAS,CACLT,SAAU,KAAM,EAChBU,MAAO,CAAC,OAAQ,YAKpBpC,KAAKgB,SAASE,EAClB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from"./constants/currency-decimals.js";import{currencyMinorUnitsConfig as
|
|
1
|
+
import r from"./constants/currency-decimals.js";import{currencyMinorUnitsConfig as e}from"./constants/currency-minor-units.js";function t(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function n(r){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},c=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(c=c.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),c.forEach(function(e){t(r,e,n[e])})}return r}const c=e=>r[e]||100,o=(r,e)=>{const t=c(e);return parseInt(String(r),10)/t},u=(r,t,c,u={})=>{const i=r.toString(),y=o(i,c),s=t.replace("_","-"),a=e[c]?n({},u,e[c]):u,l=n({style:"currency",currency:c,currencyDisplay:"symbol"},a);try{return y.toLocaleString(s,l)}catch(r){return i}},i=r=>{if(!r||"object"!=typeof r)return!1;const e="number"==typeof r.value&&!Number.isNaN(r.value),t="string"==typeof r.currency&&r.currency.length>0,n=void 0===r.currencyDisplay||"string"==typeof r.currencyDisplay;return e&&t&&n};export{o as getDecimalAmount,c as getDivider,u as getLocalisedAmount,i as isAmountValid};
|
|
2
2
|
//# sourceMappingURL=amount-util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount-util.js","sources":["../../../src/utils/amount-util.ts"],"sourcesContent":["import CURRENCY_DECIMALS from './constants/currency-decimals';\nimport { currencyMinorUnitsConfig } from './constants/currency-minor-units';\n\n/**\n * @internal\n * @param currencyCode -\n * Get divider amount\n */\nexport const getDivider = (currencyCode: string): number => CURRENCY_DECIMALS[currencyCode] || 100;\n\n/**\n * @internal\n */\nexport const getDecimalAmount = (amount: number | string, currencyCode: string): number => {\n const divider = getDivider(currencyCode);\n return parseInt(String(amount), 10) / divider;\n};\n\n/**\n * @internal\n */\nexport const getLocalisedAmount = (amount: number, locale: string, currencyCode: string, options = {}): string => {\n const stringAmount = amount.toString(); // Changing amount to string to avoid 0-value from returning false\n\n const decimalAmount = getDecimalAmount(stringAmount, currencyCode);\n const formattedLocale = locale.replace('_', '-');\n\n const modifiedOptions = currencyMinorUnitsConfig[currencyCode] ? { ...options, ...currencyMinorUnitsConfig[currencyCode] } : options;\n const localeOptions = {\n style: 'currency',\n currency: currencyCode,\n currencyDisplay: 'symbol',\n ...modifiedOptions\n };\n\n try {\n return decimalAmount.toLocaleString(formattedLocale, localeOptions);\n } catch (e) {\n return stringAmount;\n }\n};\n"],"names":["getDivider","currencyCode","CURRENCY_DECIMALS","getDecimalAmount","amount","divider","parseInt","String","getLocalisedAmount","locale","options","stringAmount","toString","decimalAmount","formattedLocale","replace","modifiedOptions","currencyMinorUnitsConfig","_object_spread","localeOptions","style","currency","currencyDisplay","toLocaleString","e"],"mappings":"
|
|
1
|
+
{"version":3,"file":"amount-util.js","sources":["../../../src/utils/amount-util.ts"],"sourcesContent":["import { PaymentAmount } from '../types';\nimport CURRENCY_DECIMALS from './constants/currency-decimals';\nimport { currencyMinorUnitsConfig } from './constants/currency-minor-units';\n\n/**\n * @internal\n * @param currencyCode -\n * Get divider amount\n */\nexport const getDivider = (currencyCode: string): number => {\n const divider = CURRENCY_DECIMALS[currencyCode as keyof typeof CURRENCY_DECIMALS];\n return divider || 100;\n};\n\n/**\n * @internal\n */\nexport const getDecimalAmount = (amount: number | string, currencyCode: string): number => {\n const divider = getDivider(currencyCode);\n return parseInt(String(amount), 10) / divider;\n};\n\n/**\n * @internal\n */\nexport const getLocalisedAmount = (amount: number, locale: string, currencyCode: string, options = {}): string => {\n const stringAmount = amount.toString(); // Changing amount to string to avoid 0-value from returning false\n\n const decimalAmount = getDecimalAmount(stringAmount, currencyCode);\n const formattedLocale = locale.replace('_', '-');\n\n const modifiedOptions = currencyMinorUnitsConfig[currencyCode] ? { ...options, ...currencyMinorUnitsConfig[currencyCode] } : options;\n\n const localeOptions: Intl.NumberFormatOptions = {\n style: 'currency',\n currency: currencyCode,\n currencyDisplay: 'symbol',\n ...modifiedOptions\n };\n\n try {\n return decimalAmount.toLocaleString(formattedLocale, localeOptions);\n } catch (e) {\n return stringAmount;\n }\n};\n\n/**\n * Validates a payment amount object.\n *\n * @param amount - The payment amount object to validate\n * @returns True if the amount has a valid numeric value, non-empty currency string,\n * and optionally a valid currencyDisplay string\n */\nexport const isAmountValid = (amount: PaymentAmount): boolean => {\n if (!amount || typeof amount !== 'object') {\n return false;\n }\n\n const hasValidValue = typeof amount.value === 'number' && !Number.isNaN(amount.value);\n const hasValidCurrency = typeof amount.currency === 'string' && amount.currency.length > 0;\n const hasValidCurrencyDisplay = amount.currencyDisplay === undefined || typeof amount.currencyDisplay === 'string';\n\n return hasValidValue && hasValidCurrency && hasValidCurrencyDisplay;\n};\n"],"names":["getDivider","currencyCode","CURRENCY_DECIMALS","getDecimalAmount","amount","divider","parseInt","String","getLocalisedAmount","locale","options","stringAmount","toString","decimalAmount","formattedLocale","replace","modifiedOptions","currencyMinorUnitsConfig","_object_spread","localeOptions","style","currency","currencyDisplay","toLocaleString","e","isAmountValid","hasValidValue","value","Number","isNaN","hasValidCurrency","length","hasValidCurrencyDisplay","undefined"],"mappings":"2jBASO,MAAMA,EAAcC,GACPC,EAAkBD,IAChB,IAMTE,EAAmB,CAACC,EAAyBH,KACtD,MAAMI,EAAUL,EAAWC,GAC3B,OAAOK,SAASC,OAAOH,GAAS,IAAMC,GAM7BG,EAAqB,CAACJ,EAAgBK,EAAgBR,EAAsBS,EAAU,MAC/F,MAAMC,EAAeP,EAAOQ,WAEtBC,EAAgBV,EAAiBQ,EAAcV,GAC/Ca,EAAkBL,EAAOM,QAAQ,IAAK,KAEtCC,EAAkBC,EAAyBhB,GAAgBiB,KAAKR,EAAYO,EAAyBhB,IAAkBS,EAEvHS,EAA0CD,EAAA,CAC5CE,MAAO,WACPC,SAAUpB,EACVqB,gBAAiB,UACdN,GAGP,IACI,OAAOH,EAAcU,eAAeT,EAAiBK,EACzD,CAAE,MAAOK,GACL,OAAOb,CACX,GAUSc,EAAiBrB,IAC1B,IAAKA,GAA4B,iBAAXA,EAClB,OAAO,EAGX,MAAMsB,EAAwC,iBAAjBtB,EAAOuB,QAAuBC,OAAOC,MAAMzB,EAAOuB,OACzEG,EAA8C,iBAApB1B,EAAOiB,UAAyBjB,EAAOiB,SAASU,OAAS,EACnFC,OAAqDC,IAA3B7B,EAAOkB,iBAAmE,iBAA3BlB,EAAOkB,gBAEtF,OAAOI,GAAiBI,GAAoBE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
function e(){if("undefined"==typeof window)return;const e=window.screen.colorDepth,n=window.screen.height,t=window.screen.width,o=window.navigator.userAgent;return{acceptHeader:"*/*",javaEnabled:!1,colorDepth:e,language:window.navigator.language||"en",screenHeight:n,screenWidth:t,userAgent:o,timeZoneOffset:(new Date).getTimezoneOffset()}}export{e as default};
|
|
2
2
|
//# sourceMappingURL=browserInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserInfo.js","sources":["../../../src/utils/browserInfo.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"browserInfo.js","sources":["../../../src/utils/browserInfo.ts"],"sourcesContent":["import type { BrowserInfo } from '../types/global-types';\n\n/**\n * Collects available frontend browser info and store it in the properties dictated by the EMVCo spec\n * (3DS_Spec_protocolAndCoreFny_v2-1_Oct2017.pdf)\n *\n * @example\n * ```js\n * const browserInfo = collectBrowserInfo();\n * ```\n *\n * @returns An object containing the retrieved browser properties\n */\nexport default function collectBrowserInfo(): BrowserInfo {\n if (typeof window === 'undefined') {\n return;\n }\n const colorDepth = window.screen.colorDepth;\n const screenHeight = window.screen.height;\n const screenWidth = window.screen.width;\n const userAgent = window.navigator.userAgent;\n\n const language = window.navigator.language || 'en';\n const timeZoneOffset = new Date().getTimezoneOffset();\n\n return {\n acceptHeader: '*/*',\n javaEnabled: false,\n colorDepth,\n language,\n screenHeight,\n screenWidth,\n userAgent,\n timeZoneOffset\n };\n}\n"],"names":["collectBrowserInfo","window","colorDepth","screen","screenHeight","height","screenWidth","width","userAgent","navigator","acceptHeader","javaEnabled","language","timeZoneOffset","Date","getTimezoneOffset"],"mappings":"AAae,SAASA,IACpB,GAAsB,oBAAXC,OACP,OAEJ,MAAMC,EAAaD,OAAOE,OAAOD,WAC3BE,EAAeH,OAAOE,OAAOE,OAC7BC,EAAcL,OAAOE,OAAOI,MAC5BC,EAAYP,OAAOQ,UAAUD,UAKnC,MAAO,CACHE,aAAc,MACdC,aAAa,EACbT,aACAU,SAPaX,OAAOQ,UAAUG,UAAY,KAQ1CR,eACAE,cACAE,YACAK,gBAVmB,IAAIC,MAAOC,oBAYtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency-minor-units.js","sources":["../../../../src/utils/constants/currency-minor-units.ts"],"sourcesContent":["/** Work around solution until chromium bug is fixed https://bugs.chromium.org/p/chromium/issues/detail?id=1381996\n * We need to hardcode minimumFractionDigits for the following currencies in order to force them to have 2 decimal places and\n * not be rounded up to a major unit\n */\nexport const currencyMinorUnitsConfig = {\n RSD: { minimumFractionDigits: 2 },\n AFN: { minimumFractionDigits: 2 },\n ALL: { minimumFractionDigits: 2 },\n IRR: { minimumFractionDigits: 2 },\n LAK: { minimumFractionDigits: 2 },\n LBP: { minimumFractionDigits: 2 },\n MMK: { minimumFractionDigits: 2 },\n SOS: { minimumFractionDigits: 2 },\n SYP: { minimumFractionDigits: 2 },\n YER: { minimumFractionDigits: 2 },\n IQD: { minimumFractionDigits: 3 }\n};\n"],"names":["currencyMinorUnitsConfig","RSD","minimumFractionDigits","AFN","ALL","IRR","LAK","LBP","MMK","SOS","SYP","YER","IQD"],"mappings":"MAIaA,
|
|
1
|
+
{"version":3,"file":"currency-minor-units.js","sources":["../../../../src/utils/constants/currency-minor-units.ts"],"sourcesContent":["/** Work around solution until chromium bug is fixed https://bugs.chromium.org/p/chromium/issues/detail?id=1381996\n * We need to hardcode minimumFractionDigits for the following currencies in order to force them to have 2 decimal places and\n * not be rounded up to a major unit\n */\nexport const currencyMinorUnitsConfig: Record<string, { minimumFractionDigits: number }> = {\n RSD: { minimumFractionDigits: 2 },\n AFN: { minimumFractionDigits: 2 },\n ALL: { minimumFractionDigits: 2 },\n IRR: { minimumFractionDigits: 2 },\n LAK: { minimumFractionDigits: 2 },\n LBP: { minimumFractionDigits: 2 },\n MMK: { minimumFractionDigits: 2 },\n SOS: { minimumFractionDigits: 2 },\n SYP: { minimumFractionDigits: 2 },\n YER: { minimumFractionDigits: 2 },\n IQD: { minimumFractionDigits: 3 }\n};\n"],"names":["currencyMinorUnitsConfig","RSD","minimumFractionDigits","AFN","ALL","IRR","LAK","LBP","MMK","SOS","SYP","YER","IQD"],"mappings":"MAIaA,EAA8E,CACvFC,IAAK,CAAEC,sBAAuB,GAC9BC,IAAK,CAAED,sBAAuB,GAC9BE,IAAK,CAAEF,sBAAuB,GAC9BG,IAAK,CAAEH,sBAAuB,GAC9BI,IAAK,CAAEJ,sBAAuB,GAC9BK,IAAK,CAAEL,sBAAuB,GAC9BM,IAAK,CAAEN,sBAAuB,GAC9BO,IAAK,CAAEP,sBAAuB,GAC9BQ,IAAK,CAAER,sBAAuB,GAC9BS,IAAK,CAAET,sBAAuB,GAC9BU,IAAK,CAAEV,sBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSdkData.js","sources":["../../../src/utils/createSdkData.ts"],"sourcesContent":["import base64 from './base64';\n\nexport interface SdkDataObject {\n schemaVersion: number;\n createdAt: number;\n analytics: {\n checkoutAttemptId: string;\n };\n riskData: {\n clientData: string;\n };\n}\n\n/**\n * Creates the sdkData object with analytics and risk information\n * @param checkoutAttemptId - The checkout attempt ID from analytics\n * @param clientData - The client data from risk module\n * @returns Base64 encoded JSON string of the SDK data object\n */\nexport function createSdkData(checkoutAttemptId: string, clientData: string | null): string {\n const sdkDataObject: SdkDataObject = {\n schemaVersion: 1,\n createdAt: Date.now(),\n analytics: {\n checkoutAttemptId\n },\n ...(clientData && { riskData: { clientData } })
|
|
1
|
+
{"version":3,"file":"createSdkData.js","sources":["../../../src/utils/createSdkData.ts"],"sourcesContent":["import base64 from './base64';\n\nexport interface SdkDataObject {\n schemaVersion: number;\n createdAt: number;\n analytics: {\n checkoutAttemptId: string;\n };\n riskData: {\n clientData: string;\n };\n}\n\n/**\n * Creates the sdkData object with analytics and risk information\n * @param checkoutAttemptId - The checkout attempt ID from analytics\n * @param clientData - The client data from risk module\n * @returns Base64 encoded JSON string of the SDK data object\n */\nexport function createSdkData(checkoutAttemptId: string, clientData: string | null): string {\n const sdkDataObject: SdkDataObject = {\n schemaVersion: 1,\n createdAt: Date.now(),\n analytics: {\n checkoutAttemptId\n },\n ...(clientData && { riskData: { clientData } })\n };\n\n return base64.encode(JSON.stringify(sdkDataObject));\n}\n"],"names":["createSdkData","checkoutAttemptId","clientData","sdkDataObject","_object_spread","schemaVersion","createdAt","Date","now","analytics","riskData","base64","encode","JSON","stringify"],"mappings":"mJAmBO,SAASA,EAAcC,EAA2BC,GACrD,MAAMC,oUAA+BC,CAAA,CACjCC,cAAe,EACfC,UAAWC,KAAKC,MAChBC,UAAW,CACPR,sBAEAC,GAAc,CAAEQ,SAAU,CAAER,gBAGpC,OAAOS,EAAOC,OAAOC,KAAKC,UAAUX,GACxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConsentUrl.js","sources":["../../../src/utils/getConsentUrl.ts"],"sourcesContent":["type UrlMap = {\n [countryCode: string]: {\n [language: string]: string;\n };\n};\n\nfunction getConsentUrl(countryCode: string, locale: string, urlMap: UrlMap): string {\n const languageCode = locale?.toLowerCase().slice(0, 2);\n const consentLink = urlMap[countryCode?.toLowerCase()]?.[languageCode];\n if (!consentLink) {\n console.warn(`Cannot find a consent url for the provided countryCode: ${countryCode} and locale: ${locale}`);\n return;\n }\n return consentLink;\n}\n\nexport { getConsentUrl };\n"],"names":["getConsentUrl","countryCode","locale","urlMap","languageCode","toLowerCase","slice","consentLink","console","warn"],"mappings":"AAMA,SAASA,EAAcC,EAAqBC,EAAgBC,GAEpCA,IAAAA,EADpB,MAAMC,EAAeF,
|
|
1
|
+
{"version":3,"file":"getConsentUrl.js","sources":["../../../src/utils/getConsentUrl.ts"],"sourcesContent":["type UrlMap = {\n [countryCode: string]: {\n [language: string]: string;\n };\n};\n\nfunction getConsentUrl(countryCode: string, locale: string, urlMap: UrlMap): string {\n const languageCode = locale?.toLowerCase().slice(0, 2);\n const consentLink = urlMap[countryCode?.toLowerCase()]?.[languageCode];\n if (!consentLink) {\n console.warn(`Cannot find a consent url for the provided countryCode: ${countryCode} and locale: ${locale}`);\n return;\n }\n return consentLink;\n}\n\nexport { getConsentUrl };\n"],"names":["getConsentUrl","countryCode","locale","urlMap","languageCode","toLowerCase","slice","consentLink","console","warn"],"mappings":"AAMA,SAASA,EAAcC,EAAqBC,EAAgBC,GAEpCA,IAAAA,EADpB,MAAMC,EAAeF,eAAAA,EAAQG,cAAcC,MAAM,EAAG,GAC9CC,EAAgD,QAAlCJ,EAAAA,EAAOF,aAAAA,EAAAA,EAAaI,sBAApBF,IAAAA,OAAAA,EAAAA,EAAqCC,GACzD,GAAKG,EAIL,OAAOA,EAHHC,QAAQC,KAAK,2DAA2DR,iBAA2BC,IAI3G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getErrorMessage.js","sources":["../../../src/utils/getErrorMessage.ts"],"sourcesContent":["import { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../core/Errors/constants';\n\nexport const getErrorMessage = (i18n
|
|
1
|
+
{"version":3,"file":"getErrorMessage.js","sources":["../../../src/utils/getErrorMessage.ts"],"sourcesContent":["import { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../core/Errors/constants';\nimport Language from '../language';\n\nexport const getErrorMessage = (\n i18n: Language,\n error?: { errorMessage: string },\n label?: string,\n lowerCaseLabel: boolean = true\n): string | boolean => {\n if (error?.errorMessage) {\n const errorKey = error.errorMessage;\n const shouldBuildErrorMessage = [ERROR_FIELD_REQUIRED, ERROR_FIELD_INVALID].includes(errorKey);\n // Build the error msg: Enter the [label name] or Enter a valid [label name]\n const options = { values: { label: lowerCaseLabel ? label?.toLowerCase() : label } };\n return shouldBuildErrorMessage ? i18n.get(errorKey, options) : i18n.get(errorKey);\n }\n\n return !!error;\n};\n"],"names":["getErrorMessage","i18n","error","label","lowerCaseLabel","errorMessage","errorKey","shouldBuildErrorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","includes","options","values","toLowerCase","get"],"mappings":"kGAGaA,EAAkB,CAC3BC,EACAC,EACAC,EACAC,GAA0B,KAE1B,GAAIF,aAAAA,EAAAA,EAAOG,aAAc,CACrB,MAAMC,EAAWJ,EAAMG,aACjBE,EAA0B,CAACC,EAAsBC,GAAqBC,SAASJ,GAE/EK,EAAU,CAAEC,OAAQ,CAAET,MAAOC,EAAiBD,aAAAA,EAAAA,EAAOU,cAAgBV,IAC3E,OAAOI,EAA0BN,EAAKa,IAAIR,EAAUK,GAAWV,EAAKa,IAAIR,EAC5E,CAEA,QAASJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{hasOwnProperty as r}from"./hasOwnProperty.js";function t(t,e){return e.split(".").reduce((t,e)=>{if(null==t)return;if("object"!=typeof t)return;const n=t;return r(n,e)?n[e]:void 0},t)}export{t as default};
|
|
2
2
|
//# sourceMappingURL=getProp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProp.js","sources":["../../../src/utils/getProp.ts"],"sourcesContent":["/**\n * returns the indicated property of an object, if it exists.\n *\n * @param object - The object to query\n * @param path - The property name or path to the property\n * @returns The value at `obj[p]`.\n\n * @example\n * ```\n * getProp({x: 100}, 'x'); //=> 100\n * getProp({}, 'x'); //=> undefined\n * ```\n */\
|
|
1
|
+
{"version":3,"file":"getProp.js","sources":["../../../src/utils/getProp.ts"],"sourcesContent":["import { hasOwnProperty } from './hasOwnProperty';\n\n/**\n * returns the indicated property of an object, if it exists.\n *\n * @param object - The object to query\n * @param path - The property name or path to the property\n * @returns The value at `obj[p]`.\n\n * @example\n * ```\n * getProp({x: 100}, 'x'); //=> 100\n * getProp({}, 'x'); //=> undefined\n * ```\n */\nfunction getProp(object: unknown, path: string): unknown {\n const splitPath = path.split('.');\n\n return splitPath.reduce<unknown>((xs, key) => {\n if (xs === null || xs === undefined) return undefined;\n if (typeof xs !== 'object') return undefined;\n const record = xs as Record<string, unknown>;\n return hasOwnProperty(record, key) ? record[key] : undefined;\n }, object);\n}\nexport default getProp;\n"],"names":["getProp","object","path","split","reduce","xs","key","record","hasOwnProperty","undefined"],"mappings":"qDAeA,SAASA,EAAQC,EAAiBC,GAG9B,OAFkBA,EAAKC,MAAM,KAEZC,OAAgB,CAACC,EAAIC,KAClC,GAAID,QAAiC,OACrC,GAAkB,iBAAPA,EAAiB,OAC5B,MAAME,EAASF,EACf,OAAOG,EAAeD,EAAQD,GAAOC,EAAOD,QAAOG,GACpDR,EACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasOwnProperty.js","sources":["../../../src/utils/hasOwnProperty.ts"],"sourcesContent":["export function hasOwnProperty(obj = {}, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n"],"names":["hasOwnProperty","obj","prop","Object","prototype","call"],"mappings":"AAAO,SAASA,EAAeC,EAAM,CAAA,EAAIC,GACrC,OAAOC,OAAOC,UAAUJ,eAAeK,KAAKJ,EAAKC,EACrD"}
|
|
1
|
+
{"version":3,"file":"hasOwnProperty.js","sources":["../../../src/utils/hasOwnProperty.ts"],"sourcesContent":["export function hasOwnProperty(obj = {}, prop: string) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n"],"names":["hasOwnProperty","obj","prop","Object","prototype","call"],"mappings":"AAAO,SAASA,EAAeC,EAAM,CAAA,EAAIC,GACrC,OAAOC,OAAOC,UAAUJ,eAAeK,KAAKJ,EAAKC,EACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValidURL.js","sources":["../../../src/utils/isValidURL.ts"],"sourcesContent":["export const isValidHttpUrl = (string, allowHttp = false) => {\n let url;\n try {\n url = new URL(
|
|
1
|
+
{"version":3,"file":"isValidURL.js","sources":["../../../src/utils/isValidURL.ts"],"sourcesContent":["export const isValidHttpUrl = (httpUrl: string, allowHttp = false) => {\n let url: URL;\n try {\n url = new URL(httpUrl);\n } catch (_) {\n return false;\n }\n return allowHttp ? url.protocol === 'http:' || url.protocol === 'https:' : url.protocol === 'https:';\n};\n"],"names":["isValidHttpUrl","httpUrl","allowHttp","url","URL","_","protocol"],"mappings":"AAAO,MAAMA,EAAiB,CAACC,EAAiBC,GAAY,KACxD,IAAIC,EACJ,IACIA,EAAM,IAAIC,IAAIH,EAClB,CAAE,MAAOI,GACL,OAAO,CACX,CACA,OAAOH,GAA6B,UAAjBC,EAAIG,UAAqE,WAAjBH,EAAIG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listenerUtils.js","sources":["../../../src/utils/listenerUtils.ts"],"sourcesContent":["export const on = (node: Window | HTMLElement | Document
|
|
1
|
+
{"version":3,"file":"listenerUtils.js","sources":["../../../src/utils/listenerUtils.ts"],"sourcesContent":["export const on = (\n node: Window | HTMLElement | Document,\n event: string,\n callback: EventListenerOrEventListenerObject,\n useCapture: boolean = false\n) => {\n if (node && typeof node.addEventListener === 'function') {\n node.addEventListener(event, callback, useCapture);\n return true;\n }\n return false;\n};\n\nexport const off = (\n node: Window | HTMLElement | Document,\n event: string,\n callback: EventListenerOrEventListenerObject,\n useCapture: boolean = false\n) => {\n if (node && typeof node.removeEventListener === 'function') {\n node.removeEventListener(event, callback, useCapture);\n return true;\n }\n return false;\n};\n"],"names":["on","node","event","callback","useCapture","addEventListener","off","removeEventListener"],"mappings":"MAAaA,EAAK,CACdC,EACAC,EACAC,EACAC,GAAsB,OAElBH,GAAyC,mBAA1BA,EAAKI,oBACpBJ,EAAKI,iBAAiBH,EAAOC,EAAUC,IAChC,GAKFE,EAAM,CACfL,EACAC,EACAC,EACAC,GAAsB,OAElBH,GAA4C,mBAA7BA,EAAKM,uBACpBN,EAAKM,oBAAoBL,EAAOC,EAAUC,IACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promiseTimeout.js","sources":["../../../src/utils/promiseTimeout.ts"],"sourcesContent":["/**\n * Tests if a passed promise settles before a certain amount of time has elapsed\n *\n * @param ms - number of milliseconds the passed promise has to settle\n * @param promise - the passed promise\n * @param timeOutObject - the object that the promiseTimeout will reject with if the passed promise doesn't settle in time\n */\nconst promiseTimeout = (ms: number, promise: Promise<any>, timeOutObject: object) => {\n let timer;\n\n const promiseTimer: Promise<any> = new Promise((resolve, reject): void => {\n // Create a timeout to reject promise if not resolved\n timer = setTimeout((): void => {\n reject(timeOutObject);\n }, ms);\n\n promise\n .then((res): void => {\n clearTimeout(timer);\n resolve(res);\n })\n .catch((err): void => {\n clearTimeout(timer);\n reject(err);\n });\n });\n\n const cancelTimer = (): void => {\n clearTimeout(timer);\n };\n\n return {\n promise: promiseTimer,\n cancel: cancelTimer\n };\n};\n\nexport default promiseTimeout;\n"],"names":["promiseTimeout","ms","promise","timeOutObject","timer","Promise","resolve","reject","setTimeout","then","res","clearTimeout","catch","err","cancel"],"mappings":"AAOA,MAAMA,EAAiB,CAACC,EAAYC,EAAuBC,KACvD,IAAIC,EAuBJ,MAAO,CACHF,QAtB+B,IAAIG,QAAQ,CAACC,EAASC,KAErDH,EAAQI,WAAW,KACfD,EAAOJ,IACRF,GAEHC,EACKO,KAAMC,IACHC,aAAaP,GACbE,EAAQI,KAEXE,MAAOC,IACJF,aAAaP,GACbG,EAAOM,OAUfC,OANgB,KAChBH,aAAaP"}
|
|
1
|
+
{"version":3,"file":"promiseTimeout.js","sources":["../../../src/utils/promiseTimeout.ts"],"sourcesContent":["/**\n * Tests if a passed promise settles before a certain amount of time has elapsed\n *\n * @param ms - number of milliseconds the passed promise has to settle\n * @param promise - the passed promise\n * @param timeOutObject - the object that the promiseTimeout will reject with if the passed promise doesn't settle in time\n */\nconst promiseTimeout = (ms: number, promise: Promise<any>, timeOutObject: object) => {\n let timer: NodeJS.Timeout | null;\n\n const promiseTimer: Promise<any> = new Promise((resolve, reject): void => {\n // Create a timeout to reject promise if not resolved\n timer = setTimeout((): void => {\n reject(timeOutObject);\n }, ms);\n\n promise\n .then((res): void => {\n clearTimeout(timer);\n resolve(res);\n })\n .catch((err): void => {\n clearTimeout(timer);\n reject(err);\n });\n });\n\n const cancelTimer = (): void => {\n clearTimeout(timer);\n };\n\n return {\n promise: promiseTimer,\n cancel: cancelTimer\n };\n};\n\nexport default promiseTimeout;\n"],"names":["promiseTimeout","ms","promise","timeOutObject","timer","Promise","resolve","reject","setTimeout","then","res","clearTimeout","catch","err","cancel"],"mappings":"AAOA,MAAMA,EAAiB,CAACC,EAAYC,EAAuBC,KACvD,IAAIC,EAuBJ,MAAO,CACHF,QAtB+B,IAAIG,QAAQ,CAACC,EAASC,KAErDH,EAAQI,WAAW,KACfD,EAAOJ,IACRF,GAEHC,EACKO,KAAMC,IACHC,aAAaP,GACbE,EAAQI,KAEXE,MAAOC,IACJF,aAAaP,GACbG,EAAOM,OAUfC,OANgB,KAChBH,aAAaP"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{selectOne as e}from"../components/internal/SecuredFields/lib/utilities/dom.js";const
|
|
1
|
+
import{selectOne as e}from"../components/internal/SecuredFields/lib/utilities/dom.js";import{windowScrollTo as t}from"./windowScrollTo.js";import o from"../components/internal/SecuredFields/lib/CSF/utils/userAgent.js";const n=(n,i,c="")=>{const l=n instanceof Element?n:e(document,n);let r;r=e(l,"country"===i||"stateOrProvince"===i||"issuer-list"===i||"selectedAccountType"===i?`${c}.adyen-checkout__field--${i} .adyen-checkout__filter-input`:`${c} [name="${i}"]`),o.__IS_IOS&&t(r),null==r||r.focus({preventScroll:o.__IS_IOS})};export{n as setFocusOnField};
|
|
2
2
|
//# sourceMappingURL=setFocus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setFocus.js","sources":["../../../src/utils/setFocus.ts"],"sourcesContent":["import { selectOne } from '../components/internal/SecuredFields/lib/utilities/dom';\n\n/**\n * Generic function to set focus on named element\n * @param holder - DOM element or CSS selector string to search within\n * @param fieldToFocus - Name of the field to focus on\n * @param focusContextSelector - some fields can occur twice in a form but in a different context e.g. as part of a billingAddress or as part of a deliverySddress.\n * This param provides the context so we can select them correctly\n */\nexport const setFocusOnField = (holder: Element | string, fieldToFocus: string, focusContextSelector = '') => {\n // If holder is already a DOM element, use it directly; otherwise query for it\n const pdHolder = holder instanceof Element ? holder : selectOne(document, holder);\n\n // Identify if we're dealing with a dropdown\n if (\n fieldToFocus === 'country' ||\n fieldToFocus === 'stateOrProvince' ||\n fieldToFocus === 'issuer-list' ||\n fieldToFocus === 'selectedAccountType'\n ) {\n // Set focus on dropdown\n
|
|
1
|
+
{"version":3,"file":"setFocus.js","sources":["../../../src/utils/setFocus.ts"],"sourcesContent":["import { selectOne } from '../components/internal/SecuredFields/lib/utilities/dom';\nimport { windowScrollTo } from './windowScrollTo';\nimport ua from '../components/internal/SecuredFields/lib/CSF/utils/userAgent';\n\n/**\n * Generic function to set focus on named element\n * @param holder - DOM element or CSS selector string to search within\n * @param fieldToFocus - Name of the field to focus on\n * @param focusContextSelector - some fields can occur twice in a form but in a different context e.g. as part of a billingAddress or as part of a deliverySddress.\n * This param provides the context so we can select them correctly\n */\nexport const setFocusOnField = (holder: Element | string, fieldToFocus: string, focusContextSelector = '') => {\n // If holder is already a DOM element, use it directly; otherwise query for it\n const pdHolder = holder instanceof Element ? holder : selectOne(document, holder);\n\n let field: HTMLElement;\n\n // Identify if we're dealing with a dropdown\n if (\n fieldToFocus === 'country' ||\n fieldToFocus === 'stateOrProvince' ||\n fieldToFocus === 'issuer-list' ||\n fieldToFocus === 'selectedAccountType'\n ) {\n // Set focus on dropdown\n field = selectOne(pdHolder, `${focusContextSelector}.adyen-checkout__field--${fieldToFocus} .adyen-checkout__filter-input`);\n } else {\n // Set focus on input\n field = selectOne(pdHolder, `${focusContextSelector} [name=\"${fieldToFocus}\"]`);\n }\n\n // Fix for iOS scrolling issues: can't programmatically set focus on an element on iOS, so we scroll to it instead, so at least it is in view\n if (ua.__IS_IOS) {\n windowScrollTo(field);\n }\n\n field?.focus({ preventScroll: ua.__IS_IOS }); // Don't even attempt to allow the focus call to trigger a scroll on iOS\n};\n"],"names":["setFocusOnField","holder","fieldToFocus","focusContextSelector","pdHolder","Element","selectOne","document","field","ua","__IS_IOS","windowScrollTo","focus","preventScroll"],"mappings":"0NAWO,MAAMA,EAAkB,CAACC,EAA0BC,EAAsBC,EAAuB,MAEnG,MAAMC,EAAWH,aAAkBI,QAAUJ,EAASK,EAAUC,SAAUN,GAE1E,IAAIO,EAUAA,EAAQF,EAAUF,EAND,YAAjBF,GACiB,oBAAjBA,GACiB,gBAAjBA,GACiB,wBAAjBA,EAG4B,GAAGC,4BAA+CD,kCAGlD,GAAGC,YAA+BD,OAI9DO,EAAGC,UACHC,EAAeH,GAGnBA,SAAAA,EAAOI,MAAM,CAAEC,cAAeJ,EAAGC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textUtils.js","sources":["../../../src/utils/textUtils.ts"],"sourcesContent":["export const camelCaseToSnakeCase = camelCaseString => {\n return camelCaseString.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();\n};\n\nexport const capitalizeFirstLetter = (str: string): string => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n};\n"],"names":["camelCaseToSnakeCase","camelCaseString","replace","toLowerCase"],"mappings":"AAAO,MAAMA,
|
|
1
|
+
{"version":3,"file":"textUtils.js","sources":["../../../src/utils/textUtils.ts"],"sourcesContent":["export const camelCaseToSnakeCase = (camelCaseString: string): string => {\n return camelCaseString.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();\n};\n\nexport const capitalizeFirstLetter = (str: string): string => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n};\n"],"names":["camelCaseToSnakeCase","camelCaseString","replace","toLowerCase"],"mappings":"AAAO,MAAMA,EAAwBC,GAC1BA,EAAgBC,QAAQ,kBAAmB,SAASC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoFocus.js","sources":["../../../src/utils/useAutoFocus.ts"],"sourcesContent":["import { useRef, useEffect } from 'preact/hooks';\n\nconst useAutoFocus = () => {\n const ref = useRef(null);\n\n useEffect(() => {\n ref.current?.focus();\n }, []);\n\n return ref;\n};\n\nexport default useAutoFocus;\n"],"names":["useAutoFocus","ref","useRef","useEffect","current","focus"],"mappings":"+EAEA,MAAMA,EAAe,KACjB,MAAMC,EAAMC,EAAO,MAMnB,OAJAC,EAAU,KACNF,IAAAA,EAAW,QAAXA,EAAAA,EAAIG,
|
|
1
|
+
{"version":3,"file":"useAutoFocus.js","sources":["../../../src/utils/useAutoFocus.ts"],"sourcesContent":["import { useRef, useEffect } from 'preact/hooks';\n\nconst useAutoFocus = () => {\n const ref = useRef(null);\n\n useEffect(() => {\n ref.current?.focus();\n }, []);\n\n return ref;\n};\n\nexport default useAutoFocus;\n"],"names":["useAutoFocus","ref","useRef","useEffect","current","focus"],"mappings":"+EAEA,MAAMA,EAAe,KACjB,MAAMC,EAAMC,EAAO,MAMnB,OAJAC,EAAU,KACNF,IAAAA,EAAW,QAAXA,EAAAA,EAAIG,mBAAJH,GAAAA,EAAaI,SACd,IAEIJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.js","sources":["../../../../src/utils/useForm/reducer.ts"],"sourcesContent":["const omitKeys = (obj, omit) =>\n Object.keys(obj)\n .filter(k => !omit.includes(k))\n .reduce((a, c) => {\n a[c] = obj[c];\n return a;\n }, {});\n\nconst addKeys = (obj, add, initialValue, defaultData, pendingData) =>\n add.reduce((a, c) => ({ ...a, [c]: a[c] ?? pendingData?.[c] ?? defaultData?.[c] ?? initialValue }), obj);\n\n/**\n * Processes default data and sets as default in state\n */\nexport function init({ schema, defaultData, processField, fieldProblems }) {\n const getProcessedState = fieldKey => {\n if (typeof defaultData[fieldKey] === 'undefined')\n return { valid: false, errors: null, data: null, fieldProblems: fieldProblems?.[fieldKey] ?? null };\n\n const [formattedValue, validationResult] = processField(\n { key: fieldKey, value: defaultData[fieldKey], mode: 'blur' },\n { state: { data: defaultData } }\n );\n\n return {\n valid: (validationResult.isValid && !fieldProblems?.[fieldKey]) || false,\n errors: validationResult.hasError() ? validationResult.getError() : null,\n data: formattedValue,\n fieldProblems: fieldProblems?.[fieldKey] ?? null\n };\n };\n\n const formData = schema.reduce(\n (acc: any, fieldKey) => {\n const { valid, errors, data, fieldProblems } = getProcessedState(fieldKey);\n\n return {\n valid: { ...acc.valid, [fieldKey]: valid },\n errors: { ...acc.errors, [fieldKey]: errors },\n data: { ...acc.data, [fieldKey]: data },\n fieldProblems: { ...acc.fieldProblems, [fieldKey]: fieldProblems }\n };\n },\n { data: {}, valid: {}, errors: {}, fieldProblems: {} }\n );\n\n return {\n schema,\n data: formData.data,\n valid: formData.valid,\n errors: formData.errors,\n fieldProblems: formData.fieldProblems\n };\n}\n\nexport function getReducer(processField) {\n return function reducer(state, { type, key, value, mode, schema, defaultData, formValue, selectedSchema, fieldProblems, data }) {\n const validationSchema: string[] = selectedSchema || state.schema;\n\n switch (type) {\n case 'setData': {\n return { ...state, data: { ...state['data'], [key]: value } };\n }\n case 'mergeData': {\n return { ...state, data: { ...state['data'], ...data } };\n }\n case 'setValid': {\n return { ...state, valid: { ...state['valid'], [key]: value } };\n }\n case 'setErrors': {\n return { ...state, errors: { ...state['errors'], [key]: value } };\n }\n case 'setFieldProblems': {\n return (\n state?.schema?.reduce(\n (acc, key) => ({\n ...acc,\n fieldProblems: { ...state['fieldProblems'], [key]: fieldProblems?.[key] ?? null },\n valid: { ...state['valid'], [key]: state['valid']?.[key] && !fieldProblems[key] }\n }),\n state\n ) ?? state\n );\n }\n case 'updateField': {\n const [formattedValue, validation] = processField({ key, value, mode }, { state });\n const oldValue = state.data[key];\n const fieldProblems = { ...state.fieldProblems };\n if (oldValue !== formattedValue) {\n fieldProblems[key] = null;\n }\n return {\n ...state,\n data: { ...state['data'], [key]: formattedValue },\n errors: { ...state['errors'], [key]: validation.hasError() ? validation.getError() : null },\n valid: { ...state['valid'], [key]: (validation.isValid && !fieldProblems[key]) || false },\n fieldProblems\n };\n }\n case 'mergeForm': {\n // To provide a uniform result from forms even if there are multiple levels of nested forms are present\n const mergedState = {\n ...state,\n data: { ...state['data'], ...formValue['data'] },\n errors: { ...state['errors'], ...formValue['errors'] },\n valid: { ...state['valid'], ...formValue['valid'] },\n fieldProblems: { ...state['fieldProblems'], ...formValue['fieldProblems'] }\n };\n if (mergedState['valid']) {\n mergedState.isValid = Object.values(mergedState.valid).every(isValid => isValid);\n }\n return mergedState;\n }\n case 'setSchema': {\n const defaultState = init({ schema, defaultData, processField, fieldProblems });\n const removedSchemaFields = state.schema.filter(x => !schema.includes(x));\n const newSchemaFields = schema.filter(x => !state.schema.includes(x));\n\n // if we remove a key from the schema we also lost the latest value of the field\n // to prevent this we have to store the value in a local state so we can recover it when the key is re-added to the schema\n const local = {\n data: omitKeys(state.data, newSchemaFields),\n errors: omitKeys(state.errors, newSchemaFields),\n valid: omitKeys(state.valid, newSchemaFields)\n };\n\n // reindex data and validation according to the new schema\n const data = addKeys(omitKeys(state.data, removedSchemaFields), newSchemaFields, null, defaultState.data, state.local?.data);\n const valid = addKeys(omitKeys(state.valid, removedSchemaFields), newSchemaFields, false, defaultState.valid, state.local?.valid);\n const errors = addKeys(omitKeys(state.errors, removedSchemaFields), newSchemaFields, null, defaultState.errors, state.local?.errors);\n\n return { ...state, schema, data, valid, errors, local };\n }\n case 'validateForm': {\n const formValidation = validationSchema.reduce(\n (acc, cur) => {\n const [, validation] = processField({ key: cur, value: state.data[cur], mode: 'blur' }, { state });\n return {\n valid: { ...acc['valid'], [cur]: (validation.isValid && !state.fieldProblems[cur]) || false },\n errors: { ...acc['errors'], [cur]: validation.hasError(true) ? validation.getError(true) : null }\n };\n },\n { valid: state.valid, errors: state.errors }\n );\n\n return { ...state, valid: formValidation.valid, errors: formValidation.errors };\n }\n default:\n throw new Error('Undefined useForm action');\n }\n };\n}\n"],"names":["omitKeys","obj","omit","Object","keys","filter","k","includes","reduce","a","c","addKeys","add","initialValue","defaultData","pendingData","_object_spread_props","_object_spread","init","schema","processField","fieldProblems","getProcessedState","fieldKey","valid","errors","data","_ref","formattedValue","validationResult","key","value","mode","state","isValid","hasError","getError","_ref1","formData","acc","getReducer","type","formValue","selectedSchema","validationSchema","validation","oldValue","mergedState","values","every","defaultState","removedSchemaFields","x","newSchemaFields","local","formValidation","cur","Error"],"mappings":"yyBAAA,MAAMA,EAAW,CAACC,EAAKC,IACnBC,OAAOC,KAAKH,GACPI,OAAOC,IAAMJ,EAAKK,SAASD,IAC3BE,OAAO,CAACC,EAAGC,KACRD,EAAEC,GAAKT,EAAIS,GACJD,GACR,CAAA,GAELE,EAAU,CAACV,EAAKW,EAAKC,EAAcC,EAAaC,IAClDH,EAAIJ,OAAO,CAACC,EAAGC,KAAoBD,IAAAA,EAAAA,EAAAA,SAAbO,EAAAC,EAAA,CAAA,EAAKR,GAAAA,CAAGC,CAACA,GAAgD,QAA5CD,EAAwB,QAAxBA,EAAI,QAAJA,EAAAA,EAAEC,UAAFD,IAAAA,EAAAA,EAAQM,aAAAA,EAAAA,EAAcL,UAAtBD,IAAAA,EAAAA,EAA4BK,aAAAA,EAAAA,EAAcJ,UAA1CD,IAAAA,EAAAA,EAAgDI,KAAiBZ,GAKjG,SAASiB,GAAKC,OAAEA,EAAML,YAAEA,EAAWM,aAAEA,EAAYC,cAAEA,IACtD,MAAMC,EAAoBC,YACtB,QAAqC,IAA1BT,EAAYS,GACnB,MAAO,CAAEC,OAAO,EAAOC,OAAQ,KAAMC,KAAM,KAAML,cAAwC,UAAzBA,aAAAA,EAAAA,EAAgBE,UAAS,IAAAI,EAAAA,EAAI,MAEjG,MAAOC,EAAgBC,GAAoBT,EACvC,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AAaT,OACrHC,EAASd,EAAQX,EAASiC,EAAMR,OAAQ0B,GAAsBE,EAAiB,KAAMH,EAAazB,OAAmB,QAAXQ,EAAAA,EAAMqB,aAANrB,IAAAA,OAAAA,EAAAA,EAAaR,QAE7H,OAAOT,EAAAC,EAAA,CAAA,EAAKgB,GAAAA,CAAOd,SAAQO,OAAMF,QAAOC,SAAQ6B,SACpD,CACA,IAAK,eAAgB,CACjB,MAAMC,EAAiBX,EAAiBpC,OACpC,CAAC+B,EAAKiB,KACF,MAAM,CAAGX,GAAczB,EAAa,CAAEU,IAAK0B,EAAKzB,MAAOE,EAAMP,KAAK8B,GAAMxB,KAAM,QAAU,CAAEC,UAC1F,MAAO,CACHT,MAAOR,EAAAC,EAAA,CAAA,EAAKsB,EAAI,OAAQ,CAAEiB,CAACA,GAAOX,EAAWX,UAAYD,EAAMZ,cAAcmC,KAAS,IACtF/B,OAAQT,EAAAC,EAAA,CAAA,EAAKsB,EAAI,QAAS,CAAEiB,CAACA,GAAMX,EAAWV,UAAS,GAAQU,EAAWT,UAAS,GAAQ,SAGnG,CAAEZ,MAAOS,EAAMT,MAAOC,OAAQQ,EAAMR,SAGxC,OAAOT,EAAAC,EAAA,CAAA,EAAKgB,GAAAA,CAAOT,MAAO+B,EAAe/B,MAAOC,OAAQ8B,EAAe9B,QAC3E,CACA,QACI,MAAM,IAAIgC,MAAM,4BAE5B,CACJ"}
|
|
1
|
+
{"version":3,"file":"reducer.js","sources":["../../../../src/utils/useForm/reducer.ts"],"sourcesContent":["const omitKeys = (obj, omit) =>\n Object.keys(obj)\n .filter(k => !omit.includes(k))\n .reduce((a, c) => {\n a[c] = obj[c];\n return a;\n }, {});\n\nconst addKeys = (obj, add, initialValue, defaultData, pendingData) =>\n add.reduce((a, c) => ({ ...a, [c]: a[c] ?? pendingData?.[c] ?? defaultData?.[c] ?? initialValue }), obj);\n\n/**\n * Processes default data and sets as default in state\n */\nexport function init({ schema, defaultData, processField, fieldProblems }) {\n const getProcessedState = fieldKey => {\n if (typeof defaultData[fieldKey] === 'undefined')\n return { valid: false, errors: null, data: null, fieldProblems: fieldProblems?.[fieldKey] ?? null };\n\n const [formattedValue, validationResult] = processField(\n { key: fieldKey, value: defaultData[fieldKey], mode: 'blur' },\n { state: { data: defaultData } }\n );\n\n return {\n valid: (validationResult.isValid && !fieldProblems?.[fieldKey]) || false,\n errors: validationResult.hasError() ? validationResult.getError() : null,\n data: formattedValue,\n fieldProblems: fieldProblems?.[fieldKey] ?? null\n };\n };\n\n const formData = schema.reduce(\n (acc: any, fieldKey) => {\n const { valid, errors, data, fieldProblems } = getProcessedState(fieldKey);\n\n return {\n valid: { ...acc.valid, [fieldKey]: valid },\n errors: { ...acc.errors, [fieldKey]: errors },\n data: { ...acc.data, [fieldKey]: data },\n fieldProblems: { ...acc.fieldProblems, [fieldKey]: fieldProblems }\n };\n },\n { data: {}, valid: {}, errors: {}, fieldProblems: {} }\n );\n\n return {\n schema,\n data: formData.data,\n valid: formData.valid,\n errors: formData.errors,\n fieldProblems: formData.fieldProblems\n };\n}\n\nexport function getReducer(processField) {\n return function reducer(state, { type, key, value, mode, schema, defaultData, formValue, selectedSchema, fieldProblems, data }) {\n const validationSchema: string[] = selectedSchema || state.schema;\n\n switch (type) {\n case 'setData': {\n return { ...state, data: { ...state['data'], [key]: value } };\n }\n case 'mergeData': {\n return { ...state, data: { ...state['data'], ...data } };\n }\n case 'setValid': {\n return { ...state, valid: { ...state['valid'], [key]: value } };\n }\n case 'setErrors': {\n return { ...state, errors: { ...state['errors'], [key]: value } };\n }\n case 'setFieldProblems': {\n return (\n state?.schema?.reduce(\n (acc, key) => ({\n ...acc,\n fieldProblems: { ...state['fieldProblems'], [key]: fieldProblems?.[key] ?? null },\n valid: { ...state['valid'], [key]: state['valid']?.[key] && !fieldProblems[key] }\n }),\n state\n ) ?? state\n );\n }\n case 'updateField': {\n const [formattedValue, validation] = processField({ key, value, mode }, { state });\n const oldValue = state.data[key];\n const fieldProblems = { ...state.fieldProblems };\n if (oldValue !== formattedValue) {\n fieldProblems[key] = null;\n }\n return {\n ...state,\n data: { ...state['data'], [key]: formattedValue },\n errors: { ...state['errors'], [key]: validation.hasError() ? validation.getError() : null },\n valid: { ...state['valid'], [key]: (validation.isValid && !fieldProblems[key]) || false },\n fieldProblems\n };\n }\n case 'mergeForm': {\n // To provide a uniform result from forms even if there are multiple levels of nested forms are present\n const mergedState = {\n ...state,\n data: { ...state['data'], ...formValue['data'] },\n errors: { ...state['errors'], ...formValue['errors'] },\n valid: { ...state['valid'], ...formValue['valid'] },\n fieldProblems: { ...state['fieldProblems'], ...formValue['fieldProblems'] }\n };\n if (mergedState['valid']) {\n mergedState.isValid = Object.values(mergedState.valid).every(isValid => isValid);\n }\n return mergedState;\n }\n case 'setSchema': {\n const defaultState = init({ schema, defaultData, processField, fieldProblems });\n const removedSchemaFields = state.schema.filter(x => !schema.includes(x));\n const newSchemaFields = schema.filter(x => !state.schema.includes(x));\n\n // if we remove a key from the schema we also lost the latest value of the field\n // to prevent this we have to store the value in a local state so we can recover it when the key is re-added to the schema\n const local = {\n data: omitKeys(state.data, newSchemaFields),\n errors: omitKeys(state.errors, newSchemaFields),\n valid: omitKeys(state.valid, newSchemaFields)\n };\n\n // reindex data and validation according to the new schema\n const data = addKeys(omitKeys(state.data, removedSchemaFields), newSchemaFields, null, defaultState.data, state.local?.data);\n const valid = addKeys(omitKeys(state.valid, removedSchemaFields), newSchemaFields, false, defaultState.valid, state.local?.valid);\n const errors = addKeys(omitKeys(state.errors, removedSchemaFields), newSchemaFields, null, defaultState.errors, state.local?.errors);\n\n return { ...state, schema, data, valid, errors, local };\n }\n case 'validateForm': {\n const formValidation = validationSchema.reduce(\n (acc, cur) => {\n const [, validation] = processField({ key: cur, value: state.data[cur], mode: 'blur' }, { state });\n return {\n valid: { ...acc['valid'], [cur]: (validation.isValid && !state.fieldProblems[cur]) || false },\n errors: { ...acc['errors'], [cur]: validation.hasError(true) ? validation.getError(true) : null }\n };\n },\n { valid: state.valid, errors: state.errors }\n );\n\n return { ...state, valid: formValidation.valid, errors: formValidation.errors };\n }\n default:\n throw new Error('Undefined useForm action');\n }\n };\n}\n"],"names":["omitKeys","obj","omit","Object","keys","filter","k","includes","reduce","a","c","addKeys","add","initialValue","defaultData","pendingData","_object_spread_props","_object_spread","init","schema","processField","fieldProblems","getProcessedState","fieldKey","valid","errors","data","_ref","formattedValue","validationResult","key","value","mode","state","isValid","hasError","getError","_ref1","formData","acc","getReducer","type","formValue","selectedSchema","validationSchema","validation","oldValue","mergedState","values","every","defaultState","removedSchemaFields","x","newSchemaFields","local","formValidation","cur","Error"],"mappings":"yyBAAA,MAAMA,EAAW,CAACC,EAAKC,IACnBC,OAAOC,KAAKH,GACPI,OAAOC,IAAMJ,EAAKK,SAASD,IAC3BE,OAAO,CAACC,EAAGC,KACRD,EAAEC,GAAKT,EAAIS,GACJD,GACR,CAAA,GAELE,EAAU,CAACV,EAAKW,EAAKC,EAAcC,EAAaC,IAClDH,EAAIJ,OAAO,CAACC,EAAGC,KAAoBD,IAAAA,EAAAA,EAAAA,SAAbO,EAAAC,EAAA,CAAA,EAAKR,GAAAA,CAAGC,CAACA,GAAgD,QAA5CD,EAAwB,QAAxBA,EAAI,QAAJA,EAAAA,EAAEC,UAAFD,IAAAA,EAAAA,EAAQM,aAAAA,EAAAA,EAAcL,UAAtBD,IAAAA,EAAAA,EAA4BK,aAAAA,EAAAA,EAAcJ,UAA1CD,IAAAA,EAAAA,EAAgDI,KAAiBZ,GAKjG,SAASiB,GAAKC,OAAEA,EAAML,YAAEA,EAAWM,aAAEA,EAAYC,cAAEA,IACtD,MAAMC,EAAoBC,YACtB,QAAqC,IAA1BT,EAAYS,GACnB,MAAO,CAAEC,OAAO,EAAOC,OAAQ,KAAMC,KAAM,KAAML,cAAwC,UAAzBA,aAAAA,EAAAA,EAAgBE,UAAS,IAAAI,EAAAA,EAAI,MAEjG,MAAOC,EAAgBC,GAAoBT,EACvC,CAAEU,IAAKP,EAAUQ,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