@adyen/adyen-web 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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/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/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/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/BcmcMobile/BcmcMobile.js +1 -1
- package/dist/es-legacy/components/BcmcMobile/BcmcMobile.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/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/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 +4 -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":"OpenInvoiceContainer.js","sources":["../../../../../src/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport OpenInvoice from '../../internal/OpenInvoice';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { OpenInvoiceConfiguration } from './types';\n\nexport default class OpenInvoiceContainer extends UIElement<OpenInvoiceConfiguration> {\n protected static defaultProps: Partial<OpenInvoiceConfiguration> = {\n onChange: () => {},\n data: { companyDetails: {}, personalDetails: {}, billingAddress: {}, deliveryAddress: {}, bankAccount: {} },\n visibility: {\n companyDetails: 'hidden',\n personalDetails: 'editable',\n billingAddress: 'editable',\n deliveryAddress: 'editable',\n bankAccount: 'hidden'\n }\n };\n\n /**\n * Returns whether the component state is valid or not\n */\n get isValid() {\n return !!this.state.isValid;\n }\n\n /**\n * Formats props on construction time\n */\n formatProps(props) {\n const country = props.countryCode || props.data?.billingAddress?.countryCode;\n\n return {\n ...props,\n allowedCountries: [country],\n visibility: {\n ...OpenInvoiceContainer.defaultProps.visibility,\n ...props.visibility\n },\n data: {\n ...props.data,\n billingAddress: {\n ...props.data.billingAddress,\n country\n },\n deliveryAddress: {\n ...props.data.deliveryAddress,\n country\n }\n }\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const { data = {} } = this.state;\n const { companyDetails = {}, personalDetails = {}, billingAddress, deliveryAddress, bankAccount } = data;\n\n return {\n paymentMethod: {\n type: this.constructor['type']\n },\n ...personalDetails,\n ...companyDetails,\n ...(bankAccount && {\n bankAccount: {\n iban: bankAccount.ibanNumber,\n ownerName: bankAccount.ownerName,\n countryCode: bankAccount.countryCode\n }\n }),\n ...(billingAddress && { billingAddress }),\n ...((deliveryAddress || billingAddress) && { deliveryAddress: deliveryAddress || billingAddress })\n };\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <OpenInvoice\n setComponentRef={this.setComponentRef}\n {...this.props}\n {...this.state}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n"],"names":["OpenInvoiceContainer","UIElement","
|
|
1
|
+
{"version":3,"file":"OpenInvoiceContainer.js","sources":["../../../../../src/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport OpenInvoice from '../../internal/OpenInvoice';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { OpenInvoiceConfiguration } from './types';\n\nexport default class OpenInvoiceContainer extends UIElement<OpenInvoiceConfiguration> {\n protected static defaultProps: Partial<OpenInvoiceConfiguration> = {\n onChange: () => {},\n data: { companyDetails: {}, personalDetails: {}, billingAddress: {}, deliveryAddress: {}, bankAccount: {} },\n visibility: {\n companyDetails: 'hidden',\n personalDetails: 'editable',\n billingAddress: 'editable',\n deliveryAddress: 'editable',\n bankAccount: 'hidden'\n }\n };\n\n /**\n * Returns whether the component state is valid or not\n */\n get isValid() {\n return !!this.state.isValid;\n }\n\n /**\n * Formats props on construction time\n */\n formatProps(props) {\n const country = props.countryCode || props.data?.billingAddress?.countryCode;\n\n return {\n ...props,\n allowedCountries: [country],\n visibility: {\n ...OpenInvoiceContainer.defaultProps.visibility,\n ...props.visibility\n },\n data: {\n ...props.data,\n billingAddress: {\n ...props.data.billingAddress,\n country\n },\n deliveryAddress: {\n ...props.data.deliveryAddress,\n country\n }\n }\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const { data = {} } = this.state;\n const { companyDetails = {}, personalDetails = {}, billingAddress, deliveryAddress, bankAccount } = data;\n\n return {\n paymentMethod: {\n type: this.constructor['type']\n },\n ...personalDetails,\n ...companyDetails,\n ...(bankAccount && {\n bankAccount: {\n iban: bankAccount.ibanNumber,\n ownerName: bankAccount.ownerName,\n countryCode: bankAccount.countryCode\n }\n }),\n ...(billingAddress && { billingAddress }),\n ...((deliveryAddress || billingAddress) && { deliveryAddress: deliveryAddress || billingAddress })\n };\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <OpenInvoice\n setComponentRef={this.setComponentRef}\n {...this.props}\n {...this.state}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n"],"names":["OpenInvoiceContainer","UIElement","isValid","this","state","formatProps","props","country","countryCode","data","billingAddress","allowedCountries","visibility","defaultProps","deliveryAddress","formatData","companyDetails","personalDetails","bankAccount","paymentMethod","type","constructor","iban","ibanNumber","ownerName","render","h","CoreProvider","i18n","loadingContext","resources","SRPanelProvider","srPanel","modules","OpenInvoice","setComponentRef","onChange","setState","onSubmit","submit","payButton"],"mappings":"+TAOe,MAAMA,UAA6BC,EAgB9C,WAAIC,GACA,QAASC,KAAKC,MAAMF,OACxB,CAKAG,WAAAA,CAAYC,GACR,MAAMC,EAAUD,EAAME,aAAeF,EAAMG,MAAMC,gBAAgBF,YAEjE,MAAO,IACAF,EACHK,iBAAkB,CAACJ,GACnBK,WAAY,IACLZ,EAAqBa,aAAaD,cAClCN,EAAMM,YAEbH,KAAM,IACCH,EAAMG,KACTC,eAAgB,IACTJ,EAAMG,KAAKC,eACdH,WAEJO,gBAAiB,IACVR,EAAMG,KAAKK,gBACdP,YAIhB,CAKAQ,UAAAA,GACI,MAAMN,KAAEA,EAAO,CAAA,GAAON,KAAKC,OACrBY,eAAEA,EAAiB,CAAE,EAAAC,gBAAEA,EAAkB,CAAA,EAAEP,eAAEA,EAAcI,gBAAEA,EAAeI,YAAEA,GAAgBT,EAEpG,MAAO,CACHU,cAAe,CACXC,KAAMjB,KAAKkB,YAAmB,SAE/BJ,KACAD,KACCE,GAAe,CACfA,YAAa,CACTI,KAAMJ,EAAYK,WAClBC,UAAWN,EAAYM,UACvBhB,YAAaU,EAAYV,iBAG7BE,GAAkB,CAAEA,sBACnBI,GAAmBJ,IAAmB,CAAEI,gBAAiBA,GAAmBJ,GAEzF,CAEAe,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMzB,KAAKG,MAAMsB,KAAMC,eAAgB1B,KAAKG,MAAMuB,eAAgBC,UAAW3B,KAAK2B,WAC5FJ,EAACK,EAAAA,CAAgBC,QAAS7B,KAAKG,MAAM2B,QAAQD,SACzCN,EAACQ,EAAAA,CACGC,gBAAiBhC,KAAKgC,mBAClBhC,KAAKG,SACLH,KAAKC,MACTgC,SAAUjC,KAAKkC,SACfC,SAAUnC,KAAKoC,OACfC,UAAWrC,KAAKqC,aAKpC,cAtFmE,CAC/DJ,SAAU,OACV3B,KAAM,CAAEO,eAAgB,CAAC,EAAGC,gBAAiB,CAAC,EAAGP,eAAgB,CAAC,EAAGI,gBAAiB,CAAC,EAAGI,YAAa,CAAC,GACxGN,WAAY,CACRI,eAAgB,SAChBC,gBAAiB,WACjBP,eAAgB,WAChBI,gBAAiB,WACjBI,YAAa,cARJL,oBADAb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as
|
|
1
|
+
import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as e}from"../../internal/UIElement/UIElement.js";import o from"../../internal/QRLoader/QRLoader.js";import{CoreProvider as r}from"../../../core/Context/CoreProvider.js";import n from"../../internal/RedirectButton/RedirectButton.js";import s from"../../../core/Errors/SRPanelProvider.js";class i extends e{formatData(){return{paymentMethod:{type:this.type,...this.state.data}}}get isValid(){return!0}renderQRCode(){return t(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(s,{srPanel:this.props.modules.srPanel},t(o,{ref:t=>{this.componentRef=t},...this.props,type:this.constructor.type,brandLogo:this.props.brandLogo||this.icon,delay:this.props.delay,onComplete:this.onComplete,countdownTime:this.props.countdownTime,instructions:this.props.instructions,onActionHandled:this.onActionHandled,brandName:this.displayName,onSubmitAnalytics:this.submitAnalytics})))}render(){return this.props.paymentData?this.renderQRCode():this.props.showPayButton?t(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(n,{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}})):null}}var a,p,l;l={qrCodeImage:"",amount:null,paymentData:null,onError:()=>{},onComplete:()=>{}},(p="defaultProps")in(a=i)?Object.defineProperty(a,p,{value:l,enumerable:!0,configurable:!0,writable:!0}):a[p]=l;export{i as default};
|
|
2
2
|
//# sourceMappingURL=QRLoaderContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRLoaderContainer.js","sources":["../../../../../src/components/helpers/QRLoaderContainer/QRLoaderContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport QRLoader from '../../internal/QRLoader';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport RedirectButton from '../../internal/RedirectButton';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { QRLoaderConfiguration } from './types';\n\nclass QRLoaderContainer<T extends QRLoaderConfiguration = QRLoaderConfiguration> extends UIElement<T> {\n // Using the generic here allow to fully extend the QRLoaderContainer (including it's props)\n protected static defaultProps = {\n qrCodeImage: '',\n amount: null,\n paymentData: null,\n onError: () => {},\n onComplete: () => {}\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...this.state.data\n }\n };\n }\n\n get isValid() {\n return true;\n }\n\n // Makes possible to extend the final QR code step\n public renderQRCode() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <QRLoader\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n type={this.constructor['type']}\n brandLogo={this.props.brandLogo || this.icon}\n delay={this.props.delay}\n onComplete={this.onComplete}\n countdownTime={this.props.countdownTime}\n instructions={this.props.instructions}\n onActionHandled={this.onActionHandled}\n brandName={this.displayName}\n onSubmitAnalytics={this.submitAnalytics}\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n\n render() {\n if (this.props.paymentData) {\n return this.renderQRCode();\n }\n\n if (this.props.showPayButton) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n </CoreProvider>\n );\n }\n\n return null;\n }\n}\n\nexport default QRLoaderContainer;\n"],"names":["QRLoaderContainer","UIElement","
|
|
1
|
+
{"version":3,"file":"QRLoaderContainer.js","sources":["../../../../../src/components/helpers/QRLoaderContainer/QRLoaderContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport QRLoader from '../../internal/QRLoader';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport RedirectButton from '../../internal/RedirectButton';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { QRLoaderConfiguration } from './types';\n\nclass QRLoaderContainer<T extends QRLoaderConfiguration = QRLoaderConfiguration> extends UIElement<T> {\n // Using the generic here allow to fully extend the QRLoaderContainer (including it's props)\n protected static defaultProps = {\n qrCodeImage: '',\n amount: null,\n paymentData: null,\n onError: () => {},\n onComplete: () => {}\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...this.state.data\n }\n };\n }\n\n get isValid() {\n return true;\n }\n\n // Makes possible to extend the final QR code step\n public renderQRCode() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <QRLoader\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n type={this.constructor['type']}\n brandLogo={this.props.brandLogo || this.icon}\n delay={this.props.delay}\n onComplete={this.onComplete}\n countdownTime={this.props.countdownTime}\n instructions={this.props.instructions}\n onActionHandled={this.onActionHandled}\n brandName={this.displayName}\n onSubmitAnalytics={this.submitAnalytics}\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n\n render() {\n if (this.props.paymentData) {\n return this.renderQRCode();\n }\n\n if (this.props.showPayButton) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n </CoreProvider>\n );\n }\n\n return null;\n }\n}\n\nexport default QRLoaderContainer;\n"],"names":["QRLoaderContainer","UIElement","formatData","paymentMethod","type","this","state","data","isValid","renderQRCode","h","CoreProvider","i18n","props","loadingContext","resources","SRPanelProvider","srPanel","modules","QRLoader","ref","componentRef","constructor","brandLogo","icon","delay","onComplete","countdownTime","instructions","onActionHandled","brandName","displayName","onSubmitAnalytics","submitAnalytics","render","paymentData","showPayButton","RedirectButton","name","onSubmit","submit","payButton","qrCodeImage","amount","onError","defaultProps"],"mappings":"wXAQA,MAAMA,UAAmFC,EAUrFC,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMC,KAAKD,QACRC,KAAKC,MAAMC,MAG1B,CAEA,WAAIC,GACA,OAAO,CACX,CAGOC,YAAAA,GACH,OACIC,EAACC,EAAAA,CAAaC,KAAMP,KAAKQ,MAAMD,KAAME,eAAgBT,KAAKQ,MAAMC,eAAgBC,UAAWV,KAAKU,WAC5FL,EAACM,EAAAA,CAAgBC,QAASZ,KAAKQ,MAAMK,QAAQD,SACzCP,EAACS,EAAAA,CACGC,IAAKA,IACDf,KAAKgB,aAAeD,CAAAA,KAEpBf,KAAKQ,MACTT,KAAMC,KAAKiB,YAAmB,KAC9BC,UAAWlB,KAAKQ,MAAMU,WAAalB,KAAKmB,KACxCC,MAAOpB,KAAKQ,MAAMY,MAClBC,WAAYrB,KAAKqB,WACjBC,cAAetB,KAAKQ,MAAMc,cAC1BC,aAAcvB,KAAKQ,MAAMe,aACzBC,gBAAiBxB,KAAKwB,gBACtBC,UAAWzB,KAAK0B,YAChBC,kBAAmB3B,KAAK4B,mBAK5C,CAEAC,MAAAA,GACI,OAAI7B,KAAKQ,MAAMsB,YACJ9B,KAAKI,eAGZJ,KAAKQ,MAAMuB,cAEP1B,EAACC,EAAAA,CAAaC,KAAMP,KAAKQ,MAAMD,KAAME,eAAgBT,KAAKQ,MAAMC,eAAgBC,UAAWV,KAAKU,WAC5FL,EAAC2B,EAAAA,CACGD,cAAe/B,KAAKQ,MAAMuB,cAC1BE,KAAMjC,KAAK0B,YACXQ,SAAUlC,KAAKmC,OACfC,UAAWpC,KAAKoC,UAChBrB,IAAKA,IACDf,KAAKgB,aAAeD,CAAAA,KAOjC,IACX,cApEgC,CAC5BsB,YAAa,GACbC,OAAQ,KACRR,YAAa,KACbS,QAAS,OACTlB,WAAY,WALCmB,oBAFf7C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as r,useCallback as a,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import l from"./components/ReadOnlyAddress.js";import{getAddressValidationRules as d}from"./validate.js";import{addressFormatters as c,countrySpecificFormatters as u}from"./validate.formats.js";import m from"./components/FieldContainer.js";import p from"../../../utils/useForm/useForm.js";import f from"./Specifications.js";import{FALLBACK_VALUE as y,ADDRESS_SCHEMA as F}from"./constants.js";import{getMaxLengthByFieldAndCountry as h}from"../../../utils/validator-utils.js";import{useCoreContext as C}from"../../../core/Context/CoreProvider.js";import g from"./components/AddressSearch.js";function A(A){const{i18n:v}=C(),{label:b="",requiredFields:j,visibility:x,iOSFocusedField:S=null,showContextualElement:k}=A,M=s({});Object.keys(M.current).length||A.setComponentRef?.(M.current);const O=o((()=>new f(A.specifications)),[A.specifications]),
|
|
1
|
+
import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as r,useCallback as a,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import l from"./components/ReadOnlyAddress.js";import{getAddressValidationRules as d}from"./validate.js";import{addressFormatters as c,countrySpecificFormatters as u}from"./validate.formats.js";import m from"./components/FieldContainer.js";import p from"../../../utils/useForm/useForm.js";import f from"./Specifications.js";import{FALLBACK_VALUE as y,ADDRESS_SCHEMA as F}from"./constants.js";import{getMaxLengthByFieldAndCountry as h}from"../../../utils/validator-utils.js";import{useCoreContext as C}from"../../../core/Context/CoreProvider.js";import g from"./components/AddressSearch.js";function A(A){const{i18n:v}=C(),{label:b="",requiredFields:j,visibility:x,iOSFocusedField:S=null,showContextualElement:k}=A,M=s({});Object.keys(M.current).length||A.setComponentRef?.(M.current);const O=o((()=>new f(A.specifications)),[A.specifications]),D=O.getAddressSchemaForCountryFlat(A.countryCode).filter((e=>j.includes(e))),[w,B]=r(!1),[E,N]=r(!1),[P,L]=r(""),R=!!A.onAddressLookup,[V,q]=r(!1),H=!A.onAddressLookup||(w||E),{data:T,errors:_,valid:I,isValid:$,handleChangeFor:z,triggerValidation:G,setData:J,mergeData:K}=p({schema:D,defaultData:A.data,rules:{...d(O),...A.validationRules},formatters:c}),Q=a((e=>{const t=F.reduce(((t,s)=>{const o=e[s];return null!=o&&(t[s]=String(o)),t}),{});K(t),q(!0),G(),B(!0)}),[B,G,J]),U=a((()=>{N(!0)}),[]);M.current.showValidation=()=>{G(),L(!R||H||$?"":v.get("address.errors.incomplete"))};const W=D.filter((e=>!S||e===S));if(n((()=>{if(V)return void q(!1);const e=O.countryHasDataset(T.country)?"":y,t={...T,stateOrProvince:e};j.forEach((e=>{z(e,"input")(t[e]??"")})),t.postalCode&&z("postalCode","blur")(T.postalCode)}),[T.country]),n((()=>{const e=j.includes("stateOrProvince"),t=T.country&&O.countryHasDataset(T.country),s=e&&t,o=T.stateOrProvince||(s?"":y);z("stateOrProvince","input")(o)}),[]),n((()=>{const e=O.getOptionalFieldsForCountry(T.country),t=F.reduce(((t,s)=>{const o=e.includes(s),r=j.includes(s),a=T[s],n=A.data[s],i=o&&!a||!r?r||a||!n?y:n:a;return i?.length&&(t[s]=i),t}),{});A.onChange({data:t,valid:I,errors:_,isValid:$})}),[T,I,_,$]),"hidden"===x)return null;if("readOnly"===x)return e(l,{data:T,label:b});const X=(t,{classNameModifiers:s=[]})=>j.includes(t)?e(m,{key:t,allowedCountries:A.allowedCountries,classNameModifiers:[...s,t],data:T,errors:_,valid:I,fieldName:t,onInput:z(t,"input"),onBlur:z(t,"blur"),onDropdownChange:z(t,"blur"),specifications:O,maxLength:h(u,t,T.country),trimOnBlur:!0,disabled:!W.includes(t),onFieldFocusAnalytics:A.onFieldFocusAnalytics,onFieldBlurAnalytics:A.onFieldBlurAnalytics}):null,Y=O.getAddressSchemaForCountry(T.country);return e(t,null,e(i,{classNameModifiers:[b||"address"],label:b},R&&e(g,{onAddressLookup:A.onAddressLookup,onAddressSelected:A.onAddressSelected,onSelect:Q,onManualAddress:U,externalErrorMessage:P,hideManualButton:H,showContextualElement:k,contextualText:v.get("address.search.contextualText"),addressSearchDebounceMs:A.addressSearchDebounceMs}),H&&e(t,null,Y.map((t=>t instanceof Array?e("div",{className:"adyen-checkout__field-group"},t.map((([e,t])=>X(e,{classNameModifiers:[`col-${t}`]})))):X(t,{}))))))}A.defaultProps={countryCode:null,validationRules:null,data:{},onChange:()=>{},visibility:"editable",requiredFields:F,specifications:{},onFieldFocusAnalytics:()=>{},onFieldBlurAnalytics:()=>{}};export{A 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","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","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":"u1BAiBe,SAASA,EAAQC,GAC5B,MAAMC,KAAEA,GAASC,KAEXC,MAAEA,EAAQ,GAAEC,eAAEA,EAAcC,WAAEA,EAAUC,gBAAEA,EAAkB,KAAIC,sBAAEA,GAA0BP,EAG5FQ,EAAaC,EAA4B,CAAA,GAE1CC,OAAOC,KAAKH,EAAWI,SAASC,QACjCb,EAAMc,kBAAkBN,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EAAWlC,EAAK+B,SACpFiC,YAAY,EACZC,UAAWvC,EAAcrC,SAAS6C,GAClCgC,sBAAuBpG,EAAMoG,sBAC7BC,qBAAsBrG,EAAMqG,uBAnBY,KA8B9CC,EAAgBvF,EAAewF,2BAA2BrE,EAAK+B,SAErE,OACIoB,EAACmB,OACGnB,EAACoB,EAAAA,CAASjB,mBAAoB,CAACrF,GAAS,WAAYA,MAAOA,GACtD4B,GACGsD,EAACqB,EAAAA,CACG1E,gBAAiBhC,EAAMgC,gBACvB2E,kBAAmB3G,EAAM2G,kBACzBC,SAAU3D,EACVQ,gBAAiBA,EACjBoD,qBAAsBhF,EACtBiF,iBAAkB7E,EAClB1B,sBAAuBA,EACvBwG,eAAgB9G,EAAK0D,IAAI,iCACzBqD,wBAAyBhH,EAAMgH,0BAGtC/E,GACGoD,EAACmB,EAAAA,KAAUF,EAAcW,KAAI3F,GAAUA,aAAiB4F,MAxBpE7B,EAAC8B,MAAAA,CAAIC,UAAU,+BAwBwE9F,EAvB5E2F,KAAI,EAAE3F,EAAO+F,KAAU9B,EAAajE,EAAO,CAAEkE,mBAAoB,CAAC,OAAO6B,UAuBY9B,EAAajE,EAAO,QAK5H,CAEAvB,EAAQuH,aAAe,CACnBlG,YAAa,KACb0B,gBAAiB,KACjBZ,KAAM,CAAC,EACPkD,SAAU,OACV/E,WAAY,WACZD,eAAgBgD,EAChBrC,eAAgB,CAAC,EACjBqF,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","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","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":"u1BA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ZD,eAAgBoD,EAChBzC,eAAgB,CAAC,EACjByF,sBAAuB,OACvBC,qBAAsB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ADDRESS_SPECIFICATIONS as
|
|
1
|
+
import{ADDRESS_SPECIFICATIONS as e}from"./constants.js";class t{countryHasDataset(e){return!!this.specifications?.[e]?.hasDataset}countryHasOptionalField(e,t){return!!this.specifications?.[e]?.optionalFields?.includes(t)}getAddressSchemaForCountry(e){return this.specifications?.[e]?.schema||this.specifications.default.schema}getAddressLabelsForCountry(e){return this.specifications?.[e]?.labels||this.specifications.default.labels}getOptionalFieldsForCountry(e){return this.specifications?.[e]?.optionalFields||this.specifications.default?.optionalFields||[]}getKeyForField(e,t){return this.specifications?.[t]?.labels?.[e]||this.specifications?.default?.labels?.[e]||e}getPlaceholderKeyForField(e,t){return this.specifications?.[t]?.placeholders?.[e]||this.specifications?.default?.placeholders?.[e]}getAddressSchemaForCountryFlat(e){return this.getAddressSchemaForCountry(e).flat(2).filter((e=>"string"==typeof e))}constructor(t){var i,s,a;a=void 0,(s="specifications")in(i=this)?Object.defineProperty(i,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[s]=a,this.specifications={...e,...t}}}export{t as default};
|
|
2
2
|
//# sourceMappingURL=Specifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Specifications.js","sources":["../../../../../src/components/internal/Address/Specifications.ts"],"sourcesContent":["import { AddressSchema, AddressSpecifications, StringObject } from './types';\nimport { ADDRESS_SPECIFICATIONS } from './constants';\nimport { AddressField } from '../../../types/global-types';\n\nconst SCHEMA_MAX_DEPTH = 2;\n\nclass Specifications {\n private specifications: AddressSpecifications;\n\n constructor(specifications?) {\n this.specifications = { ...ADDRESS_SPECIFICATIONS, ...specifications };\n }\n\n /**\n * Checks if a certain country has a dataset.\n * @param country - The selected country\n * @returns Boolean\n */\n countryHasDataset(country: string): boolean {\n return !!this.specifications?.[country]?.hasDataset;\n }\n\n /**\n * Checks if a certain country has the passed field in their optional fields array.\n * @param country - The selected country\n * @param fieldName - The field to be checked\n * @returns Boolean\n */\n countryHasOptionalField(country: string, fieldName: string): boolean {\n return !!this.specifications?.[country]?.optionalFields?.includes(fieldName as any);\n }\n\n /**\n * Returns the address schema of the selected country or the default address schema.\n * @param country - The selected country\n * @returns AddressSchema\n */\n getAddressSchemaForCountry(country: string): AddressSchema {\n return this.specifications?.[country]?.schema || this.specifications.default.schema;\n }\n\n /**\n * Returns the address labels of the selected country or the default address labels.\n * @param country - The selected country\n * @returns StringObject\n */\n getAddressLabelsForCountry(country: string): StringObject {\n return this.specifications?.[country]?.labels || this.specifications.default.labels;\n }\n\n /**\n * Returns the optional fields of the selected country or the default optional fields.\n * @param country - The selected country\n * @returns Optional fields array\n */\n getOptionalFieldsForCountry(country: string): string[] {\n return this.specifications?.[country]?.optionalFields || this.specifications.default?.optionalFields || [];\n }\n\n /**\n * Returns the key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.labels?.[fieldName] || this.specifications?.default?.labels?.[fieldName] || fieldName;\n }\n\n /**\n * Returns the placeholder key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getPlaceholderKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.placeholders?.[fieldName] || this.specifications?.default?.placeholders?.[fieldName];\n }\n\n /**\n * Returns an array with the address schema of the selected country or the default address schema\n * Flat version of getAddressSchemaForCountry\n * @param country - The selected country\n * @returns Array\n */\n getAddressSchemaForCountryFlat(country: string): AddressField[] {\n return this.getAddressSchemaForCountry(country)\n .flat(SCHEMA_MAX_DEPTH)\n .filter((element): element is AddressField => typeof element === 'string');\n }\n}\n\nexport default Specifications;\n"],"names":["Specifications","
|
|
1
|
+
{"version":3,"file":"Specifications.js","sources":["../../../../../src/components/internal/Address/Specifications.ts"],"sourcesContent":["import { AddressSchema, AddressSpecifications, StringObject } from './types';\nimport { ADDRESS_SPECIFICATIONS } from './constants';\nimport { AddressField } from '../../../types/global-types';\n\nconst SCHEMA_MAX_DEPTH = 2;\n\nclass Specifications {\n private specifications: AddressSpecifications;\n\n constructor(specifications?) {\n this.specifications = { ...ADDRESS_SPECIFICATIONS, ...specifications };\n }\n\n /**\n * Checks if a certain country has a dataset.\n * @param country - The selected country\n * @returns Boolean\n */\n countryHasDataset(country: string): boolean {\n return !!this.specifications?.[country]?.hasDataset;\n }\n\n /**\n * Checks if a certain country has the passed field in their optional fields array.\n * @param country - The selected country\n * @param fieldName - The field to be checked\n * @returns Boolean\n */\n countryHasOptionalField(country: string, fieldName: string): boolean {\n return !!this.specifications?.[country]?.optionalFields?.includes(fieldName as any);\n }\n\n /**\n * Returns the address schema of the selected country or the default address schema.\n * @param country - The selected country\n * @returns AddressSchema\n */\n getAddressSchemaForCountry(country: string): AddressSchema {\n return this.specifications?.[country]?.schema || this.specifications.default.schema;\n }\n\n /**\n * Returns the address labels of the selected country or the default address labels.\n * @param country - The selected country\n * @returns StringObject\n */\n getAddressLabelsForCountry(country: string): StringObject {\n return this.specifications?.[country]?.labels || this.specifications.default.labels;\n }\n\n /**\n * Returns the optional fields of the selected country or the default optional fields.\n * @param country - The selected country\n * @returns Optional fields array\n */\n getOptionalFieldsForCountry(country: string): string[] {\n return this.specifications?.[country]?.optionalFields || this.specifications.default?.optionalFields || [];\n }\n\n /**\n * Returns the key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.labels?.[fieldName] || this.specifications?.default?.labels?.[fieldName] || fieldName;\n }\n\n /**\n * Returns the placeholder key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getPlaceholderKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.placeholders?.[fieldName] || this.specifications?.default?.placeholders?.[fieldName];\n }\n\n /**\n * Returns an array with the address schema of the selected country or the default address schema\n * Flat version of getAddressSchemaForCountry\n * @param country - The selected country\n * @returns Array\n */\n getAddressSchemaForCountryFlat(country: string): AddressField[] {\n return this.getAddressSchemaForCountry(country)\n .flat(SCHEMA_MAX_DEPTH)\n .filter((element): element is AddressField => typeof element === 'string');\n }\n}\n\nexport default Specifications;\n"],"names":["Specifications","countryHasDataset","country","this","specifications","hasDataset","countryHasOptionalField","fieldName","optionalFields","includes","getAddressSchemaForCountry","schema","default","getAddressLabelsForCountry","labels","getOptionalFieldsForCountry","getKeyForField","getPlaceholderKeyForField","placeholders","getAddressSchemaForCountryFlat","flat","filter","element","constructor","ADDRESS_SPECIFICATIONS"],"mappings":"wDAMA,MAAMA,EAYFC,iBAAAA,CAAkBC,GACd,QAASC,KAAKC,iBAAiBF,IAAUG,UAC7C,CAQAC,uBAAAA,CAAwBJ,EAAiBK,GACrC,QAASJ,KAAKC,iBAAiBF,IAAUM,gBAAgBC,SAASF,EACtE,CAOAG,0BAAAA,CAA2BR,GACvB,OAAOC,KAAKC,iBAAiBF,IAAUS,QAAUR,KAAKC,eAAeQ,QAAQD,MACjF,CAOAE,0BAAAA,CAA2BX,GACvB,OAAOC,KAAKC,iBAAiBF,IAAUY,QAAUX,KAAKC,eAAeQ,QAAQE,MACjF,CAOAC,2BAAAA,CAA4Bb,GACxB,OAAOC,KAAKC,iBAAiBF,IAAUM,gBAAkBL,KAAKC,eAAeQ,SAASJ,gBAAkB,EAC5G,CAOAQ,cAAAA,CAAeT,EAAmBL,GAC9B,OAAOC,KAAKC,iBAAiBF,IAAUY,SAASP,IAAcJ,KAAKC,gBAAgBQ,SAASE,SAASP,IAAcA,CACvH,CAOAU,yBAAAA,CAA0BV,EAAmBL,GACzC,OAAOC,KAAKC,iBAAiBF,IAAUgB,eAAeX,IAAcJ,KAAKC,gBAAgBQ,SAASM,eAAeX,EACrH,CAQAY,8BAAAA,CAA+BjB,GAC3B,OAAOC,KAAKO,2BAA2BR,GAClCkB,KAjFY,GAkFZC,QAAQC,GAAwD,iBAAZA,GAC7D,CA9EAC,WAAAA,CAAYnB,oBAFZ,KAAQA,sBAARD,4FAGIA,KAAKC,eAAiB,IAAKoB,KAA2BpB,EAC1D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/getProp.js";import s from"../../../utils/uuid.js";import
|
|
1
|
+
import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/getProp.js";import s from"../../../utils/uuid.js";import r from"../../../core/Errors/AdyenCheckoutError.js";import{NO_CHECKOUT_ATTEMPT_ID as o,ANALYTICS_RENDERED_STR as n}from"../../../core/Analytics/constants.js";import{on as i,off as a}from"../../../utils/listenerUtils.js";function h(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class p{buildElementProps(t){this.props=this.formatProps({...this.constructor.defaultProps,...t})}formatProps(t){return t}formatData(){return{}}setUpAnalytics(t){return null}submitAnalytics(t){return null}handleKeyPress(t){return null}setState(t){this.state={...this.state,...t}}get data(){const t=e(this.props,"modules.risk.data"),s=e(this.props,"modules.analytics.getCheckoutAttemptId")?.()??o,r=this.state.order||this.props.order,n=this.formatData();if(n.paymentMethod&&s&&(n.paymentMethod.checkoutAttemptId=s),"riverty"!==this.props.type&&n.billingAddress){const{firstName:t,lastName:e,...s}=n.billingAddress;n.billingAddress={...s}}return{...t&&{riskData:{clientData:t}},...r&&{order:{orderData:r.orderData,pspReference:r.pspReference}},...n,clientStateDataIndicator:!0}}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const s="string"==typeof e?document.querySelector(e):e;if(!s)throw new Error("Component could not mount. Root node was not found.");const r=!this._node;return this._node&&this.unmount(),this._node=s,i(this._node,"keypress",this.handleKeyPress,!1),this._component=this.render(),t(this._component,s),r&&this.props.modules&&this.props.modules.analytics&&this.setUpAnalytics({containerWidth:s&&s.offsetWidth,component:this.props.isDropin?"dropin":this.constructor.analyticsType??this.constructor.type,flavor:this.props.isDropin?"dropin":"components"}).then((()=>{this.props.isDropin||this.submitAnalytics({type:n})})),this}update(t){return this.props=this.formatProps({...this.props,...t}),this.state={},this.unmount().mount(this._node)}unmount(){return a(this._node,"keypress",this.handleKeyPress),this._node&&t(null,this._node),this}remove(){this.unmount(),this.core&&this.core.remove(this)}constructor(t,e){h(this,"_id",`${this.constructor.type}-${s()}`),h(this,"core",void 0),h(this,"props",void 0),h(this,"state",{}),h(this,"_component",void 0),h(this,"_node",null);const o=function(t){return!!t&&("function"==typeof t.initialize&&"function"==typeof t.createFromAction)}(t);if(!o)throw new r("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=t,this.buildElementProps(e),this.handleKeyPress=this.handleKeyPress.bind(this)}}h(p,"defaultProps",{});export{p as default};
|
|
2
2
|
//# sourceMappingURL=BaseElement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render } from 'preact';\nimport getProp from '../../../utils/getProp';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { ANALYTICS_RENDERED_STR, NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\n\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport type { AnalyticsInitialEvent, SendAnalyticsObject } from '../../../core/Analytics/types';\nimport { off, on } from '../../../utils/listenerUtils';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps> implements IBaseElement {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: any = {};\n public _component;\n\n protected _node: HTMLElement = null;\n\n protected static defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyPress = this.handleKeyPress.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): any {\n return {};\n }\n\n /* eslint-disable-next-line */\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj?: SendAnalyticsObject) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const clientData = getProp(this.props, 'modules.risk.data');\n const checkoutAttemptId = getProp(this.props, 'modules.analytics.getCheckoutAttemptId')?.() ?? NO_CHECKOUT_ATTEMPT_ID; // NOTE: we never expect to see this \"failed\" value, but, just in case...\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n // Workaround, to be fixed properly\n // Remove the firstName & lastName in the billingAddress for non Riverty components\n // @ts-ignore type exists\n if (this.props.type !== 'riverty' && componentData.billingAddress) {\n const { firstName, lastName, ...rest } = componentData.billingAddress;\n componentData.billingAddress = { ...rest };\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n const setupAnalytics = !this._node;\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key press events, notably 'Enter' key presses\n on(this._node, 'keypress', this.handleKeyPress, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n // Set up analytics (once, since this._node is currently undefined) now that we have mounted and rendered\n if (setupAnalytics) {\n if (this.props.modules && this.props.modules.analytics) {\n this.setUpAnalytics({\n containerWidth: node && node.offsetWidth,\n component: !this.props.isDropin ? (this.constructor['analyticsType'] ?? this.constructor['type']) : 'dropin',\n flavor: !this.props.isDropin ? 'components' : 'dropin'\n }).then(() => {\n // Once the initial analytics set up call has been made...\n // ...create an analytics event declaring that the component has been rendered\n // (The dropin will do this itself from DropinComponent once the PM list has rendered)\n if (!this.props.isDropin) {\n this.submitAnalytics({ type: ANALYTICS_RENDERED_STR });\n }\n });\n }\n }\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {};\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keypress', this.handleKeyPress);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","_id","this","constructor","uuid","core","props","state","_component","_node","static","checkout","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","buildElementProps","handleKeyPress","bind","componentProps","formatProps","formatData","setUpAnalytics","setUpAnalyticsObj","submitAnalytics","analyticsObj","e","setState","newState","data","clientData","getProp","checkoutAttemptId","NO_CHECKOUT_ATTEMPT_ID","order","componentData","paymentMethod","type","billingAddress","firstName","lastName","rest","riskData","orderData","pspReference","clientStateDataIndicator","render","Error","mount","domNode","node","document","querySelector","setupAnalytics","unmount","on","modules","analytics","containerWidth","offsetWidth","component","isDropin","flavor","then","ANALYTICS_RENDERED_STR","update","off","remove"],"mappings":"kXAuBA,MAAeA,EACKC,IAAM,GAAGC,KAAKC,YAAmB,QAAIC,MACrCC,KAETC,MACAC,MAAa,CAAA,EACbC,WAEGC,MAAqB,KAE/BC,oBAAgC,CAAA,EAEhCP,WAAAA,CAAYQ,EAAiBL,GACzB,MAAMM,EAnBd,SAA8BD,GAC1B,QAAKA,IAC+C,mBAAxBA,EAASE,YAAkE,mBAA9BF,EAASG,iBAEtF,CAe+BC,CAAqBJ,GAE5C,IAAKC,EACD,MAAM,IAAII,EACN,uBACA,uCAAuCd,KAAKC,YAAmB,6DAIvED,KAAKG,KAAOM,EACZT,KAAKe,kBAAkBX,GAEvBJ,KAAKgB,eAAiBhB,KAAKgB,eAAeC,KAAKjB,KACnD,CAEUe,iBAAAA,CAA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C,SAEvBA,EAAO7C,KAAKM,WAAY2C,GAGpBG,GACIpD,KAAKI,MAAMmD,SAAWvD,KAAKI,MAAMmD,QAAQC,WACzCxD,KAAKqB,eAAe,CAChBoC,eAAgBR,GAAQA,EAAKS,YAC7BC,UAAY3D,KAAKI,MAAMwD,SAA6E,SAAjE5D,KAAKC,2BAAgCD,KAAKC,iBAC7E4D,OAAS7D,KAAKI,MAAMwD,SAA0B,SAAf,eAChCE,MAAK,KAIC9D,KAAKI,MAAMwD,UACZ5D,KAAKuB,gBAAgB,CAAEa,KAAM2B,GACjC,IAKL/D,IACX,CAQOgE,MAAAA,CAAO5D,GAIV,OAHAJ,KAAKI,MAAQJ,KAAKmB,YAAY,IAAKnB,KAAKI,SAAUA,IAClDJ,KAAKK,MAAQ,GAENL,KAAKqD,UAAUN,MAAM/C,KAAKO,MACrC,CAKA,OAAA8C,GAQI,OANAY,EAAIjE,KAAKO,MAAO,WAAYP,KAAKgB,gBAE7BhB,KAAKO,OACLsC,EAAO,KAAM7C,KAAKO,OAGfP,IACX,CAMA,MAAAkE,GACIlE,KAAKqD,UAEDrD,KAAKG,MACLH,KAAKG,KAAK+D,OAAOlE,KAEzB"}
|
|
1
|
+
{"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render } from 'preact';\nimport getProp from '../../../utils/getProp';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { ANALYTICS_RENDERED_STR, NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\n\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport type { AnalyticsInitialEvent, SendAnalyticsObject } from '../../../core/Analytics/types';\nimport { off, on } from '../../../utils/listenerUtils';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps> implements IBaseElement {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: any = {};\n public _component;\n\n protected _node: HTMLElement = null;\n\n protected static defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyPress = this.handleKeyPress.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): any {\n return {};\n }\n\n /* eslint-disable-next-line */\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj?: SendAnalyticsObject) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const clientData = getProp(this.props, 'modules.risk.data');\n const checkoutAttemptId = getProp(this.props, 'modules.analytics.getCheckoutAttemptId')?.() ?? NO_CHECKOUT_ATTEMPT_ID; // NOTE: we never expect to see this \"failed\" value, but, just in case...\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n // Workaround, to be fixed properly\n // Remove the firstName & lastName in the billingAddress for non Riverty components\n // @ts-ignore type exists\n if (this.props.type !== 'riverty' && componentData.billingAddress) {\n const { firstName, lastName, ...rest } = componentData.billingAddress;\n componentData.billingAddress = { ...rest };\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n const setupAnalytics = !this._node;\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key press events, notably 'Enter' key presses\n on(this._node, 'keypress', this.handleKeyPress, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n // Set up analytics (once, since this._node is currently undefined) now that we have mounted and rendered\n if (setupAnalytics) {\n if (this.props.modules && this.props.modules.analytics) {\n this.setUpAnalytics({\n containerWidth: node && node.offsetWidth,\n component: !this.props.isDropin ? (this.constructor['analyticsType'] ?? this.constructor['type']) : 'dropin',\n flavor: !this.props.isDropin ? 'components' : 'dropin'\n }).then(() => {\n // Once the initial analytics set up call has been made...\n // ...create an analytics event declaring that the component has been rendered\n // (The dropin will do this itself from DropinComponent once the PM list has rendered)\n if (!this.props.isDropin) {\n this.submitAnalytics({ type: ANALYTICS_RENDERED_STR });\n }\n });\n }\n }\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {};\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keypress', this.handleKeyPress);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","constructor","formatData","setUpAnalytics","setUpAnalyticsObj","submitAnalytics","analyticsObj","handleKeyPress","e","setState","newState","state","data","clientData","getProp","checkoutAttemptId","NO_CHECKOUT_ATTEMPT_ID","order","componentData","paymentMethod","type","billingAddress","firstName","lastName","rest","riskData","orderData","pspReference","clientStateDataIndicator","render","Error","mount","domNode","node","document","querySelector","setupAnalytics","_node","unmount","on","_component","modules","analytics","containerWidth","offsetWidth","component","isDropin","flavor","then","ANALYTICS_RENDERED_STR","update","off","remove","core","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"0eAuBA,MAAeA,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAY,IAAKF,KAAKG,YAA2B,gBAAKJ,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,CAMA,UAAAG,GACI,MAAO,EACX,CAGUC,cAAAA,CAAeC,GACrB,OAAO,IACX,CAGUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAGUC,cAAAA,CAAeC,GACrB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACfZ,K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MAAM+C,UACZhD,KAAKO,gBAAgB,CAAEe,KAAM6B,GACjC,IAKLnD,IACX,CAQOoD,MAAAA,CAAOnD,GAIV,OAHAD,KAAKC,MAAQD,KAAKE,YAAY,IAAKF,KAAKC,SAAUA,IAClDD,KAAKa,MAAQ,GAENb,KAAKwC,UAAUP,MAAMjC,KAAKuC,MACrC,CAKA,OAAAC,GAQI,OANAa,EAAIrD,KAAKuC,MAAO,WAAYvC,KAAKS,gBAE7BT,KAAKuC,OACLR,EAAO,KAAM/B,KAAKuC,OAGfvC,IACX,CAMA,MAAAsD,GACItD,KAAKwC,UAEDxC,KAAKuD,MACLvD,KAAKuD,KAAKD,OAAOtD,KAEzB,CA/KAG,WAAAA,CAAYqD,EAAiBvD,GAX7BwD,EAAAzD,KAAgB0D,MAAM,GAAG1D,KAAKG,YAAY,QAAWwD,OACrDF,EAAAzD,KAAgBuD,YAAhB,GAEAE,EAAAzD,KAAOC,aAAP,GACAwD,EAAAzD,KAAOa,QAAa,CAAA,GACpB4C,EAAAzD,KAAO0C,kBAAP,GAEAe,EAAAzD,KAAUuC,QAAqB,MAK3B,MAAMqB,EAnBd,SAA8BJ,GAC1B,QAAKA,IAC+C,mBAAxBA,EAASK,YAAkE,mBAA9BL,EAASM,iBAEtF,CAe+BC,CAAqBP,GAE5C,IAAKI,EACD,MAAM,IAAII,EACN,uBACA,uCAAuChE,KAAKG,YAAmB,6DAIvEH,KAAKuD,KAAOC,EACZxD,KAAKF,kBAAkBG,GAEvBD,KAAKS,eAAiBT,KAAKS,eAAewD,KAAKjE,KACnD,EAhBAyD,EAVW5D,EAUMqE,eAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import n from"../../../external/classnames/index.js";import a from"../Spinner/Spinner.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";
|
|
1
|
+
import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import n from"../../../external/classnames/index.js";import a from"../Spinner/Spinner.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class i extends e{render({classNameModifiers:e=[],disabled:s,href:i,icon:r,inline:l,label:c,status:d,variant:p},{completed:u}){const{i18n:m}=o(),_=r?t("img",{className:"adyen-checkout__button__icon",src:r,alt:"","aria-hidden":"true"}):"",h=[...e,..."primary"!==p?[p]:[],...l?["inline"]:[],...u?["completed"]:[],..."loading"===d||"redirect"===d?["loading"]:[]],b=n(["adyen-checkout__button",...h.map((e=>`adyen-checkout__button--${e}`))]),y={loading:t("span",{className:"adyen-checkout__button__content"},t(a,{size:"medium",inline:!0}),t("span",{className:"adyen-checkout__button__text--sr-only"},m.get("loading"))),redirect:t("span",{className:"adyen-checkout__button__content"},t(a,{size:"medium",inline:!0}),m.get("payButton.redirecting")),default:t("span",{className:"adyen-checkout__button__content"},_,t("span",{className:"adyen-checkout__button__text"},c))},f=y[d]||y.default;return i?t("a",{className:b,href:i,disabled:s,target:this.props.target,rel:this.props.rel},f):t("button",{className:b,type:"button",disabled:s,onClick:this.onClick,onKeyDown:this.onKeyDown},f,"loading"!==d&&"redirect"!==d&&this.props.children)}constructor(...e){super(...e),s(this,"onClick",(e=>{e.preventDefault(),this.props.disabled||this.props.onClick(e,{complete:this.complete})})),s(this,"complete",((e=1e3)=>{this.setState({completed:!0}),setTimeout((()=>{this.setState({completed:!1})}),e)})),s(this,"onKeyDown",(e=>{this.props.onKeyDown?.(e)}))}}s(i,"defaultProps",{status:"default",variant:"primary",disabled:!1,label:"",inline:!1,target:"_self",onClick:()=>{}});export{i as default};
|
|
2
2
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './Button.scss';\nimport { ButtonProps, ButtonState } from './types';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self',\n onClick: () => {}\n };\n\n public onClick = e => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n public onKeyDown = (event: KeyboardEvent) => {\n this.props.onKeyDown?.(event);\n };\n\n render({ classNameModifiers = [], disabled, href, icon, inline, label, status, variant }, { completed }) {\n const { i18n } = useCoreContext();\n\n const buttonIcon = icon ? <img className=\"adyen-checkout__button__icon\" src={icon} alt=\"\" aria-hidden=\"true\" /> : '';\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant !== 'primary' ? [variant] : []),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: (\n <span className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n <span className={'adyen-checkout__button__text--sr-only'}>{i18n.get('loading')}</span>\n </span>\n ),\n redirect: (\n <span className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n {i18n.get('payButton.redirecting')}\n </span>\n ),\n default: (\n <span className=\"adyen-checkout__button__content\">\n {buttonIcon}\n <span className=\"adyen-checkout__button__text\">{label}</span>\n </span>\n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n <a className={buttonClasses} href={href} disabled={disabled} target={this.props.target} rel={this.props.rel}>\n {buttonText}\n </a>\n );\n }\n\n return (\n <button className={buttonClasses} type=\"button\" disabled={disabled} onClick={this.onClick} onKeyDown={this.onKeyDown}>\n {buttonText}\n {status !== 'loading' && status !== 'redirect' && this.props.children}\n </button>\n );\n }\n}\n\nexport default Button;\n"],"names":["Button","Component","
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './Button.scss';\nimport { ButtonProps, ButtonState } from './types';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self',\n onClick: () => {}\n };\n\n public onClick = e => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n public onKeyDown = (event: KeyboardEvent) => {\n this.props.onKeyDown?.(event);\n };\n\n render({ classNameModifiers = [], disabled, href, icon, inline, label, status, variant }, { completed }) {\n const { i18n } = useCoreContext();\n\n const buttonIcon = icon ? <img className=\"adyen-checkout__button__icon\" src={icon} alt=\"\" aria-hidden=\"true\" /> : '';\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant !== 'primary' ? [variant] : []),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: (\n <span className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n <span className={'adyen-checkout__button__text--sr-only'}>{i18n.get('loading')}</span>\n </span>\n ),\n redirect: (\n <span className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n {i18n.get('payButton.redirecting')}\n </span>\n ),\n default: (\n <span className=\"adyen-checkout__button__content\">\n {buttonIcon}\n <span className=\"adyen-checkout__button__text\">{label}</span>\n </span>\n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n <a className={buttonClasses} href={href} disabled={disabled} target={this.props.target} rel={this.props.rel}>\n {buttonText}\n </a>\n );\n }\n\n return (\n <button className={buttonClasses} type=\"button\" disabled={disabled} onClick={this.onClick} onKeyDown={this.onKeyDown}>\n {buttonText}\n {status !== 'loading' && status !== 'redirect' && this.props.children}\n </button>\n );\n }\n}\n\nexport default Button;\n"],"names":["Button","Component","render","classNameModifiers","disabled","href","icon","inline","label","status","variant","completed","i18n","useCoreContext","buttonIcon","h","img","className","src","alt","aria-hidden","modifiers","buttonClasses","classNames","map","m","buttonStates","loading","span","Spinner","size","get","redirect","default","buttonText","a","target","this","props","rel","button","type","onClick","onKeyDown","children","_define_property","e","preventDefault","complete","delay","setState","setTimeout","event","defaultProps"],"mappings":"gXAOA,MAAMA,UAAeC,EA8BjBC,MAAAA,EAAOC,mBAAEA,EAAqB,GAAEC,SAAEA,EAAQC,KAAEA,EAAIC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,IAAWC,UAAEA,IACxF,MAAMC,KAAEA,GAASC,IAEXC,EAAaR,EAAOS,EAACC,MAAAA,CAAIC,UAAU,+BAA+BC,IAAKZ,EAAMa,IAAI,GAAGC,cAAY,SAAY,GAE5GC,EAAY,IACXlB,KACa,YAAZO,EAAwB,CAACA,GAAW,MACpCH,EAAS,CAAC,UAAY,MACtBI,EAAY,CAAC,aAAe,MACjB,YAAXF,GAAmC,aAAXA,EAAwB,CAAC,WAAa,IAGhEa,EAAgBC,EAAW,CAAC,4BAA6BF,EAAUG,KAAIC,GAAK,2BAA2BA,QAEvGC,EAAe,CACjBC,QACIZ,EAACa,OAAAA,CAAKX,UAAU,mCACZF,EAACc,EAAAA,CAAQC,KAAK,SAASvB,QAAAA,IACvBQ,EAACa,OAAAA,CAAKX,UAAW,yCAA0CL,EAAKmB,IAAI,aAG5EC,SACIjB,EAACa,OAAAA,CAAKX,UAAU,mCACZF,EAACc,EAAAA,CAAQC,KAAK,SAASvB,QAAAA,IACtBK,EAAKmB,IAAI,0BAGlBE,QACIlB,EAACa,OAAAA,CAAKX,UAAU,mCACXH,EACDC,EAACa,OAAAA,CAAKX,UAAU,gCAAgCT,KAKtD0B,EAAaR,EAAajB,IAAWiB,EAAaO,QAExD,OAAI5B,EAEIU,EAACoB,IAAAA,CAAElB,UAAWK,EAAejB,KAAMA,EAAMD,SAAUA,EAAUgC,OAAQC,KAAKC,MAAMF,OAAQG,IAAKF,KAAKC,MAAMC,KACnGL,GAMTnB,EAACyB,SAAAA,CAAOvB,UAAWK,EAAemB,KAAK,SAASrC,SAAUA,EAAUsC,QAASL,KAAKK,QAASC,UAAWN,KAAKM,WACtGT,EACW,YAAXzB,GAAmC,aAAXA,GAAyB4B,KAAKC,MAAMM,SAGzE,+BAvEAC,EAAAR,KAAOK,WAAUI,IACbA,EAAEC,iBAEGV,KAAKC,MAAMlC,UACZiC,KAAKC,MAAMI,QAAQI,EAAG,CAAEE,SAAUX,KAAKW,UAC3C,IAGJH,EAAOG,KAAAA,YAAW,CAACC,EAAQ,OACvBZ,KAAKa,SAAS,CAAEvC,WAAW,IAC3BwC,YAAW,KACPd,KAAKa,SAAS,CAAEvC,WAAW,GAAM,GAClCsC,EAAAA,IAGPJ,EAAAR,KAAOM,aAAaS,IAChBf,KAAKC,MAAMK,YAAYS,EAAAA,KA1B3BP,EADE7C,EACYqD,eAAe,CACzB5C,OAAQ,UACRC,QAAS,UACTN,UAAU,EACVI,MAAO,GACPD,QAAQ,EACR6B,OAAQ,QACRM,QAAS"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e,r,i){return r in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}class r extends Error{setCorrelationId(e){this.correlationId=e}toString(){return this.message}constructor(r){super(`ClickToPayService - Timeout during ${r.source}() of the scheme '${r.scheme}'`),e(this,"scheme",void 0),e(this,"source",void 0),e(this,"isTimeoutTriggeredBySchemeSdk",void 0),e(this,"correlationId",void 0),this.name="TimeoutError",this.source=r.source,this.scheme=r.scheme,this.isTimeoutTriggeredBySchemeSdk=r.isTimeoutTriggeredBySchemeSdk}}export{r as default};
|
|
2
2
|
//# sourceMappingURL=TimeoutError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeoutError.js","sources":["../../../../../../src/components/internal/ClickToPay/errors/TimeoutError.ts"],"sourcesContent":["interface TimeoutErrorProps {\n source: string;\n scheme: string;\n isTimeoutTriggeredBySchemeSdk: boolean;\n}\n\nclass TimeoutError extends Error {\n public scheme: string;\n public source: string;\n public isTimeoutTriggeredBySchemeSdk: boolean;\n\n /** Currently populated only by Visa SDK if available */\n public correlationId?: string;\n\n constructor(options: TimeoutErrorProps) {\n super(`ClickToPayService - Timeout during ${options.source}() of the scheme '${options.scheme}'`);\n\n this.name = 'TimeoutError';\n this.source = options.source;\n this.scheme = options.scheme;\n this.isTimeoutTriggeredBySchemeSdk = options.isTimeoutTriggeredBySchemeSdk;\n }\n\n public setCorrelationId(correlationId: string): void {\n this.correlationId = correlationId;\n }\n\n public toString() {\n return this.message;\n }\n}\n\nexport default TimeoutError;\n"],"names":["TimeoutError","Error","
|
|
1
|
+
{"version":3,"file":"TimeoutError.js","sources":["../../../../../../src/components/internal/ClickToPay/errors/TimeoutError.ts"],"sourcesContent":["interface TimeoutErrorProps {\n source: string;\n scheme: string;\n isTimeoutTriggeredBySchemeSdk: boolean;\n}\n\nclass TimeoutError extends Error {\n public scheme: string;\n public source: string;\n public isTimeoutTriggeredBySchemeSdk: boolean;\n\n /** Currently populated only by Visa SDK if available */\n public correlationId?: string;\n\n constructor(options: TimeoutErrorProps) {\n super(`ClickToPayService - Timeout during ${options.source}() of the scheme '${options.scheme}'`);\n\n this.name = 'TimeoutError';\n this.source = options.source;\n this.scheme = options.scheme;\n this.isTimeoutTriggeredBySchemeSdk = options.isTimeoutTriggeredBySchemeSdk;\n }\n\n public setCorrelationId(correlationId: string): void {\n this.correlationId = correlationId;\n }\n\n public toString() {\n return this.message;\n }\n}\n\nexport default TimeoutError;\n"],"names":["TimeoutError","Error","setCorrelationId","correlationId","this","toString","message","constructor","options","super","source","scheme","_define_property","isTimeoutTriggeredBySchemeSdk","name"],"mappings":"wHAMA,MAAMA,UAAqBC,MAiBhBC,gBAAAA,CAAiBC,GACpBC,KAAKD,cAAgBA,CACzB,CAEOE,QAAAA,GACH,OAAOD,KAAKE,OAChB,CAfAC,WAAAA,CAAYC,GACRC,MAAM,sCAAsCD,EAAQE,2BAA2BF,EAAQG,WAR3FC,EAAAR,KAAOO,cAAP,GACAC,EAAAR,KAAOM,cAAP,GACAE,EAAAR,KAAOS,qCAAP,GAGAD,EAAOT,KAAAA,qBAAP,GAKIC,KAAKU,KAAO,eACZV,KAAKM,OAASF,EAAQE,OACtBN,KAAKO,OAASH,EAAQG,OACtBP,KAAKS,8BAAgCL,EAAQK,6BACjD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{SchemeNames as t}from"../services/sdks/utils.js";
|
|
1
|
+
import{SchemeNames as t}from"../services/sdks/utils.js";function i(t,i,a){return i in t?Object.defineProperty(t,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[i]=a,t}class a{get title(){return"visa"===this.scheme?t[this.scheme]:this.descriptorName||t[this.scheme]}get isDcfPopupEmbedded(){return"mc"===this.scheme}confirmCardIsExpired(){if("ACTIVE"!==this.status)return!0;if(!this.panExpirationYear&&!this.panExpirationMonth)return!1;const[t,i]=[(new Date).getMonth()+1,(new Date).getFullYear()];return!(Number(this.panExpirationYear)>i)&&!(Number(this.panExpirationYear)===i&&Number(this.panExpirationMonth)>=t)}constructor(t,a,r){i(this,"dateOfCardLastUsed",void 0),i(this,"dateOfCardCreated",void 0),i(this,"panLastFour",void 0),i(this,"srcDigitalCardId",void 0),i(this,"scheme",void 0),i(this,"artUri",void 0),i(this,"srcCorrelationId",void 0),i(this,"tokenId",void 0),i(this,"isExpired",void 0),i(this,"panExpirationMonth",void 0),i(this,"panExpirationYear",void 0),i(this,"descriptorName",void 0),i(this,"status",null),this.dateOfCardLastUsed=t.dateOfCardLastUsed,this.dateOfCardCreated=t.dateOfCardCreated,this.panLastFour=t.panLastFour,this.srcDigitalCardId=t.srcDigitalCardId,this.descriptorName=t.digitalCardData.descriptorName,this.tokenId=t.tokenId,this.scheme=a,this.artUri=t.digitalCardData.artUri,this.srcCorrelationId=r,this.panExpirationMonth=t.panExpirationMonth,this.panExpirationYear=t.panExpirationYear,this.status=t.digitalCardData.status,this.isExpired=this.confirmCardIsExpired()}}export{a as default};
|
|
2
2
|
//# sourceMappingURL=ShopperCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShopperCard.js","sources":["../../../../../../src/components/internal/ClickToPay/models/ShopperCard.ts"],"sourcesContent":["import { DigitalCardStatus, SrcCard } from '../services/sdks/types';\nimport { SchemeNames } from '../services/sdks/utils';\nimport { ClickToPayScheme } from '../types';\n\nclass ShopperCard {\n public dateOfCardLastUsed?: string;\n public dateOfCardCreated: string;\n public panLastFour: string;\n public srcDigitalCardId: string;\n public scheme: ClickToPayScheme;\n public artUri: string;\n public srcCorrelationId: string;\n public tokenId?: string;\n public isExpired: boolean;\n\n private readonly panExpirationMonth: string;\n private readonly panExpirationYear: string;\n private readonly descriptorName?: string;\n private readonly status?: DigitalCardStatus = null;\n\n constructor(maskedCard: SrcCard, scheme: ClickToPayScheme, srcCorrelationId: string) {\n this.dateOfCardLastUsed = maskedCard.dateOfCardLastUsed;\n this.dateOfCardCreated = maskedCard.dateOfCardCreated;\n this.panLastFour = maskedCard.panLastFour;\n this.srcDigitalCardId = maskedCard.srcDigitalCardId;\n this.descriptorName = maskedCard.digitalCardData.descriptorName;\n this.tokenId = maskedCard.tokenId;\n this.scheme = scheme;\n this.artUri = maskedCard.digitalCardData.artUri;\n this.srcCorrelationId = srcCorrelationId;\n this.panExpirationMonth = maskedCard.panExpirationMonth;\n this.panExpirationYear = maskedCard.panExpirationYear;\n this.status = maskedCard.digitalCardData.status;\n\n this.isExpired = this.confirmCardIsExpired();\n }\n\n get title() {\n return this.scheme === 'visa' ? SchemeNames[this.scheme] : this.descriptorName || SchemeNames[this.scheme];\n }\n\n get isDcfPopupEmbedded(): boolean {\n return this.scheme === 'mc';\n }\n\n private confirmCardIsExpired(): boolean {\n if (this.status !== 'ACTIVE') return true;\n if (!this.panExpirationYear && !this.panExpirationMonth) return false;\n\n const [currentMonth, currentYear] = [new Date().getMonth() + 1, new Date().getFullYear()];\n if (Number(this.panExpirationYear) > currentYear) return false;\n if (Number(this.panExpirationYear) === currentYear && Number(this.panExpirationMonth) >= currentMonth) return false;\n\n return true;\n }\n}\n\nexport default ShopperCard;\n"],"names":["ShopperCard","
|
|
1
|
+
{"version":3,"file":"ShopperCard.js","sources":["../../../../../../src/components/internal/ClickToPay/models/ShopperCard.ts"],"sourcesContent":["import { DigitalCardStatus, SrcCard } from '../services/sdks/types';\nimport { SchemeNames } from '../services/sdks/utils';\nimport { ClickToPayScheme } from '../types';\n\nclass ShopperCard {\n public dateOfCardLastUsed?: string;\n public dateOfCardCreated: string;\n public panLastFour: string;\n public srcDigitalCardId: string;\n public scheme: ClickToPayScheme;\n public artUri: string;\n public srcCorrelationId: string;\n public tokenId?: string;\n public isExpired: boolean;\n\n private readonly panExpirationMonth: string;\n private readonly panExpirationYear: string;\n private readonly descriptorName?: string;\n private readonly status?: DigitalCardStatus = null;\n\n constructor(maskedCard: SrcCard, scheme: ClickToPayScheme, srcCorrelationId: string) {\n this.dateOfCardLastUsed = maskedCard.dateOfCardLastUsed;\n this.dateOfCardCreated = maskedCard.dateOfCardCreated;\n this.panLastFour = maskedCard.panLastFour;\n this.srcDigitalCardId = maskedCard.srcDigitalCardId;\n this.descriptorName = maskedCard.digitalCardData.descriptorName;\n this.tokenId = maskedCard.tokenId;\n this.scheme = scheme;\n this.artUri = maskedCard.digitalCardData.artUri;\n this.srcCorrelationId = srcCorrelationId;\n this.panExpirationMonth = maskedCard.panExpirationMonth;\n this.panExpirationYear = maskedCard.panExpirationYear;\n this.status = maskedCard.digitalCardData.status;\n\n this.isExpired = this.confirmCardIsExpired();\n }\n\n get title() {\n return this.scheme === 'visa' ? SchemeNames[this.scheme] : this.descriptorName || SchemeNames[this.scheme];\n }\n\n get isDcfPopupEmbedded(): boolean {\n return this.scheme === 'mc';\n }\n\n private confirmCardIsExpired(): boolean {\n if (this.status !== 'ACTIVE') return true;\n if (!this.panExpirationYear && !this.panExpirationMonth) return false;\n\n const [currentMonth, currentYear] = [new Date().getMonth() + 1, new Date().getFullYear()];\n if (Number(this.panExpirationYear) > currentYear) return false;\n if (Number(this.panExpirationYear) === currentYear && Number(this.panExpirationMonth) >= currentMonth) return false;\n\n return true;\n }\n}\n\nexport default ShopperCard;\n"],"names":["ShopperCard","title","this","scheme","SchemeNames","descriptorName","isDcfPopupEmbedded","confirmCardIsExpired","status","panExpirationYear","panExpirationMonth","currentMonth","currentYear","Date","getMonth","getFullYear","Number","constructor","maskedCard","srcCorrelationId","_define_property","dateOfCardLastUsed","dateOfCardCreated","panLastFour","srcDigitalCardId","artUri","tokenId","isExpired","digitalCardData"],"mappings":"gLAIA,MAAMA,EAiCF,SAAIC,GACA,MAAuB,SAAhBC,KAAKC,OAAoBC,EAAYF,KAAKC,QAAUD,KAAKG,gBAAkBD,EAAYF,KAAKC,OACvG,CAEA,sBAAIG,GACA,MAAuB,OAAhBJ,KAAKC,MAChB,CAEQI,oBAAAA,GACJ,GAAoB,WAAhBL,KAAKM,OAAqB,OAAO,EACrC,IAAKN,KAAKO,oBAAsBP,KAAKQ,mBAAoB,OAAO,EAEhE,MAAOC,EAAcC,GAAe,EAAC,IAAIC,MAAOC,WAAa,GAAG,IAAID,MAAOE,eAC3E,QAAIC,OAAOd,KAAKO,mBAAqBG,MACjCI,OAAOd,KAAKO,qBAAuBG,GAAeI,OAAOd,KAAKQ,qBAAuBC,EAG7F,CAlCAM,WAAAA,CAAYC,EAAqBf,EAA0BgB,GAf3DC,EAAAlB,KAAOmB,0BAAP,GACAD,EAAAlB,KAAOoB,yBAAP,GACAF,EAAAlB,KAAOqB,mBAAP,GACAH,EAAAlB,KAAOsB,wBAAP,GACAJ,EAAAlB,KAAOC,cAAP,GACAiB,EAAAlB,KAAOuB,cAAP,GACAL,EAAAlB,KAAOiB,wBAAP,GACAC,EAAAlB,KAAOwB,eAAP,GACAN,EAAAlB,KAAOyB,iBAAP,GAEAP,EAAAlB,KAAiBQ,0BAAjB,GACAU,EAAAlB,KAAiBO,yBAAjB,GACAW,EAAAlB,KAAiBG,sBAAjB,GACAe,EAAAlB,KAAiBM,SAA6B,MAG1CN,KAAKmB,mBAAqBH,EAAWG,mBACrCnB,KAAKoB,kBAAoBJ,EAAWI,kBACpCpB,KAAKqB,YAAcL,EAAWK,YAC9BrB,KAAKsB,iBAAmBN,EAAWM,iBACnCtB,KAAKG,eAAiBa,EAAWU,gBAAgBvB,eACjDH,KAAKwB,QAAUR,EAAWQ,QAC1BxB,KAAKC,OAASA,EACdD,KAAKuB,OAASP,EAAWU,gBAAgBH,OACzCvB,KAAKiB,iBAAmBA,EACxBjB,KAAKQ,mBAAqBQ,EAAWR,mBACrCR,KAAKO,kBAAoBS,EAAWT,kBACpCP,KAAKM,OAASU,EAAWU,gBAAgBpB,OAEzCN,KAAKyB,UAAYzB,KAAKK,sBAC1B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{CTP_IFRAME_NAME as e,createCheckoutPayloadBasedOnScheme as
|
|
1
|
+
import{CTP_IFRAME_NAME as e,createCheckoutPayloadBasedOnScheme as i,createShopperCardsList as t}from"./utils.js";import s from"./sdks/SrciError.js";import{SchemeNames as o}from"./sdks/utils.js";import n from"../../../../utils/uuid.js";import r from"../../../../core/Errors/AdyenCheckoutError.js";import{isRejected as a,isFulfilled as d}from"../../../../utils/promise-util.js";import h from"../errors/TimeoutError.js";import{executeWithTimeout as c}from"./execute-with-timeout.js";function l(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}var m;!function(e){e.Idle="Idle",e.Loading="Loading",e.ShopperIdentified="ShopperIdentified",e.OneTimePassword="OneTimePassword",e.Ready="Ready",e.Login="Login",e.NotAvailable="NotAvailable"}(m||(m={}));class S{get shopperAccountFound(){return["Ready","ShopperIdentified"].includes(this.state)}get schemes(){return this.sdkLoader.schemes}updateStoreCookiesConsent(e){this.storeCookies=e}async initialize(){this.setState("Loading");try{this.sdks=await this.sdkLoader.load(this.environment),await this.initiateSdks();const{recognized:e=!1,idTokens:i=null}=await this.verifyIfShopperIsRecognized();if(e)return await this.getShopperProfile(i),void this.setState("Ready");if(!this.shopperIdentity)return void this.setState("NotAvailable");const{isEnrolled:t}=await this.verifyIfShopperIsEnrolled(this.shopperIdentity);if(t)return void this.setState("ShopperIdentified");this.setState("NotAvailable")}catch(e){e instanceof s&&"REQUEST_TIMEOUT"===e?.reason||e instanceof h?this.handleTimeout(e):e instanceof s?console.warn(`Error at ClickToPayService # init: ${e.toString()}`):console.warn(e),this.setState("NotAvailable")}}subscribeOnStateChange(e){this.stateSubscriber=e}async startIdentityValidation(){if(!this.validationSchemeSdk)throw Error("startIdentityValidation: No ValidationSDK set for the validation process");try{const{maskedValidationChannel:e}=await this.validationSchemeSdk.initiateIdentityValidation();this.identityValidationData={maskedShopperContact:e.replace(/\*/g,"•"),selectedNetwork:o[this.validationSchemeSdk.schemeName]},this.setState("OneTimePassword")}catch(e){throw this.validationSchemeSdk=null,e}}async finishIdentityValidation(e){if(!this.validationSchemeSdk)throw Error("finishIdentityValidation: No ValidationSDK set for the validation process");const i=await this.validationSchemeSdk.completeIdentityValidation(e);await this.getShopperProfile([i.idToken]),this.setState("Ready"),this.validationSchemeSdk=null}async checkout(t){if(!t)throw Error("ClickToPayService # checkout: Missing card data");const s=this.sdks.find((e=>e.schemeName===t.scheme)),o=await s.checkout({srcDigitalCardId:t.srcDigitalCardId,srcCorrelationId:t.srcCorrelationId,...t.isDcfPopupEmbedded&&{windowRef:window.frames[e]},...this.storeCookies&&{complianceSettings:{complianceResources:[{complianceType:"REMEMBER_ME",uri:""}]}}});if("COMPLETE"!==o.dcfActionCode)throw new r("ERROR",`Checkout through Scheme DCF did not complete. DCF Action code received: ${o.dcfActionCode}`);return i(t,o,this.environment)}async logout(){if(!this.sdks)throw new r("ERROR","ClickToPayService is not initialized");try{const e=this.sdks.map((e=>e.unbindAppInstance()));await Promise.all(e)}catch(e){e instanceof s?console.warn(`Error at ClickToPayService # logout: ${e.toString()}`):console.warn(e)}this.shopperCards=null,this.identityValidationData=null,this.validationSchemeSdk=null,this.setState("Login")}verifyIfShopperIsEnrolled(e){const{shopperEmail:i}=e;return new Promise(((e,t)=>{const s=this.sdks.map((s=>c((()=>s.identityLookup({identityValue:i,type:"email"})),5e3,new h({source:"identityLookup",scheme:s.schemeName,isTimeoutTriggeredBySchemeSdk:!1})).then((i=>{i.consumerPresent&&!this.validationSchemeSdk&&(this.setSdkForPerformingShopperIdentityValidation(s),e({isEnrolled:!0}))})).catch((e=>{t(e)}))));Promise.allSettled(s).then((()=>{e({isEnrolled:!1})}))}))}setState(e){this.state=e,this.stateSubscriber?.(this.state)}setSdkForPerformingShopperIdentityValidation(e){this.validationSchemeSdk=e}handleTimeout(e){const i=e instanceof s?new h({source:e.source,scheme:e.scheme,isTimeoutTriggeredBySchemeSdk:!0}):e;"visa"===i.scheme&&(i.setCorrelationId(window.VISA_SDK?.correlationId),window.VISA_SDK?.correlationId?window.VISA_SDK?.buildClientProfile?.():window.VISA_SDK?.buildClientProfile?.(this.schemesConfig.visa.srciDpaId)),this.onTimeout?.(i)}async getShopperProfile(e){return new Promise(((i,s)=>{const o=this.sdks.map((i=>i.getSrcProfile(e)));Promise.allSettled(o).then((e=>{e.every(a)&&s(e[0].reason);const o=e.map(((e,i)=>d(e)&&{...e.value,scheme:this.sdks[i].schemeName})).filter((e=>!!e));this.shopperCards=t(o),i()}))}))}verifyIfShopperIsRecognized(){return new Promise(((e,i)=>{const t=this.sdks.map((t=>c((()=>t.isRecognized()),5e3,new h({source:"isRecognized",scheme:t.schemeName,isTimeoutTriggeredBySchemeSdk:!1})).then((i=>{i.recognized&&e(i)})).catch((e=>{i(e)}))));Promise.allSettled(t).then((()=>{e({recognized:!1})}))}))}initiateSdks(){const e=this.sdks.map((e=>{const i=this.schemesConfig[e.schemeName];return c((()=>e.init(i,this.srciTransactionId)),5e3,new h({source:"init",scheme:e.schemeName,isTimeoutTriggeredBySchemeSdk:!1}))}));return Promise.all(e)}constructor(e,i,t,s,o){l(this,"sdkLoader",void 0),l(this,"schemesConfig",void 0),l(this,"shopperIdentity",void 0),l(this,"environment",void 0),l(this,"onTimeout",void 0),l(this,"srciTransactionId",n()),l(this,"sdks",void 0),l(this,"validationSchemeSdk",null),l(this,"stateSubscriber",void 0),l(this,"state","Idle"),l(this,"shopperCards",null),l(this,"identityValidationData",null),l(this,"storeCookies",!1),this.sdkLoader=i,this.schemesConfig=e,this.shopperIdentity=s,this.environment=t,this.onTimeout=o}}export{m as CtpState,S as default};
|
|
2
2
|
//# sourceMappingURL=ClickToPayService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickToPayService.js","sources":["../../../../../../src/components/internal/ClickToPay/services/ClickToPayService.ts"],"sourcesContent":["import { ISrcInitiator } from './sdks/AbstractSrcInitiator';\nimport {\n CallbackStateSubscriber,\n IClickToPayService,\n IdentityLookupParams,\n ClickToPayCheckoutPayload,\n SrcProfileWithScheme,\n SchemesConfiguration,\n IdentityValidationData\n} from './types';\nimport { ISrcSdkLoader } from './sdks/SrcSdkLoader';\nimport { createCheckoutPayloadBasedOnScheme, createShopperCardsList, CTP_IFRAME_NAME } from './utils';\nimport { SrciIdentityLookupResponse, SrciIsRecognizedResponse, SrcProfile } from './sdks/types';\nimport SrciError from './sdks/SrciError';\nimport { SchemeNames } from './sdks/utils';\nimport ShopperCard from '../models/ShopperCard';\nimport uuidv4 from '../../../../utils/uuid';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { isFulfilled, isRejected } from '../../../../utils/promise-util';\nimport TimeoutError from '../errors/TimeoutError';\nimport { executeWithTimeout } from './execute-with-timeout';\n\nexport enum CtpState {\n Idle = 'Idle',\n Loading = 'Loading',\n ShopperIdentified = 'ShopperIdentified',\n OneTimePassword = 'OneTimePassword',\n Ready = 'Ready',\n Login = 'Login',\n NotAvailable = 'NotAvailable'\n}\n\nclass ClickToPayService implements IClickToPayService {\n private readonly sdkLoader: ISrcSdkLoader;\n private readonly schemesConfig: SchemesConfiguration;\n private readonly shopperIdentity?: IdentityLookupParams;\n private readonly environment: string;\n\n private readonly onTimeout?: (error: TimeoutError) => void;\n\n /**\n * Mandatory unique ID passed to all the networks (Click to Pay systems), used to track user journey\n */\n private readonly srciTransactionId: string = uuidv4();\n\n private sdks: ISrcInitiator[];\n private validationSchemeSdk: ISrcInitiator = null;\n private stateSubscriber: CallbackStateSubscriber;\n\n public state: CtpState = CtpState.Idle;\n public shopperCards: ShopperCard[] = null;\n public identityValidationData: IdentityValidationData = null;\n\n /**\n * Indicates if the shopper opted for saving cookies during the transaction\n */\n public storeCookies = false;\n\n constructor(\n schemesConfig: SchemesConfiguration,\n sdkLoader: ISrcSdkLoader,\n environment: string,\n shopperIdentity?: IdentityLookupParams,\n onTimeout?: (error: TimeoutError) => void\n ) {\n this.sdkLoader = sdkLoader;\n this.schemesConfig = schemesConfig;\n this.shopperIdentity = shopperIdentity;\n this.environment = environment;\n this.onTimeout = onTimeout;\n }\n\n public get shopperAccountFound(): boolean {\n return [CtpState.Ready, CtpState.ShopperIdentified].includes(this.state);\n }\n\n public get schemes(): string[] {\n return this.sdkLoader.schemes;\n }\n\n public updateStoreCookiesConsent(shouldStore: boolean) {\n this.storeCookies = shouldStore;\n }\n\n public async initialize(): Promise<void> {\n this.setState(CtpState.Loading);\n\n try {\n this.sdks = await this.sdkLoader.load(this.environment);\n await this.initiateSdks();\n\n const { recognized = false, idTokens = null } = await this.verifyIfShopperIsRecognized();\n\n if (recognized) {\n await this.getShopperProfile(idTokens);\n this.setState(CtpState.Ready);\n return;\n }\n\n if (!this.shopperIdentity) {\n this.setState(CtpState.NotAvailable);\n return;\n }\n\n const { isEnrolled } = await this.verifyIfShopperIsEnrolled(this.shopperIdentity);\n if (isEnrolled) {\n this.setState(CtpState.ShopperIdentified);\n return;\n }\n\n this.setState(CtpState.NotAvailable);\n } catch (error) {\n if ((error instanceof SrciError && error?.reason === 'REQUEST_TIMEOUT') || error instanceof TimeoutError) {\n this.handleTimeout(error);\n } else if (error instanceof SrciError) {\n console.warn(`Error at ClickToPayService # init: ${error.toString()}`);\n } else {\n console.warn(error);\n }\n\n this.setState(CtpState.NotAvailable);\n }\n }\n\n /**\n * Set the callback for notifying when the CtPState changes\n */\n public subscribeOnStateChange(callback: CallbackStateSubscriber): void {\n this.stateSubscriber = callback;\n }\n\n /**\n * Initiates Consumer Identity validation with one Click to Pay System.\n * The Click to Pay System sends a one-time-password (OTP) to the registered email address or mobile number.\n **/\n public async startIdentityValidation(): Promise<void> {\n if (!this.validationSchemeSdk) {\n throw Error('startIdentityValidation: No ValidationSDK set for the validation process');\n }\n try {\n const { maskedValidationChannel } = await this.validationSchemeSdk.initiateIdentityValidation();\n\n this.identityValidationData = {\n maskedShopperContact: maskedValidationChannel.replace(/\\*/g, '•'),\n selectedNetwork: SchemeNames[this.validationSchemeSdk.schemeName]\n };\n\n this.setState(CtpState.OneTimePassword);\n } catch (error: unknown) {\n // If there is an error when 'startIdentityValidation' (Ex: account is blocked), we reset the scheme chosen to perform this step\n this.validationSchemeSdk = null;\n throw error;\n }\n }\n\n /**\n * Completes the validation of the Shopper by evaluating the supplied OTP.\n */\n public async finishIdentityValidation(otpCode: string): Promise<void> {\n if (!this.validationSchemeSdk) {\n throw Error('finishIdentityValidation: No ValidationSDK set for the validation process');\n }\n\n const validationToken = await this.validationSchemeSdk.completeIdentityValidation(otpCode);\n await this.getShopperProfile([validationToken.idToken]);\n this.setState(CtpState.Ready);\n this.validationSchemeSdk = null;\n }\n\n /**\n * This method performs checkout using the selected card\n */\n public async checkout(card: ShopperCard): Promise<ClickToPayCheckoutPayload> {\n if (!card) {\n throw Error('ClickToPayService # checkout: Missing card data');\n }\n\n const checkoutSdk = this.sdks.find(sdk => sdk.schemeName === card.scheme);\n\n const checkoutResponse = await checkoutSdk.checkout({\n srcDigitalCardId: card.srcDigitalCardId,\n srcCorrelationId: card.srcCorrelationId,\n ...(card.isDcfPopupEmbedded && { windowRef: window.frames[CTP_IFRAME_NAME] }),\n ...(this.storeCookies && { complianceSettings: { complianceResources: [{ complianceType: 'REMEMBER_ME', uri: '' }] } })\n });\n\n if (checkoutResponse.dcfActionCode !== 'COMPLETE') {\n throw new AdyenCheckoutError(\n 'ERROR',\n `Checkout through Scheme DCF did not complete. DCF Action code received: ${checkoutResponse.dcfActionCode}`\n );\n }\n\n return createCheckoutPayloadBasedOnScheme(card, checkoutResponse, this.environment);\n }\n\n /**\n * Call the 'unbindAppInstance()' method of each SRC SDK in order to remove the shopper cookies.\n * Besides, it deletes all information stored about the shopper.\n */\n public async logout(): Promise<void> {\n if (!this.sdks) {\n throw new AdyenCheckoutError('ERROR', 'ClickToPayService is not initialized');\n }\n\n try {\n const logoutPromises = this.sdks.map(sdk => sdk.unbindAppInstance());\n await Promise.all(logoutPromises);\n } catch (error) {\n if (error instanceof SrciError) console.warn(`Error at ClickToPayService # logout: ${error.toString()}`);\n else console.warn(error);\n }\n\n this.shopperCards = null;\n this.identityValidationData = null;\n this.validationSchemeSdk = null;\n\n this.setState(CtpState.Login);\n }\n\n /**\n * Call the 'identityLookup()' method of each SRC SDK in order to verify if the shopper has an account.\n *\n * Based on the responses from the Click to Pay Systems, we should do the validation process using the SDK that\n * that responds faster with 'consumerPresent=true'\n */\n public verifyIfShopperIsEnrolled(shopperIdentity: IdentityLookupParams): Promise<{ isEnrolled: boolean }> {\n const { shopperEmail } = shopperIdentity;\n\n return new Promise((resolve, reject) => {\n const lookupPromises = this.sdks.map(sdk => {\n const identityLookupPromise = executeWithTimeout<SrciIdentityLookupResponse>(\n () => sdk.identityLookup({ identityValue: shopperEmail, type: 'email' }),\n 5000,\n new TimeoutError({\n source: 'identityLookup',\n scheme: sdk.schemeName,\n isTimeoutTriggeredBySchemeSdk: false\n })\n );\n\n return identityLookupPromise\n .then(response => {\n if (response.consumerPresent && !this.validationSchemeSdk) {\n this.setSdkForPerformingShopperIdentityValidation(sdk);\n resolve({ isEnrolled: true });\n }\n })\n .catch(error => {\n reject(error);\n });\n });\n\n void Promise.allSettled(lookupPromises).then(() => {\n resolve({ isEnrolled: false });\n });\n });\n }\n\n private setState(state: CtpState): void {\n this.state = state;\n this.stateSubscriber?.(this.state);\n }\n\n private setSdkForPerformingShopperIdentityValidation(sdk: ISrcInitiator) {\n this.validationSchemeSdk = sdk;\n }\n\n private handleTimeout(error: SrciError | TimeoutError) {\n // If the timeout error was thrown directly by the scheme SDK, we convert it to TimeoutError\n // If the timeout error was thrown by our internal timeout mechanism, we don't do anything\n const timeoutError =\n error instanceof SrciError\n ? new TimeoutError({ source: error.source, scheme: error.scheme, isTimeoutTriggeredBySchemeSdk: true })\n : error;\n\n if (timeoutError.scheme === 'visa') {\n timeoutError.setCorrelationId(window.VISA_SDK?.correlationId);\n\n // Visa srciDpaId must be passed when there is no correlation ID available\n if (window.VISA_SDK?.correlationId) window.VISA_SDK?.buildClientProfile?.();\n else window.VISA_SDK?.buildClientProfile?.(this.schemesConfig.visa.srciDpaId);\n }\n this.onTimeout?.(timeoutError);\n }\n\n /**\n * Based on the given 'idToken', this method goes through each SRCi SDK and fetches the shopper\n * profile with his cards.\n */\n private async getShopperProfile(idTokens: string[]): Promise<void> {\n return new Promise((resolve, reject) => {\n const srcProfilesPromises = this.sdks.map(sdk => sdk.getSrcProfile(idTokens));\n\n void Promise.allSettled(srcProfilesPromises).then(srcProfilesResponses => {\n if (srcProfilesResponses.every(isRejected)) {\n reject(srcProfilesResponses[0].reason);\n }\n\n const createProfileWithScheme = (promiseResult: PromiseSettledResult<SrcProfile>, index) =>\n isFulfilled(promiseResult) && { ...promiseResult.value, scheme: this.sdks[index].schemeName };\n\n const profilesWithScheme: SrcProfileWithScheme[] = srcProfilesResponses.map(createProfileWithScheme).filter(profile => !!profile);\n\n this.shopperCards = createShopperCardsList(profilesWithScheme);\n resolve();\n });\n });\n }\n\n /**\n * Calls the 'isRecognized()' method of each SRC SDK in order to verify if the shopper is\n * recognized on the device. The shopper is recognized if he/she has the Cookies stored\n * on their browser\n */\n private verifyIfShopperIsRecognized(): Promise<SrciIsRecognizedResponse> {\n return new Promise((resolve, reject) => {\n const promises = this.sdks.map(sdk => {\n const isRecognizedPromise = executeWithTimeout<SrciIsRecognizedResponse>(\n () => sdk.isRecognized(),\n 5000,\n new TimeoutError({\n source: 'isRecognized',\n scheme: sdk.schemeName,\n isTimeoutTriggeredBySchemeSdk: false\n })\n );\n\n return isRecognizedPromise\n .then(response => {\n if (response.recognized) resolve(response);\n })\n .catch(error => {\n reject(error);\n });\n });\n\n // If the 'resolve' didn't happen until this point, then shopper is not recognized\n void Promise.allSettled(promises).then(() => {\n resolve({ recognized: false });\n });\n });\n }\n\n private initiateSdks(): Promise<void[]> {\n const initPromises = this.sdks.map(sdk => {\n const cfg = this.schemesConfig[sdk.schemeName];\n\n return executeWithTimeout<void>(\n () => sdk.init(cfg, this.srciTransactionId),\n 5000,\n new TimeoutError({\n source: 'init',\n scheme: sdk.schemeName,\n isTimeoutTriggeredBySchemeSdk: false\n })\n );\n });\n\n return Promise.all(initPromises);\n }\n}\n\nexport default ClickToPayService;\n"],"names":["CtpState","ClickToPayService","sdkLoader","schemesConfig","shopperIdentity","environment","onTimeout","srciTransactionId","uuidv4","sdks","validationSchemeSdk","stateSubscriber","state","shopperCards","identityValidationData","storeCookies","constructor","this","shopperAccountFound","includes","schemes","updateStoreCookiesConsent","shouldStore","initialize","setState","load","initiateSdks","recognized","idTokens","verifyIfShopperIsRecognized","getShopperProfile","isEnrolled","verifyIfShopperIsEnrolled","error","SrciError","reason","TimeoutError","handleTimeout","console","warn","toString","subscribeOnStateChange","callback","startIdentityValidation","Error","maskedValidationChannel","initiateIdentityValidation","maskedShopperContact","replace","selectedNetwork","SchemeNames","schemeName","finishIdentityValidation","otpCode","validationToken","completeIdentityValidation","idToken","checkout","card","checkoutSdk","find","sdk","scheme","checkoutResponse","srcDigitalCardId","srcCorrelationId","isDcfPopupEmbedded","windowRef","window","frames","CTP_IFRAME_NAME","complianceSettings","complianceResources","complianceType","uri","dcfActionCode","AdyenCheckoutError","createCheckoutPayloadBasedOnScheme","logout","logoutPromises","map","unbindAppInstance","Promise","all","shopperEmail","resolve","reject","lookupPromises","executeWithTimeout","identityLookup","identityValue","type","source","isTimeoutTriggeredBySchemeSdk","then","response","consumerPresent","setSdkForPerformingShopperIdentityValidation","catch","allSettled","timeoutError","setCorrelationId","VISA_SDK","correlationId","buildClientProfile","visa","srciDpaId","srcProfilesPromises","getSrcProfile","srcProfilesResponses","every","isRejected","profilesWithScheme","promiseResult","index","isFulfilled","value","filter","profile","createShopperCardsList","promises","isRecognized","initPromises","cfg","init"],"mappings":"ueAsBYA,SAAAA,+KAAAA,CAAAA,IAAAA,EAAAA,CAAAA,IAUZ,MAAMC,EACeC,UACAC,cACAC,gBACAC,YAEAC,UAKAC,kBAA4BC,IAErCC,KACAC,oBAAqC,KACrCC,gBAEDC,MAAgC,OAChCC,aAA8B,KAC9BC,uBAAiD,KAKjDC,cAAe,EAEtBC,WAAAA,CACIb,EACAD,EACAG,EACAD,EACAE,GAEAW,KAAKf,UAAYA,EACjBe,KAAKd,cAAgBA,EACrBc,KAAKb,gBAAkBA,EACvBa,KAAKZ,YAAcA,EACnBY,KAA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GACJ,GAER,CAOA,2BAAAxD,GACI,OAAO,IAAIqD,SAAQ,CAACG,EAASC,KACzB,MAAMkC,EAAWvG,KAAKR,KAAKuE,KAAInB,GACC2B,GACxB,IAAM3B,EAAI4D,gBACV,IACA,IAAIrF,EAAa,CACbwD,OAAQ,eACR9B,OAAQD,EAAIV,WACZ0C,+BAA+B,KAKlCC,MAAKC,IACEA,EAASpE,YAAY0D,EAAQU,EAAAA,IAEpCG,OAAMjE,IACHqD,EAAOrD,EAAAA,MAKdiD,QAAQiB,WAAWqB,GAAU1B,MAAK,KACnCT,EAAQ,CAAE1D,YAAY,GAAM,GAChC,GAER,CAEQD,YAAAA,GACJ,MAAMgG,EAAezG,KAAKR,KAAKuE,KAAInB,IAC/B,MAAM8D,EAAM1G,KAAKd,cAAc0D,EAAIV,YAEnC,OAAOqC,GACH,IAAM3B,EAAI+D,KAAKD,EAAK1G,KAAKV,oBACzB,IACA,IAAI6B,EAAa,CACbwD,OAAQ,OACR9B,OAAQD,EAAIV,WACZ0C,+BAA+B,IACnC,IAIR,OAAOX,QAAQC,IAAIuC,EACvB"}
|
|
1
|
+
{"version":3,"file":"ClickToPayService.js","sources":["../../../../../../src/components/internal/ClickToPay/services/ClickToPayService.ts"],"sourcesContent":["import { ISrcInitiator } from './sdks/AbstractSrcInitiator';\nimport {\n CallbackStateSubscriber,\n IClickToPayService,\n IdentityLookupParams,\n ClickToPayCheckoutPayload,\n SrcProfileWithScheme,\n SchemesConfiguration,\n IdentityValidationData\n} from './types';\nimport { ISrcSdkLoader } from './sdks/SrcSdkLoader';\nimport { createCheckoutPayloadBasedOnScheme, createShopperCardsList, CTP_IFRAME_NAME } from './utils';\nimport { SrciIdentityLookupResponse, SrciIsRecognizedResponse, SrcProfile } from './sdks/types';\nimport SrciError from './sdks/SrciError';\nimport { SchemeNames } from './sdks/utils';\nimport ShopperCard from '../models/ShopperCard';\nimport uuidv4 from '../../../../utils/uuid';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { isFulfilled, isRejected } from '../../../../utils/promise-util';\nimport TimeoutError from '../errors/TimeoutError';\nimport { executeWithTimeout } from './execute-with-timeout';\n\nexport enum CtpState {\n Idle = 'Idle',\n Loading = 'Loading',\n ShopperIdentified = 'ShopperIdentified',\n OneTimePassword = 'OneTimePassword',\n Ready = 'Ready',\n Login = 'Login',\n NotAvailable = 'NotAvailable'\n}\n\nclass ClickToPayService implements IClickToPayService {\n private readonly sdkLoader: ISrcSdkLoader;\n private readonly schemesConfig: SchemesConfiguration;\n private readonly shopperIdentity?: IdentityLookupParams;\n private readonly environment: string;\n\n private readonly onTimeout?: (error: TimeoutError) => void;\n\n /**\n * Mandatory unique ID passed to all the networks (Click to Pay systems), used to track user journey\n */\n private readonly srciTransactionId: string = uuidv4();\n\n private sdks: ISrcInitiator[];\n private validationSchemeSdk: ISrcInitiator = null;\n private stateSubscriber: CallbackStateSubscriber;\n\n public state: CtpState = CtpState.Idle;\n public shopperCards: ShopperCard[] = null;\n public identityValidationData: IdentityValidationData = null;\n\n /**\n * Indicates if the shopper opted for saving cookies during the transaction\n */\n public storeCookies = false;\n\n constructor(\n schemesConfig: SchemesConfiguration,\n sdkLoader: ISrcSdkLoader,\n environment: string,\n shopperIdentity?: IdentityLookupParams,\n onTimeout?: (error: TimeoutError) => void\n ) {\n this.sdkLoader = sdkLoader;\n this.schemesConfig = schemesConfig;\n this.shopperIdentity = shopperIdentity;\n this.environment = environment;\n this.onTimeout = onTimeout;\n }\n\n public get shopperAccountFound(): boolean {\n return [CtpState.Ready, CtpState.ShopperIdentified].includes(this.state);\n }\n\n public get schemes(): string[] {\n return this.sdkLoader.schemes;\n }\n\n public updateStoreCookiesConsent(shouldStore: boolean) {\n this.storeCookies = shouldStore;\n }\n\n public async initialize(): Promise<void> {\n this.setState(CtpState.Loading);\n\n try {\n this.sdks = await this.sdkLoader.load(this.environment);\n await this.initiateSdks();\n\n const { recognized = false, idTokens = null } = await this.verifyIfShopperIsRecognized();\n\n if (recognized) {\n await this.getShopperProfile(idTokens);\n this.setState(CtpState.Ready);\n return;\n }\n\n if (!this.shopperIdentity) {\n this.setState(CtpState.NotAvailable);\n return;\n }\n\n const { isEnrolled } = await this.verifyIfShopperIsEnrolled(this.shopperIdentity);\n if (isEnrolled) {\n this.setState(CtpState.ShopperIdentified);\n return;\n }\n\n this.setState(CtpState.NotAvailable);\n } catch (error) {\n if ((error instanceof SrciError && error?.reason === 'REQUEST_TIMEOUT') || error instanceof TimeoutError) {\n this.handleTimeout(error);\n } else if (error instanceof SrciError) {\n console.warn(`Error at ClickToPayService # init: ${error.toString()}`);\n } else {\n console.warn(error);\n }\n\n this.setState(CtpState.NotAvailable);\n }\n }\n\n /**\n * Set the callback for notifying when the CtPState changes\n */\n public subscribeOnStateChange(callback: CallbackStateSubscriber): void {\n this.stateSubscriber = callback;\n }\n\n /**\n * Initiates Consumer Identity validation with one Click to Pay System.\n * The Click to Pay System sends a one-time-password (OTP) to the registered email address or mobile number.\n **/\n public async startIdentityValidation(): Promise<void> {\n if (!this.validationSchemeSdk) {\n throw Error('startIdentityValidation: No ValidationSDK set for the validation process');\n }\n try {\n const { maskedValidationChannel } = await this.validationSchemeSdk.initiateIdentityValidation();\n\n this.identityValidationData = {\n maskedShopperContact: maskedValidationChannel.replace(/\\*/g, '•'),\n selectedNetwork: SchemeNames[this.validationSchemeSdk.schemeName]\n };\n\n this.setState(CtpState.OneTimePassword);\n } catch (error: unknown) {\n // If there is an error when 'startIdentityValidation' (Ex: account is blocked), we reset the scheme chosen to perform this step\n this.validationSchemeSdk = null;\n throw error;\n }\n }\n\n /**\n * Completes the validation of the Shopper by evaluating the supplied OTP.\n */\n public async finishIdentityValidation(otpCode: string): Promise<void> {\n if (!this.validationSchemeSdk) {\n throw Error('finishIdentityValidation: No ValidationSDK set for the validation process');\n }\n\n const validationToken = await this.validationSchemeSdk.completeIdentityValidation(otpCode);\n await this.getShopperProfile([validationToken.idToken]);\n this.setState(CtpState.Ready);\n this.validationSchemeSdk = null;\n }\n\n /**\n * This method performs checkout using the selected card\n */\n public async checkout(card: ShopperCard): Promise<ClickToPayCheckoutPayload> {\n if (!card) {\n throw Error('ClickToPayService # checkout: Missing card data');\n }\n\n const checkoutSdk = this.sdks.find(sdk => sdk.schemeName === card.scheme);\n\n const checkoutResponse = await checkoutSdk.checkout({\n srcDigitalCardId: card.srcDigitalCardId,\n srcCorrelationId: card.srcCorrelationId,\n ...(card.isDcfPopupEmbedded && { windowRef: window.frames[CTP_IFRAME_NAME] }),\n ...(this.storeCookies && { complianceSettings: { complianceResources: [{ complianceType: 'REMEMBER_ME', uri: '' }] } })\n });\n\n if (checkoutResponse.dcfActionCode !== 'COMPLETE') {\n throw new AdyenCheckoutError(\n 'ERROR',\n `Checkout through Scheme DCF did not complete. DCF Action code received: ${checkoutResponse.dcfActionCode}`\n );\n }\n\n return createCheckoutPayloadBasedOnScheme(card, checkoutResponse, this.environment);\n }\n\n /**\n * Call the 'unbindAppInstance()' method of each SRC SDK in order to remove the shopper cookies.\n * Besides, it deletes all information stored about the shopper.\n */\n public async logout(): Promise<void> {\n if (!this.sdks) {\n throw new AdyenCheckoutError('ERROR', 'ClickToPayService is not initialized');\n }\n\n try {\n const logoutPromises = this.sdks.map(sdk => sdk.unbindAppInstance());\n await Promise.all(logoutPromises);\n } catch (error) {\n if (error instanceof SrciError) console.warn(`Error at ClickToPayService # logout: ${error.toString()}`);\n else console.warn(error);\n }\n\n this.shopperCards = null;\n this.identityValidationData = null;\n this.validationSchemeSdk = null;\n\n this.setState(CtpState.Login);\n }\n\n /**\n * Call the 'identityLookup()' method of each SRC SDK in order to verify if the shopper has an account.\n *\n * Based on the responses from the Click to Pay Systems, we should do the validation process using the SDK that\n * that responds faster with 'consumerPresent=true'\n */\n public verifyIfShopperIsEnrolled(shopperIdentity: IdentityLookupParams): Promise<{ isEnrolled: boolean }> {\n const { shopperEmail } = shopperIdentity;\n\n return new Promise((resolve, reject) => {\n const lookupPromises = this.sdks.map(sdk => {\n const identityLookupPromise = executeWithTimeout<SrciIdentityLookupResponse>(\n () => sdk.identityLookup({ identityValue: shopperEmail, type: 'email' }),\n 5000,\n new TimeoutError({\n source: 'identityLookup',\n scheme: sdk.schemeName,\n isTimeoutTriggeredBySchemeSdk: false\n })\n );\n\n return identityLookupPromise\n .then(response => {\n if (response.consumerPresent && !this.validationSchemeSdk) {\n this.setSdkForPerformingShopperIdentityValidation(sdk);\n resolve({ isEnrolled: true });\n }\n })\n .catch(error => {\n reject(error);\n });\n });\n\n void Promise.allSettled(lookupPromises).then(() => {\n resolve({ isEnrolled: false });\n });\n });\n }\n\n private setState(state: CtpState): void {\n this.state = state;\n this.stateSubscriber?.(this.state);\n }\n\n private setSdkForPerformingShopperIdentityValidation(sdk: ISrcInitiator) {\n this.validationSchemeSdk = sdk;\n }\n\n private handleTimeout(error: SrciError | TimeoutError) {\n // If the timeout error was thrown directly by the scheme SDK, we convert it to TimeoutError\n // If the timeout error was thrown by our internal timeout mechanism, we don't do anything\n const timeoutError =\n error instanceof SrciError\n ? new TimeoutError({ source: error.source, scheme: error.scheme, isTimeoutTriggeredBySchemeSdk: true })\n : error;\n\n if (timeoutError.scheme === 'visa') {\n timeoutError.setCorrelationId(window.VISA_SDK?.correlationId);\n\n // Visa srciDpaId must be passed when there is no correlation ID available\n if (window.VISA_SDK?.correlationId) window.VISA_SDK?.buildClientProfile?.();\n else window.VISA_SDK?.buildClientProfile?.(this.schemesConfig.visa.srciDpaId);\n }\n this.onTimeout?.(timeoutError);\n }\n\n /**\n * Based on the given 'idToken', this method goes through each SRCi SDK and fetches the shopper\n * profile with his cards.\n */\n private async getShopperProfile(idTokens: string[]): Promise<void> {\n return new Promise((resolve, reject) => {\n const srcProfilesPromises = this.sdks.map(sdk => sdk.getSrcProfile(idTokens));\n\n void Promise.allSettled(srcProfilesPromises).then(srcProfilesResponses => {\n if (srcProfilesResponses.every(isRejected)) {\n reject(srcProfilesResponses[0].reason);\n }\n\n const createProfileWithScheme = (promiseResult: PromiseSettledResult<SrcProfile>, index) =>\n isFulfilled(promiseResult) && { ...promiseResult.value, scheme: this.sdks[index].schemeName };\n\n const profilesWithScheme: SrcProfileWithScheme[] = srcProfilesResponses.map(createProfileWithScheme).filter(profile => !!profile);\n\n this.shopperCards = createShopperCardsList(profilesWithScheme);\n resolve();\n });\n });\n }\n\n /**\n * Calls the 'isRecognized()' method of each SRC SDK in order to verify if the shopper is\n * recognized on the device. The shopper is recognized if he/she has the Cookies stored\n * on their browser\n */\n private verifyIfShopperIsRecognized(): Promise<SrciIsRecognizedResponse> {\n return new Promise((resolve, reject) => {\n const promises = this.sdks.map(sdk => {\n const isRecognizedPromise = executeWithTimeout<SrciIsRecognizedResponse>(\n () => sdk.isRecognized(),\n 5000,\n new TimeoutError({\n source: 'isRecognized',\n scheme: sdk.schemeName,\n isTimeoutTriggeredBySchemeSdk: false\n })\n );\n\n return isRecognizedPromise\n .then(response => {\n if (response.recognized) resolve(response);\n })\n .catch(error => {\n reject(error);\n });\n });\n\n // If the 'resolve' didn't happen until this point, then shopper is not recognized\n void Promise.allSettled(promises).then(() => {\n resolve({ recognized: false });\n });\n });\n }\n\n private initiateSdks(): Promise<void[]> {\n const initPromises = this.sdks.map(sdk => {\n const cfg = this.schemesConfig[sdk.schemeName];\n\n return executeWithTimeout<void>(\n () => sdk.init(cfg, this.srciTransactionId),\n 5000,\n new TimeoutError({\n source: 'init',\n scheme: sdk.schemeName,\n isTimeoutTriggeredBySchemeSdk: false\n })\n );\n });\n\n return Promise.all(initPromises);\n }\n}\n\nexport default ClickToPayService;\n"],"names":["CtpState","ClickToPayService","shopperAccountFound","includes","this","state","schemes","sdkLoader","updateStoreCookiesConsent","shouldStore","storeCookies","initialize","setState","sdks","load","environment","initiateSdks","recognized","idTokens","verifyIfShopperIsRecognized","getShopperProfile","shopperIdentity","isEnrolled","verifyIfShopperIsEnrolled","error","SrciError","reason","TimeoutError","handleTimeout","console","warn","toString","subscribeOnStateChange","callback","stateSubscriber","startIdentityValidation","validationSchemeSdk","Error","maskedValidationChannel","initiateIdentityValidation","identityValidationData","maskedShopperContact","replace","selectedNetwork","SchemeNames","schemeName","finishIdentityValidation","otpCode","validationToken","completeIdentityValidation","idToken","checkout","card","checkoutSdk","find","sdk","scheme","checkoutResponse","srcDigitalCardId","srcCorrelationId","isDcfPopupEmbedded","windowRef","window","frames","CTP_IFRAME_NAME","complianceSettings","complianceResources","complianceType","uri","dcfActionCode","AdyenCheckoutError","createCheckoutPayloadBasedOnScheme","logout","logoutPromises","map","unbindAppInstance","Promise","all","shopperCards","shopperEmail","resolve","reject","lookupPromises","executeWithTimeout","identityLookup","identityValue","type","source","isTimeoutTriggeredBySchemeSdk","then","response","consumerPresent","setSdkForPerformingShopperIdentityValidation","catch","allSettled","timeoutError","setCorrelationId","VISA_SDK","correlationId","buildClientProfile","schemesConfig","visa","srciDpaId","onTimeout","srcProfilesPromises","getSrcProfile","srcProfilesResponses","every","isRejected","profilesWithScheme","promiseResult","index","isFulfilled","value","filter","profile","createShopperCardsList","promises","isRecognized","initPromises","cfg","init","srciTransactionId","constructor","_define_property","uuidv4"],"mappings":"+lBAsBYA,SAAAA,+KAAAA,CAAAA,IAAAA,EAAAA,CAAAA,IAUZ,MAAMC,EAwCF,uBAAWC,GACP,MAAO,8BAA6CC,SAASC,KAAKC,MACtE,CAEA,WAAWC,GACP,OAAOF,KAAKG,UAAUD,OAC1B,CAEOE,yBAAAA,CAA0BC,GAC7BL,KAAKM,aAAeD,CACxB,CAEA,gBAAaE,GACTP,KAAKQ,SAAQ,WAEb,IACIR,KAAKS,WAAaT,KAAKG,UAAUO,KAAKV,KAAKW,mBACrCX,KAAKY,eAEX,MAAMC,WAAEA,GAAa,EAAKC,SAAEA,EAAW,YAAed,KAAKe,8BAE3D,GAAIF,EAGA,aAFMb,KAAKgB,kBAAkBF,QAC7Bd,KAAKQ,SAAQ,SAIjB,IAAKR,KAAKiB,gBAEN,YADAjB,KAAKQ,SAAQ,gBAIjB,MAAMU,W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