@adyen/adyen-web 6.0.0-alpha.5 → 6.0.0-alpha.6
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/dist/cjs/adyen.css +10 -9
- 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 +33 -29
- package/dist/es/adyen.css +10 -9
- package/dist/es/adyen.css.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/BacsDD/components/BacsInput.js +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es/components/Blik/components/BlikInput.js +1 -1
- package/dist/es/components/Blik/components/BlikInput.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
- package/dist/es/components/CashAppPay/components/CashAppComponent.js +1 -1
- package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
- package/dist/es/components/GooglePay/components/GooglePayButton.js +1 -1
- package/dist/es/components/GooglePay/components/GooglePayButton.js.map +1 -1
- package/dist/es/components/GooglePay/defaultProps.js +1 -1
- package/dist/es/components/GooglePay/defaultProps.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/internal/Address/Address.js +1 -1
- package/dist/es/components/internal/Address/Address.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/utils.js +1 -1
- package/dist/es/components/internal/ClickToPay/services/utils.js.map +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
- package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
- package/dist/es/components/internal/Icon/constants.js +2 -0
- package/dist/es/components/internal/Icon/constants.js.map +1 -0
- package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
- package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
- package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +2 -0
- package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -0
- 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/lib/constants.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/components/internal/Voucher/Voucher.js +1 -1
- package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
- package/dist/es/core/Analytics/Analytics.js +1 -1
- package/dist/es/core/Analytics/Analytics.js.map +1 -1
- package/dist/es/core/Analytics/constants.js +1 -1
- package/dist/es/core/Analytics/constants.js.map +1 -1
- package/dist/es/core/Analytics/utils.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/Environment/Environment.js +1 -1
- package/dist/es/core/Environment/Environment.js.map +1 -1
- package/dist/es/core/Environment/constants.js +2 -0
- package/dist/es/core/Environment/constants.js.map +1 -0
- package/dist/es/core/Errors/SRMessages.js +1 -1
- package/dist/es/core/Errors/SRMessages.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/Services/analytics/collect-id.js +1 -1
- package/dist/es/core/Services/analytics/collect-id.js.map +1 -1
- package/dist/es/core/Services/analytics/log-event.js +1 -1
- package/dist/es/core/Services/get-translations.js +1 -1
- package/dist/es/core/Services/get-translations.js.map +1 -1
- package/dist/es/core/core.defaultProps.js +1 -1
- package/dist/es/core/core.defaultProps.js.map +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/core.js.map +1 -1
- package/dist/es/core/utils.js +1 -1
- package/dist/es/core/utils.js.map +1 -1
- package/dist/es/external/preact/dist/preact.js +1 -1
- package/dist/es/external/preact/dist/preact.js.map +1 -1
- package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
- package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
- package/dist/es/index.d.ts +33 -29
- package/dist/es/utils/arrayUtils.js +1 -1
- package/dist/es/utils/arrayUtils.js.map +1 -1
- package/dist/es/utils/useForm/useForm.js +1 -1
- package/dist/es/utils/validator-utils.js +1 -1
- package/dist/es/utils/validator-utils.js.map +1 -1
- package/dist/es-legacy/adyen.css +10 -9
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
- package/dist/es-legacy/components/Ach/Ach.js +1 -1
- package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
- package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js +1 -1
- package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +1 -1
- package/dist/es-legacy/components/Address/Address.js +1 -1
- package/dist/es-legacy/components/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/Affirm/Affirm.js +1 -1
- package/dist/es-legacy/components/Affirm/Affirm.js.map +1 -1
- package/dist/es-legacy/components/AfterPay/AfterPay.js +1 -1
- package/dist/es-legacy/components/AfterPay/AfterPay.js.map +1 -1
- package/dist/es-legacy/components/AfterPay/AfterPayB2B.js +1 -1
- package/dist/es-legacy/components/AfterPay/AfterPayB2B.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
- package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
- package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es-legacy/components/Atome/Atome.js +1 -1
- package/dist/es-legacy/components/Atome/Atome.js.map +1 -1
- package/dist/es-legacy/components/Atome/config.js +1 -1
- package/dist/es-legacy/components/Atome/config.js.map +1 -1
- package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
- package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es-legacy/components/BankTransfer/BankTransfer.js +1 -1
- package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
- package/dist/es-legacy/components/BillDesk/BillDeskOnline.js +1 -1
- package/dist/es-legacy/components/BillDesk/BillDeskOnline.js.map +1 -1
- package/dist/es-legacy/components/BillDesk/BillDeskWallet.js +1 -1
- package/dist/es-legacy/components/BillDesk/BillDeskWallet.js.map +1 -1
- package/dist/es-legacy/components/Blik/Blik.js +1 -1
- package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
- package/dist/es-legacy/components/Blik/components/BlikInput.js +1 -1
- package/dist/es-legacy/components/Blik/components/BlikInput.js.map +1 -1
- package/dist/es-legacy/components/Boleto/Boleto.js +1 -1
- package/dist/es-legacy/components/Boleto/Boleto.js.map +1 -1
- package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
- package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
- package/dist/es-legacy/components/Card/Bancontact.js +1 -1
- package/dist/es-legacy/components/Card/Bancontact.js.map +1 -1
- package/dist/es-legacy/components/Card/Card.js +1 -1
- package/dist/es-legacy/components/Card/Card.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/IframeLabelAlternative.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/IframeLabelAlternative.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
- package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js +1 -1
- package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
- package/dist/es-legacy/components/ClickToPay/ClickToPay.js +1 -1
- package/dist/es-legacy/components/ClickToPay/ClickToPay.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
- package/dist/es-legacy/components/Doku/Doku.js +1 -1
- package/dist/es-legacy/components/Doku/Doku.js.map +1 -1
- package/dist/es-legacy/components/Donation/Donation.js +1 -1
- package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
- package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
- package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
- package/dist/es-legacy/components/Dropin/elements/createInstantPaymentElements.js +1 -1
- package/dist/es-legacy/components/Dropin/elements/createInstantPaymentElements.js.map +1 -1
- package/dist/es-legacy/components/Dropin/elements/createStoredElements.js +1 -1
- package/dist/es-legacy/components/Dropin/elements/createStoredElements.js.map +1 -1
- package/dist/es-legacy/components/EPS/index.js +1 -1
- package/dist/es-legacy/components/EPS/index.js.map +1 -1
- package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
- package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
- package/dist/es-legacy/components/FacilyPay/FacilyPay10x.js +1 -1
- package/dist/es-legacy/components/FacilyPay/FacilyPay10x.js.map +1 -1
- package/dist/es-legacy/components/FacilyPay/FacilyPay12x.js +1 -1
- package/dist/es-legacy/components/FacilyPay/FacilyPay12x.js.map +1 -1
- package/dist/es-legacy/components/FacilyPay/FacilyPay3x.js +1 -1
- package/dist/es-legacy/components/FacilyPay/FacilyPay3x.js.map +1 -1
- package/dist/es-legacy/components/FacilyPay/FacilyPay4x.js +1 -1
- package/dist/es-legacy/components/FacilyPay/FacilyPay4x.js.map +1 -1
- package/dist/es-legacy/components/FacilyPay/FacilyPay6x.js +1 -1
- package/dist/es-legacy/components/FacilyPay/FacilyPay6x.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardFields.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardFields.js.map +1 -1
- package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
- package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js +1 -1
- package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/defaultProps.js +1 -1
- package/dist/es-legacy/components/GooglePay/defaultProps.js.map +1 -1
- package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
- package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
- package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
- package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
- package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
- package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
- package/dist/es-legacy/components/MealVoucherFR/MealVoucherFR.js +1 -1
- package/dist/es-legacy/components/MealVoucherFR/MealVoucherFR.js.map +1 -1
- package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherFields.js +1 -1
- package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherFields.js.map +1 -1
- package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
- package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
- package/dist/es-legacy/components/OnlineBankingCZ/index.js +1 -1
- package/dist/es-legacy/components/OnlineBankingCZ/index.js.map +1 -1
- package/dist/es-legacy/components/OnlineBankingIN/index.js +1 -1
- package/dist/es-legacy/components/OnlineBankingIN/index.js.map +1 -1
- package/dist/es-legacy/components/OnlineBankingPL/OnlineBankingPL.js +1 -1
- package/dist/es-legacy/components/OnlineBankingPL/OnlineBankingPL.js.map +1 -1
- package/dist/es-legacy/components/OnlineBankingSK/index.js +1 -1
- package/dist/es-legacy/components/OnlineBankingSK/index.js.map +1 -1
- package/dist/es-legacy/components/Oxxo/Oxxo.js +1 -1
- package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
- package/dist/es-legacy/components/PayByBank/PayByBank.js +1 -1
- package/dist/es-legacy/components/PayByBank/PayByBank.js.map +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
- package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js +1 -1
- package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js.map +1 -1
- package/dist/es-legacy/components/PayU/PayuCashcard.js +1 -1
- package/dist/es-legacy/components/PayU/PayuCashcard.js.map +1 -1
- package/dist/es-legacy/components/PayU/PayuNetBanking.js +1 -1
- package/dist/es-legacy/components/PayU/PayuNetBanking.js.map +1 -1
- package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/Pix/Pix.js +1 -1
- package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
- package/dist/es-legacy/components/RatePay/RatePay.js +1 -1
- package/dist/es-legacy/components/RatePay/RatePay.js.map +1 -1
- package/dist/es-legacy/components/RatePay/RatePayDirectDebit.js +1 -1
- package/dist/es-legacy/components/RatePay/RatePayDirectDebit.js.map +1 -1
- package/dist/es-legacy/components/Redirect/Redirect.js +1 -1
- package/dist/es-legacy/components/Redirect/Redirect.js.map +1 -1
- package/dist/es-legacy/components/Riverty/Riverty.js +1 -1
- package/dist/es-legacy/components/Riverty/Riverty.js.map +1 -1
- package/dist/es-legacy/components/Sepa/Sepa.js +1 -1
- package/dist/es-legacy/components/Sepa/Sepa.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es-legacy/components/Trustly/Trustly.js +1 -1
- package/dist/es-legacy/components/Trustly/Trustly.js.map +1 -1
- package/dist/es-legacy/components/Twint/Twint.js +1 -1
- package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
- package/dist/es-legacy/components/UPI/UPI.js +1 -1
- package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
- package/dist/es-legacy/components/WalletIN/index.js +1 -1
- package/dist/es-legacy/components/WalletIN/index.js.map +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js +1 -1
- package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
- package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
- package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/components/CountryField.js +1 -1
- package/dist/es-legacy/components/internal/Address/components/CountryField.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/MastercardSdk.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/utils.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputEmail.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputEmail.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputTelephone.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputTelephone.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputText.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputText.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
- package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
- package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
- package/dist/es-legacy/components/internal/Icon/constants.js +2 -0
- package/dist/es-legacy/components/internal/Icon/constants.js.map +1 -0
- package/dist/es-legacy/components/internal/Img/Img.js +1 -1
- package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js.map +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +2 -0
- package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -0
- package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
- package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
- package/dist/es-legacy/core/Analytics/constants.js +1 -1
- package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
- package/dist/es-legacy/core/Context/Resources.js +1 -1
- package/dist/es-legacy/core/Context/Resources.js.map +1 -1
- package/dist/es-legacy/core/Environment/Environment.js +1 -1
- package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
- package/dist/es-legacy/core/Environment/constants.js +2 -0
- package/dist/es-legacy/core/Environment/constants.js.map +1 -0
- package/dist/es-legacy/core/Errors/SRPanel.js +1 -1
- package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/process-response.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/process-response.js.map +1 -1
- package/dist/es-legacy/core/RiskModule/RiskModule.js +1 -1
- package/dist/es-legacy/core/RiskModule/RiskModule.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/log-event.js +1 -1
- package/dist/es-legacy/core/Services/get-translations.js +1 -1
- package/dist/es-legacy/core/Services/get-translations.js.map +1 -1
- package/dist/es-legacy/core/Services/http.js +1 -1
- package/dist/es-legacy/core/Services/http.js.map +1 -1
- package/dist/es-legacy/core/core.defaultProps.js +1 -1
- package/dist/es-legacy/core/core.defaultProps.js.map +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/dist/es-legacy/core/core.registry.js +1 -1
- package/dist/es-legacy/core/core.registry.js.map +1 -1
- package/dist/es-legacy/core/utils.js +1 -1
- package/dist/es-legacy/core/utils.js.map +1 -1
- package/dist/es-legacy/external/preact/dist/preact.js +1 -1
- package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
- package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
- package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
- package/dist/es-legacy/utils/arrayUtils.js +1 -1
- package/dist/es-legacy/utils/arrayUtils.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/validator-utils.js +1 -1
- package/dist/es-legacy/utils/validator-utils.js.map +1 -1
- package/package.json +146 -148
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SetSRMessagesReturnObject, SortedErrorObject } from '../../../../core/Errors/types';\nimport { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout, lookupBlurBasedErrors, mapFieldKey } from './utils';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler, setFocusOnFirstField } from './handlers';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../../core/Errors/constants';\nimport useSRPanelContext from '../../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../../core/Errors/SRPanelProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CbObjOnFocus } from '../../../internal/SecuredFields/lib/types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\n\nconst CardInput = (props: CardInputProps) => {\n const sfp = useRef(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n /** SR stuff */\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n /** end SR stuff */\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data.holderName ?? '' })\n });\n\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? props.data.billingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsObj>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = !!Object.keys(props.installmentOptions).length && props.fundingSource !== 'debit';\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn(sfState.autoCompleteName) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Get the previous value\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n // Extract and then flatten billingAddress errors into a new object with *all* the field errors at top level\n const { billingAddress: extractedAddressErrors, ...errorsWithoutAddress } = mergedErrors;\n\n const errorsForPanel = { ...errorsWithoutAddress, ...extractedAddressErrors };\n\n // Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: retrieveLayout(),\n // If we don't have country specific address labels, we might have a label related to a partialAddressSchema (i.e. zipCode)\n countrySpecificLabels: specifications.getAddressLabelsForCountry(billingAddress?.country) ?? partialAddressSchema?.default?.labels\n });\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout);\n\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n if (shouldMoveFocusSR) setFocusOnFirstField(isValidating.current, sfp, srPanelResp?.fieldToFocus);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n /** On blur scenario: not validating, i.e. trying to submit form, but there might be an error, either to set or to clear */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Use the error code to look up whether error is actually a blur based one (most are but some SF ones aren't)\n const isBlurBasedError = lookupBlurBasedErrors(latestErrorMsg.errorCode);\n\n /**\n * ONLY ADD BLUR BASED ERRORS TO THE ERROR PANEL - doing this step prevents the non-blur based errors from being read out twice\n * (once from the aria-live, error panel & once from the aria-describedby element)\n */\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n // console.log('### CardInput2::componentDidUpdate:: #2 (not validating) single error:: latestSRError', latestSRError);\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n // console.log('### CardInput2::componentDidUpdate:: #3(not validating) clearing errors:: NO latestErrorMsg');\n clearSRPanel();\n }\n break;\n }\n default:\n break;\n }\n\n // Analytics\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n newErrors?.forEach(errorItem => {\n const aObj: FieldErrorAnalyticsObject = {\n fieldType: errorItem.field,\n errorCode: errorItem.errorCode\n };\n\n props.onValidationErrorAnalytics(aObj);\n });\n }\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onChange={handleSecuredFieldsChange}\n onBrand={props.onBrand}\n onFocus={handleFocus}\n type={props.brand}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n {props.showFormInstruction && <FormInstruction />}\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n {props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })('lock')\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","status","setStatus","useState","errors","setErrors","valid","setValid","_object_spread","holderNameRequired","holderName","data","setData","hasHolderName","sortedErrorList","setSortedErrorList","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","useCallback","obj","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","extensions","CIExtensions","showValidation","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","_object_spread_props","taxNumber","addressHasErrors","entries","reduce","acc","error","previousSortedErrors","usePrevious","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","extractedAddressErrors","errorsForPanel","srPanelResp","layout","countrySpecificLabels","getAddressLabelsForCountry","default","labels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnFirstField","fieldToFocus","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","lookupBlurBasedErrors","errorCode","errorMessage","newErrors","forEach","errorItem","aObj","field","onValidationErrorAnalytics","onChange","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","acHolderName","getRuleByNameAndMode","holderNameValidationFn","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","onBrand","type","disableIOSArrowKeys","render","setRootNode","sfpState","div","className","classNames","role","showFormInstruction","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","defaultProps"],"mappings":"qhGAiCA,MAAMA,EAAaC,QA6DsDA,EAAAA,EA5DrE,MAAMC,EAAMC,EAAO,MACbC,EAAeD,GAAO,GACtBE,EAAWC,KAGXC,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA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uBzB,EAAC0B,EAC/B,MAAA1B,EAACH,UAEO8B,EAA0BlO,IAAAA,CAG9BsC,KAAMA,GACNL,MAAOA,GACPF,OAAQA,GACRoD,gBAAiBA,GACjBxC,eAAgBA,GAChBoG,WAAYA,EACZ4E,SAAUA,EACVzK,UAAWA,GACXiD,gBAAiBA,GACjBG,0BAA2BA,GAC3B6H,mBAAoBpJ,GAEpBqJ,YAAapO,EAAMoO,YACnB/I,SAAUA,GACVE,WAAYA,GACZD,UAAWA,GACXvC,iBAAkBA,GAClBQ,wBAAyBA,GACzBgF,WAAYA,GACZ9E,mBAAoBA,GAEpBiD,QAASA,GAETG,iBAAkBA,GAClBjC,qBAAsBA,GAEtByJ,qBAAsB7J,GAEtBzD,cAAeA,GACfsD,eAAgBA,GAChBiK,8BAA+BpK,IAAwBqK,EAAiCnK,GAAsBnD,SAC9GiD,qBAAsBA,GACtBiE,cAAeA,GACfqG,gBAAiBxO,EAAMwO,gBACvBC,kBAAmBzO,EAAMyO,kBACzBC,wBAAyB1O,EAAM0O,wBAE/BzJ,gBAAiBA,GAEjB8B,sBAAuBA,GACvBM,qBAAsBA,WAKrCrH,EAAM2O,eACH3O,EAAM4O,UAAU,CACZhN,UACAiN,QAAS7O,EAAM8O,0BAA4B,UAAY,YACvDC,KAAM3O,EAAS,CAAE4O,YAAa,eAAxB5O,CAAyC,UACnD,EAKhBL,EAAUkP,aAAeA"}
|
|
1
|
+
{"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SetSRMessagesReturnObject, SortedErrorObject } from '../../../../core/Errors/types';\nimport { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout, lookupBlurBasedErrors, mapFieldKey } from './utils';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler, setFocusOnFirstField } from './handlers';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../../core/Errors/constants';\nimport useSRPanelContext from '../../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../../core/Errors/SRPanelProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CbObjOnFocus } from '../../../internal/SecuredFields/lib/types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\n\nconst CardInput = (props: CardInputProps) => {\n const sfp = useRef(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n /** SR stuff */\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n /** end SR stuff */\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data.holderName ?? '' })\n });\n\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? props.data.billingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsObj>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = !!Object.keys(props.installmentOptions).length && props.fundingSource !== 'debit';\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn(sfState.autoCompleteName) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Get the previous value\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n // Extract and then flatten billingAddress errors into a new object with *all* the field errors at top level\n const { billingAddress: extractedAddressErrors, ...errorsWithoutAddress } = mergedErrors;\n\n const errorsForPanel = { ...errorsWithoutAddress, ...extractedAddressErrors };\n\n // Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: retrieveLayout(),\n // If we don't have country specific address labels, we might have a label related to a partialAddressSchema (i.e. zipCode)\n countrySpecificLabels: specifications.getAddressLabelsForCountry(billingAddress?.country) ?? partialAddressSchema?.default?.labels\n });\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout);\n\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n if (shouldMoveFocusSR) setFocusOnFirstField(isValidating.current, sfp, srPanelResp?.fieldToFocus);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n /** On blur scenario: not validating, i.e. trying to submit form, but there might be an error, either to set or to clear */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Use the error code to look up whether error is actually a blur based one (most are but some SF ones aren't)\n const isBlurBasedError = lookupBlurBasedErrors(latestErrorMsg.errorCode);\n\n /**\n * ONLY ADD BLUR BASED ERRORS TO THE ERROR PANEL - doing this step prevents the non-blur based errors from being read out twice\n * (once from the aria-live, error panel & once from the aria-describedby element)\n */\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n // console.log('### CardInput2::componentDidUpdate:: #2 (not validating) single error:: latestSRError', latestSRError);\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n // console.log('### CardInput2::componentDidUpdate:: #3(not validating) clearing errors:: NO latestErrorMsg');\n clearSRPanel();\n }\n break;\n }\n default:\n break;\n }\n\n // Analytics\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n newErrors?.forEach(errorItem => {\n const aObj: FieldErrorAnalyticsObject = {\n fieldType: errorItem.field,\n errorCode: errorItem.errorCode\n };\n\n props.onValidationErrorAnalytics(aObj);\n });\n }\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onChange={handleSecuredFieldsChange}\n onBrand={props.onBrand}\n onFocus={handleFocus}\n type={props.brand}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n {props.showFormInstruction && <FormInstruction />}\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n {props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","status","setStatus","useState","errors","setErrors","valid","setValid","_object_spread","holderNameRequired","holderName","data","setData","hasHolderName","sortedErrorList","setSortedErrorList","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","useCallback","obj","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","extensions","CIExtensions","showValidation","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","_object_spread_props","taxNumber","addressHasErrors","entries","reduce","acc","error","previousSortedErrors","usePrevious","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","extractedAddressErrors","errorsForPanel","srPanelResp","layout","countrySpecificLabels","getAddressLabelsForCountry","default","labels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnFirstField","fieldToFocus","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","lookupBlurBasedErrors","errorCode","errorMessage","newErrors","forEach","errorItem","aObj","field","onValidationErrorAnalytics","onChange","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","acHolderName","getRuleByNameAndMode","holderNameValidationFn","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","onBrand","type","disableIOSArrowKeys","render","setRootNode","sfpState","div","className","classNames","role","showFormInstruction","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"2/FAkCA,MAAMA,EAAaC,QA6DsDA,EAAAA,EA5DrE,MAAMC,EAAMC,EAAO,MACbC,EAAeD,GAAO,GACtBE,EAAWC,KAGXC,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAG1FC,EAAuCL,aAAAA,EAAAA,EA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AA,CAG9BsC,KAAMA,GACNL,MAAOA,GACPF,OAAQA,GACRoD,gBAAiBA,GACjBxC,eAAgBA,GAChBoG,WAAYA,EACZ4E,SAAUA,EACVzK,UAAWA,GACXiD,gBAAiBA,GACjBG,0BAA2BA,GAC3B6H,mBAAoBpJ,GAEpBqJ,YAAapO,EAAMoO,YACnB/I,SAAUA,GACVE,WAAYA,GACZD,UAAWA,GACXvC,iBAAkBA,GAClBQ,wBAAyBA,GACzBgF,WAAYA,GACZ9E,mBAAoBA,GAEpBiD,QAASA,GAETG,iBAAkBA,GAClBjC,qBAAsBA,GAEtByJ,qBAAsB7J,GAEtBzD,cAAeA,GACfsD,eAAgBA,GAChBiK,8BAA+BpK,IAAwBqK,EAAiCnK,GAAsBnD,SAC9GiD,qBAAsBA,GACtBiE,cAAeA,GACfqG,gBAAiBxO,EAAMwO,gBACvBC,kBAAmBzO,EAAMyO,kBACzBC,wBAAyB1O,EAAM0O,wBAE/BzJ,gBAAiBA,GAEjB8B,sBAAuBA,GACvBM,qBAAsBA,WAKrCrH,EAAM2O,eACH3O,EAAM4O,UAAU,CACZhN,UACAiN,QAAS7O,EAAM8O,0BAA4B,UAAY,YACvDC,KAAM3O,EAAS,CAAE4O,YAAa,eAAxB5O,CAAyC,GAAG6O,WACtD,EAKhBlP,EAAUmP,aAAeA"}
|
package/dist/es-legacy/components/Card/components/CardInput/components/IframeLabelAlternative.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../../external/preact/dist/preact.js";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);
|
|
1
|
+
import{createElement as e}from"../../../../../external/preact/dist/preact.js";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const n=(n,o)=>e("div",r(function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(r){t(e,r,n[r])}))}return e}({},n),{"aria-hidden":"true"}),o);export{n as alternativeLabelContent};
|
|
2
2
|
//# sourceMappingURL=IframeLabelAlternative.js.map
|
package/dist/es-legacy/components/Card/components/CardInput/components/IframeLabelAlternative.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IframeLabelAlternative.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/IframeLabelAlternative.tsx"],"sourcesContent":["import { h } from 'preact';\n\nexport const alternativeLabelContent = (defaultWrapperProps, children) => {\n return (\n <div {...defaultWrapperProps} aria-hidden={'true'}>\n {children}\n </div>\n );\n};\n"],"names":["alternativeLabelContent","defaultWrapperProps","children","h","div","aria-hidden"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IframeLabelAlternative.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/IframeLabelAlternative.tsx"],"sourcesContent":["import { h } from 'preact';\n\nexport const alternativeLabelContent = (defaultWrapperProps, children) => {\n return (\n <div {...defaultWrapperProps} aria-hidden={'true'}>\n {children}\n </div>\n );\n};\n"],"names":["alternativeLabelContent","defaultWrapperProps","children","h","div","aria-hidden"],"mappings":"ujBAEO,MAAMA,EAA0B,CAACC,EAAqBC,IAErDC,EAACC,MAAQH,wUAAAA,CAAAA,CAAAA,EAAAA,GAAAA,CAAqBI,cAAa,SACtCH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"./CVC.js";import r from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as c}from"../../../../../core/Context/CoreProvider.js";import{ENCRYPTED_SECURITY_CODE as o}from"../../../../internal/SecuredFields/lib/constants.js";import
|
|
1
|
+
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"./CVC.js";import r from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as c}from"../../../../../core/Context/CoreProvider.js";import{ENCRYPTED_SECURITY_CODE as o}from"../../../../internal/SecuredFields/lib/constants.js";import a from"../../../../internal/FormFields/InputText.js";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);r.push.apply(r,c)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function d({brand:d,hasCVC:l,onFocusField:s,errors:u,valid:p,cvcPolicy:y,focusedElement:f,lastFour:m,expiryMonth:b,expiryYear:_,showContextualElement:C}){const{i18n:O}=c(),x=`${O.get("creditCard.storedCard.description.ariaLabel").replace("%@",m)}${b&&_?` ${O.get("creditCard.expiryDate.label")} ${b}/${_}`:""}`,j="amex"===d,g=j?O.get("creditCard.securityCode.contextualText.4digits"):O.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form adyen-checkout__card__form--oneClick","aria-label":x},e("div",{className:"adyen-checkout__card__exp-cvc adyen-checkout__field-wrapper"},b&&_&&e(r,{label:O.get("creditCard.expiryDate.label"),className:"adyen-checkout__field--50",classNameModifiers:["storedCard"],name:"expiryDateField",disabled:!0},e(a,{name:"expiryDateField",className:"adyen-checkout__input adyen-checkout__input--disabled adyen-checkout__card__exp-date__input--oneclick",value:`${b} / ${_}`,disabled:!0,dir:"ltr"})),l&&e(t,n(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},c=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(c=c.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),c.forEach((function(t){i(e,t,r[t])}))}return e}({cvcPolicy:y,error:((e,t)=>e[t]?O.get(e[t]):null)(u,o),focused:"encryptedSecurityCode"===f,filled:!!p.encryptedSecurityCode||!!u.encryptedSecurityCode,isValid:!!p.encryptedSecurityCode,label:O.get("creditCard.securityCode.label"),onFocusField:s},b&&_&&{className:"adyen-checkout__field--50"}),{classNameModifiers:["storedCard"],frontCVC:j,showContextualElement:C,contextualText:g}))))}export{d as default};
|
|
2
2
|
//# sourceMappingURL=StoredCardFields.js.map
|
package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoredCardFields.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/StoredCardFields.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CVC from './CVC';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { StoredCardFieldsProps } from './types';\nimport { ENCRYPTED_SECURITY_CODE } from '../../../../internal/SecuredFields/lib/constants';\nimport InputText from '../../../../internal/FormFields/InputText';\n\nexport default function StoredCardFields({\n brand,\n hasCVC,\n onFocusField,\n errors,\n valid,\n cvcPolicy,\n focusedElement,\n lastFour,\n expiryMonth,\n expiryYear,\n showContextualElement\n}: StoredCardFieldsProps) {\n const { i18n } = useCoreContext();\n const storedCardDescription = i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', lastFour);\n const storedCardDescriptionSuffix = expiryMonth && expiryYear ? ` ${i18n.get('creditCard.expiryDate.label')} ${expiryMonth}/${expiryYear}` : '';\n const ariaLabel = `${storedCardDescription}${storedCardDescriptionSuffix}`;\n const isAmex = brand === 'amex';\n const cvcContextualText = isAmex\n ? i18n.get('creditCard.securityCode.contextualText.4digits')\n : i18n.get('creditCard.securityCode.contextualText.3digits');\n\n const getError = (errors, fieldType) => {\n return errors[fieldType] ? i18n.get(errors[fieldType]) : null;\n };\n\n return (\n <div className=\"adyen-checkout__card__form adyen-checkout__card__form--oneClick\" aria-label={ariaLabel}>\n <div className=\"adyen-checkout__card__exp-cvc adyen-checkout__field-wrapper\">\n {expiryMonth && expiryYear && (\n <Field\n label={i18n.get('creditCard.expiryDate.label')}\n className=\"adyen-checkout__field--50\"\n classNameModifiers={['storedCard']}\n name={'expiryDateField'}\n disabled\n >\n <InputText\n name={'expiryDateField'}\n className={'adyen-checkout__input adyen-checkout__input--disabled adyen-checkout__card__exp-date__input--oneclick'}\n value={`${expiryMonth} / ${expiryYear}`}\n disabled={true}\n dir={'ltr'}\n />\n </Field>\n )}\n\n {hasCVC && (\n <CVC\n cvcPolicy={cvcPolicy}\n error={getError(errors, ENCRYPTED_SECURITY_CODE)}\n focused={focusedElement === 'encryptedSecurityCode'}\n filled={!!valid.encryptedSecurityCode || !!errors.encryptedSecurityCode}\n isValid={!!valid.encryptedSecurityCode}\n label={i18n.get('creditCard.securityCode.label')}\n onFocusField={onFocusField}\n {...(expiryMonth && expiryYear && { className: 'adyen-checkout__field--50' })}\n classNameModifiers={['storedCard']}\n frontCVC={isAmex}\n showContextualElement={showContextualElement}\n contextualText={cvcContextualText}\n />\n )}\n </div>\n </div>\n );\n}\n"],"names":["StoredCardFields","brand","hasCVC","onFocusField","errors","valid","cvcPolicy","focusedElement","lastFour","expiryMonth","expiryYear","showContextualElement","i18n","useCoreContext","ariaLabel","get","replace","isAmex","cvcContextualText","h","div","className","aria-label","Field","label","classNameModifiers","name","disabled","InputText","value","dir","CVC","error","fieldType","getError","ENCRYPTED_SECURITY_CODE","focused","filled","encryptedSecurityCode","isValid","frontCVC","contextualText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"StoredCardFields.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/StoredCardFields.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CVC from './CVC';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { StoredCardFieldsProps } from './types';\nimport { ENCRYPTED_SECURITY_CODE } from '../../../../internal/SecuredFields/lib/constants';\nimport InputText from '../../../../internal/FormFields/InputText';\n\nexport default function StoredCardFields({\n brand,\n hasCVC,\n onFocusField,\n errors,\n valid,\n cvcPolicy,\n focusedElement,\n lastFour,\n expiryMonth,\n expiryYear,\n showContextualElement\n}: StoredCardFieldsProps) {\n const { i18n } = useCoreContext();\n const storedCardDescription = i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', lastFour);\n const storedCardDescriptionSuffix = expiryMonth && expiryYear ? ` ${i18n.get('creditCard.expiryDate.label')} ${expiryMonth}/${expiryYear}` : '';\n const ariaLabel = `${storedCardDescription}${storedCardDescriptionSuffix}`;\n const isAmex = brand === 'amex';\n const cvcContextualText = isAmex\n ? i18n.get('creditCard.securityCode.contextualText.4digits')\n : i18n.get('creditCard.securityCode.contextualText.3digits');\n\n const getError = (errors, fieldType) => {\n return errors[fieldType] ? i18n.get(errors[fieldType]) : null;\n };\n\n return (\n <div className=\"adyen-checkout__card__form adyen-checkout__card__form--oneClick\" aria-label={ariaLabel}>\n <div className=\"adyen-checkout__card__exp-cvc adyen-checkout__field-wrapper\">\n {expiryMonth && expiryYear && (\n <Field\n label={i18n.get('creditCard.expiryDate.label')}\n className=\"adyen-checkout__field--50\"\n classNameModifiers={['storedCard']}\n name={'expiryDateField'}\n disabled\n >\n <InputText\n name={'expiryDateField'}\n className={'adyen-checkout__input adyen-checkout__input--disabled adyen-checkout__card__exp-date__input--oneclick'}\n value={`${expiryMonth} / ${expiryYear}`}\n disabled={true}\n dir={'ltr'}\n />\n </Field>\n )}\n\n {hasCVC && (\n <CVC\n cvcPolicy={cvcPolicy}\n error={getError(errors, ENCRYPTED_SECURITY_CODE)}\n focused={focusedElement === 'encryptedSecurityCode'}\n filled={!!valid.encryptedSecurityCode || !!errors.encryptedSecurityCode}\n isValid={!!valid.encryptedSecurityCode}\n label={i18n.get('creditCard.securityCode.label')}\n onFocusField={onFocusField}\n {...(expiryMonth && expiryYear && { className: 'adyen-checkout__field--50' })}\n classNameModifiers={['storedCard']}\n frontCVC={isAmex}\n showContextualElement={showContextualElement}\n contextualText={cvcContextualText}\n />\n )}\n </div>\n </div>\n );\n}\n"],"names":["StoredCardFields","brand","hasCVC","onFocusField","errors","valid","cvcPolicy","focusedElement","lastFour","expiryMonth","expiryYear","showContextualElement","i18n","useCoreContext","ariaLabel","get","replace","isAmex","cvcContextualText","h","div","className","aria-label","Field","label","classNameModifiers","name","disabled","InputText","value","dir","CVC","error","fieldType","getError","ENCRYPTED_SECURITY_CODE","focused","filled","encryptedSecurityCode","isValid","frontCVC","contextualText"],"mappings":"o3BAQe,SAASA,GAAiBC,MACrCA,EAAKC,OACLA,EAAMC,aACNA,EAAYC,OACZA,EAAMC,MACNA,EAAKC,UACLA,EAASC,eACTA,EAAcC,SACdA,EAAQC,YACRA,EAAWC,WACXA,EAAUC,sBACVA,IAEA,MAAMC,KAAEA,GAASC,IAGXC,EAAY,GAFYF,EAAKG,IAAI,+CAA+CC,QAAQ,KAAMR,KAChEC,GAAeC,EAAa,IAAIE,EAAKG,IAAI,kCAAkCN,KAAeC,IAAe,KAEvIO,EAAmB,SAAVhB,EACTiB,EAAoBD,EACpBL,EAAKG,IAAI,kDACTH,EAAKG,IAAI,kDAMf,OACII,EAACC,MAAAA,CAAIC,UAAU,kEAAkEC,aAAYR,GACzFK,EAACC,MAAAA,CAAIC,UAAU,+DACVZ,GAAeC,GACZS,EAACI,EAAAA,CACGC,MAAOZ,EAAKG,IAAI,+BAChBM,UAAU,4BACVI,mBAAoB,CAAC,cACrBC,KAAM,kBACNC,UAAAA,GAEAR,EAACS,EAAAA,CACGF,KAAM,kBACNL,UAAW,wGACXQ,MAAO,GAAGpB,OAAiBC,IAC3BiB,UAAU,EACVG,IAAK,SAKhB5B,GACGiB,EAACY,EAAAA,wUAAAA,CAAAA,CACGzB,UAAWA,EACX0B,MA5BH,EAAC5B,EAAQ6B,IACf7B,EAAO6B,GAAarB,EAAKG,IAAIX,EAAO6B,IAAc,KA2BlCC,CAAS9B,EAAQ+B,GACxBC,QAA4B,0BAAnB7B,EACT8B,SAAUhC,EAAMiC,yBAA2BlC,EAAOkC,sBAClDC,UAAWlC,EAAMiC,sBACjBd,MAAOZ,EAAKG,IAAI,iCAChBZ,aAAcA,GACTM,GAAeC,GAAc,CAAEW,UAAW,8BAA4B,CAC3EI,mBAAoB,CAAC,cACrBe,SAAUvB,EACVN,sBAAuBA,EACvB8B,eAAgBvB,MAMxC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CoreProvider as r}from"../../core/Context/CoreProvider.js";import{CashAppComponent as o}from"./components/CashAppComponent.js";import s from"./services/CashAppService.js";import{CashAppSdkLoader as n}from"./services/CashAppSdkLoader.js";import i from"./defaultProps.js";import a from"../internal/RedirectButton/RedirectButton.js";import"../internal/Button/Button.js";import{payAmountLabel as p}from"../internal/PayButton/utils.js";import{TxVariants as h}from"../tx-variants.js";function
|
|
1
|
+
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CoreProvider as r}from"../../core/Context/CoreProvider.js";import{CashAppComponent as o}from"./components/CashAppComponent.js";import s from"./services/CashAppService.js";import{CashAppSdkLoader as n}from"./services/CashAppSdkLoader.js";import i from"./defaultProps.js";import a from"../internal/RedirectButton/RedirectButton.js";import"../internal/Button/Button.js";import{payAmountLabel as p}from"../internal/PayButton/utils.js";import{TxVariants as h}from"../tx-variants.js";import{PREFIX as c}from"../internal/Icon/constants.js";function d(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),o.forEach((function(e){d(t,e,r[e])}))}return t}function u(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r.push.apply(r,o)}return r}(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})),t}class m extends e{formatProps(t){var e,r;return u(l({},t),{enableStoreDetails:(null===(r=t.session)||void 0===r||null===(e=r.configuration)||void 0===e?void 0:e.enableStoreDetails)||t.enableStoreDetails})}formatData(){const{shopperWantsToStore:t,grantId:e,onFileGrantId:r,cashTag:o,customerId:s}=this.state.data||{},{storePaymentMethod:n,storedPaymentMethodId:i}=this.props,a=this.props.enableStoreDetails||!this.props.session&&n;if(i)return{paymentMethod:{type:m.type,storedPaymentMethodId:i}};return l({paymentMethod:l({type:m.type},e&&{grantId:e},s&&{customerId:s},r&&o&&{onFileGrantId:r,cashtag:o})},a&&{storePaymentMethod:n||t})}get displayName(){return this.props.storedPaymentMethodId&&this.props.cashtag?this.props.cashtag:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?"Cash App Pay":""}get isValid(){return!0}render(){var e;return t(r,{i18n:this.props.i18n,resources:this.resources,loadingContext:this.props.loadingContext},this.props.storedPaymentMethodId?t(a,{label:p(this.props.i18n,this.props.amount),icon:null===(e=this.resources)||void 0===e?void 0:e.getImage({imageFolder:"components/"})(`${c}lock`),name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(o,{ref:t=>{this.componentRef=t},enableStoreDetails:this.props.enableStoreDetails,cashAppService:this.cashAppService,onChangeStoreDetails:this.handleOnChangeStoreDetails,onError:this.handleError,onClick:this.submit,onAuthorize:this.handleAuthorize}))}constructor(t,e){var r,o;super(t,e),d(this,"cashAppService",void 0),d(this,"submit",(()=>{const{onClick:t,storedPaymentMethodId:e}=this.props;if(e)return void super.submit();let r=!1;new Promise(((e,r)=>t({resolve:e,reject:r}))).catch((()=>{throw r=!0,Error("onClick rejected")})).then((()=>this.cashAppService.createCustomerRequest())).then((()=>{this.cashAppService.begin()})).catch((t=>{r||this.handleError(t)}))})),d(this,"handleOnChangeStoreDetails",(t=>{const e=u(l({},this.state.data),{shopperWantsToStore:t});this.setState({data:e})})),d(this,"handleAuthorize",(t=>{const e=l({},this.state.data,t);this.setState({data:e,valid:{},errors:{},isValid:!0}),super.submit()})),this.props.enableStoreDetails&&this.props.storePaymentMethod&&console.warn("CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior."),this.props.storedPaymentMethodId||(this.cashAppService=new s(new n,{storePaymentMethod:this.props.storePaymentMethod,useCashAppButtonUi:this.props.showPayButton,environment:this.props.environment,amount:this.props.amount,redirectURL:this.props.redirectURL,clientId:null===(r=this.props.configuration)||void 0===r?void 0:r.clientId,scopeId:null===(o=this.props.configuration)||void 0===o?void 0:o.scopeId,button:this.props.button,referenceId:this.props.referenceId}))}}d(m,"type",h.cashapp),d(m,"defaultProps",i);export{m as CashAppPay,m as default};
|
|
2
2
|
//# sourceMappingURL=CashAppPay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n this.cashAppService = new CashAppService(new CashAppSdkLoader(), {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n amount: this.props.amount,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest();\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} resources={this.resources} loadingContext={this.props.loadingContext}>\n {this.props.storedPaymentMethodId ? (\n <RedirectButton\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })('lock')}\n name={this.displayName}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","_object_spread_props","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","_object_spread","cashtag","displayName","name","additionalInfo","isValid","render","_this_resources","h","CoreProvider","i18n","resources","loadingContext","RedirectButton","label","payAmountLabel","amount","icon","getImage","imageFolder","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","_this_props_configuration","_this_props_configuration1","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","CashAppService","CashAppSdkLoader","useCashAppButtonUi","showPayButton","environment","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"i/CAcO,MAAMA,UAAmBC,EAiCrBC,WAAAA,CAAYC,OAGSA,EAAAA,EAFxB,OAAOC,EACAD,EAAAA,CAAAA,EAAAA,GAAAA,CACHE,4BAAoBF,EAAAA,EAAMG,eAANH,IAAAA,WAAAA,EAAAA,EAAeI,qBAAfJ,IAAAA,OAAAA,EAAAA,EAA8BE,qBAAsBF,EAAME,oBAEtF,CAEOG,UAAAA,GACH,MAAMC,oBAAEA,EAAmBC,QAAEA,EAAO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,mBAAoBpE,KAAKX,MAAMgF,cAC/BC,YAAatE,KAAKX,MAAMiF,YACxB7C,OAAQzB,KAAKX,MAAMoC,OACnB8C,YAAavE,KAAKX,MAAMkF,YACxBC,SAAkC,QAAxB3B,EAAA7C,KAAKX,MAAMI,qBAAX,IAAAoD,OAAA,EAAAA,EAA0B2B,SACpCC,QAAiC,QAAxB3B,EAAA9C,KAAKX,MAAMI,qBAAX,IAAAqD,OAAA,EAAAA,EAA0B2B,QACnCC,OAAQ1E,KAAKX,MAAMqF,OACnBC,YAAa3E,KAAKX,MAAMsF,cAEhC,EA9BA3B,EADS9D,EACKsB,OAAOoE,EAAWC,SAIhC7B,EALS9D,EAKQ4F,eAAeA"}
|
|
1
|
+
{"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { PREFIX } from '../internal/Icon/constants';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n this.cashAppService = new CashAppService(new CashAppSdkLoader(), {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n amount: this.props.amount,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest();\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} resources={this.resources} loadingContext={this.props.loadingContext}>\n {this.props.storedPaymentMethodId ? (\n <RedirectButton\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","_object_spread_props","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","_object_spread","cashtag","displayName","name","additionalInfo","isValid","render","_this_resources","h","CoreProvider","i18n","resources","loadingContext","RedirectButton","label","payAmountLabel","amount","icon","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","_this_props_configuration","_this_props_configuration1","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","CashAppService","CashAppSdkLoader","useCashAppButtonUi","showPayButton","environment","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"i9CAeO,MAAMA,UAAmBC,EAiCrBC,WAAAA,CAAYC,OAGSA,EAAAA,EAFxB,OAAOC,EACAD,EAAAA,CAAAA,EAAAA,GAAAA,CACHE,4BAAoBF,EAAAA,EAAMG,eAANH,IAAAA,WAAAA,EAAAA,EAAeI,qBAAfJ,IAAAA,OAAAA,EAAAA,EAA8BE,qBAAsBF,EAAME,oBAEtF,CAEOG,UAAAA,GACH,MAAMC,oBAAEA,EAAmBC,QAAEA,EAAOC,cAAEA,EAAaC,QAAEA,EAAOC,WAAEA,GAAeC,KAAKC,MAAMC,MAAQ,IACxFC,mBAAoBC,EAA+BC,sBAAEA,GAA0BL,KAAKX,MAKtFiB,EAA4BN,KAAKX,MAAME,qBAAwBS,KAAKX,MAAMG,SAAWY,EAE3F,GAAIC,EACA,MAAO,CACHE,cAAe,CACXC,KAAMtB,EAAWsB,KACjBH,0BAOZ,OAAOI,EAAA,CACHF,cAAeE,EAAA,CACXD,KAAMtB,EAAWsB,MACbZ,GAAW,CAAEA,WACbG,GAAc,CAAEA,cANMF,GAAiBC,GAOV,CAAED,gBAAea,QAASZ,KAE3DQ,GAA6B,CAAEH,mBAAoBC,GAAmCT,GAElG,CAEA,eAAIgB,GACA,OAAIX,KAAKX,MAAMgB,uBAAyBL,KAAKX,MAAMqB,QACxCV,KAAKX,MAAMqB,QAEfV,KAAKX,MAAMuB,IACtB,CAEA,kBAAIC,GACA,OAAOb,KAAKX,MAAMgB,sBAAwB,eAAiB,EAC/D,CAgCA,WAAWS,GACP,OAAO,CAC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,YAAYmB,EAAAA,GACrB,IAORV,EAAAjD,KAAQsC,8BAA8BsB,IAClC,MAAM1D,EAAOZ,EAAKmB,EAAA,CAAA,EAAAT,KAAKC,MAAMC,MAAI,CAAEP,oBAAqBiE,IACxD5D,KAAK6D,SAAS,CAAE3D,QAAK,IAGzB+C,EAAAjD,KAAQ2C,mBAAmBmB,IACvB,MAAM5D,EAAOO,EAAK,CAAA,EAAAT,KAAKC,MAAMC,KAAS4D,GACtC9D,KAAK6D,SAAS,CAAE3D,OAAM6D,MAAO,CAAC,EAAGC,OAAQ,CAAC,EAAGlD,SAAS,IACtDkC,MAAMhB,QAAAA,IAlHFhC,KAAKX,MAAME,oBAAsBS,KAAKX,MAAMc,oBAC5C8D,QAAQC,KACJ,oJAIJlE,KAAKX,MAAMgB,wBAIfL,KAAKoC,eAAiB,IAAI+B,EAAe,IAAIC,EAAoB,CAC7DjE,mBAAoBH,KAAKX,MAAMc,mBAC/BkE,mBAAoBrE,KAAKX,MAAMiF,cAC/BC,YAAavE,KAAKX,MAAMkF,YACxB9C,OAAQzB,KAAKX,MAAMoC,OACnB+C,YAAaxE,KAAKX,MAAMmF,YACxBC,SAAkC,QAAxB3B,EAAA9C,KAAKX,MAAMI,qBAAX,IAAAqD,OAAA,EAAAA,EAA0B2B,SACpCC,QAAiC,QAAxB3B,EAAA/C,KAAKX,MAAMI,qBAAX,IAAAsD,OAAA,EAAAA,EAA0B2B,QACnCC,OAAQ3E,KAAKX,MAAMsF,OACnBC,YAAa5E,KAAKX,MAAMuF,cAEhC,EA9BA3B,EADS/D,EACKsB,OAAOqE,EAAWC,SAIhC7B,EALS/D,EAKQ6F,eAAeA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as t,useState as r,useCallback as n,useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import s from"../../internal/Spinner/Spinner.js";import{CashAppPayEvents as i}from"../services/types.js";import c from"../../internal/StoreDetails/StoreDetails.js";function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u({enableStoreDetails:u,cashAppService:d,onClick:m,onChangeStoreDetails:p,onAuthorize:f,onError:b}){const
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as t,useState as r,useCallback as n,useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import s from"../../internal/Spinner/Spinner.js";import{CashAppPayEvents as i}from"../services/types.js";import c from"../../internal/StoreDetails/StoreDetails.js";function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u({enableStoreDetails:u,cashAppService:d,onClick:m,onChangeStoreDetails:p,onAuthorize:f,onError:b}){const h=t(null),[y,g]=r("loading"),v=t([]),[C,E]=r(!1);this.setStatus=g;const w=n((async()=>{try{await d.initialize(),v.current=[d.subscribeToEvent(i.CustomerDismissed,(()=>{b(new o("CANCEL","Customer dismissed the modal"))})),d.subscribeToEvent(i.CustomerRequestDeclined,(async()=>{b(new o("ERROR","Payment declined by CashAppPay")),await d.restart(),await d.renderButton(h.current)})),d.subscribeToEvent(i.CustomerRequestApproved,(({customerProfile:e,grants:t})=>{var r,n;const a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){l(e,t,r[t])}))}return e}({},(null==e?void 0:e.id)&&{customerId:e.id},(null==e?void 0:e.cashtag)&&{cashTag:e.cashtag},(null==t||null===(r=t.payment)||void 0===r?void 0:r.grantId)&&{grantId:t.payment.grantId},(null==t||null===(n=t.onFile)||void 0===n?void 0:n.grantId)&&{onFileGrantId:t.onFile.grantId});f(a)})),d.subscribeToEvent(i.CustomerRequestFailed,(()=>{b(new o("ERROR","Customer request failed"))}))],await d.renderButton(h.current),g("ready")}catch(e){b(e instanceof o?e:new o("ERROR","Error when initializing CashAppPay",{cause:e}))}}),[d,b,f]);return a((()=>{u&&(d.setStorePaymentMethod(C),p(C))}),[u,C]),a((()=>(w(),()=>{d.restart(),v.current.forEach((e=>e()))})),[d,w]),e("div",{className:"adyen-checkout__cashapp","aria-live":"polite","aria-busy":"loading"===y},"loading"===y&&e(s,null),"loading"!==y&&u&&e(c,{storeDetails:C,onChange:E}),e("div",{onClick:m,className:"adyen-checkout__cashapp-button",ref:h}))}export{u as CashAppComponent};
|
|
2
2
|
//# sourceMappingURL=CashAppComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CashAppComponent.js","sources":["../../../../../src/components/CashAppPay/components/CashAppComponent.tsx"],"sourcesContent":["import { h, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Spinner from '../../internal/Spinner';\nimport { CashAppPayEvents, ICashAppService } from '../services/types';\nimport { CashAppPayEventData } from '../types';\nimport StoreDetails from '../../internal/StoreDetails';\nimport './CashAppComponent.scss';\nimport { UIElementStatus } from '../../internal/UIElement/types';\n\ninterface CashAppComponentProps {\n enableStoreDetails?: boolean;\n cashAppService: ICashAppService;\n onClick(): void;\n onChangeStoreDetails(data: any): void;\n onAuthorize(payEventData: CashAppPayEventData): void;\n onError(error: AdyenCheckoutError): void;\n ref(ref: RefObject<typeof CashAppComponent>): void;\n}\n\nexport function CashAppComponent({\n enableStoreDetails,\n cashAppService,\n onClick,\n onChangeStoreDetails,\n onAuthorize,\n onError\n}: CashAppComponentProps): h.JSX.Element {\n const cashAppRef = useRef<HTMLDivElement>(null);\n const [status, setStatus] = useState<UIElementStatus>('loading');\n const subscriptions = useRef<Function[]>([]);\n const [storePaymentMethod, setStorePaymentMethod] = useState<boolean>(false);\n\n this.setStatus = setStatus;\n\n const initializeCashAppSdk = useCallback(async () => {\n try {\n await cashAppService.initialize();\n\n subscriptions.current = [\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerDismissed, () => {\n onError(new AdyenCheckoutError('CANCEL', 'Customer dismissed the modal'));\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestDeclined, async () => {\n onError(new AdyenCheckoutError('ERROR', 'Payment declined by CashAppPay'));\n await cashAppService.restart();\n await cashAppService.renderButton(cashAppRef.current);\n }),\n\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestApproved, ({ customerProfile, grants }) => {\n const cashAppPaymentData: CashAppPayEventData = {\n ...(customerProfile?.id && { customerId: customerProfile.id }),\n ...(customerProfile?.cashtag && { cashTag: customerProfile.cashtag }),\n ...(grants?.payment?.grantId && { grantId: grants.payment.grantId }),\n ...(grants?.onFile?.grantId && { onFileGrantId: grants.onFile.grantId })\n };\n\n onAuthorize(cashAppPaymentData);\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestFailed, () => {\n onError(new AdyenCheckoutError('ERROR', 'Customer request failed'));\n })\n ];\n\n await cashAppService.renderButton(cashAppRef.current);\n\n setStatus('ready');\n } catch (error) {\n onError(error);\n }\n }, [cashAppService, onError, onAuthorize]);\n\n useEffect(() => {\n if (enableStoreDetails) {\n cashAppService.setStorePaymentMethod(storePaymentMethod);\n onChangeStoreDetails(storePaymentMethod);\n }\n }, [enableStoreDetails, storePaymentMethod]);\n\n useEffect(() => {\n initializeCashAppSdk();\n return () => {\n cashAppService.restart();\n subscriptions.current.forEach(unsubscribeFn => unsubscribeFn());\n };\n }, [cashAppService, initializeCashAppSdk]);\n\n return (\n <div className=\"adyen-checkout__cashapp\" aria-live=\"polite\" aria-busy={status === 'loading'}>\n {status === 'loading' && <Spinner />}\n {status !== 'loading' && enableStoreDetails && <StoreDetails storeDetails={storePaymentMethod} onChange={setStorePaymentMethod} />}\n\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div onClick={onClick} className={'adyen-checkout__cashapp-button'} ref={cashAppRef}></div>\n </div>\n );\n}\n"],"names":["CashAppComponent","enableStoreDetails","cashAppService","onClick","onChangeStoreDetails","onAuthorize","onError","cashAppRef","useRef","status","setStatus","useState","subscriptions","storePaymentMethod","setStorePaymentMethod","this","initializeCashAppSdk","useCallback","async","initialize","current","subscribeToEvent","CashAppPayEvents","CustomerDismissed","AdyenCheckoutError","CustomerRequestDeclined","restart","renderButton","CustomerRequestApproved","customerProfile","grants","cashAppPaymentData","_object_spread","id","customerId","cashtag","cashTag","payment","grantId","onFile","onFileGrantId","CustomerRequestFailed","error","useEffect","forEach","unsubscribeFn","h","div","className","aria-live","aria-busy","Spinner","StoreDetails","storeDetails","onChange","ref"],"mappings":"khBAoBO,SAASA,GAAiBC,mBAC7BA,EAAkBC,eAClBA,EAAcC,QACdA,EAAOC,qBACPA,EAAoBC,YACpBA,EAAWC,QACXA,IAEA,MAAMC,EAAaC,EAAuB,OACnCC,EAAQC,GAAaC,EAA0B,WAChDC,EAAgBJ,EAAmB,KAClCK,EAAoBC,GAAyBH,GAAkB,GAEtEI,KAAKL,UAAYA,EAEjB,MAAMM,EAAuBC,GAAYC,UACrC,UACUhB,EAAeiB,aAErBP,EAAcQ,QAAU,CACpBlB,EAAemB,iBAAiBC,EAAiBC,mBAAmB,KAChEjB,EAAQ,IAAIkB,EAAmB,SAAU,gCAAA,IAE7CtB,EAAemB,iBAAiBC,EAAiBG,yBAAyBP,UACtEZ,EAAQ,IAAIkB,EAAmB,QAAS,yCAClCtB,EAAewB,gBACfxB,EAAeyB,aAAapB,EAAWa,QAAO,IAGxDlB,EAAemB,iBAAiBC,EAAiBM,yBAAyB,EAAGC,kBAAiBC,iBAIlFA,EACAA,EAJR,MAAMC,wUAA0CC,CACxCH,CAAAA,GAAAA,aAAAA,EAAAA,EAAiBI,KAAM,CAAEC,WAAYL,EAAgBI,KACrDJ,aAAAA,EAAAA,EAAiBM,UAAW,CAAEC,QAASP,EAAgBM,UACvDL,SAAAA,QAAAA,EAAAA,EAAQO,eAARP,IAAAA,OAAAA,EAAAA,EAAiBQ,UAAW,CAAEA,QAASR,EAAOO,QAAQC,UACtDR,SAAAA,QAAAA,EAAAA,EAAQS,cAART,IAAAA,OAAAA,EAAAA,EAAgBQ,UAAW,CAAEE,cAAeV,EAAOS,OAAOD,UAGlEjC,EAAY0B,EAAAA,IAEhB7B,EAAemB,iBAAiBC,EAAiBmB,uBAAuB,KACpEnC,EAAQ,IAAIkB,EAAmB,QAAS,2BAAA,WAI1CtB,EAAeyB,aAAapB,EAAWa,SAE7CV,EAAU,QACd,CAAE,MAAOgC,
|
|
1
|
+
{"version":3,"file":"CashAppComponent.js","sources":["../../../../../src/components/CashAppPay/components/CashAppComponent.tsx"],"sourcesContent":["import { h, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Spinner from '../../internal/Spinner';\nimport { CashAppPayEvents, ICashAppService } from '../services/types';\nimport { CashAppPayEventData } from '../types';\nimport StoreDetails from '../../internal/StoreDetails';\nimport './CashAppComponent.scss';\nimport { UIElementStatus } from '../../internal/UIElement/types';\n\ninterface CashAppComponentProps {\n enableStoreDetails?: boolean;\n cashAppService: ICashAppService;\n onClick(): void;\n onChangeStoreDetails(data: any): void;\n onAuthorize(payEventData: CashAppPayEventData): void;\n onError(error: AdyenCheckoutError): void;\n ref(ref: RefObject<typeof CashAppComponent>): void;\n}\n\nexport function CashAppComponent({\n enableStoreDetails,\n cashAppService,\n onClick,\n onChangeStoreDetails,\n onAuthorize,\n onError\n}: CashAppComponentProps): h.JSX.Element {\n const cashAppRef = useRef<HTMLDivElement>(null);\n const [status, setStatus] = useState<UIElementStatus>('loading');\n const subscriptions = useRef<Function[]>([]);\n const [storePaymentMethod, setStorePaymentMethod] = useState<boolean>(false);\n\n this.setStatus = setStatus;\n\n const initializeCashAppSdk = useCallback(async () => {\n try {\n await cashAppService.initialize();\n\n subscriptions.current = [\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerDismissed, () => {\n onError(new AdyenCheckoutError('CANCEL', 'Customer dismissed the modal'));\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestDeclined, async () => {\n onError(new AdyenCheckoutError('ERROR', 'Payment declined by CashAppPay'));\n await cashAppService.restart();\n await cashAppService.renderButton(cashAppRef.current);\n }),\n\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestApproved, ({ customerProfile, grants }) => {\n const cashAppPaymentData: CashAppPayEventData = {\n ...(customerProfile?.id && { customerId: customerProfile.id }),\n ...(customerProfile?.cashtag && { cashTag: customerProfile.cashtag }),\n ...(grants?.payment?.grantId && { grantId: grants.payment.grantId }),\n ...(grants?.onFile?.grantId && { onFileGrantId: grants.onFile.grantId })\n };\n\n onAuthorize(cashAppPaymentData);\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestFailed, () => {\n onError(new AdyenCheckoutError('ERROR', 'Customer request failed'));\n })\n ];\n\n await cashAppService.renderButton(cashAppRef.current);\n\n setStatus('ready');\n } catch (error) {\n if (error instanceof AdyenCheckoutError) onError(error);\n else onError(new AdyenCheckoutError('ERROR', 'Error when initializing CashAppPay', { cause: error }));\n }\n }, [cashAppService, onError, onAuthorize]);\n\n useEffect(() => {\n if (enableStoreDetails) {\n cashAppService.setStorePaymentMethod(storePaymentMethod);\n onChangeStoreDetails(storePaymentMethod);\n }\n }, [enableStoreDetails, storePaymentMethod]);\n\n useEffect(() => {\n initializeCashAppSdk();\n return () => {\n cashAppService.restart();\n subscriptions.current.forEach(unsubscribeFn => unsubscribeFn());\n };\n }, [cashAppService, initializeCashAppSdk]);\n\n return (\n <div className=\"adyen-checkout__cashapp\" aria-live=\"polite\" aria-busy={status === 'loading'}>\n {status === 'loading' && <Spinner />}\n {status !== 'loading' && enableStoreDetails && <StoreDetails storeDetails={storePaymentMethod} onChange={setStorePaymentMethod} />}\n\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div onClick={onClick} className={'adyen-checkout__cashapp-button'} ref={cashAppRef}></div>\n </div>\n );\n}\n"],"names":["CashAppComponent","enableStoreDetails","cashAppService","onClick","onChangeStoreDetails","onAuthorize","onError","cashAppRef","useRef","status","setStatus","useState","subscriptions","storePaymentMethod","setStorePaymentMethod","this","initializeCashAppSdk","useCallback","async","initialize","current","subscribeToEvent","CashAppPayEvents","CustomerDismissed","AdyenCheckoutError","CustomerRequestDeclined","restart","renderButton","CustomerRequestApproved","customerProfile","grants","cashAppPaymentData","_object_spread","id","customerId","cashtag","cashTag","payment","grantId","onFile","onFileGrantId","CustomerRequestFailed","error","cause","useEffect","forEach","unsubscribeFn","h","div","className","aria-live","aria-busy","Spinner","StoreDetails","storeDetails","onChange","ref"],"mappings":"khBAoBO,SAASA,GAAiBC,mBAC7BA,EAAkBC,eAClBA,EAAcC,QACdA,EAAOC,qBACPA,EAAoBC,YACpBA,EAAWC,QACXA,IAEA,MAAMC,EAAaC,EAAuB,OACnCC,EAAQC,GAAaC,EAA0B,WAChDC,EAAgBJ,EAAmB,KAClCK,EAAoBC,GAAyBH,GAAkB,GAEtEI,KAAKL,UAAYA,EAEjB,MAAMM,EAAuBC,GAAYC,UACrC,UACUhB,EAAeiB,aAErBP,EAAcQ,QAAU,CACpBlB,EAAemB,iBAAiBC,EAAiBC,mBAAmB,KAChEjB,EAAQ,IAAIkB,EAAmB,SAAU,gCAAA,IAE7CtB,EAAemB,iBAAiBC,EAAiBG,yBAAyBP,UACtEZ,EAAQ,IAAIkB,EAAmB,QAAS,yCAClCtB,EAAewB,gBACfxB,EAAeyB,aAAapB,EAAWa,QAAO,IAGxDlB,EAAemB,iBAAiBC,EAAiBM,yBAAyB,EAAGC,kBAAiBC,iBAIlFA,EACAA,EAJR,MAAMC,wUAA0CC,CACxCH,CAAAA,GAAAA,aAAAA,EAAAA,EAAiBI,KAAM,CAAEC,WAAYL,EAAgBI,KACrDJ,aAAAA,EAAAA,EAAiBM,UAAW,CAAEC,QAASP,EAAgBM,UACvDL,SAAAA,QAAAA,EAAAA,EAAQO,eAARP,IAAAA,OAAAA,EAAAA,EAAiBQ,UAAW,CAAEA,QAASR,EAAOO,QAAQC,UACtDR,SAAAA,QAAAA,EAAAA,EAAQS,cAART,IAAAA,OAAAA,EAAAA,EAAgBQ,UAAW,CAAEE,cAAeV,EAAOS,OAAOD,UAGlEjC,EAAY0B,EAAAA,IAEhB7B,EAAemB,iBAAiBC,EAAiBmB,uBAAuB,KACpEnC,EAAQ,IAAIkB,EAAmB,QAAS,2BAAA,WAI1CtB,EAAeyB,aAAapB,EAAWa,SAE7CV,EAAU,QACd,CAAE,MAAOgC,GACoCpC,EAArCoC,aAAiBlB,EAA4BkB,EACpC,IAAIlB,EAAmB,QAAS,qCAAsC,CAAEmB,MAAOD,IAChG,IACD,CAACxC,EAAgBI,EAASD,IAiB7B,OAfAuC,GAAU,KACF3C,IACAC,EAAeY,sBAAsBD,GACrCT,EAAqBS,GACzB,GACD,CAACZ,EAAoBY,IAExB+B,GAAU,KACN5B,IACO,KACHd,EAAewB,UACfd,EAAcQ,QAAQyB,SAAQC,GAAiBA,KAAAA,IAEpD,CAAC5C,EAAgBc,IAGhB+B,EAACC,MAAAA,CAAIC,UAAU,0BAA0BC,YAAU,SAASC,YAAsB,YAAX1C,GACvD,YAAXA,GAAwBsC,EAACK,EAAAA,MACd,YAAX3C,GAAwBR,GAAsB8C,EAACM,EAAAA,CAAaC,aAAczC,EAAoB0C,SAAUzC,IAGzGiC,EAACC,MAAAA,CAAI7C,QAASA,EAAS8C,UAAW,iCAAkCO,IAAKjD,IAGrF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import{CoreProvider as t}from"../../core/Context/CoreProvider.js";import r from"../../utils/browserInfo.js";import i from"../internal/ClickToPay/services/create-clicktopay-service.js";import{CtpState as n}from"../internal/ClickToPay/services/ClickToPayService.js";import s from"../internal/ClickToPay/context/ClickToPayProvider.js";import c from"../internal/ClickToPay/ClickToPayComponent.js";import a from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as l}from"../tx-variants.js";function p(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}function u(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(o){p(e,o,t[o])}))}return e}function h(e,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):function(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);
|
|
1
|
+
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import{CoreProvider as t}from"../../core/Context/CoreProvider.js";import r from"../../utils/browserInfo.js";import i from"../internal/ClickToPay/services/create-clicktopay-service.js";import{CtpState as n}from"../internal/ClickToPay/services/ClickToPayService.js";import s from"../internal/ClickToPay/context/ClickToPayProvider.js";import c from"../internal/ClickToPay/ClickToPayComponent.js";import a from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as l}from"../tx-variants.js";function p(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}function u(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(o){p(e,o,t[o])}))}return e}function h(e,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):function(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})),e}class m extends o{get isValid(){return!0}get browserInfo(){return r()}formatData(){var e,o;const{srcScheme:t,srcCorrelationId:r,srcTokenReference:i,srcCheckoutPayload:n,srcDigitalCardId:s}=this.state.data;return{paymentMethod:u({type:m.type},t&&{srcScheme:t},r&&{srcCorrelationId:r},i&&{srcTokenReference:i},n&&{srcCheckoutPayload:n},s&&{srcDigitalCardId:s}),browserInfo:this.browserInfo,origin:null===(o=window)||void 0===o||null===(e=o.location)||void 0===e?void 0:e.origin}}formatProps(e){var o,t,r,i,n,s;return h(u({},e),{disableOtpAutoFocus:e.disableOtpAutoFocus||!1,shopperEmail:e.shopperEmail||(null===(t=this.core.options)||void 0===t||null===(o=t.session)||void 0===o?void 0:o.shopperEmail),telephoneNumber:e.telephoneNumber||(null===(i=this.core.options)||void 0===i||null===(r=i.session)||void 0===r?void 0:r.telephoneNumber),locale:e.locale||(null===(s=e.i18n)||void 0===s||null===(n=s.locale)||void 0===n?void 0:n.replace("-","_"))})}async isAvailable(){return this.clickToPayService?this.clickToPayService.shopperAccountFound?Promise.resolve():new Promise(((e,o)=>{this.clickToPayService.subscribeOnStateChange((t=>{this.clickToPayService.shopperAccountFound&&e(),t!==n.NotAvailable&&t!==n.Login&&t!==n.Idle||o()}))})):Promise.reject()}render(){return e(t,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},e(s,{isStandaloneComponent:!0,configuration:this.ctpConfiguration,amount:this.props.amount,clickToPayService:this.clickToPayService,setClickToPayRef:this.setComponentRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},e(c,null)))}constructor(e,o){var t;super(e,o),p(this,"clickToPayService",void 0),p(this,"ctpConfiguration",void 0),p(this,"handleClickToPaySubmit",(e=>{this.setState({data:u({},e),valid:{},errors:{},isValid:!0}),this.submit()})),this.ctpConfiguration={shopperEmail:this.props.shopperEmail,telephoneNumber:this.props.telephoneNumber,merchantDisplayName:this.props.merchantDisplayName,locale:this.props.locale,onReady:this.props.onReady,onTimeout:this.props.onTimeout},this.clickToPayService=i(this.props.configuration,this.ctpConfiguration,this.props.environment),null===(t=this.clickToPayService)||void 0===t||t.initialize().catch((e=>{this.handleError(new a("ERROR",e.toString(),{cause:e}))})),this.clickToPayService||console.warn("ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing")}}p(m,"type",l.clicktopay);export{m as ClickToPayElement,m as default};
|
|
2
2
|
//# sourceMappingURL=ClickToPay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickToPay.js","sources":["../../../../src/components/ClickToPay/ClickToPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { ClickToPayConfiguration, ClickToPayPaymentData } from './types';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport { ClickToPayProps } from '../internal/ClickToPay/types';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { CtpState } from '../internal/ClickToPay/services/ClickToPayService';\nimport ClickToPayProvider from '../internal/ClickToPay/context/ClickToPayProvider';\nimport ClickToPayComponent from '../internal/ClickToPay';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\n\nexport class ClickToPayElement extends UIElement<ClickToPayConfiguration> {\n public static type = TxVariants.clicktopay;\n\n private readonly clickToPayService: IClickToPayService | null;\n private readonly ctpConfiguration: ClickToPayProps;\n\n constructor(checkout: ICore, props?: ClickToPayConfiguration) {\n super(checkout, props);\n\n this.ctpConfiguration = {\n shopperEmail: this.props.shopperEmail,\n telephoneNumber: this.props.telephoneNumber,\n merchantDisplayName: this.props.merchantDisplayName,\n locale: this.props.locale,\n onReady: this.props.onReady,\n onTimeout: this.props.onTimeout\n };\n\n this.clickToPayService = createClickToPayService(this.props.configuration, this.ctpConfiguration, this.props.environment);\n this.clickToPayService?.initialize().catch(error => {\n this.handleError(new AdyenCheckoutError('ERROR', error.toString(), { cause: error }));\n });\n\n if (!this.clickToPayService) {\n console.warn('ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing');\n }\n }\n\n get isValid() {\n return true;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n public formatData(): ClickToPayPaymentData {\n const { srcScheme, srcCorrelationId, srcTokenReference, srcCheckoutPayload, srcDigitalCardId } = this.state.data;\n return {\n paymentMethod: {\n type: ClickToPayElement.type,\n ...(srcScheme && { srcScheme }),\n ...(srcCorrelationId && { srcCorrelationId }),\n ...(srcTokenReference && { srcTokenReference }),\n ...(srcCheckoutPayload && { srcCheckoutPayload }),\n ...(srcDigitalCardId && { srcDigitalCardId })\n },\n browserInfo: this.browserInfo,\n origin: window?.location?.origin\n };\n }\n\n protected formatProps(props: ClickToPayConfiguration) {\n return {\n ...props,\n disableOtpAutoFocus: props.disableOtpAutoFocus || false,\n shopperEmail: props.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.locale || props.i18n?.locale?.replace('-', '_')\n };\n }\n\n /**\n * Method used to let the merchant know if the shopper have a valid CtP accoubt\n *\n * Resolves Promise if the Shopper has cookies OR has valid CtP account\n * Rejects Promise if account isn't found or if Login screen is triggered\n */\n public override async isAvailable(): Promise<void> {\n if (!this.clickToPayService) {\n return Promise.reject();\n }\n\n if (this.clickToPayService.shopperAccountFound) {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n this.clickToPayService.subscribeOnStateChange((state: CtpState) => {\n if (this.clickToPayService.shopperAccountFound) resolve();\n if (state === CtpState.NotAvailable || state === CtpState.Login || state === CtpState.Idle) reject();\n });\n });\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <ClickToPayProvider\n isStandaloneComponent={true}\n configuration={this.ctpConfiguration}\n amount={this.props.amount}\n clickToPayService={this.clickToPayService}\n setClickToPayRef={this.setComponentRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n <ClickToPayComponent />\n </ClickToPayProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default ClickToPayElement;\n"],"names":["ClickToPayElement","UIElement","isValid","browserInfo","collectBrowserInfo","formatData","window","srcScheme","srcCorrelationId","srcTokenReference","srcCheckoutPayload","srcDigitalCardId","this","state","data","paymentMethod","_object_spread","type","origin","location","formatProps","props","_this_core_options_session","_this_core_options","_this_core_options_session1","_this_core_options1","_object_spread_props","disableOtpAutoFocus","shopperEmail","core","options","session","telephoneNumber","locale","i18n","replace","isAvailable","clickToPayService","shopperAccountFound","Promise","resolve","reject","subscribeOnStateChange","CtpState","NotAvailable","Login","Idle","render","h","CoreProvider","loadingContext","resources","ClickToPayProvider","isStandaloneComponent","configuration","ctpConfiguration","amount","setClickToPayRef","setComponentRef","onSetStatus","setElementStatus","onSubmit","handleClickToPaySubmit","onError","handleError","ClickToPayComponent","constructor","checkout","_this_clickToPayService","super","_define_property","payload","setState","valid","errors","submit","merchantDisplayName","onReady","onTimeout","createClickToPayService","environment","initialize","catch","error","AdyenCheckoutError","toString","cause","console","warn","TxVariants","clicktopay"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClickToPay.js","sources":["../../../../src/components/ClickToPay/ClickToPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { ClickToPayConfiguration, ClickToPayPaymentData } from './types';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport { ClickToPayProps } from '../internal/ClickToPay/types';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { CtpState } from '../internal/ClickToPay/services/ClickToPayService';\nimport ClickToPayProvider from '../internal/ClickToPay/context/ClickToPayProvider';\nimport ClickToPayComponent from '../internal/ClickToPay';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\n\nexport class ClickToPayElement extends UIElement<ClickToPayConfiguration> {\n public static type = TxVariants.clicktopay;\n\n private readonly clickToPayService: IClickToPayService | null;\n private readonly ctpConfiguration: ClickToPayProps;\n\n constructor(checkout: ICore, props?: ClickToPayConfiguration) {\n super(checkout, props);\n\n this.ctpConfiguration = {\n shopperEmail: this.props.shopperEmail,\n telephoneNumber: this.props.telephoneNumber,\n merchantDisplayName: this.props.merchantDisplayName,\n locale: this.props.locale,\n onReady: this.props.onReady,\n onTimeout: this.props.onTimeout\n };\n\n this.clickToPayService = createClickToPayService(this.props.configuration, this.ctpConfiguration, this.props.environment);\n this.clickToPayService?.initialize().catch(error => {\n this.handleError(new AdyenCheckoutError('ERROR', error.toString(), { cause: error }));\n });\n\n if (!this.clickToPayService) {\n console.warn('ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing');\n }\n }\n\n get isValid() {\n return true;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n public formatData(): ClickToPayPaymentData {\n const { srcScheme, srcCorrelationId, srcTokenReference, srcCheckoutPayload, srcDigitalCardId } = this.state.data;\n return {\n paymentMethod: {\n type: ClickToPayElement.type,\n ...(srcScheme && { srcScheme }),\n ...(srcCorrelationId && { srcCorrelationId }),\n ...(srcTokenReference && { srcTokenReference }),\n ...(srcCheckoutPayload && { srcCheckoutPayload }),\n ...(srcDigitalCardId && { srcDigitalCardId })\n },\n browserInfo: this.browserInfo,\n origin: window?.location?.origin\n };\n }\n\n protected formatProps(props: ClickToPayConfiguration) {\n return {\n ...props,\n disableOtpAutoFocus: props.disableOtpAutoFocus || false,\n shopperEmail: props.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.locale || props.i18n?.locale?.replace('-', '_')\n };\n }\n\n /**\n * Method used to let the merchant know if the shopper have a valid CtP accoubt\n *\n * Resolves Promise if the Shopper has cookies OR has valid CtP account\n * Rejects Promise if account isn't found or if Login screen is triggered\n */\n public override async isAvailable(): Promise<void> {\n if (!this.clickToPayService) {\n return Promise.reject();\n }\n\n if (this.clickToPayService.shopperAccountFound) {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n this.clickToPayService.subscribeOnStateChange((state: CtpState) => {\n if (this.clickToPayService.shopperAccountFound) resolve();\n if (state === CtpState.NotAvailable || state === CtpState.Login || state === CtpState.Idle) reject();\n });\n });\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <ClickToPayProvider\n isStandaloneComponent={true}\n configuration={this.ctpConfiguration}\n amount={this.props.amount}\n clickToPayService={this.clickToPayService}\n setClickToPayRef={this.setComponentRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n <ClickToPayComponent />\n </ClickToPayProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default ClickToPayElement;\n"],"names":["ClickToPayElement","UIElement","isValid","browserInfo","collectBrowserInfo","formatData","window","srcScheme","srcCorrelationId","srcTokenReference","srcCheckoutPayload","srcDigitalCardId","this","state","data","paymentMethod","_object_spread","type","origin","location","formatProps","props","_this_core_options_session","_this_core_options","_this_core_options_session1","_this_core_options1","_object_spread_props","disableOtpAutoFocus","shopperEmail","core","options","session","telephoneNumber","locale","i18n","replace","isAvailable","clickToPayService","shopperAccountFound","Promise","resolve","reject","subscribeOnStateChange","CtpState","NotAvailable","Login","Idle","render","h","CoreProvider","loadingContext","resources","ClickToPayProvider","isStandaloneComponent","configuration","ctpConfiguration","amount","setClickToPayRef","setComponentRef","onSetStatus","setElementStatus","onSubmit","handleClickToPaySubmit","onError","handleError","ClickToPayComponent","constructor","checkout","_this_clickToPayService","super","_define_property","payload","setState","valid","errors","submit","merchantDisplayName","onReady","onTimeout","createClickToPayService","environment","initialize","catch","error","AdyenCheckoutError","toString","cause","console","warn","TxVariants","clicktopay"],"mappings":"o6CAeO,MAAMA,UAA0BC,EA4BnC,WAAIC,GACA,OAAO,CACX,CAEA,eAAIC,GACA,OAAOC,GACX,CAEOC,UAAAA,OAYSC,EAAAA,EAXZ,MAAMC,UAAEA,EAASC,iBAAEA,EAAgBC,kBAAEA,EAAiBC,mBAAEA,EAAkBC,iBAAEA,GAAqBC,KAAKC,MAAMC,KAC5G,MAAO,CACHC,cAAeC,EAAA,CACXC,KAAMjB,EAAkBiB,MACpBV,GAAa,CAAEA,aACfC,GAAoB,CAAEA,oBACtBC,GAAqB,CAAEA,qBACvBC,GAAsB,CAAEA,sBACxBC,GAAoB,CAAEA,qBAE9BR,YAAaS,KAAKT,YAClBe,OAAQZ,QAAAA,EAAAA,cAAAA,IAAAA,GAAgB,QAAhBA,EAAAA,EAAQa,gBAARb,IAAAA,OAAAA,EAAAA,EAAkBY,OAElC,CAEUE,WAAAA,CAAYC,OAIsBC,EAAAC,EACMC,EAAAC,EAClBJ,EAAAA,EAL5B,OAAOK,EACAL,EAAAA,CAAAA,EAAAA,GAAAA,CACHM,oBAAqBN,EAAMM,sBAAuB,EAClDC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EAAA1D,KAAQkD,0BAA0BS,IAC9B3D,KAAK4D,SAAS,CAAE1D,KAAME,EAAKuD,CAAAA,EAAAA,GAAWE,MAAO,CAAC,EAAGC,OAAQ,CAAC,EAAGxE,SAAS,IACtEU,KAAK+D,QAAM,IA9EX/D,KAAK2C,iBAAmB,CACpB3B,aAAchB,KAAKS,MAAMO,aACzBI,gBAAiBpB,KAAKS,MAAMW,gBAC5B4C,oBAAqBhE,KAAKS,MAAMuD,oBAChC3C,OAAQrB,KAAKS,MAAMY,OACnB4C,QAASjE,KAAKS,MAAMwD,QACpBC,UAAWlE,KAAKS,MAAMyD,WAG1BlE,KAAKyB,kBAAoB0C,EAAwBnE,KAAKS,MAAMiC,cAAe1C,KAAK2C,iBAAkB3C,KAAKS,MAAM2D,aAC7G,QAAAZ,EAAAxD,KAAKyB,yBAAL,IAAA+B,GAAAA,EAAwBa,aAAaC,OAAMC,IACvCvE,KAAKoD,YAAY,IAAIoB,EAAmB,QAASD,EAAME,WAAY,CAAEC,MAAOH,IAAM,IAGjFvE,KAAKyB,mBACNkD,QAAQC,KAAK,2GAErB,EAzBAlB,EADStE,EACKiB,OAAOwE,EAAWC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import
|
|
1
|
+
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import o from"./CustomCardInput/CustomCardInput.js";import{CoreProvider as r}from"../../core/Context/CoreProvider.js";import n from"../../utils/browserInfo.js";import s from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{getCardImageUrl as i,fieldTypeToSnakeCase as a}from"../internal/SecuredFields/utils.js";import{TxVariants as p}from"../tx-variants.js";import{ANALYTICS_FOCUS_STR as u,ANALYTICS_UNFOCUS_STR as c}from"../../core/Analytics/constants.js";function d(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function l(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),r.forEach((function(t){d(e,t,o[t])}))}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o.push.apply(o,r)}return o}(Object(t)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))})),e}class m extends t{formatProps(e){return h(l({},e),{type:p.customCard,brand:p.card})}formatData(){const e=this.state.selectedBrandValue;return{paymentMethod:l({type:"scheme"},this.state.data,e&&{brand:e}),browserInfo:this.browserInfo}}updateStyles(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.updateStyles)&&this.componentRef.updateStyles(e),this}setFocusOn(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.setFocusOn)&&this.componentRef.setFocusOn(e),this}processBinLookupResponse(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.processBinLookupResponse)&&this.componentRef.processBinLookupResponse(e),this}dualBrandingChangeHandler(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.dualBrandingChangeHandler)&&this.componentRef.dualBrandingChangeHandler(e),this}handleUnsupportedCard(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.handleUnsupportedCard)&&this.componentRef.handleUnsupportedCard(e),this}onBinLookup(e){const t=l({},e);var o;(t.rootNode=this._node,t.isReset)||(t.supportedBrandsRaw=null===(o=e.supportedBrandsRaw)||void 0===o?void 0:o.map((e=>{var t,o;return e.brandImageUrl=null!==(o=null===(t=this.props.brandsConfiguration[e.brand])||void 0===t?void 0:t.icon)&&void 0!==o?o:i(e.brand,this.resources),e})));this.props.onBinLookup(t)}get isValid(){return!!this.state.isValid}get browserInfo(){return n()}render(){return e(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},e(o,h(l({ref:e=>{this.componentRef=e}},this.props,this.state),{rootNode:this._node,onChange:this.setState,onBinValue:this.onBinValue,implementationType:"custom",resources:this.resources,brand:this.props.brand,onFocus:this.onFocus})))}constructor(...e){super(...e),d(this,"onBinValue",s(this)),d(this,"onFocus",(e=>{var t,o;this.submitAnalytics({type:!0===e.focus?u:c,target:a(e.fieldType)}),null===(t=(o=this.props).onFocus)||void 0===t||t.call(o,e)}))}}d(m,"type",p.customCard),d(m,"analyticsType","custom-scheme"),d(m,"defaultProps",{onBinLookup:()=>{},brandsConfiguration:{}});export{m as CustomCard,m as default};
|
|
2
2
|
//# sourceMappingURL=CustomCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { ANALYTICS_FOCUS_STR, ANALYTICS_UNFOCUS_STR } from '../../core/Analytics/constants';\n\n// TODO questions about\n// brand - does a merchant ever make a custom stored card?\n// type\n// countryCode\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static type = TxVariants.customCard;\n\n public static analyticsType = 'custom-scheme';\n\n protected static defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard,\n brand: TxVariants.card\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n return {\n paymentMethod: {\n type: 'scheme',\n ...this.state.data,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CbObjOnBinLookup) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private onFocus = (obj: CbObjOnFocus) => {\n this.submitAnalytics({\n type: obj.focus === true ? ANALYTICS_FOCUS_STR : ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.props.brand}\n onFocus={this.onFocus}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","_object_spread_props","type","TxVariants","customCard","brand","card","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","_object_spread","data","browserInfo","updateStyles","stylesObj","_this_componentRef","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","_this_props_brandsConfiguration_item_brand","_this_props_brandsConfiguration_item_brand_icon","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","isValid","collectBrowserInfo","render","h","CoreProvider","i18n","loadingContext","CustomCardInput","ref","onChange","setState","onBinValue","implementationType","onFocus","_define_property","triggerBinLookUp","_this_props_onFocus","_this_props","submitAnalytics","focus","ANALYTICS_FOCUS_STR","ANALYTICS_UNFOCUS_STR","target","fieldTypeToSnakeCase","fieldType","call","analyticsType","defaultProps"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { ANALYTICS_FOCUS_STR, ANALYTICS_UNFOCUS_STR } from '../../core/Analytics/constants';\n\n// TODO questions about\n// brand - does a merchant ever make a custom stored card?\n// type\n// countryCode\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static type = TxVariants.customCard;\n\n public static analyticsType = 'custom-scheme';\n\n protected static defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard,\n brand: TxVariants.card\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n return {\n paymentMethod: {\n type: 'scheme',\n ...this.state.data,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CbObjOnBinLookup) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private onFocus = (obj: CbObjOnFocus) => {\n this.submitAnalytics({\n type: obj.focus === true ? ANALYTICS_FOCUS_STR : ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.props.brand}\n onFocus={this.onFocus}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","_object_spread_props","type","TxVariants","customCard","brand","card","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","_object_spread","data","browserInfo","updateStyles","stylesObj","_this_componentRef","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","_this_props_brandsConfiguration_item_brand","_this_props_brandsConfiguration_item_brand_icon","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","isValid","collectBrowserInfo","render","h","CoreProvider","i18n","loadingContext","CustomCardInput","ref","onChange","setState","onBinValue","implementationType","onFocus","_define_property","triggerBinLookUp","_this_props_onFocus","_this_props","submitAnalytics","focus","ANALYTICS_FOCUS_STR","ANALYTICS_UNFOCUS_STR","target","fieldTypeToSnakeCase","fieldType","call","analyticsType","defaultProps"],"mappings":"64CAmBO,MAAMA,UAAmBC,EAU5BC,WAAAA,CAAYC,GACR,OAAOC,EACAD,EA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as n,useMemo as r,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import i from"../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import a from"../../internal/SecuredFields/binLookup/extensions.js";function s(e,o,n){return o in e?Object.defineProperty(e,o,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[o]=n,e}function l(e){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(o){s(e,o,n[o])}))}return e}function d(e,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):function(e,o){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as o,useState as n,useMemo as r,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import i from"../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import a from"../../internal/SecuredFields/binLookup/extensions.js";function s(e,o,n){return o in e?Object.defineProperty(e,o,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[o]=n,e}function l(e){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(o){s(e,o,n[o])}))}return e}function d(e,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):function(e,o){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))})),e}function u(s){const u=o(null),[p,y]=n({}),[f,m]=n({}),[g,b]=n({}),[h,O]=n(!1),[S,C]=n(null),[j,F]=n([]),[V,E]=n(""),P=r((()=>a(s,{sfp:u},{dualBrandSelectElements:j,setDualBrandSelectElements:F,setSelectedBrandValue:E,issuingCountryCode:S,setIssuingCountryCode:C})),[j,S]);return this.processBinLookupResponse=(e,o)=>{P.processBinLookup(e,o)},this.dualBrandingChangeHandler=P.handleDualBrandSelection,t((()=>(this.setFocusOn=u.current.setFocusOn,this.updateStyles=u.current.updateStyles,this.showValidation=u.current.showValidation,this.handleUnsupportedCard=u.current.handleUnsupportedCard,()=>{u.current.destroy()})),[]),t((()=>{const e=u.current.mapErrorsToValidationRuleResult(),o=l({},p,e);if(s.onChange({data:g,valid:f,errors:o,isValid:h,selectedBrandValue:V}),Object.keys(o).length){var n,r;const e=Object.entries(o).map((([e,o])=>l({fieldType:e},o||{error:"",rootNode:this.props.rootNode})));null===(n=(r=this.props).onValidationError)||void 0===n||n.call(r,e)}}),[g,f,p,V]),e(i,d(l({ref:u},c(s)),{type:s.brand,onChange:e=>{b(l({},g,e.data)),y(l({},p,e.errors)),m(l({},f,e.valid)),O(e.isSfpValid)},render:()=>null}))}u.defaultProps={onChange:()=>{},onError:()=>{},onValidationError:()=>{}};const c=e=>({autoFocus:e.autoFocus,brands:e.brands,brandsConfiguration:e.brandsConfiguration,clientKey:e.clientKey,i18n:e.i18n,implementationType:e.implementationType,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,minimumExpiryDate:e.minimumExpiryDate,onAdditionalSFConfig:e.onAdditionalSFConfig,onAdditionalSFRemoved:e.onAdditionalSFRemoved,onAllValid:e.onAllValid,onAutoComplete:e.onAutoComplete,onBinValue:e.onBinValue,onBrand:e.onBrand,onConfigSuccess:e.onConfigSuccess,onError:e.onError,onFieldValid:e.onFieldValid,onFocus:e.onFocus,onLoad:e.onLoad,rootNode:e.rootNode,showWarnings:e.showWarnings,styles:e.styles,trimTrailingSeparator:e.trimTrailingSeparator,resources:e.resources,maskSecurityCode:e.maskSecurityCode,placeholders:e.placeholders});export{u as default};
|
|
2
2
|
//# sourceMappingURL=CustomCardInput.js.map
|