@adyen/adyen-web 6.4.0 → 6.5.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 +16 -5
- package/dist/cjs/adyen.css +7 -3
- 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 +27 -19
- package/dist/es/adyen.css +7 -3
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/ANCV/ANCV.js +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/Address/Address.js +1 -1
- package/dist/es/components/Address/Address.js.map +1 -1
- package/dist/es/components/Affirm/Affirm.js +1 -1
- package/dist/es/components/Affirm/Affirm.js.map +1 -1
- package/dist/es/components/AfterPay/AfterPay.js +1 -1
- package/dist/es/components/AfterPay/AfterPay.js.map +1 -1
- package/dist/es/components/AfterPay/AfterPayB2B.js +1 -1
- package/dist/es/components/AfterPay/AfterPayB2B.js.map +1 -1
- package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
- package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
- package/dist/es/components/ApplePay/ApplePay.js +1 -1
- package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es/components/ApplePay/ApplePayService.js +1 -1
- package/dist/es/components/ApplePay/ApplePayService.js.map +1 -1
- package/dist/es/components/ApplePay/components/ApplePayButton.js +1 -1
- package/dist/es/components/ApplePay/components/ApplePayButton.js.map +1 -1
- package/dist/es/components/Atome/Atome.js +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/BankTransfer/BankTransfer.js +1 -1
- package/dist/es/components/BankTransfer/BankTransfer.js.map +1 -1
- package/dist/es/components/BcmcMobile/BcmcMobile.js +1 -1
- package/dist/es/components/BcmcMobile/BcmcMobile.js.map +1 -1
- package/dist/es/components/BillDesk/BillDeskOnline.js +1 -1
- package/dist/es/components/BillDesk/BillDeskOnline.js.map +1 -1
- package/dist/es/components/BillDesk/BillDeskWallet.js +1 -1
- package/dist/es/components/BillDesk/BillDeskWallet.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/Boleto.js +1 -1
- package/dist/es/components/Boleto/Boleto.js.map +1 -1
- package/dist/es/components/Card/Bancontact.js +1 -1
- package/dist/es/components/Card/Bancontact.js.map +1 -1
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.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/ClickToPay/ClickToPay.js +1 -1
- package/dist/es/components/ClickToPay/ClickToPay.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/Doku/Doku.js +1 -1
- package/dist/es/components/Doku/Doku.js.map +1 -1
- package/dist/es/components/Donation/Donation.js +1 -1
- package/dist/es/components/Donation/Donation.js.map +1 -1
- package/dist/es/components/Dotpay/index.js +1 -1
- package/dist/es/components/Dotpay/index.js.map +1 -1
- package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
- package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
- package/dist/es/components/Dropin/Dropin.js +1 -1
- package/dist/es/components/Dropin/Dropin.js.map +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es/components/DuitNow/DuitNow.js +1 -1
- package/dist/es/components/DuitNow/DuitNow.js.map +1 -1
- package/dist/es/components/EPS/index.js +1 -1
- package/dist/es/components/EPS/index.js.map +1 -1
- package/dist/es/components/Econtext/Econtext.js +1 -1
- package/dist/es/components/Econtext/Econtext.js.map +1 -1
- package/dist/es/components/FacilyPay/FacilyPay10x.js +1 -1
- package/dist/es/components/FacilyPay/FacilyPay10x.js.map +1 -1
- package/dist/es/components/FacilyPay/FacilyPay12x.js +1 -1
- package/dist/es/components/FacilyPay/FacilyPay12x.js.map +1 -1
- package/dist/es/components/FacilyPay/FacilyPay3x.js +1 -1
- package/dist/es/components/FacilyPay/FacilyPay3x.js.map +1 -1
- package/dist/es/components/FacilyPay/FacilyPay4x.js +1 -1
- package/dist/es/components/FacilyPay/FacilyPay4x.js.map +1 -1
- package/dist/es/components/FacilyPay/FacilyPay6x.js +1 -1
- package/dist/es/components/FacilyPay/FacilyPay6x.js.map +1 -1
- package/dist/es/components/Giftcard/Giftcard.js +1 -1
- package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es/components/Giropay/Giropay.js +1 -1
- package/dist/es/components/Giropay/Giropay.js.map +1 -1
- package/dist/es/components/GooglePay/GooglePay.js +1 -1
- package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es/components/GooglePay/GooglePayService.js +1 -1
- package/dist/es/components/GooglePay/GooglePayService.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/MBWay/MBWay.js +1 -1
- package/dist/es/components/MBWay/MBWay.js.map +1 -1
- package/dist/es/components/MealVoucherFR/MealVoucherFR.js +1 -1
- package/dist/es/components/MealVoucherFR/MealVoucherFR.js.map +1 -1
- package/dist/es/components/MolPayEBanking/MolPayEBankingMY.js +1 -1
- package/dist/es/components/MolPayEBanking/MolPayEBankingMY.js.map +1 -1
- package/dist/es/components/MolPayEBanking/MolPayEBankingTH.js +1 -1
- package/dist/es/components/MolPayEBanking/MolPayEBankingTH.js.map +1 -1
- package/dist/es/components/MolPayEBanking/MolPayEBankingVN.js +1 -1
- package/dist/es/components/MolPayEBanking/MolPayEBankingVN.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/OnlineBankingCZ/index.js +1 -1
- package/dist/es/components/OnlineBankingCZ/index.js.map +1 -1
- package/dist/es/components/OnlineBankingFI/OnlineBankingFI.js +1 -1
- package/dist/es/components/OnlineBankingFI/OnlineBankingFI.js.map +1 -1
- package/dist/es/components/OnlineBankingIN/index.js +1 -1
- package/dist/es/components/OnlineBankingIN/index.js.map +1 -1
- package/dist/es/components/OnlineBankingPL/OnlineBankingPL.js +1 -1
- package/dist/es/components/OnlineBankingPL/OnlineBankingPL.js.map +1 -1
- package/dist/es/components/OnlineBankingSK/index.js +1 -1
- package/dist/es/components/OnlineBankingSK/index.js.map +1 -1
- package/dist/es/components/Oxxo/Oxxo.js +1 -1
- package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
- package/dist/es/components/PayByBank/PayByBank.js +1 -1
- package/dist/es/components/PayByBank/PayByBank.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/PayMe/PayMe.js +1 -1
- package/dist/es/components/PayMe/PayMe.js.map +1 -1
- package/dist/es/components/PayMe/components/PayMeInstructions.js +2 -0
- package/dist/es/components/PayMe/components/PayMeInstructions.js.map +1 -0
- package/dist/es/components/PayMe/components/PayMeIntroduction.js +2 -0
- package/dist/es/components/PayMe/components/PayMeIntroduction.js.map +1 -0
- package/dist/es/components/PayNow/PayNow.js +1 -1
- package/dist/es/components/PayNow/PayNow.js.map +1 -1
- package/dist/es/components/PayNow/components/PayNowInstructions.js +2 -0
- package/dist/es/components/PayNow/components/PayNowInstructions.js.map +1 -0
- package/dist/es/components/PayNow/components/PayNowIntroduction.js +2 -0
- package/dist/es/components/PayNow/components/PayNowIntroduction.js.map +1 -0
- package/dist/es/components/PayPal/Paypal.js +1 -1
- package/dist/es/components/PayPal/Paypal.js.map +1 -1
- package/dist/es/components/PayU/PayuCashcard.js +1 -1
- package/dist/es/components/PayU/PayuCashcard.js.map +1 -1
- package/dist/es/components/PayU/PayuNetBanking.js +1 -1
- package/dist/es/components/PayU/PayuNetBanking.js.map +1 -1
- package/dist/es/components/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es/components/Pix/Pix.js +1 -1
- package/dist/es/components/Pix/Pix.js.map +1 -1
- package/dist/es/components/PromptPay/PromptPay.js +1 -1
- package/dist/es/components/PromptPay/PromptPay.js.map +1 -1
- package/dist/es/components/RatePay/RatePay.js +1 -1
- package/dist/es/components/RatePay/RatePay.js.map +1 -1
- package/dist/es/components/RatePay/RatePayDirectDebit.js +1 -1
- package/dist/es/components/RatePay/RatePayDirectDebit.js.map +1 -1
- package/dist/es/components/Redirect/Redirect.js +1 -1
- package/dist/es/components/Redirect/Redirect.js.map +1 -1
- package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js +1 -1
- package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
- package/dist/es/components/Riverty/Riverty.js +1 -1
- package/dist/es/components/Riverty/Riverty.js.map +1 -1
- package/dist/es/components/Sepa/Sepa.js +1 -1
- package/dist/es/components/Sepa/Sepa.js.map +1 -1
- package/dist/es/components/Swish/Swish.js +1 -1
- package/dist/es/components/Swish/Swish.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/components/Challenge/DoChallenge3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.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/DoFingerprint3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.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 +1 -1
- package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
- package/dist/es/components/Trustly/Trustly.js +1 -1
- package/dist/es/components/Trustly/Trustly.js.map +1 -1
- package/dist/es/components/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/Vipps/Vipps.js +1 -1
- package/dist/es/components/Vipps/Vipps.js.map +1 -1
- package/dist/es/components/WalletIN/index.js +1 -1
- package/dist/es/components/WalletIN/index.js.map +1 -1
- package/dist/es/components/WeChat/WeChat.js +1 -1
- package/dist/es/components/WeChat/WeChat.js.map +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js +1 -1
- package/dist/es/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
- package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
- package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
- package/dist/es/components/internal/Address/Address.js +1 -1
- package/dist/es/components/internal/Address/Address.js.map +1 -1
- package/dist/es/components/internal/Address/Specifications.js +1 -1
- package/dist/es/components/internal/Address/Specifications.js.map +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/Button/Button.js +1 -1
- package/dist/es/components/internal/Button/Button.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js +1 -1
- package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/models/ShopperCard.js +1 -1
- package/dist/es/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js +1 -1
- package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/SrciError.js +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/SrciError.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
- package/dist/es/components/internal/Countdown/CountdownA11yReporter.js +1 -1
- package/dist/es/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
- package/dist/es/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js +1 -1
- package/dist/es/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js.map +1 -1
- package/dist/es/components/internal/IFrame/Iframe.js +1 -1
- package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
- package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
- package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/utilities/logger.js.map +1 -1
- package/dist/es/components/internal/Timeline/Timeline.js +2 -0
- package/dist/es/components/internal/Timeline/Timeline.js.map +1 -0
- package/dist/es/components/internal/Timeline/TimelineWrapper.js +2 -0
- package/dist/es/components/internal/Timeline/TimelineWrapper.js.map +1 -0
- 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/CheckoutSession/CheckoutSession.js +1 -1
- package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
- package/dist/es/core/Context/Resources.js +1 -1
- package/dist/es/core/Context/Resources.js.map +1 -1
- package/dist/es/core/Errors/AdyenCheckoutError.js +1 -1
- package/dist/es/core/Errors/AdyenCheckoutError.js.map +1 -1
- package/dist/es/core/Errors/SRPanel.js +1 -1
- package/dist/es/core/Errors/SRPanel.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
- package/dist/es/core/RiskModule/RiskModule.js +1 -1
- package/dist/es/core/RiskModule/RiskModule.js.map +1 -1
- package/dist/es/core/RiskModule/components/DeviceFingerprint/DeviceFingerprint.js +1 -1
- package/dist/es/core/RiskModule/components/DeviceFingerprint/DeviceFingerprint.js.map +1 -1
- package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js +1 -1
- package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
- package/dist/es/core/Services/analytics/collect-id.js +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/core.js.map +1 -1
- package/dist/es/core/core.registry.js +1 -1
- package/dist/es/core/core.registry.js.map +1 -1
- package/dist/es/index.d.ts +27 -19
- package/dist/es/language/Language.js +1 -1
- package/dist/es/language/Language.js.map +1 -1
- package/dist/es/utils/Script.js +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 +1 -1
- package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
- package/dist/es/utils/Validator/Validator.js +1 -1
- package/dist/es/utils/Validator/Validator.js.map +1 -1
- package/dist/es/utils/constants/currency-decimals.js +1 -1
- package/dist/es/utils/constants/currency-decimals.js.map +1 -1
- package/dist/es/utils/constants/currency-minor-units.js.map +1 -1
- package/dist/es/utils/useForm/reducer.js +1 -1
- package/dist/es/utils/useForm/reducer.js.map +1 -1
- package/dist/es/utils/useForm/useForm.js +1 -1
- package/dist/es/utils/useForm/useForm.js.map +1 -1
- package/dist/es/utils/useIsMobile.js +2 -0
- package/dist/es/utils/useIsMobile.js.map +1 -0
- package/dist/es-legacy/adyen.css +7 -3
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ApplePay/components/ApplePayButton.js.map +1 -1
- package/dist/es-legacy/components/BcmcMobile/BcmcMobile.js +1 -1
- package/dist/es-legacy/components/BcmcMobile/BcmcMobile.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
- package/dist/es-legacy/components/PayMe/PayMe.js +1 -1
- package/dist/es-legacy/components/PayMe/PayMe.js.map +1 -1
- package/dist/es-legacy/components/PayMe/components/PayMeInstructions.js +2 -0
- package/dist/es-legacy/components/PayMe/components/PayMeInstructions.js.map +1 -0
- package/dist/es-legacy/components/PayMe/components/PayMeIntroduction.js +2 -0
- package/dist/es-legacy/components/PayMe/components/PayMeIntroduction.js.map +1 -0
- package/dist/es-legacy/components/PayNow/PayNow.js +1 -1
- package/dist/es-legacy/components/PayNow/PayNow.js.map +1 -1
- package/dist/es-legacy/components/PayNow/components/PayNowInstructions.js +2 -0
- package/dist/es-legacy/components/PayNow/components/PayNowInstructions.js.map +1 -0
- package/dist/es-legacy/components/PayNow/components/PayNowIntroduction.js +2 -0
- package/dist/es-legacy/components/PayNow/components/PayNowIntroduction.js.map +1 -0
- package/dist/es-legacy/components/Swish/Swish.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/internal/Address/Address.js +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/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/SecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/logger.js.map +1 -1
- package/dist/es-legacy/components/internal/Timeline/Timeline.js +2 -0
- package/dist/es-legacy/components/internal/Timeline/Timeline.js.map +1 -0
- package/dist/es-legacy/components/internal/Timeline/TimelineWrapper.js +2 -0
- package/dist/es-legacy/components/internal/Timeline/TimelineWrapper.js.map +1 -0
- package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/utils/constants/currency-decimals.js +1 -1
- package/dist/es-legacy/utils/constants/currency-decimals.js.map +1 -1
- package/dist/es-legacy/utils/constants/currency-minor-units.js.map +1 -1
- package/dist/es-legacy/utils/useForm/reducer.js +1 -1
- package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
- package/dist/es-legacy/utils/useForm/useForm.js +1 -1
- package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
- package/dist/es-legacy/utils/useIsMobile.js +2 -0
- package/dist/es-legacy/utils/useIsMobile.js.map +1 -0
- package/package.json +7 -2
- package/styles/adyen.css +7 -3
- package/dist/es/components/PayMe/Instructions.js +0 -2
- package/dist/es/components/PayMe/Instructions.js.map +0 -1
- package/dist/es-legacy/components/PayMe/Instructions.js +0 -2
- package/dist/es-legacy/components/PayMe/Instructions.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplePayButton.js","sources":["../../../../../src/components/ApplePay/components/ApplePayButton.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport cx from 'classnames';\nimport './ApplePayButton.scss';\nimport Language from '../../../language/Language';\nimport { ApplePayButtonType } from '../types';\n\ninterface ApplePayButtonProps {\n i18n: Language;\n buttonColor: 'black' | 'white' | 'white-with-line';\n buttonType: ApplePayButtonType;\n onClick: (event) => void;\n}\n\nclass ApplePayButton extends Component<ApplePayButtonProps> {\n public static defaultProps = {\n onClick: () => {},\n buttonColor: 'black',\n buttonType: 'plain'\n };\n\n render({ buttonColor, buttonType }) {\n return (\n <button\n type=\"button\"\n aria-label={this.props.i18n.get('payButton')}\n lang={this.props.i18n.languageCode}\n className={cx(\n 'adyen-checkout__applepay__button',\n `adyen-checkout__applepay__button--${buttonColor}`,\n `adyen-checkout__applepay__button--${buttonType}`,\n 'apple-pay',\n 'apple-pay-button',\n `apple-pay-button-${buttonColor}`,\n `apple-pay-button--type-${buttonType}`\n )}\n onClick={this.props.onClick}\n />\n );\n
|
|
1
|
+
{"version":3,"file":"ApplePayButton.js","sources":["../../../../../src/components/ApplePay/components/ApplePayButton.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport cx from 'classnames';\nimport './ApplePayButton.scss';\nimport Language from '../../../language/Language';\nimport { ApplePayButtonType } from '../types';\n\ninterface ApplePayButtonProps {\n i18n: Language;\n buttonColor: 'black' | 'white' | 'white-with-line';\n buttonType: ApplePayButtonType;\n onClick: (event) => void;\n}\n\nclass ApplePayButton extends Component<ApplePayButtonProps> {\n public static defaultProps = {\n onClick: () => {},\n buttonColor: 'black',\n buttonType: 'plain'\n };\n\n render({ buttonColor, buttonType }) {\n return (\n <button\n type=\"button\"\n aria-label={this.props.i18n.get('payButton')}\n lang={this.props.i18n.languageCode}\n className={cx(\n 'adyen-checkout__applepay__button',\n `adyen-checkout__applepay__button--${buttonColor}`,\n `adyen-checkout__applepay__button--${buttonType}`,\n 'apple-pay',\n 'apple-pay-button',\n `apple-pay-button-${buttonColor}`,\n `apple-pay-button--type-${buttonType}`\n )}\n onClick={this.props.onClick}\n />\n );\n }\n}\n\nexport default ApplePayButton;\n"],"names":["ApplePayButton","Component","render","buttonColor","buttonType","h","button","type","aria-label","this","props","i18n","get","lang","languageCode","className","cx","onClick","defaultProps"],"mappings":"4IAaA,MAAMA,UAAuBC,EAOzBC,MAAAA,EAAOC,YAAEA,EAAWC,WAAEA,IAClB,OACIC,EAACC,SAAAA,CACGC,KAAK,SACLC,aAAYC,KAAKC,MAAMC,KAAKC,IAAI,aAChCC,KAAMJ,KAAKC,MAAMC,KAAKG,aACtBC,UAAWC,EACP,mCACA,qCAAqCb,IACrC,qCAAqCC,IACrC,YACA,mBACA,oBAAoBD,IACpB,0BAA0BC,KAE9Ba,QAASR,KAAKC,MAAMO,SAGhC,cAxB6B,CACzBA,QAAS,OACTd,YAAa,QACbC,WAAY,YAHFc,oBADZlB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"../helpers/QRLoaderContainer/QRLoaderContainer.js";import{STATUS_INTERVAL as
|
|
1
|
+
import e from"../helpers/QRLoaderContainer/QRLoaderContainer.js";import{STATUS_INTERVAL as r,COUNTDOWN_MINUTES as t}from"./config.js";import{TxVariants as o}from"../tx-variants.js";function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}class a extends e{formatProps(e){return function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),o.forEach((function(r){n(e,r,t[r])}))}return e}({delay:r,countdownTime:t,timeToPay:"payme.timeToPay"},super.formatProps(e))}}n(a,"type",o.bcmc_mobile),n(a,"txVariants",[o.bcmc_mobile,o.bcmc_mobile_QR]);export{a as default};
|
|
2
2
|
//# sourceMappingURL=BcmcMobile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BcmcMobile.js","sources":["../../../../src/components/BcmcMobile/BcmcMobile.ts"],"sourcesContent":["import QRLoaderContainer from '../helpers/QRLoaderContainer/QRLoaderContainer';\nimport { STATUS_INTERVAL, COUNTDOWN_MINUTES } from './config';\nimport { TxVariants } from '../tx-variants';\n\nclass BCMCMobileElement extends QRLoaderContainer {\n public static type = TxVariants.bcmc_mobile;\n public static txVariants = [TxVariants.bcmc_mobile, TxVariants.bcmc_mobile_QR];\n\n formatProps(props) {\n
|
|
1
|
+
{"version":3,"file":"BcmcMobile.js","sources":["../../../../src/components/BcmcMobile/BcmcMobile.ts"],"sourcesContent":["import QRLoaderContainer from '../helpers/QRLoaderContainer/QRLoaderContainer';\nimport { STATUS_INTERVAL, COUNTDOWN_MINUTES } from './config';\nimport { TxVariants } from '../tx-variants';\n\nclass BCMCMobileElement extends QRLoaderContainer {\n public static type = TxVariants.bcmc_mobile;\n public static txVariants = [TxVariants.bcmc_mobile, TxVariants.bcmc_mobile_QR];\n\n formatProps(props) {\n return {\n delay: STATUS_INTERVAL,\n countdownTime: COUNTDOWN_MINUTES,\n timeToPay: 'payme.timeToPay',\n ...super.formatProps(props)\n };\n }\n}\n\nexport default BCMCMobileElement;\n"],"names":["BCMCMobileElement","QRLoaderContainer","formatProps","props","_object_spread","delay","STATUS_INTERVAL","countdownTime","COUNTDOWN_MINUTES","timeToPay","super","_define_property","type","TxVariants","bcmc_mobile","txVariants","bcmc_mobile_QR"],"mappings":"6SAIA,MAAMA,UAA0BC,EAI5BC,WAAAA,CAAYC,GACR,6UAAOC,CAAA,CACHC,MAAOC,EACPC,cAAeC,EACfC,UAAW,mBACRC,MAAMR,YAAYC,GAE7B,EAVAQ,EADEX,EACYY,OAAOC,EAAWC,aAChCH,EAFEX,EAEYe,aAAa,CAACF,EAAWC,YAAaD,EAAWG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CVCHint.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVCHint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport { CVCHintProps } from './types';\n\nexport default function CVCHint({ frontCVC = false, fieldLabel }: CVCHintProps) {\n const hintClassnames = classNames({\n 'adyen-checkout__card__cvc__hint__wrapper': true,\n 'adyen-checkout__field__cvc--front-hint': !!frontCVC,\n 'adyen-checkout__field__cvc--back-hint': !frontCVC\n });\n\n
|
|
1
|
+
{"version":3,"file":"CVCHint.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVCHint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport { CVCHintProps } from './types';\n\nexport default function CVCHint({ frontCVC = false, fieldLabel }: CVCHintProps) {\n const hintClassnames = classNames({\n 'adyen-checkout__card__cvc__hint__wrapper': true,\n 'adyen-checkout__field__cvc--front-hint': !!frontCVC,\n 'adyen-checkout__field__cvc--back-hint': !frontCVC\n });\n\n return (\n <span className={hintClassnames}>\n <svg\n className={'adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--front'}\n width=\"27\"\n height=\"18\"\n viewBox=\"0 0 27 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden={!frontCVC}\n aria-describedby={'adyen-checkout__cvc__front-hint-img'}\n role={'img'}\n >\n <title id={'adyen-checkout__cvc__front-hint-img'}>{fieldLabel}</title>\n <path\n d=\"M0 3C0 1.34315 1.34315 0 3 0H24C25.6569 0 27 1.34315 27 3V15C27 16.6569 25.6569 18 24 18H3C1.34315 18 0 16.6569 0 15V3Z\"\n fill=\"#E6E9EB\"\n />\n <rect x=\"4\" y=\"12\" width=\"19\" height=\"2\" fill=\"#B9C4C9\" />\n <rect x=\"4\" y=\"4\" width=\"4\" height=\"4\" rx=\"1\" fill=\"white\" />\n <rect className={'adyen-checkout__card__cvc__hint__location'} x=\"16.5\" y=\"4.5\" width=\"7\" height=\"5\" rx=\"2.5\" stroke=\"#C12424\" />\n </svg>\n\n <svg\n className={'adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--back'}\n width=\"27\"\n height=\"18\"\n viewBox=\"0 0 27 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden={!!frontCVC}\n aria-describedby={'adyen-checkout__cvc__back-hint-img'}\n role={'img'}\n >\n <title id={'adyen-checkout__cvc__back-hint-img'}>{fieldLabel}</title>\n <path\n d=\"M27 4.00001V3.37501C27 2.4799 26.6444 1.62146 26.0115 0.988518C25.3786 0.355581 24.5201 0 23.625 0H3.375C2.47989 0 1.62145 0.355581 0.988514 0.988518C0.355579 1.62146 0 2.4799 0 3.37501V4.00001H27Z\"\n fill=\"#E6E9EB\"\n />\n <path\n d=\"M0 6.99994V14.6666C0 15.5507 0.355579 16.3985 0.988514 17.0237C1.62145 17.6488 2.47989 18 3.375 18H23.625C24.5201 18 25.3786 17.6488 26.0115 17.0237C26.6444 16.3985 27 15.5507 27 14.6666V6.99994H0Z\"\n fill=\"#E6E9EB\"\n />\n <rect y=\"4.00012\" width=\"27\" height=\"3.00001\" fill=\"#687282\" />\n <path\n d=\"M4 11C4 10.4477 4.44772 10 5 10H21C22.1046 10 23 10.8954 23 12C23 13.1046 22.1046 14 21 14H5C4.44771 14 4 13.5523 4 13V11Z\"\n fill=\"white\"\n />\n <rect className={'adyen-checkout__card__cvc__hint__location'} x=\"16.5\" y=\"9.5\" width=\"7\" height=\"5\" rx=\"2.5\" stroke=\"#C12424\" />\n </svg>\n </span>\n );\n}\n"],"names":["CVCHint","frontCVC","fieldLabel","hintClassnames","classNames","h","span","className","svg","width","height","viewBox","fill","xmlns","aria-hidden","aria-describedby","role","title","id","path","d","rect","x","y","rx","stroke"],"mappings":"yIAIe,SAASA,GAAQC,SAAEA,GAAW,EAAKC,WAAEA,IAChD,MAAMC,EAAiBC,EAAW,CAC9B,4CAA4C,EAC5C,2CAA4CH,EAC5C,yCAA0CA,IAG9C,OACII,EAACC,OAAAA,CAAKC,UAAWJ,GACbE,EAACG,MAAAA,CACGD,UAAW,yEACXE,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BACNC,eAAcb,EACdc,mBAAkB,sCAClBC,KAAM,OAENX,EAACY,QAAAA,CAAMC,GAAI,uCAAwChB,GACnDG,EAACc,OAAAA,CACGC,EAAE,0HACFR,KAAK,YAETP,EAACgB,OAAAA,CAAKC,EAAE,IAAIC,EAAE,KAAKd,MAAM,KAAKC,OAAO,IAAIE,KAAK,YAC9CP,EAACgB,OAAAA,CAAKC,EAAE,IAAIC,EAAE,IAAId,MAAM,IAAIC,OAAO,IAAIc,GAAG,IAAIZ,KAAK,UACnDP,EAACgB,OAAAA,CAAKd,UAAW,4CAA6Ce,EAAE,OAAOC,EAAE,MAAMd,MAAM,IAAIC,OAAO,IAAIc,GAAG,MAAMC,OAAO,aAGxHpB,EAACG,MAAAA,CACGD,UAAW,wEACXE,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BACNC,gBAAeb,EACfc,mBAAkB,qCAClBC,KAAM,OAENX,EAACY,QAAAA,CAAMC,GAAI,sCAAuChB,GAClDG,EAACc,OAAAA,CACGC,EAAE,wMACFR,KAAK,YAETP,EAACc,OAAAA,CACGC,EAAE,wMACFR,KAAK,YAETP,EAACgB,OAAAA,CAAKE,EAAE,UAAUd,MAAM,KAAKC,OAAO,UAAUE,KAAK,YACnDP,EAACc,OAAAA,CACGC,EAAE,6HACFR,KAAK,UAETP,EAACgB,OAAAA,CAAKd,UAAW,4CAA6Ce,EAAE,OAAOC,EAAE,MAAMd,MAAM,IAAIC,OAAO,IAAIc,GAAG,MAAMC,OAAO,aAIpI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"../helpers/QRLoaderContainer/QRLoaderContainer.js";import t from"./
|
|
1
|
+
import e from"../helpers/QRLoaderContainer/QRLoaderContainer.js";import{PayMeInstructions as t}from"./components/PayMeInstructions.js";import{PayMeIntroduction as o}from"./components/PayMeIntroduction.js";function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}class r extends e{formatProps(e){return function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),r.forEach((function(t){n(e,t,o[t])}))}return e}({delay:r.defaultDelay,countdownTime:r.defaultCountdown,redirectIntroduction:"payme.openPayMeApp",timeToPay:"payme.timeToPay",buttonLabel:"payme.redirectButtonLabel",introduction:o,instructions:t},super.formatProps(e))}}n(r,"type","payme"),n(r,"defaultCountdown",10),n(r,"defaultDelay",2e3);export{r as default};
|
|
2
2
|
//# sourceMappingURL=PayMe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayMe.js","sources":["../../../../src/components/PayMe/PayMe.ts"],"sourcesContent":["import QRLoaderContainer from '../helpers/QRLoaderContainer';\nimport
|
|
1
|
+
{"version":3,"file":"PayMe.js","sources":["../../../../src/components/PayMe/PayMe.ts"],"sourcesContent":["import QRLoaderContainer from '../helpers/QRLoaderContainer';\nimport { PayMeInstructions } from './components/PayMeInstructions';\nimport { PayMeIntroduction } from './components/PayMeIntroduction';\n\nclass PayMeElement extends QRLoaderContainer {\n public static type = 'payme';\n private static defaultCountdown = 10; // min\n private static defaultDelay = 2000; // ms\n\n formatProps(props) {\n return {\n delay: PayMeElement.defaultDelay,\n countdownTime: PayMeElement.defaultCountdown,\n redirectIntroduction: 'payme.openPayMeApp',\n timeToPay: 'payme.timeToPay',\n buttonLabel: 'payme.redirectButtonLabel',\n introduction: PayMeIntroduction,\n instructions: PayMeInstructions,\n ...super.formatProps(props)\n };\n }\n}\n\nexport default PayMeElement;\n"],"names":["PayMeElement","QRLoaderContainer","formatProps","props","_object_spread","delay","defaultDelay","countdownTime","defaultCountdown","redirectIntroduction","timeToPay","buttonLabel","introduction","PayMeIntroduction","instructions","PayMeInstructions","super","_define_property","type"],"mappings":"qUAIA,MAAMA,UAAqBC,EAKvBC,WAAAA,CAAYC,GACR,6UAAOC,CAAA,CACHC,MAAOL,EAAaM,aACpBC,cAAeP,EAAaQ,iBAC5BC,qBAAsB,qBACtBC,UAAW,kBACXC,YAAa,4BACbC,aAAcC,EACdC,aAAcC,GACXC,MAAMd,YAAYC,GAE7B,EAfAc,EADEjB,EACYkB,OAAO,SACrBD,EAFEjB,EAEaQ,mBAAmB,IAClCS,EAHEjB,EAGaM,eAAe"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useIsMobile as e}from"../../../utils/useIsMobile.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{TimelineWrapper as i}from"../../internal/Timeline/TimelineWrapper.js";import{Timeline as t}from"../../internal/Timeline/Timeline.js";import{createElement as n}from"../../../external/preact/dist/preact.js";const o=()=>{const{i18n:o}=r(),{isMobileScreenSize:s}=e();if(s)return null;const l=o.get("payme.instructions.steps").split("%@");return n(i,null,n(t,{instructions:l}))};export{o as PayMeInstructions};
|
|
2
|
+
//# sourceMappingURL=PayMeInstructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayMeInstructions.js","sources":["../../../../../src/components/PayMe/components/PayMeInstructions.tsx"],"sourcesContent":["import { useIsMobile } from '../../../utils/useIsMobile';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { Timeline, TimelineWrapper } from '../../internal/Timeline';\nimport { h } from 'preact';\n\nconst PayMeInstructions = () => {\n const { i18n } = useCoreContext();\n const { isMobileScreenSize } = useIsMobile();\n\n if (isMobileScreenSize) {\n return null;\n }\n\n const instructions = i18n.get('payme.instructions.steps').split('%@');\n\n return (\n <TimelineWrapper>\n <Timeline instructions={instructions} />\n </TimelineWrapper>\n );\n};\n\nexport { PayMeInstructions };\n"],"names":["PayMeInstructions","i18n","useCoreContext","isMobileScreenSize","useIsMobile","instructions","get","split","h","TimelineWrapper","Timeline"],"mappings":"uVAKA,MAAMA,EAAoB,KACtB,MAAMC,KAAEA,GAASC,KACXC,mBAAEA,GAAuBC,IAE/B,GAAID,EACA,OAAO,KAGX,MAAME,EAAeJ,EAAKK,IAAI,4BAA4BC,MAAM,MAEhE,OACIC,EAACC,OACGD,EAACE,EAAAA,CAASL,aAAcA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useCoreContext as e}from"../../../core/Context/CoreProvider.js";import{useIsMobile as r}from"../../../utils/useIsMobile.js";import{TimelineWrapper as t}from"../../internal/Timeline/TimelineWrapper.js";import{Timeline as i}from"../../internal/Timeline/Timeline.js";import{createElement as n,Fragment as o}from"../../../external/preact/dist/preact.js";const s=()=>{const{i18n:s}=e(),{isMobileScreenSize:m}=r(),l=s.get("payme.instructions.steps").split("%@");return m?n(t,null,n(i,{instructions:l})):n(o,null,s.get("payme.scanQrCode"))};export{s as PayMeIntroduction};
|
|
2
|
+
//# sourceMappingURL=PayMeIntroduction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayMeIntroduction.js","sources":["../../../../../src/components/PayMe/components/PayMeIntroduction.tsx"],"sourcesContent":["import { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useIsMobile } from '../../../utils/useIsMobile';\nimport { Timeline, TimelineWrapper } from '../../internal/Timeline';\nimport { Fragment, h } from 'preact';\n\nconst PayMeIntroduction = () => {\n const { i18n } = useCoreContext();\n const { isMobileScreenSize } = useIsMobile();\n\n const instructions = i18n.get('payme.instructions.steps').split('%@');\n\n return isMobileScreenSize ? (\n <TimelineWrapper>\n <Timeline instructions={instructions} />\n </TimelineWrapper>\n ) : (\n <Fragment>{i18n.get('payme.scanQrCode')}</Fragment>\n );\n};\n\nexport { PayMeIntroduction };\n"],"names":["PayMeIntroduction","i18n","useCoreContext","isMobileScreenSize","useIsMobile","instructions","get","split","h","TimelineWrapper","Timeline","Fragment"],"mappings":"qWAKA,MAAMA,EAAoB,KACtB,MAAMC,KAAEA,GAASC,KACXC,mBAAEA,GAAuBC,IAEzBC,EAAeJ,EAAKK,IAAI,4BAA4BC,MAAM,MAEhE,OAAOJ,EACHK,EAACC,EAAAA,KACGD,EAACE,EAAAA,CAASL,aAAcA,KAG5BG,EAACG,EAAAA,KAAUV,EAAKK,IAAI,oBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"../helpers/QRLoaderContainer/QRLoaderContainer.js";import{delay as o,countdownTime as r}from"./config.js";import{TxVariants as e}from"../tx-variants.js";import{PayNowIntroduction as n}from"./components/PayNowIntroduction.js";import{PayNowInstructions as i}from"./components/PayNowInstructions.js";function a(t,o,r){return o in t?Object.defineProperty(t,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[o]=r,t}class c extends t{formatProps(t){return function(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{},e=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),e.forEach((function(o){a(t,o,r[o])}))}return t}({introduction:n,instructions:i,timeToPay:"payme.timeToPay",delay:o,countdownTime:r},super.formatProps(t))}}a(c,"type",e.paynow);export{c as default};
|
|
2
2
|
//# sourceMappingURL=PayNow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayNow.js","sources":["../../../../src/components/PayNow/PayNow.ts"],"sourcesContent":["import QRLoaderContainer from '../helpers/QRLoaderContainer/QRLoaderContainer';\nimport { delay, countdownTime } from './config';\nimport { TxVariants } from '../tx-variants';\n\nclass PayNowElement extends QRLoaderContainer {\n public static type = TxVariants.paynow;\n\n formatProps(props) {\n return {\n delay,\n countdownTime,\n ...super.formatProps(props)\n };\n }\n}\n\nexport default PayNowElement;\n"],"names":["PayNowElement","QRLoaderContainer","formatProps","props","_object_spread","delay","countdownTime","super","_define_property","type","TxVariants","paynow"],"mappings":"+
|
|
1
|
+
{"version":3,"file":"PayNow.js","sources":["../../../../src/components/PayNow/PayNow.ts"],"sourcesContent":["import QRLoaderContainer from '../helpers/QRLoaderContainer/QRLoaderContainer';\nimport { delay, countdownTime } from './config';\nimport { TxVariants } from '../tx-variants';\nimport { PayNowIntroduction } from './components/PayNowIntroduction';\nimport { PayNowInstructions } from './components/PayNowInstructions';\n\nclass PayNowElement extends QRLoaderContainer {\n public static type = TxVariants.paynow;\n\n formatProps(props) {\n return {\n introduction: PayNowIntroduction,\n instructions: PayNowInstructions,\n timeToPay: 'payme.timeToPay',\n delay,\n countdownTime,\n ...super.formatProps(props)\n };\n }\n}\n\nexport default PayNowElement;\n"],"names":["PayNowElement","QRLoaderContainer","formatProps","props","_object_spread","introduction","PayNowIntroduction","instructions","PayNowInstructions","timeToPay","delay","countdownTime","super","_define_property","type","TxVariants","paynow"],"mappings":"+aAMA,MAAMA,UAAsBC,EAGxBC,WAAAA,CAAYC,GACR,6UAAOC,CAAA,CACHC,aAAcC,EACdC,aAAcC,EACdC,UAAW,kBACXC,QACAC,iBACGC,MAAMV,YAAYC,GAE7B,EAXAU,EADEb,EACYc,OAAOC,EAAWC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import r from"../../internal/ContentSeparator/ContentSeparator.js";import{useIsMobile as o}from"../../../utils/useIsMobile.js";const n=()=>{const{i18n:n}=t(),{isMobileScreenSize:i}=o();if(i)return e("div",{className:"adyen-checkout-paynow__instructions"},e(r,null),e("p",null,n.get("paynow.scanQrCode")))};export{n as PayNowInstructions};
|
|
2
|
+
//# sourceMappingURL=PayNowInstructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayNowInstructions.js","sources":["../../../../../src/components/PayNow/components/PayNowInstructions.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport ContentSeparator from '../../internal/ContentSeparator';\nimport './PayNowInstructions.scss';\nimport { useIsMobile } from '../../../utils/useIsMobile';\n\nconst PayNowInstructions = () => {\n const { i18n } = useCoreContext();\n const { isMobileScreenSize } = useIsMobile();\n\n if (!isMobileScreenSize) return;\n\n return (\n <div className=\"adyen-checkout-paynow__instructions\">\n <ContentSeparator />\n <p>{i18n.get('paynow.scanQrCode')}</p>\n </div>\n );\n};\n\nexport { PayNowInstructions };\n"],"names":["PayNowInstructions","i18n","useCoreContext","isMobileScreenSize","useIsMobile","h","div","className","ContentSeparator","p","get"],"mappings":"8QAMA,MAAMA,EAAqB,KACvB,MAAMC,KAAEA,GAASC,KACXC,mBAAEA,GAAuBC,IAE/B,GAAKD,EAEL,OACIE,EAACC,MAAAA,CAAIC,UAAU,uCACXF,EAACG,EACD,MAAAH,EAACI,IAAGR,KAAAA,EAAKS,IAAI,sBAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import{TimelineWrapper as i}from"../../internal/Timeline/TimelineWrapper.js";import{Timeline as o}from"../../internal/Timeline/Timeline.js";import{useIsMobile as n}from"../../../utils/useIsMobile.js";const r=()=>{const{i18n:r}=t(),{isMobileScreenSize:s}=n(),p=[r.get("paynow.mobileViewInstruction.step1"),r.get("paynow.mobileViewInstruction.step2"),r.get("paynow.mobileViewInstruction.step3"),r.get("paynow.mobileViewInstruction.step4"),r.get("paynow.mobileViewInstruction.step5")];return e("div",{className:"adyen-checkout-paynow__introduction","data-testid":"paynow-introduction"},s?e(i,null,e(o,{instructions:p})):r.get("paynow.scanQrCode"))};export{r as PayNowIntroduction};
|
|
2
|
+
//# sourceMappingURL=PayNowIntroduction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayNowIntroduction.js","sources":["../../../../../src/components/PayNow/components/PayNowIntroduction.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PayNowIntroduction.scss';\nimport { TimelineWrapper, Timeline } from '../../internal/Timeline';\nimport { useIsMobile } from '../../../utils/useIsMobile';\n\nconst PayNowIntroduction = () => {\n const { i18n } = useCoreContext();\n const { isMobileScreenSize } = useIsMobile();\n\n const instructions = [\n i18n.get('paynow.mobileViewInstruction.step1'),\n i18n.get('paynow.mobileViewInstruction.step2'),\n i18n.get('paynow.mobileViewInstruction.step3'),\n i18n.get('paynow.mobileViewInstruction.step4'),\n i18n.get('paynow.mobileViewInstruction.step5')\n ];\n\n return (\n <div className=\"adyen-checkout-paynow__introduction\" data-testid=\"paynow-introduction\">\n {isMobileScreenSize ? (\n <TimelineWrapper>\n <Timeline instructions={instructions} />\n </TimelineWrapper>\n ) : (\n i18n.get('paynow.scanQrCode')\n )}\n </div>\n );\n};\n\nexport { PayNowIntroduction };\n"],"names":["PayNowIntroduction","i18n","useCoreContext","isMobileScreenSize","useIsMobile","instructions","get","h","div","className","data-testid","TimelineWrapper","Timeline"],"mappings":"uVAMA,MAAMA,EAAqB,KACvB,MAAMC,KAAEA,GAASC,KACXC,mBAAEA,GAAuBC,IAEzBC,EAAe,CACjBJ,EAAKK,IAAI,sCACTL,EAAKK,IAAI,sCACTL,EAAKK,IAAI,sCACTL,EAAKK,IAAI,sCACTL,EAAKK,IAAI,uCAGb,OACIC,EAACC,MAAAA,CAAIC,UAAU,sCAAsCC,cAAY,uBAC5DP,EACGI,EAACI,OACGJ,EAACK,EAAAA,CAASP,aAAcA,KAG5BJ,EAAKK,IAAI,qBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Swish.js","sources":["../../../../src/components/Swish/Swish.ts"],"sourcesContent":["import QRLoaderContainer from '../helpers/QRLoaderContainer/QRLoaderContainer';\nimport { TxVariants } from '../tx-variants';\n\nclass SwishElement extends QRLoaderContainer {\n public static type = TxVariants.swish;\n\n formatProps(props) {\n return {\n delay: 2000, // ms\n countdownTime: 3, // min\n instructions: 'swish.pendingMessage',\n ...super.formatProps(props)\n };\n }\n}\n\nexport default SwishElement;\n"],"names":["SwishElement","QRLoaderContainer","formatProps","props","_object_spread","delay","countdownTime","instructions","super","_define_property","type","TxVariants","swish"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Swish.js","sources":["../../../../src/components/Swish/Swish.ts"],"sourcesContent":["import QRLoaderContainer from '../helpers/QRLoaderContainer/QRLoaderContainer';\nimport { TxVariants } from '../tx-variants';\nimport './Swish.scss';\n\nclass SwishElement extends QRLoaderContainer {\n public static type = TxVariants.swish;\n\n formatProps(props) {\n return {\n delay: 2000, // ms\n countdownTime: 3, // min\n instructions: 'swish.pendingMessage',\n ...super.formatProps(props)\n };\n }\n}\n\nexport default SwishElement;\n"],"names":["SwishElement","QRLoaderContainer","formatProps","props","_object_spread","delay","countdownTime","instructions","super","_define_property","type","TxVariants","swish"],"mappings":"wOAIA,MAAMA,UAAqBC,EAGvBC,WAAAA,CAAYC,GACR,6UAAOC,CAAA,CACHC,MAAO,IACPC,cAAe,EACfC,aAAc,wBACXC,MAAMN,YAAYC,GAE7B,EATAM,EADET,EACYU,OAAOC,EAAWC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e,Fragment as t}from"../../../../external/preact/dist/preact.js";import{useState as a,useCallback as n,useEffect as o}from"../../../../external/preact/hooks/dist/hooks.js";import r from"../VpaInput/VpaInput.js";import l from"../../../../core/Context/useImage.js";import i from"./useUpiSegmentedControlOptions.js";import{A11Y as s}from"./constants.js";import d from"../../../internal/SegmentedControl/SegmentedControl.js";import u from"../../../internal/ContentSeparator/ContentSeparator.js";import p from"../UPIIntentAppList/UPIIntentAppList.js";import{useCoreContext as c}from"../../../../core/Context/CoreProvider.js";function m(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function g(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},n=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(a).filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable})))),n.forEach((function(t){m(e,t,a[t])}))}return e}function b({defaultMode:m,onChange:b,onUpdateMode:f,payButton:y,showPayButton:I,apps:v=[]}){const{i18n:
|
|
1
|
+
import{createElement as e,Fragment as t}from"../../../../external/preact/dist/preact.js";import{useState as a,useCallback as n,useEffect as o}from"../../../../external/preact/hooks/dist/hooks.js";import r from"../VpaInput/VpaInput.js";import l from"../../../../core/Context/useImage.js";import i from"./useUpiSegmentedControlOptions.js";import{A11Y as s}from"./constants.js";import d from"../../../internal/SegmentedControl/SegmentedControl.js";import u from"../../../internal/ContentSeparator/ContentSeparator.js";import p from"../UPIIntentAppList/UPIIntentAppList.js";import{useCoreContext as c}from"../../../../core/Context/CoreProvider.js";function m(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function g(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},n=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(a).filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable})))),n.forEach((function(t){m(e,t,a[t])}))}return e}function b({defaultMode:m,onChange:b,onUpdateMode:f,payButton:y,showPayButton:I,apps:v=[]}){const{i18n:C}=c(),h=l(),[j,P]=a("ready"),[S,A]=a("qrCode"===m),[V,N]=a(m),[O,k]=a(""),[w,x]=a(null),[q,B]=a(null),[E,T]=a(null),[U,M]=a(null),Q=i(v,V);this.setStatus=e=>{P(e)},this.showValidation=()=>{null==w||w.validateInput()};const R=n((e=>{x(e)}),[]),F=n((e=>{N(e),f(e)}),[f]),H=n((e=>{(null==e?void 0:e.id)!==(null==q?void 0:q.id)&&(B(e),A(!0))}),[q]),L=n((({data:{virtualPaymentAddress:e},errors:t,valid:a,isValid:n})=>{k(e),M(t),T(a),A(n)}),[]);return o((()=>{b("qrCode"!==V?{data:g({},O&&{virtualPaymentAddress:O},q&&{app:q}),errors:U,valid:E,isValid:S}:{data:{},valid:{},errors:{},isValid:!0})}),[O,q,U,E,S,V]),e(t,null,e("p",{className:"adyen-checkout_upi-mode-selection-text"},C.get("upi.modeSelection")),e(d,{onChange:F,selectedValue:V,disabled:"loading"===j,classNameModifiers:["upi-margin-bottom"],options:Q}),e(u,{label:C.get("upi.completePayment")}),"intent"===V&&e("div",{id:s.AreaId.INTENT,"aria-labelledby":s.ButtonId.INTENT,className:"adyen-checkout-upi-area-intent",role:"region"},e(p,{disabled:"loading"===j,apps:v,selectedAppId:null==q?void 0:q.id,onAppSelect:H,onVpaInputChange:L,onSetInputHandlers:R}),I&&y({label:C.get("continue"),status:j,disabled:null==q})),"vpa"===V&&e("div",{id:s.AreaId.VPA,"aria-labelledby":s.ButtonId.VPA,className:"adyen-checkout-upi-area-vpa",role:"region"},e(r,{disabled:"loading"===j,onChange:b,onSetInputHandlers:R}),I&&y({label:C.get("continue"),status:j})),"qrCode"===V&&e("div",{id:s.AreaId.QR,"aria-labelledby":s.ButtonId.QR,className:"adyen-checkout-upi-area-qr-code",role:"region"},I&&y({label:C.get("generateQRCode"),icon:h({imageFolder:"components/"})("qr"),status:j})))}export{b as default};
|
|
2
2
|
//# sourceMappingURL=UPIComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UPIComponent.js","sources":["../../../../../../src/components/UPI/components/UPIComponent/UPIComponent.tsx"],"sourcesContent":["import { Fragment, h, RefObject } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport { PayButtonFunctionProps, UIElementStatus } from '../../../types';\nimport VpaInput, { VpaInputHandlers } from '../VpaInput/VpaInput';\nimport { App, UpiMode } from '../../types';\nimport useImage from '../../../../core/Context/useImage';\nimport useUpiSegmentedControlOptions from './useUpiSegmentedControlOptions';\nimport { A11Y } from './constants';\nimport './UPIComponent.scss';\nimport SegmentedControl from '../../../internal/SegmentedControl';\nimport ContentSeparator from '../../../internal/ContentSeparator';\nimport UPIIntentAppList from '../UPIIntentAppList';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\n\ntype UpiData = { app?: App; virtualPaymentAddress?: string };\n\ntype OnChangeProps = { data: UpiData; valid; errors; isValid: boolean };\n\ninterface UPIComponentProps {\n defaultMode: UpiMode;\n showPayButton: boolean;\n apps?: Array<App>;\n\n ref?(ref: RefObject<typeof UPIComponent>): void;\n\n payButton?(props: PayButtonFunctionProps): h.JSX.Element;\n\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n\n onUpdateMode?(mode: UpiMode): void;\n}\n\nexport default function UPIComponent({ defaultMode, onChange, onUpdateMode, payButton, showPayButton, apps = [] }: UPIComponentProps): h.JSX.Element {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const [status, setStatus] = useState<UIElementStatus>('ready');\n const [isValid, setIsValid] = useState<boolean>(
|
|
1
|
+
{"version":3,"file":"UPIComponent.js","sources":["../../../../../../src/components/UPI/components/UPIComponent/UPIComponent.tsx"],"sourcesContent":["import { Fragment, h, RefObject } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport { PayButtonFunctionProps, UIElementStatus } from '../../../types';\nimport VpaInput, { VpaInputHandlers } from '../VpaInput/VpaInput';\nimport { App, UpiMode } from '../../types';\nimport useImage from '../../../../core/Context/useImage';\nimport useUpiSegmentedControlOptions from './useUpiSegmentedControlOptions';\nimport { A11Y } from './constants';\nimport './UPIComponent.scss';\nimport SegmentedControl from '../../../internal/SegmentedControl';\nimport ContentSeparator from '../../../internal/ContentSeparator';\nimport UPIIntentAppList from '../UPIIntentAppList';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\n\ntype UpiData = { app?: App; virtualPaymentAddress?: string };\n\ntype OnChangeProps = { data: UpiData; valid; errors; isValid: boolean };\n\ninterface UPIComponentProps {\n defaultMode: UpiMode;\n showPayButton: boolean;\n apps?: Array<App>;\n\n ref?(ref: RefObject<typeof UPIComponent>): void;\n\n payButton?(props: PayButtonFunctionProps): h.JSX.Element;\n\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n\n onUpdateMode?(mode: UpiMode): void;\n}\n\nexport default function UPIComponent({ defaultMode, onChange, onUpdateMode, payButton, showPayButton, apps = [] }: UPIComponentProps): h.JSX.Element {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const [status, setStatus] = useState<UIElementStatus>('ready');\n const [isValid, setIsValid] = useState<boolean>(defaultMode === 'qrCode');\n const [mode, setMode] = useState<UpiMode>(defaultMode);\n const [vpa, setVpa] = useState<string>('');\n const [vpaInputHandlers, setVpaInputHandlers] = useState<VpaInputHandlers>(null);\n const [selectedApp, setSelectedApp] = useState<App>(null);\n const [valid, setValid] = useState(null);\n const [errors, setErrors] = useState(null);\n const segmentedControlOptions = useUpiSegmentedControlOptions(apps, mode);\n\n this.setStatus = (status: UIElementStatus) => {\n setStatus(status);\n };\n\n this.showValidation = () => {\n vpaInputHandlers?.validateInput();\n };\n\n const onSetVpaInputHandlers = useCallback((handlers: VpaInputHandlers) => {\n setVpaInputHandlers(handlers);\n }, []);\n\n const onChangeUpiMode = useCallback(\n (newMode: UpiMode) => {\n setMode(newMode);\n onUpdateMode(newMode);\n },\n [onUpdateMode]\n );\n\n const handleAppSelect = useCallback(\n (app: App) => {\n if (app?.id === selectedApp?.id) return;\n\n setSelectedApp(app);\n setIsValid(true);\n },\n [selectedApp]\n );\n\n const handleVpaInputChange = useCallback(({ data: { virtualPaymentAddress }, errors, valid, isValid }: OnChangeProps) => {\n setVpa(virtualPaymentAddress);\n setErrors(errors);\n setValid(valid);\n setIsValid(isValid);\n }, []);\n\n useEffect(() => {\n if (mode !== 'qrCode') {\n onChange({\n data: { ...(vpa && { virtualPaymentAddress: vpa }), ...(selectedApp && { app: selectedApp }) },\n errors,\n valid,\n isValid\n });\n } else {\n /**\n * When selecting QR code mode, we need to clear the state data and trigger the 'onChange'.\n */\n onChange({ data: {}, valid: {}, errors: {}, isValid: true });\n }\n }, [vpa, selectedApp, errors, valid, isValid, mode]);\n\n return (\n <Fragment>\n <p className=\"adyen-checkout_upi-mode-selection-text\">{i18n.get('upi.modeSelection')}</p>\n <SegmentedControl\n onChange={onChangeUpiMode}\n selectedValue={mode}\n disabled={status === 'loading'}\n classNameModifiers={['upi-margin-bottom']}\n options={segmentedControlOptions}\n />\n <ContentSeparator label={i18n.get('upi.completePayment')} />\n {mode === 'intent' && (\n <div id={A11Y.AreaId.INTENT} aria-labelledby={A11Y.ButtonId.INTENT} className=\"adyen-checkout-upi-area-intent\" role=\"region\">\n <UPIIntentAppList\n disabled={status === 'loading'}\n apps={apps}\n selectedAppId={selectedApp?.id}\n onAppSelect={handleAppSelect}\n onVpaInputChange={handleVpaInputChange}\n onSetInputHandlers={onSetVpaInputHandlers}\n />\n\n {showPayButton &&\n payButton({\n label: i18n.get('continue'),\n status,\n disabled: selectedApp == null\n })}\n </div>\n )}\n {mode === 'vpa' && (\n <div id={A11Y.AreaId.VPA} aria-labelledby={A11Y.ButtonId.VPA} className=\"adyen-checkout-upi-area-vpa\" role=\"region\">\n <VpaInput disabled={status === 'loading'} onChange={onChange} onSetInputHandlers={onSetVpaInputHandlers} />\n\n {showPayButton &&\n payButton({\n label: i18n.get('continue'),\n status\n })}\n </div>\n )}\n {mode === 'qrCode' && (\n <div id={A11Y.AreaId.QR} aria-labelledby={A11Y.ButtonId.QR} className=\"adyen-checkout-upi-area-qr-code\" role=\"region\">\n {showPayButton &&\n payButton({\n label: i18n.get('generateQRCode'),\n icon: getImage({ imageFolder: 'components/' })('qr'),\n status\n })}\n </div>\n )}\n </Fragment>\n );\n}\n"],"names":["UPIComponent","defaultMode","onChange","onUpdateMode","payButton","showPayButton","apps","i18n","useCoreContext","getImage","useImage","status","setStatus","useState","isValid","setIsValid","mode","setMode","vpa","setVpa","vpaInputHandlers","setVpaInputHandlers","selectedApp","setSelectedApp","valid","setValid","errors","setErrors","segmentedControlOptions","useUpiSegmentedControlOptions","this","showValidation","validateInput","onSetVpaInputHandlers","useCallback","handlers","onChangeUpiMode","newMode","handleAppSelect","app","id","handleVpaInputChange","data","virtualPaymentAddress","useEffect","_object_spread","h","Fragment","p","className","get","SegmentedControl","selectedValue","disabled","classNameModifiers","options","ContentSeparator","label","div","A11Y","AreaId","INTENT","aria-labelledby","ButtonId","role","UPIIntentAppList","selectedAppId","onAppSelect","onVpaInputChange","onSetInputHandlers","VPA","VpaInput","QR","icon","imageFolder"],"mappings":"okCAgCe,SAASA,GAAaC,YAAEA,EAAWC,SAAEA,EAAQC,aAAEA,EAAYC,UAAEA,EAASC,cAAEA,EAAaC,KAAEA,EAAO,KACzG,MAAMC,KAAEA,GAASC,IACXC,EAAWC,KACVC,EAAQC,GAAaC,EAA0B,UAC/CC,EAASC,GAAcF,EAAkC,WAAhBZ,IACzCe,EAAMC,GAAWJ,EAAkBZ,IACnCiB,EAAKC,GAAUN,EAAiB,KAChCO,EAAkBC,GAAuBR,EAA2B,OACpES,EAAaC,GAAkBV,EAAc,OAC7CW,EAAOC,GAAYZ,EAAS,OAC5Ba,EAAQC,GAAad,EAAS,MAC/Be,EAA0BC,EA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A,EAAAA,EAAakB,GAC5B2B,YAAa7B,EACb8B,iBAAkB3B,EAClB4B,mBAAoBpC,IAGvB5B,GACGD,EAAU,CACNqD,MAAOlD,EAAK2C,IAAI,YAChBvC,SACA0C,SAAyB,MAAf/B,KAIhB,QAATN,GACG8B,EAACY,MAAAA,CAAIlB,GAAImB,EAAKC,OAAOU,IAAKR,kBAAiBH,EAAKI,SAASO,IAAKrB,UAAU,8BAA8Be,KAAK,UACvGlB,EAACyB,EAAAA,CAASlB,SAAqB,YAAX1C,EAAsBT,SAAUA,EAAUmE,mBAAoBpC,IAEjF5B,GACGD,EAAU,CACNqD,MAAOlD,EAAK2C,IAAI,YAChBvC,YAIN,WAATK,GACG8B,EAACY,MAAAA,CAAIlB,GAAImB,EAAKC,OAAOY,GAAIV,kBAAiBH,EAAKI,SAASS,GAAIvB,UAAU,kCAAkCe,KAAK,UACxG3D,GACGD,EAAU,CACNqD,MAAOlD,EAAK2C,IAAI,kBAChBuB,KAAMhE,EAAS,CAAEiE,YAAa,eAAxBjE,CAAyC,MAC/CE,YAM5B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useRef as r,useMemo as o,useState as n,useCallback as s,useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import l from"./components/ReadOnlyAddress.js";import{getAddressValidationRules as c}from"./validate.js";import{addressFormatters as d,countrySpecificFormatters as u}from"./validate.formats.js";import p from"./components/FieldContainer.js";import m from"../../../utils/useForm/useForm.js";import f from"./Specifications.js";import{FALLBACK_VALUE as y,ADDRESS_SCHEMA as b}from"./constants.js";import{getMaxLengthByFieldAndCountry as O}from"../../../utils/validator-utils.js";import{useCoreContext as
|
|
1
|
+
import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useRef as r,useMemo as o,useState as n,useCallback as s,useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import l from"./components/ReadOnlyAddress.js";import{getAddressValidationRules as c}from"./validate.js";import{addressFormatters as d,countrySpecificFormatters as u}from"./validate.formats.js";import p from"./components/FieldContainer.js";import m from"../../../utils/useForm/useForm.js";import f from"./Specifications.js";import{FALLBACK_VALUE as y,ADDRESS_SCHEMA as b}from"./constants.js";import{getMaxLengthByFieldAndCountry as O}from"../../../utils/validator-utils.js";import{useCoreContext as g}from"../../../core/Context/CoreProvider.js";import h from"./components/AddressSearch.js";function j(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),o.forEach((function(t){j(e,t,r[t])}))}return e}function F(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function C(j){const{i18n:C}=g(),{label:A="",requiredFields:P,visibility:w,iOSFocusedField:S=null,showContextualElement:k}=j,x=r({});var D;Object.keys(x.current).length||(null===(D=j.setComponentRef)||void 0===D||D.call(j,x.current));const M=o((()=>new f(j.specifications)),[j.specifications]),E=M.getAddressSchemaForCountryFlat(j.countryCode).filter((e=>P.includes(e))),[B,N]=n(!1),[L,R]=n(!1),[V,q]=n(""),H=!!j.onAddressLookup,[T,_]=n(!1),I=!j.onAddressLookup||(B||L),{data:$,errors:z,valid:G,isValid:J,handleChangeFor:K,triggerValidation:Q,setData:U,mergeData:W}=m({schema:E,defaultData:j.data,rules:v({},c(M),j.validationRules),formatters:d}),X=s((e=>{const t=b.reduce(((t,r)=>{const o=e[r];return null!=o&&(t[r]=String(o)),t}),{});W(t),_(!0),Q(),N(!0)}),[N,Q,U]),Y=s((()=>{R(!0)}),[]);x.current.showValidation=()=>{Q(),q(!H||I||J?"":C.get("address.errors.incomplete"))};const Z=E.filter((e=>!S||e===S));if(a((()=>{if(T)return void _(!1);const e=M.countryHasDataset($.country)?"":y,t=F(v({},$),{stateOrProvince:e});P.forEach((e=>{var r;K(e,"input")(null!==(r=t[e])&&void 0!==r?r:"")})),t.postalCode&&K("postalCode","blur")($.postalCode)}),[$.country]),a((()=>{const e=P.includes("stateOrProvince"),t=$.country&&M.countryHasDataset($.country),r=e&&t,o=$.stateOrProvince||(r?"":y);K("stateOrProvince","input")(o)}),[]),a((()=>{const e=M.getOptionalFieldsForCountry($.country),t=b.reduce(((t,r)=>{const o=e.includes(r),n=P.includes(r),s=$[r],a=j.data[r],i=o&&!s||!n?n||s||!a?y:a:s;return(null==i?void 0:i.length)&&(t[r]=i),t}),{});j.onChange({data:t,valid:G,errors:z,isValid:J})}),[$,G,z,J]),"hidden"===w)return null;if("readOnly"===w)return e(l,{data:$,label:A});const ee=(t,{classNameModifiers:r=[]})=>P.includes(t)?e(p,{key:t,allowedCountries:j.allowedCountries,classNameModifiers:[...r,t],data:$,errors:z,valid:G,fieldName:t,onInput:K(t,"input"),onBlur:K(t,"blur"),onDropdownChange:K(t,"blur"),specifications:M,maxLength:O(u,t,$.country),trimOnBlur:!0,disabled:!Z.includes(t),onFieldFocusAnalytics:j.onFieldFocusAnalytics,onFieldBlurAnalytics:j.onFieldBlurAnalytics}):null,te=M.getAddressSchemaForCountry($.country);return e(t,null,e(i,{classNameModifiers:[A||"address"],label:A},H&&e(h,{onAddressLookup:j.onAddressLookup,onAddressSelected:j.onAddressSelected,onSelect:X,onManualAddress:Y,externalErrorMessage:V,hideManualButton:I,showContextualElement:k,contextualText:C.get("address.search.contextualText"),addressSearchDebounceMs:j.addressSearchDebounceMs}),I&&e(t,null,te.map((t=>t instanceof Array?e("div",{className:"adyen-checkout__field-group"},t.map((([e,t])=>ee(e,{classNameModifiers:[`col-${t}`]})))):ee(t,{}))))))}C.defaultProps={countryCode:null,validationRules:null,data:{},onChange:()=>{},visibility:"editable",requiredFields:b,specifications:{},onFieldFocusAnalytics:()=>{},onFieldBlurAnalytics:()=>{}};export{C as default};
|
|
2
2
|
//# sourceMappingURL=Address.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Address.js","sources":["../../../../../src/components/internal/Address/Address.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport Fieldset from '../FormFields/Fieldset';\nimport ReadOnlyAddress from './components/ReadOnlyAddress';\nimport { getAddressValidationRules } from './validate';\nimport { addressFormatters, countrySpecificFormatters } from './validate.formats';\nimport { AddressProps } from './types';\nimport { AddressData } from '../../../types/global-types';\nimport FieldContainer from './components/FieldContainer';\nimport useForm from '../../../utils/useForm';\nimport Specifications from './Specifications';\nimport { ADDRESS_SCHEMA, FALLBACK_VALUE } from './constants';\nimport { getMaxLengthByFieldAndCountry } from '../../../utils/validator-utils';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport AddressSearch from './components/AddressSearch';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\nexport default function Address(props: AddressProps) {\n const { i18n } = useCoreContext();\n\n const { label = '', requiredFields, visibility, iOSFocusedField = null, showContextualElement } = props;\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const addressRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(addressRef.current).length) {\n props.setComponentRef?.(addressRef.current);\n }\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n const requiredFieldsSchema = specifications.getAddressSchemaForCountryFlat(props.countryCode).filter(field => requiredFields.includes(field));\n\n const [hasSelectedAddress, setHasSelectedAddress] = useState(false);\n\n const [useManualAddress, setUseManualAddress] = useState(false);\n\n const [searchErrorMessage, setSearchErrorMessage] = useState('');\n\n const showAddressSearch = !!props.onAddressLookup;\n\n const showAddressFields = props.onAddressLookup ? hasSelectedAddress || useManualAddress : true;\n\n const { data, errors, valid, isValid, handleChangeFor, triggerValidation, setData } = useForm<AddressData>({\n schema: requiredFieldsSchema,\n defaultData: props.data,\n // Ensure any passed validation rules are merged with the default ones\n rules: { ...getAddressValidationRules(specifications), ...props.validationRules },\n formatters: addressFormatters\n });\n\n const setSearchData = useCallback(\n (selectedAddress: AddressData) => {\n const propsKeysToProcess = ADDRESS_SCHEMA;\n propsKeysToProcess.forEach(propKey => {\n // Make sure the data provided by the merchant is always strings\n const providedValue = selectedAddress[propKey];\n if (providedValue === null || providedValue === undefined) return;\n // Cast everything to string\n setData(propKey, String(providedValue));\n });\n triggerValidation();\n setHasSelectedAddress(true);\n },\n [setHasSelectedAddress, triggerValidation, setData]\n );\n\n const onManualAddress = useCallback(() => {\n setUseManualAddress(true);\n }, []);\n\n // Expose method expected by (parent) Address.tsx\n addressRef.current.showValidation = () => {\n triggerValidation();\n if (showAddressSearch && !showAddressFields && !isValid) {\n setSearchErrorMessage(i18n.get('address.errors.incomplete'));\n } else {\n setSearchErrorMessage('');\n }\n };\n\n /**\n * For iOS: iOSFocusedField is the name of the element calling for other elements to be disabled\n * - so if it is set (meaning we are in iOS *and* an input has been focussed) only enable the field that corresponds to this element\n */\n const enabledFields: string[] = requiredFieldsSchema.filter(item => {\n return !iOSFocusedField ? true : item === iOSFocusedField;\n });\n\n /**\n * Effect that:\n * - Resets validation for all fields by triggering handleChangeFor(fieldName, 'input')\n * - Applies validation on postalCode field in case it has any value\n */\n useEffect((): void => {\n const stateOrProvince = specifications.countryHasDataset(data.country) ? '' : FALLBACK_VALUE;\n const newData = { ...data, stateOrProvince };\n\n requiredFields.forEach(fieldName => {\n handleChangeFor(fieldName, 'input')(newData[fieldName] ?? '');\n });\n\n if (newData.postalCode) {\n handleChangeFor('postalCode', 'blur')(data.postalCode);\n }\n }, [data.country]);\n\n /**\n * Set the value of 'stateOrProvince' during the initial render if\n * property is provided during the creation of the payment method\n */\n useEffect((): void => {\n const stateFieldIsRequired = requiredFields.includes('stateOrProvince');\n const countryHasStatesDataset = data.country && specifications.countryHasDataset(data.country);\n const addressShouldHaveState = stateFieldIsRequired && countryHasStatesDataset;\n const stateOrProvince = data.stateOrProvince || (addressShouldHaveState ? '' : FALLBACK_VALUE);\n\n handleChangeFor('stateOrProvince', 'input')(stateOrProvince);\n }, []);\n\n useEffect((): void => {\n const optionalFields = specifications.getOptionalFieldsForCountry(data.country);\n const processedData = ADDRESS_SCHEMA.reduce((acc, cur) => {\n const isOptional = optionalFields.includes(cur);\n const isRequired = requiredFields.includes(cur);\n const newValue = data[cur];\n const initialValue = props.data[cur];\n // recover default data values which are not requiredFields, or prefill with 'N/A'\n const fallbackValue = !isRequired && !newValue && !!initialValue ? initialValue : FALLBACK_VALUE;\n const value = (isOptional && !newValue) || !isRequired ? fallbackValue : newValue;\n if (value?.length) acc[cur] = value;\n return acc;\n }, {});\n\n props.onChange({ data: processedData, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n if (visibility === 'hidden') return null;\n if (visibility === 'readOnly') return <ReadOnlyAddress data={data} label={label} />;\n\n const getComponent = (fieldName: string, { classNameModifiers = [] }) => {\n if (!requiredFields.includes(fieldName)) return null;\n\n return (\n <FieldContainer\n key={fieldName}\n allowedCountries={props.allowedCountries}\n classNameModifiers={[...classNameModifiers, fieldName]}\n data={data}\n errors={errors}\n valid={valid}\n fieldName={fieldName}\n onInput={handleChangeFor(fieldName, 'input')}\n onBlur={handleChangeFor(fieldName, 'blur')}\n onDropdownChange={handleChangeFor(fieldName, 'blur')}\n specifications={specifications}\n maxLength={getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country, true)}\n trimOnBlur={true}\n disabled={!enabledFields.includes(fieldName)}\n onFieldFocusAnalytics={props.onFieldFocusAnalytics}\n onFieldBlurAnalytics={props.onFieldBlurAnalytics}\n />\n );\n };\n\n const getWrapper = group => (\n <div className=\"adyen-checkout__field-group\">\n {group.map(([field, size]) => getComponent(field, { classNameModifiers: [`col-${size}`] }))}\n </div>\n );\n\n const addressSchema = specifications.getAddressSchemaForCountry(data.country);\n\n return (\n <Fragment>\n <Fieldset classNameModifiers={[label || 'address']} label={label}>\n {showAddressSearch && (\n <AddressSearch\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n onSelect={setSearchData}\n onManualAddress={onManualAddress}\n externalErrorMessage={searchErrorMessage}\n hideManualButton={showAddressFields}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('address.search.contextualText')}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n />\n )}\n {showAddressFields && (\n <Fragment>{addressSchema.map(field => (field instanceof Array ? getWrapper(field) : getComponent(field, {})))}</Fragment>\n )}\n </Fieldset>\n </Fragment>\n );\n}\n\nAddress.defaultProps = {\n countryCode: null,\n validationRules: null,\n data: {},\n onChange: () => {},\n visibility: 'editable',\n requiredFields: ADDRESS_SCHEMA,\n specifications: {},\n onFieldFocusAnalytics: () => {},\n onFieldBlurAnalytics: () => {}\n};\n"],"names":["Address","props","i18n","useCoreContext","label","requiredFields","visibility","iOSFocusedField","showContextualElement","addressRef","useRef","Object","keys","current","length","setComponentRef","specifications","useMemo","Specifications","requiredFieldsSchema","getAddressSchemaForCountryFlat","countryCode","filter","field","includes","hasSelectedAddress","setHasSelectedAddress","useState","useManualAddress","setUseManualAddress","searchErrorMessage","setSearchErrorMessage","showAddressSearch","onAddressLookup","showAddressFields","data","errors","valid","isValid","handleChangeFor","triggerValidation","setData","useForm","schema","defaultData","rules","_object_spread","getAddressValidationRules","validationRules","formatters","addressFormatters","setSearchData","useCallback","selectedAddress","ADDRESS_SCHEMA","forEach","propKey","providedValue","String","onManualAddress","showValidation","get","enabledFields","item","useEffect","stateOrProvince","countryHasDataset","country","FALLBACK_VALUE","newData","_object_spread_props","fieldName","postalCode","stateFieldIsRequired","countryHasStatesDataset","addressShouldHaveState","optionalFields","getOptionalFieldsForCountry","processedData","reduce","acc","cur","isOptional","isRequired","newValue","initialValue","value","onChange","h","ReadOnlyAddress","getComponent","classNameModifiers","FieldContainer","key","allowedCountries","onInput","onBlur","onDropdownChange","maxLength","getMaxLengthByFieldAndCountry","countrySpecificFormatters","trimOnBlur","disabled","onFieldFocusAnalytics","onFieldBlurAnalytics","addressSchema","getAddressSchemaForCountry","Fragment","Fieldset","AddressSearch","onAddressSelected","onSelect","externalErrorMessage","hideManualButton","contextualText","addressSearchDebounceMs","map","Array","div","className","size","defaultProps"],"mappings":"soDAiBe,SAASA,EAAQC,GAC5B,MAAMC,KAAEA,GAASC,KAEXC,MAAEA,EAAQ,GAAEC,eAAEA,EAAcC,WAAEA,EAAUC,gBAAEA,EAAkB,KAAIC,sBAAEA,GAA0BP,EAG5FQ,EAAaC,EAA4B,CAAA,GAG3CT,IAAAA,EADCU,OAAOC,KAAKH,EAAWI,SAASC,SACZ,QAArBb,EAAAA,EAAMc,2BAANd,GAAAA,EAAAA,KAAAA,EAAwBQ,EAAWI,UAGvC,MAAMG,EAAiBC,GAAQ,IAAM,IAAIC,EAAejB,EAAMe,iBAAiB,CAACf,EAAMe,iBAEhFG,EAAuBH,EAAeI,+BAA+BnB,EAAMoB,aAAaC,QAAOC,GAASlB,EAAemB,SAASD,MAE/HE,EAAoBC,GAAyBC,GAAS,IAEtDC,EAAkBC,GAAuBF,GAAS,IAElDG,EAAoBC,GAAyBJ,EAAS,IAEvDK,IAAsB/B,EAAMgC,gBAE5BC,GAAoBjC,EAAMgC,kBAAkBR,GAAsBG,IAElEO,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,EAAOC,gBAAEA,EAAeC,kBAAEA,EAAiBC,QAAEA,GAAYC,EAAqB,CACvGC,OAAQxB,EACRyB,YAAa3C,EAAMkC,KAEnBU,MAAOC,EAAKC,GAAAA,EAA0B/B,GAAoBf,EAAM+C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H,EAAK2D,IAAI,iCACzBsD,wBAAyBlH,EAAMkH,0BAGtCjF,GACGsD,EAACmB,EAAAA,KAAUF,EAAcW,KAAI7F,GAAUA,aAAiB8F,MAxBpE7B,EAAC8B,MAAAA,CAAIC,UAAU,+BAwBwEhG,EAvB5E6F,KAAI,EAAE7F,EAAOiG,KAAU9B,EAAanE,EAAO,CAAEoE,mBAAoB,CAAC,OAAO6B,UAuBY9B,EAAanE,EAAO,QAK5H,CAEAvB,EAAQyH,aAAe,CACnBpG,YAAa,KACb2B,gBAAiB,KACjBb,KAAM,CAAC,EACPoD,SAAU,OACVjF,WAAY,WACZD,eAAgBiD,EAChBtC,eAAgB,CAAC,EACjBuF,sBAAuB,OACvBC,qBAAsB"}
|
|
1
|
+
{"version":3,"file":"Address.js","sources":["../../../../../src/components/internal/Address/Address.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport Fieldset from '../FormFields/Fieldset';\nimport ReadOnlyAddress from './components/ReadOnlyAddress';\nimport { getAddressValidationRules } from './validate';\nimport { addressFormatters, countrySpecificFormatters } from './validate.formats';\nimport { AddressProps } from './types';\nimport { AddressData } from '../../../types/global-types';\nimport FieldContainer from './components/FieldContainer';\nimport useForm from '../../../utils/useForm';\nimport Specifications from './Specifications';\nimport { ADDRESS_SCHEMA, FALLBACK_VALUE } from './constants';\nimport { getMaxLengthByFieldAndCountry } from '../../../utils/validator-utils';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport AddressSearch from './components/AddressSearch';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\nexport default function Address(props: AddressProps) {\n const { i18n } = useCoreContext();\n\n const { label = '', requiredFields, visibility, iOSFocusedField = null, showContextualElement } = props;\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const addressRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(addressRef.current).length) {\n props.setComponentRef?.(addressRef.current);\n }\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n const requiredFieldsSchema = specifications.getAddressSchemaForCountryFlat(props.countryCode).filter(field => requiredFields.includes(field));\n\n const [hasSelectedAddress, setHasSelectedAddress] = useState(false);\n\n const [useManualAddress, setUseManualAddress] = useState(false);\n\n const [searchErrorMessage, setSearchErrorMessage] = useState('');\n\n const showAddressSearch = !!props.onAddressLookup;\n\n const [ignoreCountryChange, setIgnoreCountryChange] = useState(false);\n\n const showAddressFields = props.onAddressLookup ? hasSelectedAddress || useManualAddress : true;\n\n const { data, errors, valid, isValid, handleChangeFor, triggerValidation, setData, mergeData } = useForm<AddressData>({\n schema: requiredFieldsSchema,\n defaultData: props.data,\n // Ensure any passed validation rules are merged with the default ones\n rules: { ...getAddressValidationRules(specifications), ...props.validationRules },\n formatters: addressFormatters\n });\n\n const setSearchData = useCallback(\n (selectedAddress: AddressData) => {\n const propsKeysToProcess = ADDRESS_SCHEMA;\n const newStateData = propsKeysToProcess.reduce((acc: AddressData, propKey) => {\n // Make sure the data provided by the merchant is always strings\n const providedValue = selectedAddress[propKey];\n if (providedValue !== null && providedValue !== undefined) {\n // Cast everything to string\n acc[propKey] = String(providedValue);\n }\n return acc;\n }, {});\n mergeData(newStateData);\n setIgnoreCountryChange(true);\n triggerValidation();\n setHasSelectedAddress(true);\n },\n [setHasSelectedAddress, triggerValidation, setData]\n );\n\n const onManualAddress = useCallback(() => {\n setUseManualAddress(true);\n }, []);\n\n // Expose method expected by (parent) Address.tsx\n addressRef.current.showValidation = () => {\n triggerValidation();\n if (showAddressSearch && !showAddressFields && !isValid) {\n setSearchErrorMessage(i18n.get('address.errors.incomplete'));\n } else {\n setSearchErrorMessage('');\n }\n };\n\n /**\n * For iOS: iOSFocusedField is the name of the element calling for other elements to be disabled\n * - so if it is set (meaning we are in iOS *and* an input has been focussed) only enable the field that corresponds to this element\n */\n const enabledFields: string[] = requiredFieldsSchema.filter(item => {\n return !iOSFocusedField ? true : item === iOSFocusedField;\n });\n\n /**\n * Effect that:\n * - Resets validation for all fields by triggering handleChangeFor(fieldName, 'input')\n * - Applies validation on postalCode field in case it has any value\n */\n useEffect((): void => {\n // if the country was set via setSearchData we don't want to trigger this\n if (ignoreCountryChange) {\n setIgnoreCountryChange(false);\n return;\n }\n\n const stateOrProvince = specifications.countryHasDataset(data.country) ? '' : FALLBACK_VALUE;\n const newData = { ...data, stateOrProvince };\n\n requiredFields.forEach(fieldName => {\n handleChangeFor(fieldName, 'input')(newData[fieldName] ?? '');\n });\n\n if (newData.postalCode) {\n handleChangeFor('postalCode', 'blur')(data.postalCode);\n }\n }, [data.country]);\n\n /**\n * Set the value of 'stateOrProvince' during the initial render if\n * property is provided during the creation of the payment method\n */\n useEffect((): void => {\n const stateFieldIsRequired = requiredFields.includes('stateOrProvince');\n const countryHasStatesDataset = data.country && specifications.countryHasDataset(data.country);\n const addressShouldHaveState = stateFieldIsRequired && countryHasStatesDataset;\n const stateOrProvince = data.stateOrProvince || (addressShouldHaveState ? '' : FALLBACK_VALUE);\n\n handleChangeFor('stateOrProvince', 'input')(stateOrProvince);\n }, []);\n\n useEffect((): void => {\n const optionalFields = specifications.getOptionalFieldsForCountry(data.country);\n const processedData = ADDRESS_SCHEMA.reduce((acc, cur) => {\n const isOptional = optionalFields.includes(cur);\n const isRequired = requiredFields.includes(cur);\n const newValue = data[cur];\n const initialValue = props.data[cur];\n // recover default data values which are not requiredFields, or prefill with 'N/A'\n const fallbackValue = !isRequired && !newValue && !!initialValue ? initialValue : FALLBACK_VALUE;\n const value = (isOptional && !newValue) || !isRequired ? fallbackValue : newValue;\n if (value?.length) acc[cur] = value;\n return acc;\n }, {});\n\n props.onChange({ data: processedData, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n if (visibility === 'hidden') return null;\n if (visibility === 'readOnly') return <ReadOnlyAddress data={data} label={label} />;\n\n const getComponent = (fieldName: string, { classNameModifiers = [] }) => {\n if (!requiredFields.includes(fieldName)) return null;\n\n return (\n <FieldContainer\n key={fieldName}\n allowedCountries={props.allowedCountries}\n classNameModifiers={[...classNameModifiers, fieldName]}\n data={data}\n errors={errors}\n valid={valid}\n fieldName={fieldName}\n onInput={handleChangeFor(fieldName, 'input')}\n onBlur={handleChangeFor(fieldName, 'blur')}\n onDropdownChange={handleChangeFor(fieldName, 'blur')}\n specifications={specifications}\n maxLength={getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country, true)}\n trimOnBlur={true}\n disabled={!enabledFields.includes(fieldName)}\n onFieldFocusAnalytics={props.onFieldFocusAnalytics}\n onFieldBlurAnalytics={props.onFieldBlurAnalytics}\n />\n );\n };\n\n const getWrapper = group => (\n <div className=\"adyen-checkout__field-group\">\n {group.map(([field, size]) => getComponent(field, { classNameModifiers: [`col-${size}`] }))}\n </div>\n );\n\n const addressSchema = specifications.getAddressSchemaForCountry(data.country);\n\n return (\n <Fragment>\n <Fieldset classNameModifiers={[label || 'address']} label={label}>\n {showAddressSearch && (\n <AddressSearch\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n onSelect={setSearchData}\n onManualAddress={onManualAddress}\n externalErrorMessage={searchErrorMessage}\n hideManualButton={showAddressFields}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('address.search.contextualText')}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n />\n )}\n {showAddressFields && (\n <Fragment>{addressSchema.map(field => (field instanceof Array ? getWrapper(field) : getComponent(field, {})))}</Fragment>\n )}\n </Fieldset>\n </Fragment>\n );\n}\n\nAddress.defaultProps = {\n countryCode: null,\n validationRules: null,\n data: {},\n onChange: () => {},\n visibility: 'editable',\n requiredFields: ADDRESS_SCHEMA,\n specifications: {},\n onFieldFocusAnalytics: () => {},\n onFieldBlurAnalytics: () => {}\n};\n"],"names":["Address","props","i18n","useCoreContext","label","requiredFields","visibility","iOSFocusedField","showContextualElement","addressRef","useRef","Object","keys","current","length","setComponentRef","specifications","useMemo","Specifications","requiredFieldsSchema","getAddressSchemaForCountryFlat","countryCode","filter","field","includes","hasSelectedAddress","setHasSelectedAddress","useState","useManualAddress","setUseManualAddress","searchErrorMessage","setSearchErrorMessage","showAddressSearch","onAddressLookup","ignoreCountryChange","setIgnoreCountryChange","showAddressFields","data","errors","valid","isValid","handleChangeFor","triggerValidation","setData","mergeData","useForm","schema","defaultData","rules","_object_spread","getAddressValidationRules","validationRules","formatters","addressFormatters","setSearchData","useCallback","selectedAddress","newStateData","ADDRESS_SCHEMA","reduce","acc","propKey","providedValue","String","onManualAddress","showValidation","get","enabledFields","item","useEffect","stateOrProvince","countryHasDataset","country","FALLBACK_VALUE","newData","_object_spread_props","forEach","fieldName","postalCode","stateFieldIsRequired","countryHasStatesDataset","addressShouldHaveState","optionalFields","getOptionalFieldsForCountry","processedData","cur","isOptional","isRequired","newValue","initialValue","value","onChange","h","ReadOnlyAddress","getComponent","classNameModifiers","FieldContainer","key","allowedCountries","onInput","onBlur","onDropdownChange","maxLength","getMaxLengthByFieldAndCountry","countrySpecificFormatters","trimOnBlur","disabled","onFieldFocusAnalytics","onFieldBlurAnalytics","addressSchema","getAddressSchemaForCountry","Fragment","Fieldset","AddressSearch","onAddressSelected","onSelect","externalErrorMessage","hideManualButton","contextualText","addressSearchDebounceMs","map","Array","div","className","size","defaultProps"],"mappings":"soDAiBe,SAASA,EAAQC,GAC5B,MAAMC,KAAEA,GAASC,KAEXC,MAAEA,EAAQ,GAAEC,eAAEA,EAAcC,WAAEA,EAAUC,gBAAEA,EAAkB,KAAIC,sBAAEA,GAA0BP,EAG5FQ,EAAaC,EAA4B,CAAA,GAG3CT,IAAAA,EADCU,OAAOC,KAAKH,EAAWI,SAASC,SACZ,QAArBb,EAAAA,EAAMc,2BAANd,GAAAA,EAAAA,KAAAA,EAAwBQ,EAAWI,UAGvC,MAAMG,EAAiBC,GAAQ,IAAM,IAAIC,EAAejB,EAAMe,iBAAiB,CAACf,EAAMe,iBAEhFG,EAAuBH,EAAeI,+BAA+BnB,EAAMoB,aAAaC,QAAOC,G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pCuB,OAAQ3D,EAAgBoC,EAAW,QACnCwB,iBAAkB5D,EAAgBoC,EAAW,QAC7C7D,eAAgBA,EAChBsF,UAAWC,EAA8BC,EAA2B3B,EAAWxC,EAAKmC,SACpFiC,YAAY,EACZC,UAAWvC,EAAc3C,SAASqD,GAClC8B,sBAAuB1G,EAAM0G,sBAC7BC,qBAAsB3G,EAAM2G,uBAnBY,KA8B9CC,GAAgB7F,EAAe8F,2BAA2BzE,EAAKmC,SAErE,OACIoB,EAACmB,OACGnB,EAACoB,EAAAA,CAASjB,mBAAoB,CAAC3F,GAAS,WAAYA,MAAOA,GACtD4B,GACG4D,EAACqB,EAAAA,CACGhF,gBAAiBhC,EAAMgC,gBACvBiF,kBAAmBjH,EAAMiH,kBACzBC,SAAU7D,EACVU,gBAAiBA,EACjBoD,qBAAsBtF,EACtBuF,iBAAkBjF,EAClB5B,sBAAuBA,EACvB8G,eAAgBpH,EAAKgE,IAAI,iCACzBqD,wBAAyBtH,EAAMsH,0BAGtCnF,GACGwD,EAACmB,EAAAA,KAAUF,GAAcW,KAAIjG,GAAUA,aAAiBkG,MAxBpE7B,EAAC8B,MAAAA,CAAIC,UAAU,+BAwBwEpG,EAvB5EiG,KAAI,EAAEjG,EAAOqG,KAAU9B,GAAavE,EAAO,CAAEwE,mBAAoB,CAAC,OAAO6B,UAuBY9B,GAAavE,EAAO,QAK5H,CAEAvB,EAAQ6H,aAAe,CACnBxG,YAAa,KACb8B,gBAAiB,KACjBd,KAAM,CAAC,EACPsD,SAAU,OACVrF,WAAY,WACZD,eAAgBqD,EAChB1C,eAAgB,CAAC,EACjB2F,sBAAuB,OACvBC,qBAAsB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";import o from"../Countdown/index.js";import r from"../Button/Button.js";import s from"../Spinner/Spinner.js";import a from"../../../core/Services/payment-status.js";import{processResponse as i}from"../../../core/ProcessResponse/process-response.js";import{copyToClipboard as n}from"../../../utils/clipboard.js";import c from"../../../core/Errors/AdyenCheckoutError.js";import{useCoreContext as p}from"../../../core/Context/CoreProvider.js";import d from"../ContentSeparator/ContentSeparator.js";import l from"../../../core/Context/useImage.js";import{useA11yReporter as m}from"../../../core/Errors/useA11yReporter.js";import u from"../../../utils/useAutoFocus.js";import{ANALYTICS_DOWNLOAD_STR as h,ANALYTICS_QR_CODE_DOWNLOAD as _}from"../../../core/Analytics/constants.js";import{PREFIX as y}from"../Icon/constants.js";function g(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class f extends t{componentDidMount(){this.statusInterval()}componentWillUnmount(){clearTimeout(this.timeoutId)}pollStatus(t){clearTimeout(this.timeoutId),this.timeoutId=setTimeout((async()=>{const t=performance.now();await this.checkStatus();const e=performance.now();this.statusInterval(Math.round(e-t))}),t)}render({amount:t,url:a,brandLogo:i,brandName:c,countdownTime:g,type:f,onActionHandled:k},{expired:
|
|
1
|
+
import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";import o from"../Countdown/index.js";import r from"../Button/Button.js";import s from"../Spinner/Spinner.js";import a from"../../../core/Services/payment-status.js";import{processResponse as i}from"../../../core/ProcessResponse/process-response.js";import{copyToClipboard as n}from"../../../utils/clipboard.js";import c from"../../../core/Errors/AdyenCheckoutError.js";import{useCoreContext as p}from"../../../core/Context/CoreProvider.js";import d from"../ContentSeparator/ContentSeparator.js";import l from"../../../core/Context/useImage.js";import{useA11yReporter as m}from"../../../core/Errors/useA11yReporter.js";import u from"../../../utils/useAutoFocus.js";import{ANALYTICS_DOWNLOAD_STR as h,ANALYTICS_QR_CODE_DOWNLOAD as _}from"../../../core/Analytics/constants.js";import{PREFIX as y}from"../Icon/constants.js";function g(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class f extends t{componentDidMount(){this.statusInterval()}componentWillUnmount(){clearTimeout(this.timeoutId)}pollStatus(t){clearTimeout(this.timeoutId),this.timeoutId=setTimeout((async()=>{const t=performance.now();await this.checkStatus();const e=performance.now();this.statusInterval(Math.round(e-t))}),t)}render({amount:t,url:a,brandLogo:i,brandName:c,countdownTime:g,type:f,onActionHandled:k},{expired:v,completed:q,loading:b}){var C,N,w,T;const{i18n:I,loadingContext:j}=p(),S=l(),x=this.props.qrCodeData?`${j}barcode.shtml?barcodeType=qrCode&fileType=png&data=${this.props.qrCodeData}`:this.props.qrCodeImage,E=(t,o)=>{const r=I.get(o);return m(r),e("div",{className:"adyen-checkout__qr-loader adyen-checkout__qr-loader--result"},e("img",{className:"adyen-checkout__qr-loader__icon adyen-checkout__qr-loader__icon--result",src:S({imageFolder:"components/"})(t),alt:r}),e("div",{className:"adyen-checkout__qr-loader__subtitle"},r))};if(v)return E("error","error.subtitle.payment");if(q)return E("success","creditCard.success");if(b)return e("div",{className:"adyen-checkout__qr-loader"},i&&e("div",{className:"adyen-checkout__qr-loader__brand-logo-wrapper"},e("img",{alt:c,src:i,className:"adyen-checkout__qr-loader__brand-logo"})),e(s,null));const P=I.get(this.props.timeToPay).split("%@"),D=u(),A=this.props.classNameModifiers.map((t=>`adyen-checkout__qr-loader--${t}`));return e("div",{className:`adyen-checkout__qr-loader adyen-checkout__qr-loader--${f} ${A.join(" ")}`},i&&e("div",{className:"adyen-checkout__qr-loader__brand-logo-wrapper"},e("img",{src:i,alt:c,className:"adyen-checkout__qr-loader__brand-logo"})),t&&t.value&&t.currency&&e("div",{className:"adyen-checkout__qr-loader__payment_amount"},I.amount(t.value,t.currency)),a&&e("div",{className:"adyen-checkout__qr-loader__app-link"},this.props.redirectIntroduction&&e("div",{className:"adyen-checkout__qr-loader__subtitle"},I.get(this.props.redirectIntroduction)),e(r,{classNameModifiers:["qr-loader"],onClick:()=>this.redirectToApp(a),label:I.get(this.props.buttonLabel)}),e(d,null)),e("div",{ref:D,tabIndex:0,className:"adyen-checkout__qr-loader__subtitle"},"string"==typeof this.props.introduction?I.get(this.props.introduction):null===(C=(N=this.props).introduction)||void 0===C?void 0:C.call(N)),e("img",{src:x,alt:I.get("wechatpay.scanqrcode"),onLoad:()=>{null==k||k({componentType:this.props.type,actionDescription:"qr-code-loaded"})}}),e("div",{className:"adyen-checkout__qr-loader__progress"},e("span",{className:"adyen-checkout__qr-loader__percentage",style:{width:`${this.state.percentage}%`}})),e("div",{className:"adyen-checkout__qr-loader__countdown"},P[0]," ",e(o,{minutesFromNow:g,onTick:this.onTick,onCompleted:this.onTimeUp})," ",P[1]),this.props.instructions&&e("div",{className:"adyen-checkout__qr-loader__instructions"},"string"==typeof this.props.instructions?I.get(this.props.instructions):null===(w=(T=this.props).instructions)||void 0===w?void 0:w.call(T)),this.props.copyBtn&&e("div",{className:"adyen-checkout__qr-loader__actions"},e(r,{inline:!0,variant:"action",onClick:(t,{complete:e})=>{n(this.props.qrCodeData),this.props.onSubmitAnalytics({type:h,target:_}),e()},icon:S({imageFolder:"components/"})(`${y}copy`),label:I.get("button.copy")})))}constructor(t){super(t),g(this,"timeoutId",void 0),g(this,"redirectToApp",(t=>{window.location.assign(t)})),g(this,"statusInterval",((t=0)=>{if(this.state.expired||this.state.completed)return;this.setState((e=>({timePassed:e.timePassed+this.props.delay+t})));const e=this.state.timePassed>=this.props.throttleTime?this.props.throttledInterval:this.state.delay;this.pollStatus(e)})),g(this,"onTick",(t=>{this.setState({percentage:t.percentage})})),g(this,"onTimeUp",(()=>{this.setState({expired:!0}),clearTimeout(this.timeoutId),this.props.onError(new c("ERROR","Payment Expired"))})),g(this,"onComplete",(t=>{clearTimeout(this.timeoutId),this.setState({completed:!0,loading:!1});const e={data:{details:{payload:t.props.payload},paymentData:this.props.paymentData}};this.props.onComplete(e,this)})),g(this,"onError",(t=>{if(clearTimeout(this.timeoutId),this.setState({expired:!0,loading:!1}),t.props.payload){const e={data:{details:{payload:t.props.payload},paymentData:this.props.paymentData}};this.props.onComplete(e,this)}const e=new c("ERROR","error result with no payload in response");return this.props.onError(e)})),g(this,"checkStatus",(()=>{const{paymentData:t,clientKey:e,loadingContext:o,throttledInterval:r}=this.props;return a(t,e,o,r).then(i).catch((t=>({type:"network-error",props:t}))).then((t=>{switch(t.type){case"success":this.onComplete(t);break;case"error":this.onError(t);break;default:this.setState({loading:!1})}return t}))})),this.state={buttonStatus:"default",completed:!1,delay:t.delay,expired:!1,loading:!0,percentage:100,timePassed:0}}}g(f,"defaultProps",{delay:2e3,countdownTime:15,onError:()=>{},onComplete:()=>{},throttleTime:6e4,classNameModifiers:[],throttledInterval:1e4,introduction:"wechatpay.scanqrcode",timeToPay:"wechatpay.timetopay",buttonLabel:"openApp"});export{f as default};
|
|
2
2
|
//# sourceMappingURL=QRLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRLoader.js","sources":["../../../../../src/components/internal/QRLoader/QRLoader.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport Countdown from '../Countdown';\nimport Button from '../Button';\nimport Spinner from '../Spinner';\nimport checkPaymentStatus from '../../../core/Services/payment-status';\nimport processResponse from '../../../core/ProcessResponse';\n\nimport './QRLoader.scss';\nimport { QRLoaderProps, QRLoaderState } from './types';\nimport copyToClipboard from '../../../utils/clipboard';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport ContentSeparator from '../ContentSeparator';\nimport { StatusObject } from '../Await/types';\nimport useImage from '../../../core/Context/useImage';\nimport { useA11yReporter } from '../../../core/Errors/useA11yReporter';\nimport useAutoFocus from '../../../utils/useAutoFocus';\nimport { ANALYTICS_DOWNLOAD_STR, ANALYTICS_QR_CODE_DOWNLOAD } from '../../../core/Analytics/constants';\nimport { PREFIX } from '../Icon/constants';\n\nconst QRCODE_URL = 'barcode.shtml?barcodeType=qrCode&fileType=png&data=';\n\nclass QRLoader extends Component<QRLoaderProps, QRLoaderState> {\n private timeoutId;\n\n constructor(props) {\n super(props);\n\n this.state = {\n buttonStatus: 'default',\n completed: false,\n delay: props.delay,\n expired: false,\n loading: true,\n percentage: 100,\n timePassed: 0\n };\n }\n\n public static defaultProps = {\n delay: 2000,\n countdownTime: 15,\n onError: () => {},\n onComplete: () => {},\n throttleTime: 60000,\n classNameModifiers: [],\n throttledInterval: 10000,\n introduction: 'wechatpay.scanqrcode',\n timeToPay: 'wechatpay.timetopay',\n buttonLabel: 'openApp'\n };\n\n componentDidMount() {\n this.statusInterval();\n }\n\n componentWillUnmount() {\n clearTimeout(this.timeoutId);\n }\n\n public redirectToApp = (url: string | URL) => {\n window.location.assign(url);\n };\n\n // Retry until getting a complete response from the server, or it times out\n public statusInterval = (responseTime = 0) => {\n // If we are already in the final statuses, do not poll!\n if (this.state.expired || this.state.completed) return;\n\n this.setState(previous => ({ timePassed: previous.timePassed + this.props.delay + responseTime }));\n // Changes interval time to 10 seconds after 1 minute (60 seconds)\n const newDelay = this.state.timePassed >= this.props.throttleTime ? this.props.throttledInterval : this.state.delay;\n this.pollStatus(newDelay);\n };\n\n private pollStatus(delay: number) {\n clearTimeout(this.timeoutId);\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.timeoutId = setTimeout(async () => {\n // Wait for previous status call to finish.\n // Also taking the server response time into the consideration to calculate timePassed.\n const start = performance.now();\n await this.checkStatus();\n const end = performance.now();\n this.statusInterval(Math.round(end - start));\n }, delay);\n }\n\n private onTick = (time): void => {\n this.setState({ percentage: time.percentage });\n };\n\n private onTimeUp = (): void => {\n this.setState({ expired: true });\n clearTimeout(this.timeoutId);\n this.props.onError(new AdyenCheckoutError('ERROR', 'Payment Expired'));\n };\n\n private onComplete = (status: StatusObject): void => {\n clearTimeout(this.timeoutId);\n this.setState({ completed: true, loading: false });\n\n const state = {\n data: {\n details: { payload: status.props.payload },\n paymentData: this.props.paymentData\n }\n };\n\n this.props.onComplete(state, this);\n };\n\n private onError = (status: StatusObject): void => {\n clearTimeout(this.timeoutId);\n this.setState({ expired: true, loading: false });\n\n if (status.props.payload) {\n const state = {\n data: {\n details: { payload: status.props.payload },\n paymentData: this.props.paymentData\n }\n };\n this.props.onComplete(state, this);\n }\n\n const error = new AdyenCheckoutError('ERROR', 'error result with no payload in response');\n return this.props.onError(error);\n };\n\n private checkStatus = () => {\n const { paymentData, clientKey, loadingContext, throttledInterval } = this.props;\n\n return checkPaymentStatus(paymentData, clientKey, loadingContext, throttledInterval)\n .then(processResponse)\n .catch(response => ({ type: 'network-error', props: response }))\n .then((status: StatusObject) => {\n switch (status.type) {\n case 'success':\n this.onComplete(status);\n break;\n case 'error':\n this.onError(status);\n break;\n default:\n this.setState({ loading: false });\n }\n return status;\n });\n };\n\n render({ amount, url, brandLogo, brandName, countdownTime, type, onActionHandled }: QRLoaderProps, { expired, completed, loading }) {\n const { i18n, loadingContext } = useCoreContext();\n const getImage = useImage();\n const qrCodeImage = this.props.qrCodeData ? `${loadingContext}${QRCODE_URL}${this.props.qrCodeData}` : this.props.qrCodeImage;\n const finalState = (image, message) => {\n const status = i18n.get(message);\n useA11yReporter(status);\n return (\n <div className=\"adyen-checkout__qr-loader adyen-checkout__qr-loader--result\">\n <img\n className=\"adyen-checkout__qr-loader__icon adyen-checkout__qr-loader__icon--result\"\n src={getImage({ imageFolder: 'components/' })(image)}\n alt={status}\n />\n <div className=\"adyen-checkout__qr-loader__subtitle adyen-checkout__qr-loader__subtitle--result\">{status}</div>\n </div>\n );\n };\n\n if (expired) {\n return finalState('error', 'error.subtitle.payment');\n }\n\n if (completed) {\n return finalState('success', 'creditCard.success');\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__qr-loader\">\n {brandLogo && <img alt={brandName} src={brandLogo} className=\"adyen-checkout__qr-loader__brand-logo\" />}\n <Spinner />\n </div>\n );\n }\n\n const timeToPayString = i18n.get(this.props.timeToPay).split('%@');\n\n const qrSubtitleRef = useAutoFocus();\n const classnames = this.props.classNameModifiers.map(m => `adyen-checkout__qr-loader--${m}`);\n\n return (\n <div className={`adyen-checkout__qr-loader adyen-checkout__qr-loader--${type} ${classnames.join(' ')}`}>\n {brandLogo && <img src={brandLogo} alt={brandName} className=\"adyen-checkout__qr-loader__brand-logo\" />}\n\n {amount && amount.value && amount.currency && (\n <div className=\"adyen-checkout__qr-loader__payment_amount\">{i18n.amount(amount.value, amount.currency)}</div>\n )}\n\n {url && (\n <div className=\"adyen-checkout__qr-loader__app-link\">\n {this.props.redirectIntroduction && (\n <div className=\"adyen-checkout__qr-loader__subtitle\">{i18n.get(this.props.redirectIntroduction)}</div>\n )}\n <Button classNameModifiers={['qr-loader']} onClick={() => this.redirectToApp(url)} label={i18n.get(this.props.buttonLabel)} />\n <ContentSeparator />\n </div>\n )}\n\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div ref={qrSubtitleRef} tabIndex={0} className=\"adyen-checkout__qr-loader__subtitle\">\n {i18n.get(this.props.introduction)}\n </div>\n\n <img\n src={qrCodeImage}\n alt={i18n.get('wechatpay.scanqrcode')}\n onLoad={() => {\n onActionHandled?.({\n componentType: this.props.type,\n actionDescription: 'qr-code-loaded'\n });\n }}\n />\n\n <div className=\"adyen-checkout__qr-loader__progress\">\n <span className=\"adyen-checkout__qr-loader__percentage\" style={{ width: `${this.state.percentage}%` }} />\n </div>\n\n <div className=\"adyen-checkout__qr-loader__countdown\">\n {timeToPayString[0]} \n <Countdown minutesFromNow={countdownTime} onTick={this.onTick} onCompleted={this.onTimeUp} />\n {timeToPayString[1]}\n </div>\n\n {typeof this.props.instructions === 'string' ? (\n <div className=\"adyen-checkout__qr-loader__instructions\">{i18n.get(this.props.instructions)}</div>\n ) : (\n this.props.instructions?.()\n )}\n\n {this.props.copyBtn && (\n <div className=\"adyen-checkout__qr-loader__actions\">\n <Button\n inline\n variant=\"action\"\n onClick={(e, { complete }) => {\n copyToClipboard(this.props.qrCodeData);\n this.props.onSubmitAnalytics({\n type: ANALYTICS_DOWNLOAD_STR,\n target: ANALYTICS_QR_CODE_DOWNLOAD\n });\n complete();\n }}\n icon={getImage({ imageFolder: 'components/' })(`${PREFIX}copy`)}\n label={i18n.get('button.copy')}\n />\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default QRLoader;\n"],"names":["QRLoader","Component","componentDidMount","this","statusInterval","componentWillUnmount","clearTimeout","timeoutId","pollStatus","delay","setTimeout","async","start","performance","now","checkStatus","end","Math","round","render","amount","url","brandLogo","brandName","countdownTime","type","onActionHandled","expired","completed","loading","_this_props_instructions","_this_props","i18n","loadingContext","useCoreContext","getImage","useImage","qrCodeImage","props","qrCodeData","finalState","image","message","status","get","useA11yReporter","h","div","className","img","src","imageFolder","alt","Spinner","timeToPayString","timeToPay","split","qrSubtitleRef","useAutoFocus","classnames","classNameModifiers","map","m","join","value","currency","redirectIntroduction","Button","onClick","redirectToApp","label","buttonLabel","ContentSeparator","ref","tabIndex","introduction","onLoad","componentType","actionDescription","span","style","width","state","percentage","Countdown","minutesFromNow","onTick","onCompleted","onTimeUp","instructions","call","copyBtn","inline","variant","e","complete","copyToClipboard","onSubmitAnalytics","ANALYTICS_DOWNLOAD_STR","target","ANALYTICS_QR_CODE_DOWNLOAD","icon","PREFIX","constructor","super","_define_property","window","location","assign","responseTime","setState","previous","timePassed","newDelay","throttleTime","throttledInterval","time","onError","AdyenCheckoutError","onComplete","data","details","payload","paymentData","error","clientKey","checkPaymentStatus","then","processResponse","catch","response","buttonStatus","defaultProps"],"mappings":"mgCAsBA,MAAMA,UAAiBC,EA8BnBC,iBAAAA,GACIC,KAAKC,gBACT,CAEAC,oBAAAA,GACIC,aAAaH,KAAKI,UACtB,CAiBQC,UAAAA,CAAWC,GACfH,aAAaH,KAAKI,WAGlBJ,KAAKI,UAAYG,YAAWC,UAGxB,MAAMC,EAAQC,YAAYC,YACpBX,KAAKY,cACX,MAAMC,EAAMH,YAAYC,MACxBX,KAAKC,eAAea,KAAKC,MAAMF,EAAMJ,GAAAA,GACtCH,EACP,CAiEAU,MAAAA,EAAOC,OAAEA,EAAMC,IAAEA,EAAGC,UAAEA,EAASC,UAAEA,EAAS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AAS,IAEpCc,EAAOL,MAAMoF,QAAS,CACtB,MAAMxC,EAAQ,CACVsC,KAAM,CACFC,QAAS,CAAEC,QAAS/E,EAAOL,MAAMoF,SACjCC,YAAaxH,KAAKmC,MAAMqF,cAGhCxH,KAAKmC,MAAMiF,WAAWrC,EAAO/E,KACjC,CAEA,MAAMyH,EAAQ,IAAIN,EAAmB,QAAS,4CAC9C,OAAOnH,KAAKmC,MAAM+E,QAAQO,EAAAA,IAG9BnB,EAAAtG,KAAQY,eAAc,KAClB,MAAM4G,YAAEA,EAAWE,UAAEA,EAAS5F,eAAEA,EAAckF,kBAAEA,GAAsBhH,KAAKmC,MAE3E,OAAOwF,EAAmBH,EAAaE,EAAW5F,EAAgBkF,GAC7DY,KAAKC,GACLC,OAAMC,IAAa,CAAEzG,KAAM,gBAAiBa,MAAO4F,MACnDH,MAAMpF,IACH,OAAQA,EAAOlB,MACX,IAAK,UACDtB,KAAKoH,WAAW5E,GAChB,MACJ,IAAK,QACDxC,KAAKkH,QAAQ1E,GACb,MACJ,QACIxC,KAAK2G,SAAS,CAAEjF,SAAS,IAEjC,OAAOc,CAAAA,GACX,IAzHJxC,KAAK+E,MAAQ,CACTiD,aAAc,UACdvG,WAAW,EACXnB,MAAO6B,EAAM7B,MACbkB,SAAS,EACTE,SAAS,EACTsD,WAAY,IACZ6B,WAAY,EAEpB,EAEAP,EAjBEzG,EAiBYoI,eAAe,CACzB3H,MAAO,IACPe,cAAe,GACf6F,QAAS,OACTE,WAAY,OACZL,aAAc,IACdtD,mBAAoB,GACpBuD,kBAAmB,IACnBxC,aAAc,uBACdpB,UAAW,sBACXgB,YAAa"}
|
|
1
|
+
{"version":3,"file":"QRLoader.js","sources":["../../../../../src/components/internal/QRLoader/QRLoader.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport Countdown from '../Countdown';\nimport Button from '../Button';\nimport Spinner from '../Spinner';\nimport checkPaymentStatus from '../../../core/Services/payment-status';\nimport processResponse from '../../../core/ProcessResponse';\n\nimport './QRLoader.scss';\nimport { QRLoaderProps, QRLoaderState } from './types';\nimport copyToClipboard from '../../../utils/clipboard';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport ContentSeparator from '../ContentSeparator';\nimport { StatusObject } from '../Await/types';\nimport useImage from '../../../core/Context/useImage';\nimport { useA11yReporter } from '../../../core/Errors/useA11yReporter';\nimport useAutoFocus from '../../../utils/useAutoFocus';\nimport { ANALYTICS_DOWNLOAD_STR, ANALYTICS_QR_CODE_DOWNLOAD } from '../../../core/Analytics/constants';\nimport { PREFIX } from '../Icon/constants';\n\nconst QRCODE_URL = 'barcode.shtml?barcodeType=qrCode&fileType=png&data=';\n\nclass QRLoader extends Component<QRLoaderProps, QRLoaderState> {\n private timeoutId;\n\n constructor(props) {\n super(props);\n\n this.state = {\n buttonStatus: 'default',\n completed: false,\n delay: props.delay,\n expired: false,\n loading: true,\n percentage: 100,\n timePassed: 0\n };\n }\n\n public static defaultProps = {\n delay: 2000,\n countdownTime: 15,\n onError: () => {},\n onComplete: () => {},\n throttleTime: 60000,\n classNameModifiers: [],\n throttledInterval: 10000,\n introduction: 'wechatpay.scanqrcode',\n timeToPay: 'wechatpay.timetopay',\n buttonLabel: 'openApp'\n };\n\n componentDidMount() {\n this.statusInterval();\n }\n\n componentWillUnmount() {\n clearTimeout(this.timeoutId);\n }\n\n public redirectToApp = (url: string | URL) => {\n window.location.assign(url);\n };\n\n // Retry until getting a complete response from the server, or it times out\n public statusInterval = (responseTime = 0) => {\n // If we are already in the final statuses, do not poll!\n if (this.state.expired || this.state.completed) return;\n\n this.setState(previous => ({ timePassed: previous.timePassed + this.props.delay + responseTime }));\n // Changes interval time to 10 seconds after 1 minute (60 seconds)\n const newDelay = this.state.timePassed >= this.props.throttleTime ? this.props.throttledInterval : this.state.delay;\n this.pollStatus(newDelay);\n };\n\n private pollStatus(delay: number) {\n clearTimeout(this.timeoutId);\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.timeoutId = setTimeout(async () => {\n // Wait for previous status call to finish.\n // Also taking the server response time into the consideration to calculate timePassed.\n const start = performance.now();\n await this.checkStatus();\n const end = performance.now();\n this.statusInterval(Math.round(end - start));\n }, delay);\n }\n\n private onTick = (time): void => {\n this.setState({ percentage: time.percentage });\n };\n\n private onTimeUp = (): void => {\n this.setState({ expired: true });\n clearTimeout(this.timeoutId);\n this.props.onError(new AdyenCheckoutError('ERROR', 'Payment Expired'));\n };\n\n private onComplete = (status: StatusObject): void => {\n clearTimeout(this.timeoutId);\n this.setState({ completed: true, loading: false });\n\n const state = {\n data: {\n details: { payload: status.props.payload },\n paymentData: this.props.paymentData\n }\n };\n\n this.props.onComplete(state, this);\n };\n\n private onError = (status: StatusObject): void => {\n clearTimeout(this.timeoutId);\n this.setState({ expired: true, loading: false });\n\n if (status.props.payload) {\n const state = {\n data: {\n details: { payload: status.props.payload },\n paymentData: this.props.paymentData\n }\n };\n this.props.onComplete(state, this);\n }\n\n const error = new AdyenCheckoutError('ERROR', 'error result with no payload in response');\n return this.props.onError(error);\n };\n\n private checkStatus = () => {\n const { paymentData, clientKey, loadingContext, throttledInterval } = this.props;\n\n return checkPaymentStatus(paymentData, clientKey, loadingContext, throttledInterval)\n .then(processResponse)\n .catch(response => ({ type: 'network-error', props: response }))\n .then((status: StatusObject) => {\n switch (status.type) {\n case 'success':\n this.onComplete(status);\n break;\n case 'error':\n this.onError(status);\n break;\n default:\n this.setState({ loading: false });\n }\n return status;\n });\n };\n\n render({ amount, url, brandLogo, brandName, countdownTime, type, onActionHandled }: QRLoaderProps, { expired, completed, loading }) {\n const { i18n, loadingContext } = useCoreContext();\n const getImage = useImage();\n const qrCodeImage = this.props.qrCodeData ? `${loadingContext}${QRCODE_URL}${this.props.qrCodeData}` : this.props.qrCodeImage;\n const finalState = (image, message) => {\n const status = i18n.get(message);\n useA11yReporter(status);\n return (\n <div className=\"adyen-checkout__qr-loader adyen-checkout__qr-loader--result\">\n <img\n className=\"adyen-checkout__qr-loader__icon adyen-checkout__qr-loader__icon--result\"\n src={getImage({ imageFolder: 'components/' })(image)}\n alt={status}\n />\n <div className=\"adyen-checkout__qr-loader__subtitle\">{status}</div>\n </div>\n );\n };\n\n if (expired) {\n return finalState('error', 'error.subtitle.payment');\n }\n\n if (completed) {\n return finalState('success', 'creditCard.success');\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__qr-loader\">\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img alt={brandName} src={brandLogo} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n <Spinner />\n </div>\n );\n }\n\n const timeToPayString = i18n.get(this.props.timeToPay).split('%@');\n\n const qrSubtitleRef = useAutoFocus();\n const classnames = this.props.classNameModifiers.map(m => `adyen-checkout__qr-loader--${m}`);\n\n return (\n <div className={`adyen-checkout__qr-loader adyen-checkout__qr-loader--${type} ${classnames.join(' ')}`}>\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img src={brandLogo} alt={brandName} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n\n {amount && amount.value && amount.currency && (\n <div className=\"adyen-checkout__qr-loader__payment_amount\">{i18n.amount(amount.value, amount.currency)}</div>\n )}\n\n {url && (\n <div className=\"adyen-checkout__qr-loader__app-link\">\n {this.props.redirectIntroduction && (\n <div className=\"adyen-checkout__qr-loader__subtitle\">{i18n.get(this.props.redirectIntroduction)}</div>\n )}\n <Button classNameModifiers={['qr-loader']} onClick={() => this.redirectToApp(url)} label={i18n.get(this.props.buttonLabel)} />\n <ContentSeparator />\n </div>\n )}\n\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div ref={qrSubtitleRef} tabIndex={0} className=\"adyen-checkout__qr-loader__subtitle\">\n {typeof this.props.introduction === 'string' ? i18n.get(this.props.introduction) : this.props.introduction?.()}\n </div>\n\n <img\n src={qrCodeImage}\n alt={i18n.get('wechatpay.scanqrcode')}\n onLoad={() => {\n onActionHandled?.({\n componentType: this.props.type,\n actionDescription: 'qr-code-loaded'\n });\n }}\n />\n\n <div className=\"adyen-checkout__qr-loader__progress\">\n <span className=\"adyen-checkout__qr-loader__percentage\" style={{ width: `${this.state.percentage}%` }} />\n </div>\n\n <div className=\"adyen-checkout__qr-loader__countdown\">\n {timeToPayString[0]} \n <Countdown minutesFromNow={countdownTime} onTick={this.onTick} onCompleted={this.onTimeUp} />\n {timeToPayString[1]}\n </div>\n\n {this.props.instructions && (\n <div className=\"adyen-checkout__qr-loader__instructions\">\n {typeof this.props.instructions === 'string' ? i18n.get(this.props.instructions) : this.props.instructions?.()}\n </div>\n )}\n\n {this.props.copyBtn && (\n <div className=\"adyen-checkout__qr-loader__actions\">\n <Button\n inline\n variant=\"action\"\n onClick={(e, { complete }) => {\n copyToClipboard(this.props.qrCodeData);\n this.props.onSubmitAnalytics({\n type: ANALYTICS_DOWNLOAD_STR,\n target: ANALYTICS_QR_CODE_DOWNLOAD\n });\n complete();\n }}\n icon={getImage({ imageFolder: 'components/' })(`${PREFIX}copy`)}\n label={i18n.get('button.copy')}\n />\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default QRLoader;\n"],"names":["QRLoader","Component","componentDidMount","this","statusInterval","componentWillUnmount","clearTimeout","timeoutId","pollStatus","delay","setTimeout","async","start","performance","now","checkStatus","end","Math","round","render","amount","url","brandLogo","brandName","countdownTime","type","onActionHandled","expired","completed","loading","_this_props_introduction","_this_props","_this_props_instructions","_this_props1","i18n","loadingContext","useCoreContext","getImage","useImage","qrCodeImage","props","qrCodeData","finalState","image","message","status","get","useA11yReporter","h","div","className","img","src","imageFolder","alt","Spinner","timeToPayString","timeToPay","split","qrSubtitleRef","useAutoFocus","classnames","classNameModifiers","map","m","join","value","currency","redirectIntroduction","Button","onClick","redirectToApp","label","buttonLabel","ContentSeparator","ref","tabIndex","introduction","call","onLoad","componentType","actionDescription","span","style","width","state","percentage","Countdown","minutesFromNow","onTick","onCompleted","onTimeUp","instructions","copyBtn","inline","variant","e","complete","copyToClipboard","onSubmitAnalytics","ANALYTICS_DOWNLOAD_STR","target","ANALYTICS_QR_CODE_DOWNLOAD","icon","PREFIX","constructor","super","_define_property","window","location","assign","responseTime","setState","previous","timePassed","newDelay","throttleTime","throttledInterval","time","onError","AdyenCheckoutError","onComplete","data","details","payload","paymentData","error","clientKey","checkPaymentStatus","then","processResponse","catch","response","buttonStatus","defaultProps"],"mappings":"mgCAsBA,MAAMA,UAAiBC,EA8BnBC,iBAAAA,GACIC,KAAKC,gBACT,CAEAC,oBAAAA,GACIC,aAAaH,KAAKI,UACtB,CAiBQC,UAAAA,CAAWC,GACfH,aAAaH,KAAKI,WAGlBJ,KAAKI,UAAYG,YAAWC,UAGxB,MAAMC,EAAQC,YAAYC,YACpBX,KAAKY,cACX,MAAMC,EAAMH,YAAYC,MACxBX,KAAKC,eAAea,KAAKC,MAAMF,EAAMJ,GAAAA,GACtCH,EACP,CAiEAU,MAAAA,EAAOC,OAAEA,EAAMC,IAAEA,EAAGC,UAAEA,EAASC,UAAEA,EAASC,cAAEA,EAAaC,KAAEA,EAAIC,gBAAEA,IAAkCC,QAAEA,EAAOC,UAAEA,EAASC,QAAEA,IAqEtB,IAAAC,EAAAC,EA0BIC,EAAAC,EA9FnG,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,IAC3BC,EAAWC,IACXC,EAAcpC,KAAKqC,MAAMC,WAAa,GAAGN,uDAA8BhC,KAAKqC,MAAMC,aAAetC,KAAKqC,MAAMD,YAC5GG,EAAa,CAACC,EAAOC,KACvB,MAAMC,EAASX,EAAKY,IAAIF,GAExB,OADAG,EAAgBF,GAEZG,EAACC,MAAAA,CAAIC,UAAU,+DACXF,EAACG,MAAAA,CACGD,UAAU,0EACVE,IAAKf,EAAS,CAAEgB,YAAa,eAAxBhB,CAAyCM,GAC9CW,IAAKT,IAETG,EAACC,MAAAA,CAAIC,UAAU,uCAA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BnB,EAAAxG,KAAQY,eAAc,KAClB,MAAM8G,YAAEA,EAAWE,UAAEA,EAAS5F,eAAEA,EAAckF,kBAAEA,GAAsBlH,KAAKqC,MAE3E,OAAOwF,EAAmBH,EAAaE,EAAW5F,EAAgBkF,GAC7DY,KAAKC,GACLC,OAAMC,IAAa,CAAE3G,KAAM,gBAAiBe,MAAO4F,MACnDH,MAAMpF,IACH,OAAQA,EAAOpB,MACX,IAAK,UACDtB,KAAKsH,WAAW5E,GAChB,MACJ,IAAK,QACD1C,KAAKoH,QAAQ1E,GACb,MACJ,QACI1C,KAAK6G,SAAS,CAAEnF,SAAS,IAEjC,OAAOgB,CAAAA,GACX,IAzHJ1C,KAAKkF,MAAQ,CACTgD,aAAc,UACdzG,WAAW,EACXnB,MAAO+B,EAAM/B,MACbkB,SAAS,EACTE,SAAS,EACTyD,WAAY,IACZ4B,WAAY,EAEpB,EAEAP,EAjBE3G,EAiBYsI,eAAe,CACzB7H,MAAO,IACPe,cAAe,GACf+F,QAAS,OACTE,WAAY,OACZL,aAAc,IACdtD,mBAAoB,GACpBuD,kBAAmB,IACnBxC,aAAc,uBACdpB,UAAW,sBACXgB,YAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleIOSTouchEvents.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.ts"],"sourcesContent":["import { selectOne } from '../../utilities/dom';\nimport ua from '../utils/userAgent';\nimport { on, off } from '../../../../../../utils/listenerUtils';\n\nconst getCaretPos = (pNode: HTMLInputElement | HTMLTextAreaElement): number => {\n if ('selectionStart' in pNode) {\n return pNode.selectionStart;\n }\n return 0;\n};\n\n/**\n * Detect if touched element is an input or textArea.\n * - If it is do some quirky shit to set focus and caret position on this element\n * - Else do some quirky shit to make the iOS keyboard retract\n *\n * Always then remove this listener and set var saying we have done so (read in CSF...handleFocus)\n * Tell all securedFields some other element now has focus so they can blur themselves\n *\n * @param e -\n */\nfunction touchendListener(e: Event): void {\n const targetEl: EventTarget = e.target;\n\n // If other element is Input or TextArea\n if (targetEl instanceof HTMLInputElement || (HTMLTextAreaElement && targetEl instanceof HTMLTextAreaElement)) {\n // Force caret to show - 'requires' resetting field's value\n const val: string = targetEl.value;\n\n let caretPos: number = getCaretPos(targetEl);\n\n let adjFlag = false;\n\n // For some annoying, iOS Safari, reason if caretPos is at the end of the string then it won't show up\n // - so first decrease it; then set it again, asynchronously\n if (caretPos === val.length) {\n caretPos -= 1;\n adjFlag = true;\n }\n\n targetEl.value = val;\n\n /**\n * If the input element is of an unexpected type (perhaps the merchant is using a custom button that is an input element, type=\"button\", or,\n * it is something presented in the 3DS2 flow - both, TBC) then this next line will not work.\n * However, the input element still has a setSelectionRange property of type \"function\", but trying to call it will throw an error...\n * so, try, to see if setSelectionRange can be called\n */\n try {\n if (targetEl.setSelectionRange) {\n targetEl.focus();\n targetEl.setSelectionRange(caretPos, caretPos);\n\n // Quirky! (see comment about iOS Safari, above)\n if (adjFlag) {\n caretPos += 1;\n setTimeout(() => {\n targetEl.setSelectionRange(caretPos, caretPos);\n }, 0);\n }\n }\n /* eslint-disable-next-line */\n } catch (e) {}\n } else {\n /**\n * Workaround for iOS/Safari bug where keypad doesn't retract when SF paymentMethod is no longer active\n */\n const hasKeypadFix: boolean = this.config.keypadFix; // to avoid linting no-lonely-if\n if (hasKeypadFix) {\n // Create an input we can add focus to.\n // Otherwise 2nd & sub times the caret gets left in the SF even though it has lost focus and cannot be typed into\n const rootNode: HTMLElement = this.props.rootNode;\n const nuInput: HTMLInputElement = document.createElement('input');\n nuInput.style.width = '1px';\n nuInput.style.height = '1px';\n nuInput.style.opacity = '0';\n nuInput.style.fontSize = '18px'; // prevents zoom\n rootNode.appendChild(nuInput);\n nuInput.focus(); // Takes caret from SF\n rootNode.removeChild(nuInput); // Without this numpad will be replaced with text pad\n }\n }\n\n // Remove listener - it gets reset by next call to handleAdditionalFields from handleFocus\n this.destroyTouchendListener()
|
|
1
|
+
{"version":3,"file":"handleIOSTouchEvents.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.ts"],"sourcesContent":["import { selectOne } from '../../utilities/dom';\nimport ua from '../utils/userAgent';\nimport { on, off } from '../../../../../../utils/listenerUtils';\n\nconst getCaretPos = (pNode: HTMLInputElement | HTMLTextAreaElement): number => {\n if ('selectionStart' in pNode) {\n return pNode.selectionStart;\n }\n return 0;\n};\n\n/**\n * Detect if touched element is an input or textArea.\n * - If it is do some quirky shit to set focus and caret position on this element\n * - Else do some quirky shit to make the iOS keyboard retract\n *\n * Always then remove this listener and set var saying we have done so (read in CSF...handleFocus)\n * Tell all securedFields some other element now has focus so they can blur themselves\n *\n * @param e -\n */\nfunction touchendListener(e: Event): void {\n const targetEl: EventTarget = e.target;\n\n // If other element is Input or TextArea\n if (targetEl instanceof HTMLInputElement || (HTMLTextAreaElement && targetEl instanceof HTMLTextAreaElement)) {\n // Force caret to show - 'requires' resetting field's value\n const val: string = targetEl.value;\n\n let caretPos: number = getCaretPos(targetEl);\n\n let adjFlag = false;\n\n // For some annoying, iOS Safari, reason if caretPos is at the end of the string then it won't show up\n // - so first decrease it; then set it again, asynchronously\n if (caretPos === val.length) {\n caretPos -= 1;\n adjFlag = true;\n }\n\n targetEl.value = val;\n\n /**\n * If the input element is of an unexpected type (perhaps the merchant is using a custom button that is an input element, type=\"button\", or,\n * it is something presented in the 3DS2 flow - both, TBC) then this next line will not work.\n * However, the input element still has a setSelectionRange property of type \"function\", but trying to call it will throw an error...\n * so, try, to see if setSelectionRange can be called\n */\n try {\n if (targetEl.setSelectionRange) {\n targetEl.focus();\n targetEl.setSelectionRange(caretPos, caretPos);\n\n // Quirky! (see comment about iOS Safari, above)\n if (adjFlag) {\n caretPos += 1;\n setTimeout(() => {\n targetEl.setSelectionRange(caretPos, caretPos);\n }, 0);\n }\n }\n /* eslint-disable-next-line */\n } catch (e) {}\n } else {\n /**\n * Workaround for iOS/Safari bug where keypad doesn't retract when SF paymentMethod is no longer active\n */\n const hasKeypadFix: boolean = this.config.keypadFix; // to avoid linting no-lonely-if\n if (hasKeypadFix) {\n // Create an input we can add focus to.\n // Otherwise 2nd & sub times the caret gets left in the SF even though it has lost focus and cannot be typed into\n const rootNode: HTMLElement = this.props.rootNode;\n const nuInput: HTMLInputElement = document.createElement('input');\n nuInput.style.width = '1px';\n nuInput.style.height = '1px';\n nuInput.style.opacity = '0';\n nuInput.style.fontSize = '18px'; // prevents zoom\n rootNode.appendChild(nuInput);\n nuInput.focus(); // Takes caret from SF\n rootNode.removeChild(nuInput); // Without this numpad will be replaced with text pad\n }\n }\n\n // Remove listener - it gets reset by next call to handleAdditionalFields from handleFocus\n this.destroyTouchendListener();\n\n // Store the fact we have unset the listener\n this.state.registerFieldForIos = false;\n\n // Clear focus on secured field inputs now this checkout element has gained focus\n this.postMessageToAllIframes({ fieldType: 'webInternalElement', fieldClick: true });\n}\n\n/**\n * re. Disabling arrow keys in iOS - need to enable all fields in the form and tell SFs to disable\n *\n * NOTE: Only called when iOS detected & this.props.shouldDisableIOSArrowKeys = true\n */\nfunction touchstartListener(e: Event): void {\n this.hasGenuineTouchEvents = true;\n const targetEl: EventTarget = e.target;\n // If other element is Input or Span (i.e. label text) TODO apply to other types of el?\n if (targetEl instanceof HTMLInputElement || targetEl instanceof HTMLSpanElement) {\n this.postMessageToAllIframes({ fieldType: 'webInternalElement', checkoutTouchEvent: true });\n\n const name = targetEl.getAttribute('name') ?? targetEl.getAttribute('data-id'); // if targetEl is a label's span it will only have a data-id\n this.callbacks.onTouchstartIOS?.({ fieldType: 'webInternalElement', name });\n }\n}\n\n/**\n * This works with the touchend handler to allow us to catch (click) events on non-securedFields elements\n * (re. http://gravitydept.com/blog/js-click-event-bubbling-on-ios - events don't bubble unless the click takes place on a link or input)\n *\n * We can use this event to:\n * 1. Set focus on these other elements, and\n * 2. Tell SecuredFields that this has happened so they can blur themselves\n * (see note in adyen-secured-fields...inputBase.js - \"Blur event never fires on input field\")\n *\n * NOTE: Only called when iOS detected\n */\nfunction handleTouchend(): void {\n const bodyEl: HTMLBodyElement = selectOne(document, 'body');\n bodyEl.style.cursor = 'pointer';\n\n on(bodyEl, 'touchend', this.touchendListener);\n\n // Store the fact we have set the listener\n this.state.registerFieldForIos = true;\n}\n\nfunction destroyTouchendListener(): boolean {\n if (!ua.__IS_IOS) return false; // For when fn is called as result of destroy being called on main csf instance\n\n const bodyEl: HTMLBodyElement = selectOne(document, 'body');\n bodyEl.style.cursor = 'auto';\n off(bodyEl, 'touchend', this.touchendListener);\n return true;\n}\n\nfunction destroyTouchstartListener(): boolean {\n if (!ua.__IS_IOS) return false; // For when fn is called as result of destroy being called on main csf instance\n\n off(document, 'touchstart', this.touchstartListener);\n return true;\n}\n\nexport default {\n touchendListener,\n touchstartListener,\n handleTouchend,\n destroyTouchendListener,\n destroyTouchstartListener\n};\n"],"names":["handleIOSTouchEvents","touchendListener","e","targetEl","target","HTMLInputElement","HTMLTextAreaElement","val","value","caretPos","pNode","selectionStart","adjFlag","length","setSelectionRange","focus","setTimeout","this","config","keypadFix","rootNode","props","nuInput","document","createElement","style","width","height","opacity","fontSize","appendChild","removeChild","destroyTouchendListener","state","registerFieldForIos","postMessageToAllIframes","fieldType","fieldClick","touchstartListener","hasGenuineTouchEvents","HTMLSpanElement","_this_callbacks_onTouchstartIOS","_this_callbacks","checkoutTouchEvent","name","getAttribute","callbacks","onTouchstartIOS","call","handleTouchend","bodyEl","selectOne","cursor","on","ua","__IS_IOS","off","destroyTouchstartListener"],"mappings":"+JAmJA,IAAeA,EAAA,CACXC,iBA/HJ,SAA0BC,GACtB,MAAMC,EAAwBD,EAAEE,OAGhC,GAAID,aAAoBE,kBAAqBC,qBAAuBH,aAAoBG,oBAAsB,CAE1G,MAAMC,EAAcJ,EAASK,MAE7B,IAAIC,EAxBJ,mBADaC,EAyBsBP,GAvB5BO,EAAMC,eAEV,EAuBCC,GAAU,EAIVH,IAAaF,EAAIM,SACjBJ,GAAY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