@adyen/adyen-web 6.30.0 → 6.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adyen.css +2 -2
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +557 -484
- package/dist/es/adyen.css +2 -2
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/ANCV/ANCV.js.map +1 -1
- package/dist/es/components/Ach/Ach.js +1 -1
- package/dist/es/components/Ach/Ach.js.map +1 -1
- package/dist/es/components/Ach/components/AccountTypeSelector.js.map +1 -1
- package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
- package/dist/es/components/Affirm/Affirm.js.map +1 -1
- package/dist/es/components/AfterPay/AfterPay.js.map +1 -1
- package/dist/es/components/AfterPay/AfterPayB2B.js.map +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es/components/AmazonPay/components/OrderButton.js +1 -1
- package/dist/es/components/AmazonPay/components/OrderButton.js.map +1 -1
- package/dist/es/components/AmazonPay/utils.js +1 -1
- package/dist/es/components/AmazonPay/utils.js.map +1 -1
- package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
- package/dist/es/components/ApplePay/services/ApplePayService.js +1 -1
- package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
- package/dist/es/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -1
- package/dist/es/components/ApplePay/utils/payment-request.js.map +1 -1
- package/dist/es/components/Atome/Atome.js.map +1 -1
- package/dist/es/components/BacsDD/BacsDD.js +1 -1
- package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
- package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
- package/dist/es/components/Blik/Blik.js +1 -1
- package/dist/es/components/Blik/Blik.js.map +1 -1
- package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es/components/Card/components/ClickToPayWrapper.js +1 -1
- package/dist/es/components/Card/components/ClickToPayWrapper.js.map +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
- package/dist/es/components/CashAppPay/services/CashAppSdkLoader.js.map +1 -1
- package/dist/es/components/CashAppPay/services/CashAppService.js +1 -1
- package/dist/es/components/CashAppPay/services/CashAppService.js.map +1 -1
- package/dist/es/components/CashAppPay/services/types.js.map +1 -1
- package/dist/es/components/ClickToPay/ClickToPay.js +1 -1
- package/dist/es/components/ClickToPay/ClickToPay.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
- package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
- package/dist/es/components/Dropin/Dropin.js +1 -1
- package/dist/es/components/Dropin/Dropin.js.map +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es/components/Dropin/components/DropinSuccessState.js +2 -0
- package/dist/es/components/Dropin/components/DropinSuccessState.js.map +1 -0
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
- package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
- package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardResult.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardResult.js.map +1 -1
- package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
- package/dist/es/components/Iris/Iris.js +1 -1
- package/dist/es/components/Iris/Iris.js.map +1 -1
- package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
- package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
- package/dist/es/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
- package/dist/es/components/Multibanco/Multibanco.js +1 -1
- package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
- package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es/components/PayByBankPix/components/StoredPayment/StoredPayment.js +1 -1
- package/dist/es/components/PayByBankPix/components/StoredPayment/StoredPayment.js.map +1 -1
- package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
- package/dist/es/components/PayByBankPix/services/PasskeyService.js.map +1 -1
- package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
- package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
- package/dist/es/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
- package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
- package/dist/es/components/PayTo/PayTo.js +1 -1
- package/dist/es/components/PayTo/PayTo.js.map +1 -1
- package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es/components/PayTo/components/PayToNameFields.js +1 -1
- package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
- package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
- package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
- package/dist/es/components/Twint/Twint.js +1 -1
- package/dist/es/components/Twint/Twint.js.map +1 -1
- package/dist/es/components/UPI/UPI.js +1 -1
- package/dist/es/components/UPI/UPI.js.map +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
- package/dist/es/components/internal/Address/Specifications.js.map +1 -1
- package/dist/es/components/internal/Await/Await.js +1 -1
- package/dist/es/components/internal/Await/Await.js.map +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/Button/Button.js +1 -1
- package/dist/es/components/internal/Button/Button.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/context/ClickToPayContext.js +1 -1
- package/dist/es/components/internal/ClickToPay/context/ClickToPayContext.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
- package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
- package/dist/es/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es/components/internal/PayButton/utils.js +1 -1
- package/dist/es/components/internal/PayButton/utils.js.map +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es/components/internal/RedirectButton/RedirectButton.js +1 -1
- package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/utils.js.map +1 -1
- package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
- package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
- package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
- package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/core/Analytics/Analytics.js.map +1 -1
- package/dist/es/core/Analytics/AnalyticsService.js.map +1 -1
- package/dist/es/core/Analytics/events/AbstractAnalyticsEvent.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
- package/dist/es/core/Analytics/utils.js +1 -1
- package/dist/es/core/Analytics/utils.js.map +1 -1
- package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
- package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
- package/dist/es/core/Context/AmountProvider.js +2 -0
- package/dist/es/core/Context/AmountProvider.js.map +1 -0
- package/dist/es/core/Context/Resources.js.map +1 -1
- package/dist/es/core/Errors/SRPanel.js.map +1 -1
- package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/core.js.map +1 -1
- package/dist/es/external/preact/compat/dist/compat.js +1 -1
- package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
- package/dist/es/external/preact/dist/preact.js +1 -1
- package/dist/es/external/preact/dist/preact.js.map +1 -1
- package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
- package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
- package/dist/es/index.d.ts +557 -484
- package/dist/es/language/Language.js.map +1 -1
- package/dist/es/utils/Script.js.map +1 -1
- package/dist/es/utils/Storage.js +1 -1
- package/dist/es/utils/Storage.js.map +1 -1
- package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
- package/dist/es/utils/Validator/Validator.js.map +1 -1
- package/dist/es/utils/amount-util.js +1 -1
- package/dist/es/utils/amount-util.js.map +1 -1
- package/dist/es/utils/browserInfo.js +1 -1
- package/dist/es/utils/browserInfo.js.map +1 -1
- package/dist/es/utils/constants/currency-minor-units.js.map +1 -1
- package/dist/es/utils/createSdkData.js.map +1 -1
- package/dist/es/utils/getErrorMessage.js.map +1 -1
- package/dist/es/utils/getProp.js +1 -1
- package/dist/es/utils/getProp.js.map +1 -1
- package/dist/es/utils/hasOwnProperty.js.map +1 -1
- package/dist/es/utils/isValidURL.js.map +1 -1
- package/dist/es/utils/listenerUtils.js.map +1 -1
- package/dist/es/utils/promiseTimeout.js.map +1 -1
- package/dist/es/utils/textUtils.js.map +1 -1
- package/dist/es/utils/validator-utils.js.map +1 -1
- package/dist/es-legacy/adyen.css +2 -2
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
- package/dist/es-legacy/components/Ach/Ach.js +1 -1
- package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
- package/dist/es-legacy/components/Ach/components/AccountTypeSelector.js.map +1 -1
- package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
- package/dist/es-legacy/components/Affirm/Affirm.js.map +1 -1
- package/dist/es-legacy/components/AfterPay/AfterPay.js.map +1 -1
- package/dist/es-legacy/components/AfterPay/AfterPayB2B.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/OrderButton.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/OrderButton.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
- package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/services/ApplePayService.js +1 -1
- package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
- package/dist/es-legacy/components/Atome/Atome.js.map +1 -1
- package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
- package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
- package/dist/es-legacy/components/Blik/Blik.js +1 -1
- package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
- package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
- package/dist/es-legacy/components/Card/Card.js +1 -1
- package/dist/es-legacy/components/Card/Card.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
- package/dist/es-legacy/components/Card/components/Fastlane/USOnlyPhoneInput.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
- package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/services/CashAppSdkLoader.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/services/CashAppService.js +1 -1
- package/dist/es-legacy/components/CashAppPay/services/CashAppService.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
- package/dist/es-legacy/components/ClickToPay/ClickToPay.js +1 -1
- package/dist/es-legacy/components/ClickToPay/ClickToPay.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinSuccessState.js +2 -0
- package/dist/es-legacy/components/Dropin/components/DropinSuccessState.js.map +1 -0
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
- package/dist/es-legacy/components/Iris/Iris.js +1 -1
- package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
- package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
- package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
- package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
- package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
- package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/components/StoredPayment/StoredPayment.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/components/StoredPayment/StoredPayment.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/services/PasskeyService.js.map +1 -1
- package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
- package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
- package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
- package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
- package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
- package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
- package/dist/es-legacy/components/Twint/Twint.js +1 -1
- package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
- package/dist/es-legacy/components/UPI/UPI.js +1 -1
- package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/Specifications.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
- package/dist/es-legacy/components/internal/Await/Await.js +1 -1
- package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayContext.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayContext.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/create-clicktopay-service.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +1 -1
- package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
- package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
- package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
- package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js.map +1 -1
- package/dist/es-legacy/components/internal/Tooltip/Tooltip.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
- package/dist/es-legacy/core/Analytics/AnalyticsService.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AbstractAnalyticsEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js +1 -1
- package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
- package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js +1 -1
- package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js.map +1 -1
- package/dist/es-legacy/core/Context/AmountProvider.js +2 -0
- package/dist/es-legacy/core/Context/AmountProvider.js.map +1 -0
- package/dist/es-legacy/core/Context/Resources.js.map +1 -1
- package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
- package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
- package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
- package/dist/es-legacy/core/Services/http.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
- package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
- package/dist/es-legacy/external/preact/dist/preact.js +1 -1
- package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
- package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
- package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
- package/dist/es-legacy/language/Language.js.map +1 -1
- package/dist/es-legacy/utils/Script.js.map +1 -1
- package/dist/es-legacy/utils/Storage.js +1 -1
- package/dist/es-legacy/utils/Storage.js.map +1 -1
- package/dist/es-legacy/utils/Validator/ValidationRuleResult.js.map +1 -1
- package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
- package/dist/es-legacy/utils/amount-util.js +1 -1
- package/dist/es-legacy/utils/amount-util.js.map +1 -1
- package/dist/es-legacy/utils/browserInfo.js +1 -1
- package/dist/es-legacy/utils/browserInfo.js.map +1 -1
- package/dist/es-legacy/utils/constants/currency-minor-units.js.map +1 -1
- package/dist/es-legacy/utils/createSdkData.js.map +1 -1
- package/dist/es-legacy/utils/getConsentUrl.js.map +1 -1
- package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
- package/dist/es-legacy/utils/getProp.js +1 -1
- package/dist/es-legacy/utils/getProp.js.map +1 -1
- package/dist/es-legacy/utils/hasOwnProperty.js.map +1 -1
- package/dist/es-legacy/utils/isValidURL.js.map +1 -1
- package/dist/es-legacy/utils/listenerUtils.js.map +1 -1
- package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
- package/dist/es-legacy/utils/textUtils.js.map +1 -1
- package/dist/es-legacy/utils/useAutoFocus.js.map +1 -1
- package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
- package/dist/es-legacy/utils/validator-utils.js.map +1 -1
- package/package.json +11 -11
- package/styles/adyen.css +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport type {\n BinLookupResponse,\n BrandConfiguration,\n CardBrandsConfiguration,\n CardBackendConfiguration,\n DualBrandSelectElement,\n CardPlaceholders\n} from '../../types';\nimport {
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport type {\n BinLookupResponse,\n BrandConfiguration,\n CardBrandsConfiguration,\n CardBackendConfiguration,\n DualBrandSelectElement,\n CardPlaceholders\n} from '../../types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardLoadData,\n CVCPolicyType,\n DatePolicyType\n} from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CardErrorData, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { DisclaimerMsgObject } from '../../../internal/DisclaimerMessage/DisclaimerMessage';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData } from '../../../../types/global-types';\nimport type { FastlaneSignupConfiguration } from '../../../PayPalFastlane/types';\nimport type { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { IAnalytics } from '../../../../core/Analytics/Analytics';\nimport { PayButtonProps } from '../../../internal/PayButton/PayButton';\nimport { h } from 'preact';\nimport { InstallmentOptions } from './components/Installments/Installments';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationResult;\n billingAddress?: ValidationResult;\n socialSecurityNumber?: ValidationResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey: string;\n configuration?: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n fastlaneConfiguration?: FastlaneSignupConfiguration;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit' | 'prepaid';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: string;\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel: SRPanel;\n analytics: IAnalytics;\n risk: RiskElement;\n resources: Resources;\n };\n onAdditionalSFConfig?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: (o: CardAllValidData) => {};\n onAutoComplete?: (o: CardAutoCompleteData) => {};\n onBinValue?: (o: CardBinValueData) => {};\n onBlur?: (e) => {};\n onBrand?: (o: CardBrandData) => {};\n onConfigSuccess?: (O: CardConfigSuccessData) => {};\n onChange?: (state) => {};\n onError?: () => {};\n onFieldValid?: (o: CardFieldValidData) => {};\n onFocus?: (e) => {};\n onLoad?: (o: CardLoadData) => {};\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (props: PayButtonProps) => h.JSX.Element;\n placeholders?: CardPlaceholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showPayButton: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n disclaimerMessage?: DisclaimerMsgObject;\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: any;\n setFocusOn?: (who) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CardErrorData) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n"],"names":["AddressModeOptions"],"mappings":"AA4MO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{AddressModeOptions as e}from"./types.js";import{CREDIT_CARD_NAME_TOP as o,CREDIT_CARD_NAME_BOTTOM as n,KCP_CARD_NAME_TOP as r,KCP_CARD_NAME_BOTTOM as i,SSN_CARD_NAME_TOP as t,SSN_CARD_NAME_BOTTOM as a,CREDIT_CARD as s,KCP_CARD as l,SSN_CARD as d}from"./layouts.js";import{PARTIAL_ADDRESS_SCHEMA as c}from"../../../internal/Address/constants.js";import{BRAND_READABLE_NAME_MAP as u}from"../../../internal/SecuredFields/lib/constants.js";import m from"../../../../core/Context/useImage.js";import{SF_ErrorCodes as p}from"../../../../core/Errors/constants.js";const C=(e,o)=>o({type:"card"===e?"nocard":e||"nocard",extension:"svg"})(e),h=e=>"revolving"
|
|
1
|
+
import{AddressModeOptions as e}from"./types.js";import{CREDIT_CARD_NAME_TOP as o,CREDIT_CARD_NAME_BOTTOM as n,KCP_CARD_NAME_TOP as r,KCP_CARD_NAME_BOTTOM as i,SSN_CARD_NAME_TOP as t,SSN_CARD_NAME_BOTTOM as a,CREDIT_CARD as s,KCP_CARD as l,SSN_CARD as d}from"./layouts.js";import{PARTIAL_ADDRESS_SCHEMA as c}from"../../../internal/Address/constants.js";import{BRAND_READABLE_NAME_MAP as u}from"../../../internal/SecuredFields/lib/constants.js";import m from"../../../../core/Context/useImage.js";import{SF_ErrorCodes as p}from"../../../../core/Errors/constants.js";const C=(e,o)=>o({type:"card"===e?"nocard":e||"nocard",extension:"svg"})(e),h=e=>["revolving","bonus"].includes(e?.plan)||e?.value>1,g=({props:e,showKCP:c,showBrazilianSSN:u,countrySpecificSchemas:m=null,billingAddressRequiredFields:p=null})=>{let C=s;const h=e.hasHolderName&&e.holderNameRequired;if(h&&(C=e.positionHolderNameOnTop?o:n),c&&(C=l,h&&(C=e.positionHolderNameOnTop?r:i)),u&&(C=d,h&&(C=e.positionHolderNameOnTop?t:a)),m){const r=m.flat(2).filter(e=>"number"!=typeof e);let i=r;p&&(i=r.filter(e=>p.includes(e))),C=s.concat(i),h&&(C=e.positionHolderNameOnTop?o.concat(i):n.concat(i))}return C},R=(e,o,n)=>{switch(e){case"socialSecurityNumber":return o.get(`boleto.${e}`);case"street":case"houseNumberOrName":case"postalCode":case"stateOrProvince":case"city":case"country":return n?.[e]?o.get(n?.[e]):o.get(e);default:return null}},y=e=>({billingAddressRequired:e.billingAddressRequired,billingAddressRequiredFields:e.billingAddressRequiredFields,billingAddressAllowedCountries:e.billingAddressAllowedCountries,brandsConfiguration:e.brandsConfiguration,showStoreDetailsCheckbox:e.showStoreDetailsCheckbox,hasCVC:e.hasCVC,hasHolderName:e.hasHolderName,holderNameRequired:e.holderNameRequired,installmentOptions:e.installmentOptions,placeholders:e.placeholders,positionHolderNameOnTop:e.positionHolderNameOnTop,showBrandIcon:e.showBrandIcon,showContextualElement:e.showContextualElement,lastFour:e.lastFour,expiryMonth:e.expiryMonth,expiryYear:e.expiryYear,disclaimerMessage:e.disclaimerMessage}),b=e=>({autoFocus:e.autoFocus,brands:e.brands,brandsConfiguration:e.brandsConfiguration,clientKey:e.clientKey,countryCode:e.countryCode,forceCompat:e.forceCompat,i18n:e.i18n,implementationType:e.implementationType,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,maskSecurityCode:e.maskSecurityCode,exposeExpiryDate:e.exposeExpiryDate,minimumExpiryDate:e.minimumExpiryDate,onAdditionalSFConfig:e.onAdditionalSFConfig,onAdditionalSFRemoved:e.onAdditionalSFRemoved,onAllValid:e.onAllValid,onAutoComplete:e.onAutoComplete,onBinValue:e.onBinValue,onConfigSuccess:e.onConfigSuccess,handleKeyPress:e.handleKeyPress,onError:e.onError,onFieldValid:e.onFieldValid,onLoad:e.onLoad,placeholders:e.placeholders,resources:e.resources,showContextualElement:e.showContextualElement,showWarnings:e.showWarnings,trimTrailingSeparator:e.trimTrailingSeparator}),O=o=>o==e.partial?c:null;function f(e){return![p.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,p.ERROR_MSG_CARD_TOO_OLD,p.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,p.ERROR_MSG_CARD_EXPIRES_TOO_SOON].includes(e)}function S(e){return u[e]??e}const x=(e,o)=>e.map(e=>{const n=e.id,r=m(),i="card"===n?"nocard":n,t=o[n]?.icon??C(i,r);return{id:e.id,name:e.brandObject.localeBrand||e.brandObject.brand,imageURL:t,altName:S(n)}}),A=(e,o,n)=>o.some(o=>e.includes(o[n]));export{y as extractPropsForCardFields,b as extractPropsForSFP,C as getCardImageUrl,S as getFullBrandName,g as getLayout,O as handlePartialAddressMode,f as lookupBlurBasedErrors,x as mapDualBrandButtons,R as mapFieldKey,A as mustHandleDualBrandingAccordingToEURegulations,h as shouldIncludeInstallmentsInPaymentData};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP } from '../../../internal/SecuredFields/lib/constants';\nimport useImage, { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BrandObject, CardBrandsConfiguration, DualBrandSelectElement } from '../../types';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * Verifies that installment object is valid to send to the Backend.\n * Valid means that it has 'revolving' plan set, or the number of installments is bigger than one\n */\nexport const hasValidInstallmentsObject = (installments?: InstallmentsObj) => {\n return installments?.plan === 'revolving' || installments?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number') as string[];\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs amount, hasCVC, installmentOptions)\n amount: props.amount,\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyPress: props.handleKeyPress,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n } as SFPProps; // Can't set as return type on fn or it will complain about missing, mandatory, props\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n // If it's NOT one of these, then it's a blur based error\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand) {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\nexport const mapDualBrandButtons = (dualBrandSelectElements: DualBrandSelectElement[], brandsConfiguration: CardBrandsConfiguration): any => {\n return dualBrandSelectElements.map(item => {\n const brand = item.id;\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageURL = brandsConfiguration[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n // TODO - check below if we have to still generate altName through the mapping function or whether it just\n // corresponds to item.brandObject.localeBrand\n return {\n id: item.id,\n name: item.brandObject.localeBrand || item.brandObject.brand,\n imageURL,\n altName: getFullBrandName(brand)\n };\n });\n};\n\n/**\n * Only if the brands in EU_BrandArray are present in the binLookup response should we handle dual branding based on EU regulations\n *\n * If the result from Array.some is true - then we are in a EU dual branding regulation scenario, i.e.\n * - Show the new dualBranding UI Buttons\n * - Preselect a card brand\n */\nexport const mustHandleDualBrandingAccordingToEURegulations = (\n EU_BrandArray: readonly string[],\n returnedDualBrandingObjects: DualBrandSelectElement[] | BrandObject[],\n key: string\n) => returnedDualBrandingObjects.some(item => EU_BrandArray.includes(item[key]));\n"],"names":["getCardImageUrl","brand","getImage","type","extension","hasValidInstallmentsObject","installments","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","includes","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","amount","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","handleKeyPress","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","name","brandObject","localeBrand","altName","mustHandleDualBrandingAccordingToEURegulations","EU_BrandArray","returnedDualBrandingObjects","some"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport { InstallmentsState } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP } from '../../../internal/SecuredFields/lib/constants';\nimport useImage, { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BrandObject, CardBrandsConfiguration, DualBrandSelectElement } from '../../types';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * 'installments' should be added to the payload if it has plan as revolving or bonus\n * or value greater than 1.\n *\n * More about it here: COWEB-1070\n */\nexport const shouldIncludeInstallmentsInPaymentData = (installment?: InstallmentsState): boolean => {\n return ['revolving', 'bonus'].includes(installment?.plan) || installment?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number') as string[];\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs hasCVC, installmentOptions)\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyPress: props.handleKeyPress,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n } as SFPProps; // Can't set as return type on fn or it will complain about missing, mandatory, props\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n // If it's NOT one of these, then it's a blur based error\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand) {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\nexport const mapDualBrandButtons = (dualBrandSelectElements: DualBrandSelectElement[], brandsConfiguration: CardBrandsConfiguration): any => {\n return dualBrandSelectElements.map(item => {\n const brand = item.id;\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageURL = brandsConfiguration[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n // TODO - check below if we have to still generate altName through the mapping function or whether it just\n // corresponds to item.brandObject.localeBrand\n return {\n id: item.id,\n name: item.brandObject.localeBrand || item.brandObject.brand,\n imageURL,\n altName: getFullBrandName(brand)\n };\n });\n};\n\n/**\n * Only if the brands in EU_BrandArray are present in the binLookup response should we handle dual branding based on EU regulations\n *\n * If the result from Array.some is true - then we are in a EU dual branding regulation scenario, i.e.\n * - Show the new dualBranding UI Buttons\n * - Preselect a card brand\n */\nexport const mustHandleDualBrandingAccordingToEURegulations = (\n EU_BrandArray: readonly string[],\n returnedDualBrandingObjects: DualBrandSelectElement[] | BrandObject[],\n key: string\n) => returnedDualBrandingObjects.some(item => EU_BrandArray.includes(item[key]));\n"],"names":["getCardImageUrl","brand","getImage","type","extension","shouldIncludeInstallmentsInPaymentData","installment","includes","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","handleKeyPress","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","name","brandObject","localeBrand","altName","mustHandleDualBrandingAccordingToEURegulations","EU_BrandArray","returnedDualBrandingObjects","some"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"../../internal/ClickToPay/context/ClickToPayProvider.js";import t from"./ClickToPayHolder.js";import{createElement as e}from"../../../external/preact/dist/preact.js";const n=({
|
|
1
|
+
import o from"../../internal/ClickToPay/context/ClickToPayProvider.js";import t from"./ClickToPayHolder.js";import{createElement as e}from"../../../external/preact/dist/preact.js";const n=({configuration:n,clickToPayService:r,setClickToPayRef:i,onSetStatus:a,onSubmit:c,onError:l,isStandaloneComponent:s,...m})=>e(o,{isStandaloneComponent:s,configuration:n,clickToPayService:r,setClickToPayRef:i,onSetStatus:a,onSubmit:c,onError:l},e(t,null,m.children));export{n as default};
|
|
2
2
|
//# sourceMappingURL=ClickToPayWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickToPayWrapper.js","sources":["../../../../../src/components/Card/components/ClickToPayWrapper.tsx"],"sourcesContent":["import ClickToPayProvider, { ClickToPayProviderProps } from '../../internal/ClickToPay/context/ClickToPayProvider';\nimport ClickToPayHolder from './ClickToPayHolder';\nimport { h } from 'preact';\n\nconst ClickToPayWrapper = ({\n
|
|
1
|
+
{"version":3,"file":"ClickToPayWrapper.js","sources":["../../../../../src/components/Card/components/ClickToPayWrapper.tsx"],"sourcesContent":["import ClickToPayProvider, { ClickToPayProviderProps } from '../../internal/ClickToPay/context/ClickToPayProvider';\nimport ClickToPayHolder from './ClickToPayHolder';\nimport { h } from 'preact';\n\nconst ClickToPayWrapper = ({\n configuration,\n clickToPayService,\n setClickToPayRef,\n onSetStatus,\n onSubmit,\n onError,\n isStandaloneComponent,\n ...props\n}: ClickToPayProviderProps) => {\n return (\n <ClickToPayProvider\n isStandaloneComponent={isStandaloneComponent}\n configuration={configuration}\n clickToPayService={clickToPayService}\n setClickToPayRef={setClickToPayRef}\n onSetStatus={onSetStatus}\n onSubmit={onSubmit}\n onError={onError}\n >\n <ClickToPayHolder>{props.children}</ClickToPayHolder>\n </ClickToPayProvider>\n );\n};\n\nexport default ClickToPayWrapper;\n"],"names":["ClickToPayWrapper","configuration","clickToPayService","setClickToPayRef","onSetStatus","onSubmit","onError","isStandaloneComponent","props","h","ClickToPayProvider","ClickToPayHolder","children"],"mappings":"oLAIA,MAAMA,EAAoB,EACtBC,gBACAC,oBACAC,mBACAC,cACAC,WACAC,UACAC,2BACGC,KAGCC,EAACC,EAAAA,CACGH,sBAAuBA,EACvBN,cAAeA,EACfC,kBAAmBA,EACnBC,iBAAkBA,EAClBC,YAAaA,EACbC,SAAUA,EACVC,QAASA,GAETG,EAACE,EAAAA,KAAkBH,EAAMI"}
|
|
@@ -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{CashAppComponent as s}from"./components/CashAppComponent.js";import o from"./services/CashAppService.js";import{CashAppSdkLoader as r}from"./services/CashAppSdkLoader.js";import n from"./defaultProps.js";import i from"../internal/RedirectButton/RedirectButton.js";import
|
|
1
|
+
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CashAppComponent as s}from"./components/CashAppComponent.js";import o from"./services/CashAppService.js";import{CashAppSdkLoader as r}from"./services/CashAppSdkLoader.js";import n from"./defaultProps.js";import i from"../internal/RedirectButton/RedirectButton.js";import{payAmountLabel as a}from"../internal/PayButton/utils.js";import{TxVariants as p}from"../tx-variants.js";import{PREFIX as h}from"../internal/Icon/constants.js";function d(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class c extends e{formatProps(t){return{...t,enableStoreDetails:t.session?.configuration?.enableStoreDetails||t.enableStoreDetails}}formatData(){const{shopperWantsToStore:t,grantId:e,onFileGrantId:s,cashTag:o,customerId:r}=this.state.data||{},{storePaymentMethod:n,storedPaymentMethodId:i}=this.props,a=this.props.enableStoreDetails||!this.props.session&&n;if(i)return{paymentMethod:{type:c.type,storedPaymentMethodId:i}};return{paymentMethod:{type:c.type,...e&&{grantId:e},...r&&{customerId:r},...s&&o&&{onFileGrantId:s,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}componentToRender(){return this.props.storedPaymentMethodId?t(i,{showPayButton:this.props.showPayButton,label:a(this.props.i18n,this.props.amount),icon:this.resources?.getImage({imageFolder:"components/"})(`${h}lock`),name:this.displayName,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(s,{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){if(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 s=!1;new Promise((e,s)=>t({resolve:e,reject:s})).catch(()=>{throw s=!0,Error("onClick rejected")}).then(()=>this.cashAppService.createCustomerRequest(this.props.amount)).then(()=>{this.cashAppService.begin()}).catch(t=>{s||this.handleError(t)})}),d(this,"handleOnChangeStoreDetails",t=>{const e={...this.state.data,shopperWantsToStore:t};this.setState({data:e})}),d(this,"handleAuthorize",t=>{const e={...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)return;const s=new r({environment:this.props.environment,analytics:this.analytics});this.cashAppService=new o(s,{storePaymentMethod:this.props.storePaymentMethod,useCashAppButtonUi:this.props.showPayButton,environment:this.props.environment,redirectURL:this.props.redirectURL,clientId:this.props.configuration?.clientId,scopeId:this.props.configuration?.scopeId,button:this.props.button,referenceId:this.props.referenceId})}}d(c,"type",p.cashapp),d(c,"defaultProps",n);export{c as CashAppPay,c 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 { 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 const sdkLoader = new CashAppSdkLoader({\n environment: this.props.environment,\n analytics: this.analytics\n });\n\n this.cashAppService = new CashAppService(sdkLoader, {\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 protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\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 }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","componentToRender","h","RedirectButton","showPayButton","label","payAmountLabel","i18n","amount","icon","resources","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","sdkLoader","CashAppSdkLoader","environment","analytics","CashAppService","useCashAppButtonUi","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\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/utils';\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 const sdkLoader = new CashAppSdkLoader({\n environment: this.props.environment,\n analytics: this.analytics\n });\n\n this.cashAppService = new CashAppService(sdkLoader, {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\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(this.props.amount);\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 protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\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 }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","componentToRender","h","RedirectButton","showPayButton","label","payAmountLabel","i18n","amount","icon","resources","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","sdkLoader","CashAppSdkLoader","environment","analytics","CashAppService","useCashAppButtonUi","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CashAppSdkLoader.js","sources":["../../../../../src/components/CashAppPay/services/CashAppSdkLoader.ts"],"sourcesContent":["import { CASHAPPPAY_PROD_SDK, CASHAPPPAY_SANDBOX_SDK } from './config';\nimport Script from '../../../utils/Script';\nimport { ICashAppWindowObject } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport interface ICashAppSdkLoader {\n load(environment: string): Promise<ICashAppWindowObject>;\n}\n\nclass CashAppSdkLoader implements ICashAppSdkLoader {\n private readonly analytics: IAnalytics;\n private readonly environment: string;\n\n constructor({ analytics, environment }: { analytics: IAnalytics; environment: string }) {\n this.analytics = analytics;\n this.environment = environment;\n }\n\n private isSdkIsAvailableOnWindow(): boolean {\n // @ts-ignore CashApp is created by the Cash App SDK\n return !!window.CashApp;\n }\n\n public async load(): Promise<ICashAppWindowObject> {\n const src = this.environment.toLowerCase().includes('live') ? CASHAPPPAY_PROD_SDK : CASHAPPPAY_SANDBOX_SDK;\n\n if (!this.isSdkIsAvailableOnWindow()) {\n const scriptElement = new Script({\n src,\n component: 'cashapppay',\n analytics: this.analytics\n });\n\n await scriptElement.load();\n }\n\n // @ts-ignore CashApp is created by the Cash App SDK\n return window.CashApp;\n }\n}\n\nexport { CashAppSdkLoader };\n"],"names":["CashAppSdkLoader","isSdkIsAvailableOnWindow","window","CashApp","load","src","this","environment","toLowerCase","includes","CASHAPPPAY_PROD_SDK","CASHAPPPAY_SANDBOX_SDK","scriptElement","Script","component","analytics","constructor","_define_property"],"mappings":"8OASA,MAAMA,EASMC,wBAAAA,GAEJ,QAASC,OAAOC,OACpB,CAEA,UAAaC,GACT,MAAMC,EAAMC,KAAKC,YAAYC,cAAcC,SAAS,QAAUC,EAAsBC,EAEpF,IAAKL,KAAKL,2BAA4B,CAClC,MAAMW,EAAgB,IAAIC,EAAO,CAC7BR,MACAS,UAAW,aACXC,UAAWT,KAAKS,kBAGdH,EAAcR,MACxB,CAGA,OAAOF,OAAOC,OAClB,CAzBA,WAAAa,EAAYD,UAAEA,EAASR,YAAEA,IAHzBU,EAAAX,KAAiBS,
|
|
1
|
+
{"version":3,"file":"CashAppSdkLoader.js","sources":["../../../../../src/components/CashAppPay/services/CashAppSdkLoader.ts"],"sourcesContent":["import { CASHAPPPAY_PROD_SDK, CASHAPPPAY_SANDBOX_SDK } from './config';\nimport Script from '../../../utils/Script';\nimport { ICashAppWindowObject } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport interface ICashAppSdkLoader {\n load(environment: string): Promise<ICashAppWindowObject>;\n}\n\nclass CashAppSdkLoader implements ICashAppSdkLoader {\n private readonly analytics: IAnalytics;\n private readonly environment: string;\n\n constructor({ analytics, environment }: { analytics: IAnalytics; environment: string }) {\n this.analytics = analytics;\n this.environment = environment;\n }\n\n private isSdkIsAvailableOnWindow(): boolean {\n // @ts-ignore CashApp is created by the Cash App SDK\n return !!window.CashApp;\n }\n\n public async load(): Promise<ICashAppWindowObject> {\n const src = this.environment.toLowerCase().includes('live') ? CASHAPPPAY_PROD_SDK : CASHAPPPAY_SANDBOX_SDK;\n\n if (!this.isSdkIsAvailableOnWindow()) {\n const scriptElement = new Script({\n src,\n component: 'cashapppay',\n analytics: this.analytics\n });\n\n await scriptElement.load();\n }\n\n // @ts-ignore CashApp is created by the Cash App SDK\n return window.CashApp;\n }\n}\n\nexport { CashAppSdkLoader };\n"],"names":["CashAppSdkLoader","isSdkIsAvailableOnWindow","window","CashApp","load","src","this","environment","toLowerCase","includes","CASHAPPPAY_PROD_SDK","CASHAPPPAY_SANDBOX_SDK","scriptElement","Script","component","analytics","constructor","_define_property"],"mappings":"8OASA,MAAMA,EASMC,wBAAAA,GAEJ,QAASC,OAAOC,OACpB,CAEA,UAAaC,GACT,MAAMC,EAAMC,KAAKC,YAAYC,cAAcC,SAAS,QAAUC,EAAsBC,EAEpF,IAAKL,KAAKL,2BAA4B,CAClC,MAAMW,EAAgB,IAAIC,EAAO,CAC7BR,MACAS,UAAW,aACXC,UAAWT,KAAKS,kBAGdH,EAAcR,MACxB,CAGA,OAAOF,OAAOC,OAClB,CAzBA,WAAAa,EAAYD,UAAEA,EAASR,YAAEA,IAHzBU,EAAAX,KAAiBS,oBACjBE,EAAAX,KAAiBC,sBAGbD,KAAKS,UAAYA,EACjBT,KAAKC,YAAcA,CACvB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"../../../core/Errors/AdyenCheckoutError.js";function e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class i{
|
|
1
|
+
import t from"../../../core/Errors/AdyenCheckoutError.js";function e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class i{isOneTimePayment(t){return t?.value>0}isOnFilePayment(){return this.configuration.storePaymentMethod}setStorePaymentMethod(t){this.configuration.storePaymentMethod=t}async initialize(){try{const{environment:t,clientId:e}=this.configuration,i=await this.sdkLoader.load(t);this.pay=await i.pay({clientId:e})}catch(e){throw new t("ERROR","Error during initialization",{cause:e})}}async renderButton(e){try{const{button:t,useCashAppButtonUi:i}=this.configuration,{begin:n}=await this.pay.render(e,{manage:!1,button:!!i&&{width:"full",shape:"semiround",...t}});this.startAuthorization=n}catch(e){throw new t("ERROR","Error rendering CashAppPay button",{cause:e})}}begin(){this.startAuthorization?this.startAuthorization():console.warn("CashAppService - begin() not available")}subscribeToEvent(t,e){return this.pay.addEventListener(t,e),()=>{this.pay.removeEventListener(t,e)}}async createCustomerRequest(e){try{const{referenceId:t,scopeId:i,redirectURL:n=window.location.href}=this.configuration,r={referenceId:t,redirectURL:n,actions:{...this.isOneTimePayment(e)&&{payment:{amount:e,scopeId:i}},...this.isOnFilePayment()&&{onFile:{scopeId:i}}}};await this.pay.customerRequest(r)}catch(e){throw new t("ERROR","Something went wrong during customerRequest creation",{cause:e})}}async restart(){await this.pay.restart()}constructor(t,i){e(this,"sdkLoader",void 0),e(this,"configuration",void 0),e(this,"pay",void 0),e(this,"startAuthorization",void 0),this.configuration=i,this.sdkLoader=t,i.clientId||console.warn("CashAppService: clientId is missing")}}export{i as default};
|
|
2
2
|
//# sourceMappingURL=CashAppService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CashAppService.js","sources":["../../../../../src/components/CashAppPay/services/CashAppService.ts"],"sourcesContent":["import { ICashAppSdkLoader } from './CashAppSdkLoader';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { CashAppPayEvents, CashAppServiceConfig, ICashAppSDK, ICashAppService } from './types';\n\nexport default class CashAppService implements ICashAppService {\n private readonly sdkLoader: ICashAppSdkLoader;\n private readonly configuration: CashAppServiceConfig;\n\n private pay: ICashAppSDK;\n\n /**\n * Reference to CashApp 'begin' method\n */\n private startAuthorization?: () => void;\n\n constructor(sdkLoader: ICashAppSdkLoader, configuration: CashAppServiceConfig) {\n this.configuration = configuration;\n this.sdkLoader = sdkLoader;\n\n if (!configuration.clientId) {\n console.warn('CashAppService: clientId is missing');\n }\n }\n\n
|
|
1
|
+
{"version":3,"file":"CashAppService.js","sources":["../../../../../src/components/CashAppPay/services/CashAppService.ts"],"sourcesContent":["import { ICashAppSdkLoader } from './CashAppSdkLoader';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { CashAppPayEvents, CashAppServiceConfig, ICashAppSDK, ICashAppService } from './types';\nimport { PaymentAmount } from '../../../types';\n\nexport default class CashAppService implements ICashAppService {\n private readonly sdkLoader: ICashAppSdkLoader;\n private readonly configuration: CashAppServiceConfig;\n\n private pay: ICashAppSDK;\n\n /**\n * Reference to CashApp 'begin' method\n */\n private startAuthorization?: () => void;\n\n constructor(sdkLoader: ICashAppSdkLoader, configuration: CashAppServiceConfig) {\n this.configuration = configuration;\n this.sdkLoader = sdkLoader;\n\n if (!configuration.clientId) {\n console.warn('CashAppService: clientId is missing');\n }\n }\n\n private isOneTimePayment(amount: PaymentAmount): boolean {\n return amount?.value > 0;\n }\n\n private isOnFilePayment(): boolean {\n return this.configuration.storePaymentMethod;\n }\n\n public setStorePaymentMethod(store: boolean) {\n this.configuration.storePaymentMethod = store;\n }\n\n public async initialize(): Promise<void> {\n try {\n const { environment, clientId } = this.configuration;\n const cashApp = await this.sdkLoader.load(environment);\n this.pay = await cashApp.pay({ clientId });\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error during initialization', { cause: error });\n }\n }\n\n public async renderButton(target: HTMLElement): Promise<void> {\n try {\n const { button, useCashAppButtonUi } = this.configuration;\n\n const { begin } = await this.pay.render(target, {\n manage: false,\n button: useCashAppButtonUi ? { width: 'full', shape: 'semiround', ...button } : false\n });\n this.startAuthorization = begin;\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error rendering CashAppPay button', { cause: error });\n }\n }\n\n public begin(): void {\n if (!this.startAuthorization) console.warn('CashAppService - begin() not available');\n else this.startAuthorization();\n }\n\n public subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function {\n this.pay.addEventListener(eventType, callback);\n return () => {\n this.pay.removeEventListener(eventType, callback);\n };\n }\n\n public async createCustomerRequest(amount: PaymentAmount): Promise<void> {\n try {\n const { referenceId, scopeId, redirectURL = window.location.href } = this.configuration;\n\n const customerRequest = {\n referenceId,\n redirectURL,\n actions: {\n ...(this.isOneTimePayment(amount) && {\n payment: {\n amount,\n scopeId\n }\n }),\n ...(this.isOnFilePayment() && {\n onFile: {\n scopeId\n }\n })\n }\n };\n await this.pay.customerRequest(customerRequest);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Something went wrong during customerRequest creation', { cause: error });\n }\n }\n\n public async restart(): Promise<void> {\n await this.pay.restart();\n }\n}\n"],"names":["CashAppService","isOneTimePayment","amount","value","isOnFilePayment","this","configuration","storePaymentMethod","setStorePaymentMethod","store","initialize","environment","clientId","cashApp","sdkLoader","load","pay","error","AdyenCheckoutError","cause","renderButton","target","button","useCashAppButtonUi","begin","render","manage","width","shape","startAuthorization","console","warn","subscribeToEvent","eventType","callback","addEventListener","removeEventListener","createCustomerRequest","referenceId","scopeId","redirectURL","window","location","href","customerRequest","actions","payment","onFile","restart","constructor","_define_property"],"mappings":"kLAKe,MAAMA,EAoBTC,gBAAAA,CAAiBC,GACrB,OAAOA,GAAQC,MAAQ,CAC3B,CAEQC,eAAAA,GACJ,OAAOC,KAAKC,cAAcC,kBAC9B,CAEOC,qBAAAA,CAAsBC,GACzBJ,KAAKC,cAAcC,mBAAqBE,CAC5C,CAEA,gBAAaC,GACT,IACI,MAAMC,YAAEA,EAAWC,SAAEA,GAAaP,KAAKC,cACjCO,QAAgBR,KAAKS,UAAUC,KAAKJ,GAC1CN,KAAKW,UAAYH,EAAQG,IAAI,CAAEJ,YACnC,CAAE,MAAOK,GACL,MAAM,IAAIC,EAAmB,QAAS,8BAA+B,CAAEC,MAAOF,GAClF,CACJ,CAEA,kBAAaG,CAAaC,GACtB,IACI,MAAMC,OAAEA,EAAMC,mBAAEA,GAAuBlB,KAAKC,eAEtCkB,MAAEA,SAAgBnB,KAAKW,IAAIS,OAAOJ,EAAQ,CAC5CK,QAAQ,EACRJ,SAAQC,GAAqB,CAAEI,MAAO,OAAQC,MAAO,eAAgBN,KAEzEjB,KAAKwB,mBAAqBL,CAC9B,CAAE,MAAOP,GACL,MAAM,IAAIC,EAAmB,QAAS,oCAAqC,CAAEC,MAAOF,GACxF,CACJ,CAEOO,KAAAA,GACEnB,KAAKwB,mBACLxB,KAAKwB,qBADoBC,QAAQC,KAAK,yCAE/C,CAEOC,gBAAAA,CAAiBC,EAA6BC,GAEjD,OADA7B,KAAKW,IAAImB,iBAAiBF,EAAWC,GAC9B,KACH7B,KAAKW,IAAIoB,oBAAoBH,EAAWC,GAEhD,CAEA,2BAAaG,CAAsBnC,GAC/B,IACI,MAAMoC,YAAEA,EAAWC,QAAEA,EAAOC,YAAEA,EAAcC,OAAOC,SAASC,MAAStC,KAAKC,cAEpEsC,EAAkB,CACpBN,cACAE,cACAK,QAAS,IACDxC,KAAKJ,iBAAiBC,IAAW,CACjC4C,QAAS,CACL5C,SACAqC,eAGJlC,KAAKD,mBAAqB,CAC1B2C,OAAQ,CACJR,oBAKVlC,KAAKW,IAAI4B,gBAAgBA,EACnC,CAAE,MAAO3B,GACL,MAAM,IAAIC,EAAmB,QAAS,uDAAwD,CAAEC,MAAOF,GAC3G,CACJ,CAEA,aAAa+B,SACH3C,KAAKW,IAAIgC,SACnB,CAtFA,WAAAC,CAAYnC,EAA8BR,GAV1C4C,EAAA7C,KAAiBS,oBACjBoC,EAAA7C,KAAiBC,wBAEjB4C,EAAA7C,KAAQW,cAKRkC,EAAA7C,KAAQwB,6BAGJxB,KAAKC,cAAgBA,EACrBD,KAAKS,UAAYA,EAEZR,EAAcM,UACfkB,QAAQC,KAAK,sCAErB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../../src/components/CashAppPay/services/types.ts"],"sourcesContent":["import { PaymentAmount } from '../../../types
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../../src/components/CashAppPay/services/types.ts"],"sourcesContent":["import { PaymentAmount } from '../../../types';\n\nexport interface ICashAppWindowObject {\n pay({ clientId }: { clientId: string }): Promise<ICashAppSDK>;\n}\n\n/**\n * https://developers.cash.app/docs/api/technical-documentation/sdks/pay-kit/technical-reference\n */\nexport interface ICashAppSDK {\n render(target: string | HTMLElement, options?: any): Promise<{ begin?: () => void }>;\n addEventListener(eventType: CashAppPayEvents, callback: Function): void;\n removeEventListener(eventType: CashAppPayEvents, callback: Function): void;\n customerRequest(customerRequest: any): Promise<void>;\n restart(): Promise<void>;\n}\n\nexport enum CashAppPayEvents {\n CustomerDismissed = 'CUSTOMER_DISMISSED',\n CustomerRequestApproved = 'CUSTOMER_REQUEST_APPROVED',\n CustomerRequestDeclined = 'CUSTOMER_REQUEST_DECLINED',\n CustomerRequestFailed = 'CUSTOMER_REQUEST_FAILED'\n}\n\nexport interface ICashAppService {\n begin(): void;\n initialize(): Promise<void>;\n setStorePaymentMethod(store: boolean): void;\n renderButton(target: HTMLElement): Promise<void>;\n restart(): Promise<void>;\n createCustomerRequest(amount: PaymentAmount): Promise<void>;\n subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function;\n}\n\nexport type CashAppServiceConfig = {\n useCashAppButtonUi: boolean;\n storePaymentMethod: boolean;\n environment: string;\n clientId: string;\n scopeId: string;\n referenceId?: string;\n redirectURL?: string;\n button?: {\n shape?: 'semiround' | 'round';\n size?: 'medium' | 'small';\n theme?: 'dark' | 'light';\n width?: 'static' | 'full';\n };\n};\n"],"names":["CashAppPayEvents"],"mappings":"AAiBO,IAAAA,EAAKA,SAAAA,GAAAA,8MAAAA,CAKX,CALWA,CAKX,CAAA"}
|
|
@@ -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 i from"../../utils/browserInfo.js";import t from"../internal/ClickToPay/services/create-clicktopay-service.js";import{CtpState as r}from"../internal/ClickToPay/services/ClickToPayService.js";import s from"../internal/ClickToPay/context/ClickToPayProvider.js";import n from"../internal/ClickToPay/ClickToPayComponent.js";import a from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as c}from"../tx-variants.js";function l(e,o,i){return o in e?Object.defineProperty(e,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[o]=i,e}class p extends o{get isValid(){return!0}get browserInfo(){return i()}formatData(){const{srcScheme:e,srcCorrelationId:o,srcTokenReference:i,srcCheckoutPayload:t,srcDigitalCardId:r}=this.state.data;return{paymentMethod:{type:p.type,...e&&{srcScheme:e},...o&&{srcCorrelationId:o},...i&&{srcTokenReference:i},...t&&{srcCheckoutPayload:t},...r&&{srcDigitalCardId:r}},browserInfo:this.browserInfo,origin:window?.location?.origin}}formatProps(e){return{...e,disableOtpAutoFocus:e.disableOtpAutoFocus||!1,shopperEmail:e.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:e.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:e.locale||e.i18n?.locale?.replace("-","_")}}async isAvailable(){return this.clickToPayService?this.clickToPayService.shopperAccountFound?Promise.resolve():new Promise((e,o)=>{this.clickToPayService.subscribeOnStateChange(i=>{this.clickToPayService.shopperAccountFound&&e(),i!==r.NotAvailable&&i!==r.Login&&i!==r.Idle||o()})}):Promise.reject()}componentToRender(){return e(s,{isStandaloneComponent:!0,configuration:this.ctpConfiguration,
|
|
1
|
+
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import i from"../../utils/browserInfo.js";import t from"../internal/ClickToPay/services/create-clicktopay-service.js";import{CtpState as r}from"../internal/ClickToPay/services/ClickToPayService.js";import s from"../internal/ClickToPay/context/ClickToPayProvider.js";import n from"../internal/ClickToPay/ClickToPayComponent.js";import a from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as c}from"../tx-variants.js";function l(e,o,i){return o in e?Object.defineProperty(e,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[o]=i,e}class p extends o{get isValid(){return!0}get browserInfo(){return i()}formatData(){const{srcScheme:e,srcCorrelationId:o,srcTokenReference:i,srcCheckoutPayload:t,srcDigitalCardId:r}=this.state.data;return{paymentMethod:{type:p.type,...e&&{srcScheme:e},...o&&{srcCorrelationId:o},...i&&{srcTokenReference:i},...t&&{srcCheckoutPayload:t},...r&&{srcDigitalCardId:r}},browserInfo:this.browserInfo,origin:window?.location?.origin}}formatProps(e){return{...e,disableOtpAutoFocus:e.disableOtpAutoFocus||!1,shopperEmail:e.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:e.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:e.locale||e.i18n?.locale?.replace("-","_")}}async isAvailable(){return this.clickToPayService?this.clickToPayService.shopperAccountFound?Promise.resolve():new Promise((e,o)=>{this.clickToPayService.subscribeOnStateChange(i=>{this.clickToPayService.shopperAccountFound&&e(),i!==r.NotAvailable&&i!==r.Login&&i!==r.Idle||o()})}):Promise.reject()}componentToRender(){return e(s,{isStandaloneComponent:!0,configuration:this.ctpConfiguration,clickToPayService:this.clickToPayService,setClickToPayRef:this.setComponentRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},e(n,null))}constructor(e,o){super(e,o),l(this,"clickToPayService",void 0),l(this,"ctpConfiguration",void 0),l(this,"handleClickToPaySubmit",e=>{this.setState({data:{...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=t(this.props.configuration,this.ctpConfiguration,this.props.environment,this.analytics),this.clickToPayService?.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")}}l(p,"type",c.clicktopay);export{p as ClickToPayElement,p 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 { 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, this.analytics);\n\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 protected override componentToRender(): h.JSX.Element {\n return (\n <ClickToPayProvider\n isStandaloneComponent={true}\n configuration={this.ctpConfiguration}\n
|
|
1
|
+
{"version":3,"file":"ClickToPay.js","sources":["../../../../src/components/ClickToPay/ClickToPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\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, this.analytics);\n\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 protected override componentToRender(): h.JSX.Element {\n return (\n <ClickToPayProvider\n isStandaloneComponent={true}\n configuration={this.ctpConfiguration}\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 );\n }\n}\n\nexport default ClickToPayElement;\n"],"names":["ClickToPayElement","UIElement","isValid","browserInfo","collectBrowserInfo","formatData","srcScheme","srcCorrelationId","srcTokenReference","srcCheckoutPayload","srcDigitalCardId","this","state","data","paymentMethod","type","origin","window","location","formatProps","props","disableOtpAutoFocus","shopperEmail","core","options","session","telephoneNumber","locale","i18n","replace","isAvailable","clickToPayService","shopperAccountFound","Promise","resolve","reject","subscribeOnStateChange","CtpState","NotAvailable","Login","Idle","componentToRender","h","ClickToPayProvider","isStandaloneComponent","configuration","ctpConfiguration","setClickToPayRef","setComponentRef","onSetStatus","setElementStatus","onSubmit","handleClickToPaySubmit","onError","handleError","ClickToPayComponent","constructor","checkout","super","_define_property","payload","setState","valid","errors","submit","merchantDisplayName","onReady","onTimeout","createClickToPayService","environment","analytics","initialize","catch","error","AdyenCheckoutError","toString","cause","console","warn","TxVariants","clicktopay"],"mappings":"yqBAcO,MAAMA,UAA0BC,EA6BnC,WAAIC,GACA,OAAO,CACX,CAEA,eAAIC,GACA,OAAOC,GACX,CAEOC,UAAAA,GACH,MAAMC,UAAEA,EAASC,iBAAEA,EAAgBC,kBAAEA,EAAiBC,mBAAEA,EAAkBC,iBAAEA,GAAqBC,KAAKC,MAAMC,KAC5G,MAAO,CACHC,cAAe,CACXC,KAAMf,EAAkBe,QACpBT,GAAa,CAAEA,gBACfC,GAAoB,CAAEA,uBACtBC,GAAqB,CAAEA,wBACvBC,GAAsB,CAAEA,yBACxBC,GAAoB,CAAEA,qBAE9BP,YAAaQ,KAAKR,YAClBa,OAAQC,QAAQC,UAAUF,OAElC,CAEUG,WAAAA,CAAYC,GAClB,MAAO,IACAA,EACHC,oBAAqBD,EAAMC,sBAAuB,EAClDC,aAAcF,EAAME,cAAgBX,KAAKY,KAAKC,SAASC,SAASH,aAChEI,gBAAiBN,EAAMM,iBAAmBf,KAAKY,KAAKC,SAASC,SAASC,gBACtEC,OAAQP,EAAMO,QAAUP,EAAMQ,MAAMD,QAAQE,QAAQ,IAAK,KAEjE,CAQA,iBAAsBC,GAClB,OAAKnB,KAAKoB,kBAINpB,KAAKoB,kBAAkBC,oBAChBC,QAAQC,UAGZ,IAAID,QAAQ,CAACC,EAASC,KACzBxB,KAAKoB,kBAAkBK,uBAAwBxB,IACvCD,KAAKoB,kBAAkBC,qBAAqBE,IAC5CtB,IAAUyB,EAASC,cAAgB1B,IAAUyB,EAASE,OAAS3B,IAAUyB,EAASG,MAAML,QAVzFF,QAAQE,QAavB,CAOmBM,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,uBAAuB,EACvBC,cAAelC,KAAKmC,iBACpBf,kBAAmBpB,KAAKoB,kBACxBgB,iBAAkBpC,KAAKqC,gBACvBC,YAAatC,KAAKuC,iBAClBC,SAAUxC,KAAKyC,uBACfC,QAAS1C,KAAK2C,aAEdZ,EAACa,EAAAA,MAGb,CAnGA,WAAAC,CAAYC,EAAiBrC,GACzBsC,MAAMD,EAAUrC,GAJpBuC,EAAAhD,KAAiBoB,4BACjB4B,EAAAhD,KAAiBmC,2BAkFjBa,EAAAhD,KAAQyC,yBAA0BQ,IAC9BjD,KAAKkD,SAAS,CAAEhD,KAAM,IAAK+C,GAAWE,MAAO,CAAA,EAAIC,OAAQ,CAAA,EAAI7D,SAAS,IACtES,KAAKqD,WA/ELrD,KAAKmC,iBAAmB,CACpBxB,aAAcX,KAAKS,MAAME,aACzBI,gBAAiBf,KAAKS,MAAMM,gBAC5BuC,oBAAqBtD,KAAKS,MAAM6C,oBAChCtC,OAAQhB,KAAKS,MAAMO,OACnBuC,QAASvD,KAAKS,MAAM8C,QACpBC,UAAWxD,KAAKS,MAAM+C,WAG1BxD,KAAKoB,kBAAoBqC,EAAwBzD,KAAKS,MAAMyB,cAAelC,KAAKmC,iBAAkBnC,KAAKS,MAAMiD,YAAa1D,KAAK2D,WAE/H3D,KAAKoB,mBAAmBwC,aAAaC,MAAMC,IACvC9D,KAAK2C,YAAY,IAAIoB,EAAmB,QAASD,EAAME,WAAY,CAAEC,MAAOH,OAG3E9D,KAAKoB,mBACN8C,QAAQC,KAAK,2GAErB,EA1BAnB,EADS3D,EACKe,OAAOgE,EAAWC"}
|
|
@@ -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 collectBrowserInfo from '../../utils/browserInfo';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../core/Analytics/events/AnalyticsInfoEvent';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static type = TxVariants.customCard;\n\n protected static defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n private brand = TxVariants.card;\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard\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 origin: !!window && window.location.origin\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: CardBinLookupData) {\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: CardFocusData) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: obj.focus === true ? InfoEventType.focus : InfoEventType.unfocus,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyPress={this.handleKeyPress}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.brand}\n onFocus={this.onFocus}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","updateStyles","stylesObj","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","isValid","collectBrowserInfo","componentToRender","h","CustomCardInput","ref","handleKeyPress","onChange","setState","onBinValue","implementationType","onFocus","onSubmitAnalytics","submitAnalytics","super","args","_define_property","card","triggerBinLookUp","event","AnalyticsInfoEvent","component","focus","InfoEventType","unfocus","target","fieldTypeToSnakeCase","fieldType","onEnterKeyPressed","activeElement","defaultProps"],"mappings":"ypBAYO,MAAMA,UAAmBC,EAU5BC,WAAAA,CAAYC,GACR,MAAO,IACAA,EACHC,KAAMC,EAAWC,WAEzB,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAC3B,MAAO,CACHC,cAAe,CACXR,KAAM,YACHK,KAAKC,MAAMG,QACVL,GAAW,CAAEM,MAAON,IAE5BO,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEAG,YAAAA,CAAaC,GAET,OADIX,KAAKY,cAAcF,cAAcV,KAAKY,aAAaF,aAAaC,GAC7DX,IACX,CAEAa,UAAAA,CAAWC,GAEP,OADId,KAAKY,cAAcC,YAAYb,KAAKY,aAAaC,WAAWC,GACzDd,IACX,CAEAe,wBAAAA,CAAyBC,GAErB,OADIhB,KAAKY,cAAcG,0BAA0Bf,KAAKY,aAAaG,yBAAyBC,GACrFhB,IACX,CAEAiB,yBAAAA,CAA0BC,GAEtB,OADIlB,KAAKY,cAAcK,2BAA2BjB,KAAKY,aAAaK,0BAA0BC,GACvFlB,IACX,CAEAmB,qBAAAA,CAAsBC,GAElB,OADIpB,KAAKY,cAAcO,uBAAuBnB,KAAKY,aAAaO,sBAAsBC,GAC/EpB,IACX,CAEAqB,WAAAA,CAAYC,GACR,MAAMC,EAAQ,IAAKD,GACnBC,EAAMC,SAAWxB,KAAKyB,MAEjBF,EAAMG,UAEPH,EAAMI,mBAAqBL,EAAIK,oBAAoBC,IAAKC,IACpDA,EAAKC,cAAgB9B,KAAKN,MAAMqC,oBAAoBF,EAAKxB,QAAQ2B,MAAQC,EAAgBJ,EAAKxB,MAAOL,KAAKkC,WACnGL,KAIf7B,KAAKN,MAAM2B,YAAYE,EAC3B,CAIA,WAAIY,GACA,QAASnC,KAAKC,MAAMkC,OACxB,CAEA,eAAI7B,GACA,OAAO8B,GACX,CAmBmBC,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,IAAKA,IACDxC,KAAKY,aAAe4B,MAEpBxC,KAAKN,SACLM,KAAKC,MACTwC,eAAgBzC,KAAKyC,eACrBjB,SAAUxB,KAAKyB,MACfiB,SAAU1C,KAAK2C,SACfC,WAAY5C,KAAK4C,WACjBC,mBAAoB,SACpBX,UAAWlC,KAAKkC,UAChB7B,MAAOL,KAAKK,MACZyC,QAAS9C,KAAK8C,QACdC,kBAAmB/C,KAAKgD,iBAGpC,mBAvHGC,SAAAC,GAQHC,EAAAnD,KAAQK,QAAQT,EAAWwD,MAiE3BD,EAAAnD,KAAO4C,aAAaS,EAAiBrD,OAUrCmD,EAAAnD,KAAQ8C,UAAWxB,IACf,MAAMgC,EAAQ,IAAIC,EAAmB,CACjCC,UAAWxD,KAAKL,KAChBA,MAAoB,IAAd2B,EAAImC,MAAiBC,EAAcD,MAAQC,EAAcC,QAC/DC,OAAQC,EAAqBvC,EAAIwC,aAGrC9D,KAAKgD,gBAAgBM,GAGrBtD,KAAKN,MAAMoD,UAAUxB,KAGzB6B,EAAAnD,KAAU+D,oBAAoB,CAACC,EAAwBR,KACnDxD,KAAKN,MAAMqE,oBAAoBC,EAAeR,MAhGlDL,EADS5D,EACKI,OAAOC,EAAWC,YAEhCsD,EAHS5D,EAGQ0E,eAAe,CAC5B5C,YAAa,OACbU,oBAAqB,CAAA"}
|
|
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 collectBrowserInfo from '../../utils/browserInfo';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static type = TxVariants.customCard;\n\n protected static defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n private brand = TxVariants.card;\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard\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 origin: !!window && window.location.origin\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: CardBinLookupData) {\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: CardFocusData) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: obj.focus === true ? InfoEventType.focus : InfoEventType.unfocus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyPress={this.handleKeyPress}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.brand}\n onFocus={this.onFocus}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","updateStyles","stylesObj","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","isValid","collectBrowserInfo","componentToRender","h","CustomCardInput","ref","handleKeyPress","onChange","setState","onBinValue","implementationType","onFocus","onSubmitAnalytics","submitAnalytics","super","args","_define_property","card","triggerBinLookUp","event","AnalyticsInfoEvent","component","focus","InfoEventType","unfocus","target","fieldTypeToSnakeCase","fieldType","onEnterKeyPressed","activeElement","defaultProps"],"mappings":"ypBAYO,MAAMA,UAAmBC,EAU5BC,WAAAA,CAAYC,GACR,MAAO,IACAA,EACHC,KAAMC,EAAWC,WAEzB,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAC3B,MAAO,CACHC,cAAe,CACXR,KAAM,YACHK,KAAKC,MAAMG,QACVL,GAAW,CAAEM,MAAON,IAE5BO,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEAG,YAAAA,CAAaC,GAET,OADIX,KAAKY,cAAcF,cAAcV,KAAKY,aAAaF,aAAaC,GAC7DX,IACX,CAEAa,UAAAA,CAAWC,GAEP,OADId,KAAKY,cAAcC,YAAYb,KAAKY,aAAaC,WAAWC,GACzDd,IACX,CAEAe,wBAAAA,CAAyBC,GAErB,OADIhB,KAAKY,cAAcG,0BAA0Bf,KAAKY,aAAaG,yBAAyBC,GACrFhB,IACX,CAEAiB,yBAAAA,CAA0BC,GAEtB,OADIlB,KAAKY,cAAcK,2BAA2BjB,KAAKY,aAAaK,0BAA0BC,GACvFlB,IACX,CAEAmB,qBAAAA,CAAsBC,GAElB,OADIpB,KAAKY,cAAcO,uBAAuBnB,KAAKY,aAAaO,sBAAsBC,GAC/EpB,IACX,CAEAqB,WAAAA,CAAYC,GACR,MAAMC,EAAQ,IAAKD,GACnBC,EAAMC,SAAWxB,KAAKyB,MAEjBF,EAAMG,UAEPH,EAAMI,mBAAqBL,EAAIK,oBAAoBC,IAAKC,IACpDA,EAAKC,cAAgB9B,KAAKN,MAAMqC,oBAAoBF,EAAKxB,QAAQ2B,MAAQC,EAAgBJ,EAAKxB,MAAOL,KAAKkC,WACnGL,KAIf7B,KAAKN,MAAM2B,YAAYE,EAC3B,CAIA,WAAIY,GACA,QAASnC,KAAKC,MAAMkC,OACxB,CAEA,eAAI7B,GACA,OAAO8B,GACX,CAmBmBC,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,IAAKA,IACDxC,KAAKY,aAAe4B,MAEpBxC,KAAKN,SACLM,KAAKC,MACTwC,eAAgBzC,KAAKyC,eACrBjB,SAAUxB,KAAKyB,MACfiB,SAAU1C,KAAK2C,SACfC,WAAY5C,KAAK4C,WACjBC,mBAAoB,SACpBX,UAAWlC,KAAKkC,UAChB7B,MAAOL,KAAKK,MACZyC,QAAS9C,KAAK8C,QACdC,kBAAmB/C,KAAKgD,iBAGpC,mBAvHGC,SAAAC,GAQHC,EAAAnD,KAAQK,QAAQT,EAAWwD,MAiE3BD,EAAAnD,KAAO4C,aAAaS,EAAiBrD,OAUrCmD,EAAAnD,KAAQ8C,UAAWxB,IACf,MAAMgC,EAAQ,IAAIC,EAAmB,CACjCC,UAAWxD,KAAKL,KAChBA,MAAoB,IAAd2B,EAAImC,MAAiBC,EAAcD,MAAQC,EAAcC,QAC/DC,OAAQC,EAAqBvC,EAAIwC,aAGrC9D,KAAKgD,gBAAgBM,GAGrBtD,KAAKN,MAAMoD,UAAUxB,KAGzB6B,EAAAnD,KAAU+D,oBAAoB,CAACC,EAAwBR,KACnDxD,KAAKN,MAAMqE,oBAAoBC,EAAeR,MAhGlDL,EADS5D,EACKI,OAAOC,EAAWC,YAEhCsD,EAHS5D,EAGQ0E,eAAe,CAC5B5C,YAAa,OACbU,oBAAqB,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useEffect as a,useState as r}from"../../../../external/preact/hooks/dist/hooks.js";import o from"../../../../utils/useForm/useForm.js";import t from"../../../internal/FormFields/Field/Field.js";import s from"../../../../utils/get-issuer-image.js";import{useCoreContext as i}from"../../../../core/Context/CoreProvider.js";import n from"../../../internal/FormFields/InputEmail.js";import l from"../../../internal/FormFields/Select/Select.js";import p from"../../../../core/Context/useImage.js";import{validationRules as m}from"../../../../utils/Validator/defaultRules.js";import{getErrorMessage as u}from"../../../../utils/getErrorMessage.js";function d(d){const{i18n:c}=i(),g=p(),h=()=>["dragonpay_ebanking","dragonpay_otc_banking","dragonpay_otc_non_banking"].indexOf(d.type)>-1,{handleChangeFor:f,triggerValidation:_,data:y,valid:E,errors:k,isValid:F}=o({schema:[...h()?["issuer"]:[],"shopperEmail"],rules:{issuer:{validate:e=>h()&&!!e,modes:["input","blur"]},shopperEmail:m.emailRule}}),j=s({},d.type,g),b=d.items.map(e=>({...e,icon:j(e.id&&e.id.toLowerCase())}));a(()=>{d.onChange({isValid:F,data:y,valid:E,errors:k})},[F,y,E,k]);const[x,C]=r("ready");return this.setStatus=C,this.showValidation=_,e("div",{className:"adyen-checkout__dragonpay-input__field"},e(t,{label:c.get("shopperEmail"),errorMessage:u(c,k.shopperEmail,c.get("shopperEmail")),name:"dragonpay-shopperEmail"},e(n,{name:"dragonpay-shopperEmail",autoCorrect:"off",value:y.shopperEmail,className:"adyen-checkout__input--large",
|
|
1
|
+
import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useEffect as a,useState as r}from"../../../../external/preact/hooks/dist/hooks.js";import o from"../../../../utils/useForm/useForm.js";import t from"../../../internal/FormFields/Field/Field.js";import s from"../../../../utils/get-issuer-image.js";import{useCoreContext as i}from"../../../../core/Context/CoreProvider.js";import n from"../../../internal/FormFields/InputEmail.js";import l from"../../../internal/FormFields/Select/Select.js";import p from"../../../../core/Context/useImage.js";import{validationRules as m}from"../../../../utils/Validator/defaultRules.js";import{getErrorMessage as u}from"../../../../utils/getErrorMessage.js";function d(d){const{i18n:c}=i(),g=p(),h=()=>["dragonpay_ebanking","dragonpay_otc_banking","dragonpay_otc_non_banking"].indexOf(d.type)>-1,{handleChangeFor:f,triggerValidation:_,data:y,valid:E,errors:k,isValid:F}=o({schema:[...h()?["issuer"]:[],"shopperEmail"],rules:{issuer:{validate:e=>h()&&!!e,modes:["input","blur"]},shopperEmail:m.emailRule}}),j=s({},d.type,g),b=d.items.map(e=>({...e,icon:j(e.id&&e.id.toLowerCase())}));a(()=>{d.onChange({isValid:F,data:y,valid:E,errors:k})},[F,y,E,k]);const[x,C]=r("ready");return this.setStatus=C,this.showValidation=_,e("div",{className:"adyen-checkout__dragonpay-input__field"},e(t,{label:c.get("shopperEmail"),errorMessage:u(c,k.shopperEmail,c.get("shopperEmail")),name:"dragonpay-shopperEmail"},e(n,{name:"dragonpay-shopperEmail",autoCorrect:"off",value:y.shopperEmail,className:"adyen-checkout__input--large",spellcheck:!1,onInput:f("shopperEmail","input"),onBlur:f("shopperEmail","blur")})),h()&&e(t,{label:c.get((V=d.type,"dragonpay_otc_non_banking"===V?"dragonpayVoucher.selectField.contextualText.nonBank":"dragonpayVoucher.selectField.contextualText.bank")),errorMessage:!!k.issuer,name:"issuer"},e(l,{items:b,selectedValue:y.issuer,name:"issuer",className:"adyen-checkout__dropdown--large adyen-checkout__issuer-list__dropdown",onChange:f("issuer")})),d.showPayButton&&d.payButton({status:x,label:c.get("confirmPurchase")}));var V}d.defaultProps={data:{},items:[],onChange:()=>{}};export{d as default};
|
|
2
2
|
//# sourceMappingURL=DragonpayInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragonpayInput.js","sources":["../../../../../../src/components/Dragonpay/components/DragonpayInput/DragonpayInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport useForm from '../../../../utils/useForm';\nimport Field from '../../../internal/FormFields/Field';\nimport getIssuerImageUrl from '../../../../utils/get-issuer-image';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { DragonpayInputData, DragonpayInputIssuerItem, DragonpayInputProps } from '../../types';\nimport InputEmail from '../../../internal/FormFields/InputEmail';\nimport Select from '../../../internal/FormFields/Select';\nimport useImage from '../../../../core/Context/useImage';\nimport { validationRules } from '../../../../utils/Validator/defaultRules';\nimport { getErrorMessage } from '../../../../utils/getErrorMessage';\n\nexport default function DragonpayInput(props: DragonpayInputProps) {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const isIssuerRequired = () => {\n const typesRequiringIssuers = ['dragonpay_ebanking', 'dragonpay_otc_banking', 'dragonpay_otc_non_banking'];\n return typesRequiringIssuers.indexOf(props.type) > -1;\n };\n\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<DragonpayInputData>({\n schema: [...(isIssuerRequired() ? ['issuer'] : []), 'shopperEmail'],\n rules: {\n issuer: {\n validate: issuer => isIssuerRequired() && !!issuer,\n modes: ['input', 'blur']\n },\n shopperEmail: validationRules.emailRule\n }\n });\n\n const getIssuerIcon = getIssuerImageUrl({}, props.type, getImage);\n const items = props.items.map(\n (item: DragonpayInputIssuerItem): DragonpayInputIssuerItem => ({\n ...item,\n icon: getIssuerIcon(item.id && item.id.toLowerCase())\n })\n );\n\n const getIssuerSelectFieldKey = type => {\n if (type === 'dragonpay_otc_non_banking') {\n return 'dragonpayVoucher.selectField.contextualText.nonBank';\n }\n return 'dragonpayVoucher.selectField.contextualText.bank';\n };\n\n useEffect(() => {\n props.onChange({ isValid, data, valid, errors });\n }, [isValid, data, valid, errors]);\n\n const [status, setStatus] = useState('ready');\n this.setStatus = setStatus;\n this.showValidation = triggerValidation;\n\n return (\n <div className=\"adyen-checkout__dragonpay-input__field\">\n <Field\n label={i18n.get('shopperEmail')}\n errorMessage={getErrorMessage(i18n, errors.shopperEmail, i18n.get('shopperEmail'))}\n name={'dragonpay-shopperEmail'}\n >\n <InputEmail\n name={'dragonpay-shopperEmail'}\n autoCorrect={'off'}\n value={data.shopperEmail}\n className={'adyen-checkout__input--large'}\n
|
|
1
|
+
{"version":3,"file":"DragonpayInput.js","sources":["../../../../../../src/components/Dragonpay/components/DragonpayInput/DragonpayInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport useForm from '../../../../utils/useForm';\nimport Field from '../../../internal/FormFields/Field';\nimport getIssuerImageUrl from '../../../../utils/get-issuer-image';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { DragonpayInputData, DragonpayInputIssuerItem, DragonpayInputProps } from '../../types';\nimport InputEmail from '../../../internal/FormFields/InputEmail';\nimport Select from '../../../internal/FormFields/Select';\nimport useImage from '../../../../core/Context/useImage';\nimport { validationRules } from '../../../../utils/Validator/defaultRules';\nimport { getErrorMessage } from '../../../../utils/getErrorMessage';\n\nexport default function DragonpayInput(props: DragonpayInputProps) {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const isIssuerRequired = () => {\n const typesRequiringIssuers = ['dragonpay_ebanking', 'dragonpay_otc_banking', 'dragonpay_otc_non_banking'];\n return typesRequiringIssuers.indexOf(props.type) > -1;\n };\n\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<DragonpayInputData>({\n schema: [...(isIssuerRequired() ? ['issuer'] : []), 'shopperEmail'],\n rules: {\n issuer: {\n validate: issuer => isIssuerRequired() && !!issuer,\n modes: ['input', 'blur']\n },\n shopperEmail: validationRules.emailRule\n }\n });\n\n const getIssuerIcon = getIssuerImageUrl({}, props.type, getImage);\n const items = props.items.map(\n (item: DragonpayInputIssuerItem): DragonpayInputIssuerItem => ({\n ...item,\n icon: getIssuerIcon(item.id && item.id.toLowerCase())\n })\n );\n\n const getIssuerSelectFieldKey = type => {\n if (type === 'dragonpay_otc_non_banking') {\n return 'dragonpayVoucher.selectField.contextualText.nonBank';\n }\n return 'dragonpayVoucher.selectField.contextualText.bank';\n };\n\n useEffect(() => {\n props.onChange({ isValid, data, valid, errors });\n }, [isValid, data, valid, errors]);\n\n const [status, setStatus] = useState('ready');\n this.setStatus = setStatus;\n this.showValidation = triggerValidation;\n\n return (\n <div className=\"adyen-checkout__dragonpay-input__field\">\n <Field\n label={i18n.get('shopperEmail')}\n errorMessage={getErrorMessage(i18n, errors.shopperEmail, i18n.get('shopperEmail'))}\n name={'dragonpay-shopperEmail'}\n >\n <InputEmail\n name={'dragonpay-shopperEmail'}\n autoCorrect={'off'}\n value={data.shopperEmail}\n className={'adyen-checkout__input--large'}\n spellcheck={false}\n onInput={handleChangeFor('shopperEmail', 'input')}\n onBlur={handleChangeFor('shopperEmail', 'blur')}\n />\n </Field>\n\n {isIssuerRequired() && (\n <Field label={i18n.get(getIssuerSelectFieldKey(props.type))} errorMessage={!!errors.issuer} name={'issuer'}>\n <Select\n items={items}\n selectedValue={data.issuer}\n name={'issuer'}\n className={'adyen-checkout__dropdown--large adyen-checkout__issuer-list__dropdown'}\n onChange={handleChangeFor('issuer')}\n />\n </Field>\n )}\n\n {props.showPayButton && props.payButton({ status, label: i18n.get('confirmPurchase') })}\n </div>\n );\n}\n\nDragonpayInput.defaultProps = {\n data: {},\n items: [],\n onChange: () => {}\n};\n"],"names":["DragonpayInput","props","i18n","useCoreContext","getImage","useImage","isIssuerRequired","indexOf","type","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","schema","rules","issuer","validate","modes","shopperEmail","validationRules","emailRule","getIssuerIcon","getIssuerImageUrl","items","map","item","icon","id","toLowerCase","useEffect","onChange","status","setStatus","useState","this","showValidation","h","div","className","Field","label","get","errorMessage","getErrorMessage","name","InputEmail","autoCorrect","value","spellcheck","onInput","onBlur","Select","selectedValue","showPayButton","payButton","defaultProps"],"mappings":"mtBAae,SAASA,EAAeC,GACnC,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IACXC,EAAmB,IACS,CAAC,qBAAsB,wBAAyB,6BACjDC,QAAQN,EAAMO,OAAQ,GAGjDC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAA4B,CACrGC,OAAQ,IAAKV,IAAqB,CAAC,UAAY,GAAK,gBACpDW,MAAO,CACHC,OAAQ,CACJC,SAAUD,GAAUZ,OAAwBY,EAC5CE,MAAO,CAAC,QAAS,SAErBC,aAAcC,EAAgBC,aAIhCC,EAAgBC,EAAkB,CAAA,EAAIxB,EAAMO,KAAMJ,GAClDsB,EAAQzB,EAAMyB,MAAMC,IACrBC,QACMA,EACHC,KAAML,EAAcI,EAAKE,IAAMF,EAAKE,GAAGC,kBAW/CC,EAAU,KACN/B,EAAMgC,SAAS,CAAEnB,UAASH,OAAMC,QAAOC,YACxC,CAACC,EAASH,EAAMC,EAAOC,IAE1B,MAAOqB,EAAQC,GAAaC,EAAS,SAIrC,OAHAC,KAAKF,UAAYA,EACjBE,KAAKC,eAAiB5B,EAGlB6B,EAACC,MAAAA,CAAIC,UAAU,0CACXF,EAACG,EAAAA,CACGC,MAAOzC,EAAK0C,IAAI,gBAChBC,aAAcC,EAAgB5C,EAAMW,EAAOQ,aAAcnB,EAAK0C,IAAI,iBAClEG,KAAM,0BAENR,EAACS,EAAAA,CACGD,KAAM,yBACNE,YAAa,MACbC,MAAOvC,EAAKU,aACZoB,UAAW,+BACXU,YAAY,EACZC,QAAS3C,EAAgB,eAAgB,SACzC4C,OAAQ5C,EAAgB,eAAgB,WAI/CH,KACGiC,EAACG,EAAAA,CAAMC,MAAOzC,EAAK0C,KAlCCpC,EAkC2BP,EAAMO,KAjChD,8BAATA,EACO,sDAEJ,qDA8B8DqC,eAAgBhC,EAAOK,OAAQ6B,KAAM,UAC9FR,EAACe,EAAAA,CACG5B,MAAOA,EACP6B,cAAe5C,EAAKO,OACpB6B,KAAM,SACNN,UAAW,wEACXR,SAAUxB,EAAgB,aAKrCR,EAAMuD,eAAiBvD,EAAMwD,UAAU,CAAEvB,SAAQS,MAAOzC,EAAK0C,IAAI,sBA7C1CpC,IAAAA,CAgDpC,CAEAR,EAAe0D,aAAe,CAC1B/C,KAAM,CAAA,EACNe,MAAO,GACPO,SAAU"}
|
|
@@ -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 n from"./defaultProps.js";import{DropinComponent as o}from"./components/DropinComponent.js";import
|
|
1
|
+
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import n from"./defaultProps.js";import{DropinComponent as o}from"./components/DropinComponent.js";import s from"./elements/createElements.js";import i from"./elements/createStoredElements.js";import a from"./elements/createInstantPaymentElements.js";import{hasOwnProperty as r}from"../../utils/hasOwnProperty.js";import h from"./elements/splitPaymentMethods.js";import{TxVariants as d}from"../tx-variants.js";function m(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const p=["paywithgoogle","googlepay","applepay"];class l extends e{reportIntegrationFlavor(){this.analytics.sendFlavor("dropin")}storeElementRefOnCore(){this.core.storeElementReference(this)}formatProps(t){return{...super.formatProps(t),instantPaymentTypes:Array.from(new Set(t.instantPaymentTypes)).filter(t=>p.includes(t))}}get isValid(){return!!this.dropinRef&&!!this.dropinRef.state.activePaymentMethod&&!!this.dropinRef.state.activePaymentMethod.isValid}showValidation(){return this.dropinRef.state.activePaymentMethod&&this.dropinRef.state.activePaymentMethod.showValidation(),this}setStatus(t,e={}){return this.dropinRef?.setStatus(t,e),this}get activePaymentMethod(){return this.dropinRef?.state||this.dropinRef?.state.activePaymentMethod?this.dropinRef.state.activePaymentMethod:null}get data(){return this.activePaymentMethod?this.dropinRef.state.activePaymentMethod.data:null}displayFinalAnimation(t){this.props.disableFinalAnimation||this.dropinRef?.setStatus(t)}submit(){if(!this.activePaymentMethod)throw new Error("No active payment method.");this.activePaymentMethod.isValid||this.activePaymentMethod.showValidation(),this.activePaymentMethod.isInstantPayment&&this.closeActivePaymentMethod(),this.activePaymentMethod.submit()}updateAmount(t,e){this.props={...this.props,...t&&{amount:t},...e&&{secondaryAmount:e}},this.amountProviderRef.current?.update(t,e),this.paymentMethodElements.forEach(n=>{n.updateAmount(t,e)})}handleElementsCreated(t){t&&0!==t.length||(this.paymentMethodElements=[]),this.paymentMethodElements=t}handleAction(t,e={}){if(!t||!t.type){if(r(t,"action")&&r(t,"resultCode"))throw new Error('handleAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('handleAction::Invalid Action - the passed action object does not have a "type" property')}if("redirect"!==t.type&&this.activePaymentMethod?.updateWithAction)return this.activePaymentMethod.updateWithAction(t);this.elementRef instanceof l&&(e={...this.elementRef.activePaymentMethod?.props,...e});const n=this.core.createFromAction(t,{...e,elementRef:this.elementRef,isDropin:!0});return n?(this.setStatus(n.props.statusType,{component:n}),this.componentFromAction=n,this):null}closeActivePaymentMethod(){this.dropinRef.closeActivePaymentMethod()}handleKeyPress(t){if("Enter"===t.key||"Enter"===t.code){if("radio"===document?.activeElement?.getAttribute("role"))return;super.handleKeyPress(t)}}onEnterKeyPressed(t,e){const n=this.activePaymentMethod??e;this.activePaymentMethod?.onEnterKeyPressed(t,n)}componentToRender(){return t(o,{...this.props,core:this.core,elementRef:this.elementRef,onCreateElements:this.handleCreate,onElementsCreated:this.handleElementsCreated,ref:t=>{this.dropinRef=t}})}constructor(t,e){super(t,e),m(this,"dropinRef",null),m(this,"paymentMethodsConfiguration",void 0),m(this,"componentFromAction",void 0),m(this,"paymentMethodElements",[]),m(this,"handleCreate",()=>{const{paymentMethodsConfiguration:t,showStoredPaymentMethods:e,showPaymentMethods:n,instantPaymentTypes:o}=this.props,{paymentMethods:r,storedPaymentMethods:d,instantPaymentMethods:m,fastlanePaymentMethod:p}=h(this.core.paymentMethodsResponse,o),l={elementRef:this.elementRef,isDropin:!0},c=n?s(r,t,l,this.core):[],y=a(m,t,l,this.core);return[e?i(this.props.filterStoredPaymentMethods?.(d)??d,t,l,this.core):[],c,y,p?s([p],t,l,this.core):[]]}),m(this,"handleOrder",({order:t})=>{this.updateParent({order:t})}),this.submit=this.submit.bind(this),this.handleAction=this.handleAction.bind(this),this.handleElementsCreated=this.handleElementsCreated.bind(this),this.props.paymentMethodComponents.forEach(t=>this.core.register(t)),this.paymentMethodsConfiguration=this.props.paymentMethodsConfiguration||{}}}m(l,"type",d.dropin),m(l,"defaultProps",n);export{l as default};
|
|
2
2
|
//# sourceMappingURL=Dropin.js.map
|