@adyen/adyen-web 6.8.0 → 6.9.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 +11 -7
- 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 +212 -49
- package/dist/es/_virtual/index.js +1 -1
- package/dist/es/_virtual/index2.js +2 -0
- package/dist/es/_virtual/index2.js.map +1 -0
- package/dist/es/adyen.css +11 -7
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/Ach/components/AchInput/AchInput.js +1 -1
- package/dist/es/components/Ach/components/AchInput/AchInput.js.map +1 -1
- package/dist/es/components/Ach/components/AchInput/components/AchSFInput.js +1 -1
- package/dist/es/components/Ach/components/AchInput/components/AchSFInput.js.map +1 -1
- package/dist/es/components/ApplePay/components/ApplePayButton.js +1 -1
- package/dist/es/components/ApplePay/components/ApplePayButton.js.map +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es/components/Boleto/Boleto.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVCHint.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFields.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFields.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardNumber.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
- 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/Giftcard/Giftcard.js +1 -1
- package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardNumberField.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardNumberField.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardPinField.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardPinField.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/GooglePay.js +1 -1
- package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es/components/MBWay/MBWay.js +1 -1
- package/dist/es/components/MBWay/MBWay.js.map +1 -1
- package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
- package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
- package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
- package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
- package/dist/es/components/PayPal/components/PaypalButtons.js +1 -1
- package/dist/es/components/PayPal/components/PaypalButtons.js.map +1 -1
- package/dist/es/components/PayTo/PayTo.js +2 -0
- package/dist/es/components/PayTo/PayTo.js.map +1 -0
- package/dist/es/components/PayTo/components/BSBInput.js +2 -0
- package/dist/es/components/PayTo/components/BSBInput.js.map +1 -0
- package/dist/es/components/PayTo/components/IdentifierSelector.js +2 -0
- package/dist/es/components/PayTo/components/IdentifierSelector.js.map +1 -0
- package/dist/es/components/PayTo/components/MandateSummary.js +2 -0
- package/dist/es/components/PayTo/components/MandateSummary.js.map +1 -0
- package/dist/es/components/PayTo/components/PayIDInput.js +2 -0
- package/dist/es/components/PayTo/components/PayIDInput.js.map +1 -0
- package/dist/es/components/PayTo/components/PayToComponent.js +2 -0
- package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -0
- package/dist/es/components/PayTo/components/PayToInstructions.js +2 -0
- package/dist/es/components/PayTo/components/PayToInstructions.js.map +1 -0
- package/dist/es/components/PayTo/components/PayToNameFields.js +2 -0
- package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -0
- package/dist/es/components/PayTo/components/PayToPhone.js +2 -0
- package/dist/es/components/PayTo/components/PayToPhone.js.map +1 -0
- package/dist/es/components/PayTo/components/validate.js +2 -0
- package/dist/es/components/PayTo/components/validate.js.map +1 -0
- package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
- package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
- package/dist/es/components/UPI/components/UPIComponent/useUpiSegmentedControlOptions.js.map +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.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/components-name-map.js +1 -1
- package/dist/es/components/components-name-map.js.map +1 -1
- package/dist/es/components/index.js +1 -1
- package/dist/es/components/internal/Alert/Alert.js +1 -1
- package/dist/es/components/internal/Alert/Alert.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/Button/Button.js +1 -1
- package/dist/es/components/internal/Button/Button.js.map +1 -1
- package/dist/es/components/internal/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/es/components/internal/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es/components/internal/ContentSeparator/ContentSeparator.js +1 -1
- package/dist/es/components/internal/ContentSeparator/ContentSeparator.js.map +1 -1
- package/dist/es/components/internal/DetailsTable/DetailsTable.js +2 -0
- package/dist/es/components/internal/DetailsTable/DetailsTable.js.map +1 -0
- package/dist/es/components/internal/ExpandButton/ExpandButton.js +1 -1
- package/dist/es/components/internal/ExpandButton/ExpandButton.js.map +1 -1
- package/dist/es/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
- package/dist/es/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
- package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
- package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
- package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
- package/dist/es/components/internal/FormFields/Fieldset/Fieldset.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/FormFields/RadioGroup/RadioGroup.js +1 -1
- package/dist/es/components/internal/FormFields/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
- package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectList.js +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
- package/dist/es/components/internal/IFrame/Iframe.js +1 -1
- package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
- package/dist/es/components/internal/Icon/Icon.js +1 -1
- package/dist/es/components/internal/Icon/Icon.js.map +1 -1
- package/dist/es/components/internal/Img/Img.js +1 -1
- package/dist/es/components/internal/Img/Img.js.map +1 -1
- package/dist/es/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js +1 -1
- package/dist/es/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js.map +1 -1
- package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
- package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
- package/dist/es/components/internal/Modal/Modal.js +1 -1
- package/dist/es/components/internal/Modal/Modal.js.map +1 -1
- package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
- package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es/components/internal/PhoneInput/PhoneInputFields.js +2 -0
- package/dist/es/components/internal/PhoneInput/PhoneInputFields.js.map +1 -0
- package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +2 -0
- package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -0
- package/dist/es/components/internal/PhoneInput/validate.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.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/UIElement/UIElement.js.map +1 -1
- package/dist/es/components/internal/Voucher/Voucher.js +1 -1
- package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
- package/dist/es/components/tx-variants.js +1 -1
- package/dist/es/components/tx-variants.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/filters.js +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
- package/dist/es/core/Services/analytics/collect-id.js +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/utils.js +1 -1
- package/dist/es/core/utils.js.map +1 -1
- package/dist/es/external/classnames/index.js +2 -2
- package/dist/es/external/classnames/index.js.map +1 -1
- package/dist/es/index.d.ts +212 -49
- package/dist/es/index.js +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-legacy/_virtual/index.js +1 -1
- package/dist/es-legacy/_virtual/index2.js +2 -0
- package/dist/es-legacy/_virtual/index2.js.map +1 -0
- package/dist/es-legacy/adyen.css +11 -7
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js +1 -1
- package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +1 -1
- package/dist/es-legacy/components/Ach/components/AchInput/components/AchSFInput.js +1 -1
- package/dist/es-legacy/components/Ach/components/AchInput/components/AchSFInput.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/components/ApplePayButton.js +1 -1
- package/dist/es-legacy/components/ApplePay/components/ApplePayButton.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/Boleto/Boleto.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +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/BrandIcon.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +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/CardNumber.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
- 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/Giftcard/Giftcard.js +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardNumberField.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardNumberField.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.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 +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
- package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
- package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
- package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
- package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
- package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js +2 -0
- package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -0
- package/dist/es-legacy/components/PayTo/components/BSBInput.js +2 -0
- package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -0
- package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js +2 -0
- package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js.map +1 -0
- package/dist/es-legacy/components/PayTo/components/MandateSummary.js +2 -0
- package/dist/es-legacy/components/PayTo/components/MandateSummary.js.map +1 -0
- package/dist/es-legacy/components/PayTo/components/PayIDInput.js +2 -0
- package/dist/es-legacy/components/PayTo/components/PayIDInput.js.map +1 -0
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js +2 -0
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -0
- package/dist/es-legacy/components/PayTo/components/PayToInstructions.js +2 -0
- package/dist/es-legacy/components/PayTo/components/PayToInstructions.js.map +1 -0
- package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +2 -0
- package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -0
- package/dist/es-legacy/components/PayTo/components/PayToPhone.js +2 -0
- package/dist/es-legacy/components/PayTo/components/PayToPhone.js.map +1 -0
- package/dist/es-legacy/components/PayTo/components/validate.js +2 -0
- package/dist/es-legacy/components/PayTo/components/validate.js.map +1 -0
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/useUpiSegmentedControlOptions.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.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/components-name-map.js +1 -1
- package/dist/es-legacy/components/components-name-map.js.map +1 -1
- package/dist/es-legacy/components/index.js +1 -1
- package/dist/es-legacy/components/internal/Alert/Alert.js +1 -1
- package/dist/es-legacy/components/internal/Alert/Alert.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/Button/Button.js +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
- package/dist/es-legacy/components/internal/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/es-legacy/components/internal/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/ContentSeparator/ContentSeparator.js +1 -1
- package/dist/es-legacy/components/internal/ContentSeparator/ContentSeparator.js.map +1 -1
- package/dist/es-legacy/components/internal/DetailsTable/DetailsTable.js +2 -0
- package/dist/es-legacy/components/internal/DetailsTable/DetailsTable.js.map +1 -0
- package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js +1 -1
- package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.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/RadioGroup/RadioGroup.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
- package/dist/es-legacy/components/internal/IFrame/Iframe.js +1 -1
- package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
- package/dist/es-legacy/components/internal/Icon/Icon.js +1 -1
- package/dist/es-legacy/components/internal/Icon/Icon.js.map +1 -1
- package/dist/es-legacy/components/internal/Img/Img.js +1 -1
- package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js.map +1 -1
- package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
- package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
- package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
- package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +2 -0
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -0
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +2 -0
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -0
- package/dist/es-legacy/components/internal/PhoneInput/validate.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.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/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
- package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
- package/dist/es-legacy/components/tx-variants.js +1 -1
- package/dist/es-legacy/components/tx-variants.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/utils.js +1 -1
- package/dist/es-legacy/core/utils.js.map +1 -1
- package/dist/es-legacy/external/classnames/index.js +2 -2
- package/dist/es-legacy/external/classnames/index.js.map +1 -1
- package/dist/es-legacy/index.js +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/package.json +20 -14
- package/styles/adyen.css +11 -7
- package/dist/es/components/internal/PhoneInput/PhoneInput.js +0 -2
- package/dist/es/components/internal/PhoneInput/PhoneInput.js.map +0 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js +0 -2
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useState as
|
|
1
|
+
import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useState as o,useRef as t,useEffect as r}from"../../../../external/preact/hooks/dist/hooks.js";import a from"../../../../_virtual/index.js";import n from"./components/AchSecuredFields.js";import l from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import s from"../../../internal/FormFields/Field/Field.js";import c from"../../../internal/LoadingWrapper/LoadingWrapper.js";import i from"./defaultProps.js";import d from"./defaultStyles.js";import{useCoreContext as u}from"../../../../core/Context/CoreProvider.js";import m from"../../../internal/StoreDetails/StoreDetails.js";import h from"../../../internal/FormFields/InputText.js";import p from"../../../internal/FormInstruction/FormInstruction.js";import f from"../../../internal/FormFields/RadioGroup/RadioGroup.js";function y(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}function N(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(o){y(e,o,t[o])}))}return e}function g(e,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):function(e){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);o.push.apply(o,t)}return o}(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})),e}function b(e,o=!1){return!o||!!e&&"string"==typeof e&&e.trim().length>0}function F(i){const{i18n:y}=u(),F=i.hasHolderName&&(!!i.holderName||!!i.data.holderName),[_,v]=o({}),[O,k]=o(N({},i.holderNameRequired&&{holderName:F})),[P,S]=o(N({bankAccountType:"checking"},i.hasHolderName&&{holderName:i.holderName||i.data.holderName})),[w,C]=o(!1),[x,R]=o(""),[q,A]=o(!1),E=e=>{const o=e.target.value;S(g(N({},P),{holderName:o})),v(g(N({},_),{holderName:!!i.holderNameRequired&&!b(o)})),k(g(N({},O),{holderName:!i.holderNameRequired||b(o,i.holderNameRequired)}))},T=e=>{const o=e.target.value;S(g(N({},P),{bankAccountType:o}))},V=t(null),[D,H]=o("ready"),I=t({});var L;Object.keys(I.current).length||(null===(L=i.setComponentRef)||void 0===L||L.call(i,I.current));return I.current.showValidation=()=>{V.current.showValidation(),i.holderNameRequired&&!O.holderName&&v(g(N({},_),{holderName:!0}))},I.current.setStatus=H,r((()=>(this.setFocusOn=V.current.setFocusOn,this.updateStyles=V.current.updateStyles,()=>{V.current.destroy()})),[]),r((()=>{const e=b(P.holderName,i.holderNameRequired),o=w&&e;i.onChange({data:P,isValid:o,storePaymentMethod:q})}),[P,O,_,q]),e("div",{className:a({"adyen-checkout__ach":!0,"adyen-checkout__ach--loading":"loading"===D})},e(p,null),e(l,g(N({ref:V},j(i)),{styles:N({},d,i.styles),onChange:e=>{const o=e,t=o.autoCompleteName?o.autoCompleteName:P.holderName;S(g(N({},P,o.data),{holderName:t})),v(N({},_,o.errors)),k(g(N({},O,o.valid),{holderName:!i.holderNameRequired||b(t,i.holderNameRequired)})),C(o.isSfpValid)},onFocus:e=>{const o=!0===e.focus;R(e.currentFocusObject),o?i.onFocus(e):i.onBlur(e)},render:({setRootNode:o,setFocusOn:t},r)=>{var l;return e("div",{ref:o,className:"adyen-checkout__ach-input sf-input__wrapper"},e(c,{status:r.status},e("div",{className:a(["adyen-checkout__fieldset","adyen-checkout__fieldset--ach"])},e("div",{className:"adyen-checkout__fieldset__title"},y.get("ach.bankAccount")),e(s,{classNameModifiers:["bankAccountType","no-borders"],name:"bankAccountType",useLabelElement:!1},e(f,{name:"bankAccountType",value:P.bankAccountType,items:[{id:"checking",name:y.get("ach.checking")},{id:"savings",name:y.get("ach.savings")}],onChange:T,required:!0,style:"button"})),i.hasHolderName&&e(s,{label:y.get("ach.accountHolderNameField.title"),className:"adyen-checkout__pm__holderName",errorMessage:!!_.holderName&&y.get("ach.accountHolderNameField.invalid"),showContextualElement:i.showContextualElement,contextualText:y.get("ach.accountHolderNameField.contextualText"),isValid:!!O.holderName,name:"holderName"},e(h,{className:"adyen-checkout__pm__holderName__input adyen-checkout__input",placeholder:null==i||null===(l=i.placeholders)||void 0===l?void 0:l.holderName,value:P.holderName,required:i.holderNameRequired,onInput:E})),e(n,{focusedElement:x,onFocusField:t,errors:r.errors,valid:r.valid})),i.enableStoreDetails&&e(m,{onChange:A})))}})),i.showPayButton&&i.payButton({status:D,label:y.get("confirmPurchase")}))}F.defaultProps=i;const j=e=>({autoFocus:e.autoFocus,clientKey:e.clientKey,i18n:e.i18n,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,onAllValid:e.onAllValid,onConfigSuccess:e.onConfigSuccess,onError:e.onError,onFieldValid:e.onFieldValid,onFocus:e.onFocus,onLoad:e.onLoad,showWarnings:e.showWarnings,styles:e.styles,type:e.type,forceCompat:e.forceCompat,resources:e.resources,placeholders:e.placeholders,handleKeyPress:e.handleKeyPress});export{F as default};
|
|
2
2
|
//# sourceMappingURL=AchInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AchInput.js","sources":["../../../../../../src/components/Ach/components/AchInput/AchInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef } from 'preact/hooks';\nimport classNames from 'classnames';\nimport AchSecuredFields from './components/AchSecuredFields';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport Field from '../../../internal/FormFields/Field';\nimport LoadingWrapper from '../../../internal/LoadingWrapper/LoadingWrapper';\nimport defaultProps from './defaultProps';\nimport defaultStyles from './defaultStyles';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport './AchInput.scss';\nimport { ACHInputDataState, ACHInputProps, ACHInputStateError, ACHInputStateValid } from './types';\nimport StoreDetails from '../../../internal/StoreDetails';\nimport InputText from '../../../internal/FormFields/InputText';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport RadioGroup from '../../../internal/FormFields/RadioGroup';\n\nfunction validateHolderName(holderName, holderNameRequired = false) {\n if (holderNameRequired) {\n return !!holderName && typeof holderName === 'string' && holderName.trim().length > 0;\n }\n return true;\n}\n\nfunction AchInput(props: ACHInputProps) {\n const { i18n } = useCoreContext();\n\n const holderNameIsValid = props.hasHolderName && (!!props.holderName || !!props.data.holderName);\n\n const [errors, setErrors] = useState<ACHInputStateError>({});\n const [valid, setValid] = useState<ACHInputStateValid>({\n ...(props.holderNameRequired && { holderName: holderNameIsValid })\n });\n\n const [data, setData] = useState<ACHInputDataState>({\n bankAccountType: 'checking',\n ...(props.hasHolderName && { holderName: props.holderName || props.data.holderName })\n });\n\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [focusedElement, setFocusedElement] = useState('');\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n\n const handleFocus = e => {\n const isFocused = e.focus === true;\n\n setFocusedElement(e.currentFocusObject);\n\n if (isFocused) {\n props.onFocus(e);\n } else {\n props.onBlur(e);\n }\n };\n\n const handleHolderName = e => {\n const holderName = e.target.value;\n\n setData({ ...data, holderName });\n setErrors({ ...errors, holderName: props.holderNameRequired ? !validateHolderName(holderName) : false });\n setValid({ ...valid, holderName: props.holderNameRequired ? validateHolderName(holderName, props.holderNameRequired) : true });\n };\n\n const handleBankAccountType = e => {\n const bankAccountType = e.target.value;\n\n setData({ ...data, bankAccountType });\n };\n\n const handleSecuredFieldsChange = newState => {\n const sfState = newState;\n\n const tempHolderName = sfState.autoCompleteName ? sfState.autoCompleteName : data.holderName;\n\n setData({ ...data, ...sfState.data, holderName: tempHolderName });\n setErrors({ ...errors, ...sfState.errors });\n setValid({\n ...valid,\n ...sfState.valid,\n holderName: props.holderNameRequired ? validateHolderName(tempHolderName, props.holderNameRequired) : true\n });\n\n setIsSfpValid(sfState.isSfpValid);\n };\n\n // Refs\n const sfp = useRef(null);\n\n const [status, setStatus] = useState('ready');\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const achRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(achRef.current).length) {\n props.setComponentRef?.(achRef.current);\n }\n\n achRef.current.showValidation = () => {\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName\n if (props.holderNameRequired && !valid.holderName) {\n setErrors({ ...errors, holderName: true });\n }\n };\n\n achRef.current.setStatus = setStatus;\n\n useEffect(() => {\n this.setFocusOn = sfp.current.setFocusOn;\n this.updateStyles = sfp.current.updateStyles;\n\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n // Run when state.data, -errors or -valid change\n useEffect(() => {\n // Validate whole component i.e holderName + securedFields\n const holderNameValid = validateHolderName(data.holderName, props.holderNameRequired);\n const sfpValid = isSfpValid;\n\n const isValid = sfpValid && holderNameValid;\n\n props.onChange({ data, isValid, storePaymentMethod });\n }, [data, valid, errors, storePaymentMethod]);\n\n return (\n <div className=\"adyen-checkout__ach\">\n <FormInstruction />\n\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...defaultStyles, ...props.styles }}\n onChange={handleSecuredFieldsChange}\n onFocus={handleFocus}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div ref={setRootNode} className=\"adyen-checkout__ach-input sf-input__wrapper\">\n <LoadingWrapper status={sfpState.status}>\n <div className={classNames(['adyen-checkout__fieldset', 'adyen-checkout__fieldset--ach'])}>\n {<div className=\"adyen-checkout__fieldset__title\">{i18n.get('ach.bankAccount')}</div>}\n\n <Field classNameModifiers={['bankAccountType', 'no-borders']} name={'bankAccountType'} useLabelElement={false}>\n <RadioGroup\n name={'bankAccountType'}\n value={data.bankAccountType}\n items={[\n { id: 'checking', name: i18n.get('ach.checking') },\n { id: 'savings', name: i18n.get('ach.savings') }\n ]}\n onChange={handleBankAccountType}\n required={true}\n style={'button'}\n />\n </Field>\n\n {props.hasHolderName && (\n <Field\n label={i18n.get('ach.accountHolderNameField.title')}\n className={'adyen-checkout__pm__holderName'}\n errorMessage={!!errors.holderName && i18n.get('ach.accountHolderNameField.invalid')}\n showContextualElement={props.showContextualElement}\n contextualText={i18n.get('ach.accountHolderNameField.contextualText')}\n isValid={!!valid.holderName}\n name={'holderName'}\n >\n <InputText\n className=\"adyen-checkout__pm__holderName__input adyen-checkout__input\"\n placeholder={props?.placeholders?.holderName}\n value={data.holderName}\n required={props.holderNameRequired}\n onInput={handleHolderName}\n />\n </Field>\n )}\n\n <AchSecuredFields\n focusedElement={focusedElement}\n onFocusField={setFocusOn}\n errors={sfpState.errors}\n valid={sfpState.valid}\n />\n </div>\n\n {props.enableStoreDetails && <StoreDetails onChange={setStorePaymentMethod} />}\n </LoadingWrapper>\n </div>\n )}\n />\n {props.showPayButton && props.payButton({ status, label: i18n.get('confirmPurchase') })}\n </div>\n );\n}\n\nAchInput.defaultProps = defaultProps;\n\nexport default AchInput;\n\nconst extractPropsForSFP = (props: ACHInputProps) => {\n return {\n autoFocus: props.autoFocus,\n clientKey: props.clientKey,\n i18n: props.i18n,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n onAllValid: props.onAllValid,\n onConfigSuccess: props.onConfigSuccess,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onFocus: props.onFocus,\n onLoad: props.onLoad,\n showWarnings: props.showWarnings,\n styles: props.styles,\n type: props.type,\n forceCompat: props.forceCompat,\n resources: props.resources,\n placeholders: props.placeholders,\n handleKeyPress: props.handleKeyPress\n };\n};\n"],"names":["validateHolderName","holderName","holderNameRequired","trim","length","AchInput","props","i18n","useCoreContext","holderNameIsValid","hasHolderName","data","errors","setErrors","useState","valid","setValid","_object_spread","setData","bankAccountType","isSfpValid","setIsSfpValid","focusedElement","setFocusedElement","storePaymentMethod","setStorePaymentMethod","handleHolderName","e","target","value","_object_spread_props","handleBankAccountType","sfp","useRef","status","setStatus","achRef","Object","keys","current","setComponentRef","showValidation","useEffect","this","setFocusOn","updateStyles","destroy","holderNameValid","isValid","onChange","h","div","className","FormInstruction","SecuredFieldsProvider","ref","extractPropsForSFP","styles","defaultStyles","newState","sfState","tempHolderName","autoCompleteName","onFocus","isFocused","focus","currentFocusObject","onBlur","render","setRootNode","sfpState","LoadingWrapper","classNames","get","Field","classNameModifiers","name","useLabelElement","RadioGroup","items","id","required","style","label","errorMessage","showContextualElement","contextualText","InputText","placeholder","placeholders","onInput","AchSecuredFields","onFocusField","enableStoreDetails","StoreDetails","showPayButton","payButton","defaultProps","autoFocus","clientKey","keypadFix","legacyInputMode","loadingContext","onAllValid","onConfigSuccess","onError","onFieldValid","onLoad","showWarnings","type","forceCompat","resources","handleKeyPress"],"mappings":"8pDAkBA,SAASA,EAAmBC,EAAYC,GAAqB,GACzD,OAAIA,KACSD,GAAoC,iBAAfA,GAA2BA,EAAWE,OAAOC,OAAS,CAG5F,CAEA,SAASC,EAASC,GACd,MAAMC,KAAEA,GAASC,IAEXC,EAAoBH,EAAMI,kBAAoBJ,EAAML,cAAgBK,EAAMK,KAAKV,aAE9EW,EAAQC,GAAaC,EAA6B,CAAA,IAClDC,EAAOC,GAAYF,EAA6BG,EAC/CX,CAAAA,EAAAA,EAAMJ,oBAAsB,CAAED,WAAYQ,MAG3CE,EAAMO,GAAWJ,EAA4BG,EAAA,CAChDE,gBAAiB,YACbb,EAAMI,eAAiB,CAAET,WAAYK,EAAML,YAAcK,EAAMK,KAAKV,eAGrEmB,EAAYC,GAAiBP,GAAS,IACtCQ,EAAgBC,GAAqBT,EAAS,KAC9CU,EAAoBC,GAAyBX,GAAS,GAcvDY,EAAmBC,IACrB,MAAM1B,EAAa0B,EAAEC,OAAOC,MAE5BX,EAAQY,EAAKnB,EAAAA,CAAAA,EAAAA,GAAAA,CAAMV,gBACnBY,EAAUiB,EAAKlB,EAAAA,CAAAA,EAAAA,GAAAA,CAAQX,aAAYK,EAAMJ,qBAAsBF,EAAmBC,MAClFe,EAASc,EAAKf,EAAAA,CAAAA,EAAAA,GAAAA,CAAOd,YAAYK,EAAMJ,oBAAqBF,EAAmBC,EAAYK,EAAMJ,wBAG/F6B,EAAwBJ,IAC1B,MAAMR,EAAkBQ,EAAEC,OAAOC,MAEjCX,EAAQY,EAAKnB,EAAAA,CAAAA,EAAAA,GAAAA,CA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eAAgBA,EAChBsE,aAAchD,EACdhC,OAAQ0D,EAAS1D,OACjBG,MAAOuD,EAASvD,SAIvBT,EAAMuF,oBAAsB3C,EAAC4C,EAAAA,CAAa7C,SAAUxB,UAKpEnB,EAAMyF,eAAiBzF,EAAM0F,UAAU,CAAE9D,SAAQiD,MAAO5E,EAAKkE,IAAI,qBAG9E,CAEApE,EAAS4F,aAAeA,EAIxB,MAAMzC,EAAsBlD,IACjB,CACH4F,UAAW5F,EAAM4F,UACjBC,UAAW7F,EAAM6F,UACjB5F,KAAMD,EAAMC,KACZ6F,UAAW9F,EAAM8F,UACjBC,gBAAiB/F,EAAM+F,gBACvBC,eAAgBhG,EAAMgG,eACtBC,WAAYjG,EAAMiG,WAClBC,gBAAiBlG,EAAMkG,gBACvBC,QAASnG,EAAMmG,QACfC,aAAcpG,EAAMoG,aACpB3C,QAASzD,EAAMyD,QACf4C,OAAQrG,EAAMqG,OACdC,aAActG,EAAMsG,aACpBnD,OAAQnD,EAAMmD,OACdoD,KAAMvG,EAAMuG,KACZC,YAAaxG,EAAMwG,YACnBC,UAAWzG,EAAMyG,UACjBtB,aAAcnF,EAAMmF,aACpBuB,eAAgB1G,EAAM0G"}
|
|
1
|
+
{"version":3,"file":"AchInput.js","sources":["../../../../../../src/components/Ach/components/AchInput/AchInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef } from 'preact/hooks';\nimport classNames from 'classnames';\nimport AchSecuredFields from './components/AchSecuredFields';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport Field from '../../../internal/FormFields/Field';\nimport LoadingWrapper from '../../../internal/LoadingWrapper/LoadingWrapper';\nimport defaultProps from './defaultProps';\nimport defaultStyles from './defaultStyles';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport './AchInput.scss';\nimport { ACHInputDataState, ACHInputProps, ACHInputStateError, ACHInputStateValid } from './types';\nimport StoreDetails from '../../../internal/StoreDetails';\nimport InputText from '../../../internal/FormFields/InputText';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport RadioGroup from '../../../internal/FormFields/RadioGroup';\n\nfunction validateHolderName(holderName, holderNameRequired = false) {\n if (holderNameRequired) {\n return !!holderName && typeof holderName === 'string' && holderName.trim().length > 0;\n }\n return true;\n}\n\nfunction AchInput(props: ACHInputProps) {\n const { i18n } = useCoreContext();\n\n const holderNameIsValid = props.hasHolderName && (!!props.holderName || !!props.data.holderName);\n\n const [errors, setErrors] = useState<ACHInputStateError>({});\n const [valid, setValid] = useState<ACHInputStateValid>({\n ...(props.holderNameRequired && { holderName: holderNameIsValid })\n });\n\n const [data, setData] = useState<ACHInputDataState>({\n bankAccountType: 'checking',\n ...(props.hasHolderName && { holderName: props.holderName || props.data.holderName })\n });\n\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [focusedElement, setFocusedElement] = useState('');\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n\n const handleFocus = e => {\n const isFocused = e.focus === true;\n\n setFocusedElement(e.currentFocusObject);\n\n if (isFocused) {\n props.onFocus(e);\n } else {\n props.onBlur(e);\n }\n };\n\n const handleHolderName = e => {\n const holderName = e.target.value;\n\n setData({ ...data, holderName });\n setErrors({ ...errors, holderName: props.holderNameRequired ? !validateHolderName(holderName) : false });\n setValid({ ...valid, holderName: props.holderNameRequired ? validateHolderName(holderName, props.holderNameRequired) : true });\n };\n\n const handleBankAccountType = e => {\n const bankAccountType = e.target.value;\n\n setData({ ...data, bankAccountType });\n };\n\n const handleSecuredFieldsChange = newState => {\n const sfState = newState;\n\n const tempHolderName = sfState.autoCompleteName ? sfState.autoCompleteName : data.holderName;\n\n setData({ ...data, ...sfState.data, holderName: tempHolderName });\n setErrors({ ...errors, ...sfState.errors });\n setValid({\n ...valid,\n ...sfState.valid,\n holderName: props.holderNameRequired ? validateHolderName(tempHolderName, props.holderNameRequired) : true\n });\n\n setIsSfpValid(sfState.isSfpValid);\n };\n\n // Refs\n const sfp = useRef(null);\n\n const [status, setStatus] = useState('ready');\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const achRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(achRef.current).length) {\n props.setComponentRef?.(achRef.current);\n }\n\n achRef.current.showValidation = () => {\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName\n if (props.holderNameRequired && !valid.holderName) {\n setErrors({ ...errors, holderName: true });\n }\n };\n\n achRef.current.setStatus = setStatus;\n\n useEffect(() => {\n this.setFocusOn = sfp.current.setFocusOn;\n this.updateStyles = sfp.current.updateStyles;\n\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n // Run when state.data, -errors or -valid change\n useEffect(() => {\n // Validate whole component i.e holderName + securedFields\n const holderNameValid = validateHolderName(data.holderName, props.holderNameRequired);\n const sfpValid = isSfpValid;\n\n const isValid = sfpValid && holderNameValid;\n\n props.onChange({ data, isValid, storePaymentMethod });\n }, [data, valid, errors, storePaymentMethod]);\n\n return (\n <div\n className={classNames({\n 'adyen-checkout__ach': true,\n 'adyen-checkout__ach--loading': status === 'loading'\n })}\n >\n <FormInstruction />\n\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...defaultStyles, ...props.styles }}\n onChange={handleSecuredFieldsChange}\n onFocus={handleFocus}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div ref={setRootNode} className=\"adyen-checkout__ach-input sf-input__wrapper\">\n <LoadingWrapper status={sfpState.status}>\n <div className={classNames(['adyen-checkout__fieldset', 'adyen-checkout__fieldset--ach'])}>\n {<div className=\"adyen-checkout__fieldset__title\">{i18n.get('ach.bankAccount')}</div>}\n\n <Field classNameModifiers={['bankAccountType', 'no-borders']} name={'bankAccountType'} useLabelElement={false}>\n <RadioGroup\n name={'bankAccountType'}\n value={data.bankAccountType}\n items={[\n { id: 'checking', name: i18n.get('ach.checking') },\n { id: 'savings', name: i18n.get('ach.savings') }\n ]}\n onChange={handleBankAccountType}\n required={true}\n style={'button'}\n />\n </Field>\n\n {props.hasHolderName && (\n <Field\n label={i18n.get('ach.accountHolderNameField.title')}\n className={'adyen-checkout__pm__holderName'}\n errorMessage={!!errors.holderName && i18n.get('ach.accountHolderNameField.invalid')}\n showContextualElement={props.showContextualElement}\n contextualText={i18n.get('ach.accountHolderNameField.contextualText')}\n isValid={!!valid.holderName}\n name={'holderName'}\n >\n <InputText\n className=\"adyen-checkout__pm__holderName__input adyen-checkout__input\"\n placeholder={props?.placeholders?.holderName}\n value={data.holderName}\n required={props.holderNameRequired}\n onInput={handleHolderName}\n />\n </Field>\n )}\n\n <AchSecuredFields\n focusedElement={focusedElement}\n onFocusField={setFocusOn}\n errors={sfpState.errors}\n valid={sfpState.valid}\n />\n </div>\n\n {props.enableStoreDetails && <StoreDetails onChange={setStorePaymentMethod} />}\n </LoadingWrapper>\n </div>\n )}\n />\n {props.showPayButton && props.payButton({ status, label: i18n.get('confirmPurchase') })}\n </div>\n );\n}\n\nAchInput.defaultProps = defaultProps;\n\nexport default AchInput;\n\nconst extractPropsForSFP = (props: ACHInputProps) => {\n return {\n autoFocus: props.autoFocus,\n clientKey: props.clientKey,\n i18n: props.i18n,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n onAllValid: props.onAllValid,\n onConfigSuccess: props.onConfigSuccess,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onFocus: props.onFocus,\n onLoad: props.onLoad,\n showWarnings: props.showWarnings,\n styles: props.styles,\n type: props.type,\n forceCompat: props.forceCompat,\n resources: props.resources,\n placeholders: props.placeholders,\n handleKeyPress: props.handleKeyPress\n };\n};\n"],"names":["validateHolderName","holderName","holderNameRequired","trim","length","AchInput","props","i18n","useCoreContext","holderNameIsValid","hasHolderName","data","errors","setErrors","useState","valid","setValid","_object_spread","setData","bankAccountType","isSfpValid","setIsSfpValid","focusedElement","setFocusedElement","storePaymentMethod","setStorePaymentMethod","handleHolderName","e","target","value","_object_spread_props","handleBankAccountType","sfp","useRef","status","setStatus","achRef","Object","keys","current","setComponentRef","showValidation","useEffect","this","setFocusOn","updateStyles","destroy","holderNameValid","isValid","onChange","h","div","className","classNames","FormInstruction","SecuredFieldsProvider","ref","extractPropsForSFP","styles","defaultStyles","newState","sfState","tempHolderName","autoCompleteName","onFocus","isFocused","focus","currentFocusObject","onBlur","render","setRootNode","sfpState","LoadingWrapper","get","Field","classNameModifiers","name","useLabelElement","RadioGroup","items","id","required","style","label","errorMessage","showContextualElement","contextualText","InputText","placeholder","placeholders","onInput","AchSecuredFields","onFocusField","enableStoreDetails","StoreDetails","showPayButton","payButton","defaultProps","autoFocus","clientKey","keypadFix","legacyInputMode","loadingContext","onAllValid","onConfigSuccess","onError","onFieldValid","onLoad","showWarnings","type","forceCompat","resources","handleKeyPress"],"mappings":"mpDAkBA,SAASA,EAAmBC,EAAYC,GAAqB,GACzD,OAAIA,KACSD,GAAoC,iBAAfA,GAA2BA,EAAWE,OAAOC,OAAS,CAG5F,CAEA,SAASC,EAASC,GACd,MAAMC,KAAEA,GAASC,IAEXC,EAAoBH,EAAMI,kBAAoBJ,EAAML,cAAgBK,EAAMK,KAAKV,aAE9EW,EAAQC,GAAaC,EAA6B,CAAA,IAClDC,EAAOC,GAAYF,EAA6BG,EAC/CX,CAAAA,EAAAA,EAAMJ,oBAAsB,CAAED,WAAYQ,MAG3CE,EAAMO,GAAWJ,EAA4BG,EAAA,CAChDE,gBAAiB,YACbb,EAAMI,eAAiB,CAAET,WAAYK,EAAML,YAAcK,EAAMK,KAAKV,eAGrEmB,EAAYC,GAAiBP,GAAS,IACtCQ,EAAgBC,GAAqBT,EAAS,KAC9CU,EAAoBC,GAAyBX,GAAS,GAcvDY,EAAmBC,IACrB,MAAM1B,EAAa0B,EAAEC,OAAOC,MAE5BX,EAAQY,EAAKnB,EAAAA,CAAAA,EAAAA,GAAAA,CAAMV,gBACnBY,EAAUiB,EAAKlB,EAAAA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KkE,IAAI,sCAC9CY,sBAAuB/E,EAAM+E,sBAC7BC,eAAgB/E,EAAKkE,IAAI,6CACzBzB,UAAWjC,EAAMd,WACjB2E,KAAM,cAEN1B,EAACqC,EAAAA,CACGnC,UAAU,8DACVoC,YAAalF,SAAmB,QAAnBA,EAAAA,EAAOmF,oBAAPnF,IAAAA,OAAAA,EAAAA,EAAqBL,WAClC4B,MAAOlB,EAAKV,WACZgF,SAAU3E,EAAMJ,mBAChBwF,QAAShE,KAKrBwB,EAACyC,EAAAA,CACGrE,eAAgBA,EAChBsE,aAAchD,EACdhC,OAAQ2D,EAAS3D,OACjBG,MAAOwD,EAASxD,SAIvBT,EAAMuF,oBAAsB3C,EAAC4C,EAAAA,CAAa7C,SAAUxB,UAKpEnB,EAAMyF,eAAiBzF,EAAM0F,UAAU,CAAE9D,SAAQiD,MAAO5E,EAAKkE,IAAI,qBAG9E,CAEApE,EAAS4F,aAAeA,EAIxB,MAAMxC,EAAsBnD,IACjB,CACH4F,UAAW5F,EAAM4F,UACjBC,UAAW7F,EAAM6F,UACjB5F,KAAMD,EAAMC,KACZ6F,UAAW9F,EAAM8F,UACjBC,gBAAiB/F,EAAM+F,gBACvBC,eAAgBhG,EAAMgG,eACtBC,WAAYjG,EAAMiG,WAClBC,gBAAiBlG,EAAMkG,gBACvBC,QAASnG,EAAMmG,QACfC,aAAcpG,EAAMoG,aACpB1C,QAAS1D,EAAM0D,QACf2C,OAAQrG,EAAMqG,OACdC,aAActG,EAAMsG,aACpBlD,OAAQpD,EAAMoD,OACdmD,KAAMvG,EAAMuG,KACZC,YAAaxG,EAAMwG,YACnBC,UAAWzG,EAAMyG,UACjBtB,aAAcnF,EAAMmF,aACpBuB,eAAgB1G,EAAM0G"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../
|
|
1
|
+
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import a from"../../../../internal/FormFields/Field/Field.js";import r from"../../../../Card/components/CardInput/components/DataSfSpan.js";import{alternativeLabelContent as o}from"../../../../Card/components/CardInput/components/FieldLabelAlternative.js";import{capitalizeFirstLetter as n}from"../../../../../utils/textUtils.js";const i=({id:i,dataInfo:s,className:l="",label:d,focused:c,filled:m,errorMessage:p="",isValid:u=!1,onFocusField:f,dir:_})=>{const F=`encrypted${n(i)}`;return e(a,{label:d,focused:c,filled:m,classNameModifiers:[i],onFocusField:()=>f(F),errorMessage:p,isValid:u,className:l,dir:_,name:i,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:o},e(r,{encryptedFieldType:F,"data-info":s,className:t({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__input--error":p.length,"adyen-checkout__input--focus":c,"adyen-checkout__input--valid":u})}))};export{i as default};
|
|
2
2
|
//# sourceMappingURL=AchSFInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AchSFInput.js","sources":["../../../../../../../src/components/Ach/components/AchInput/components/AchSFInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport Field from '../../../../internal/FormFields/Field';\nimport DataSfSpan from '../../../../Card/components/CardInput/components/DataSfSpan';\nimport { alternativeLabelContent } from '../../../../Card/components/CardInput/components/FieldLabelAlternative';\nimport { capitalizeFirstLetter } from '../../../../../utils/textUtils';\n\nconst AchSFInput = ({ id, dataInfo, className = '', label, focused, filled, errorMessage = '', isValid = false, onFocusField, dir }) => {\n const capitalisedId = capitalizeFirstLetter(id);\n const encryptedIdStr = `encrypted${capitalisedId}`;\n\n return (\n <Field\n label={label}\n focused={focused}\n filled={filled}\n classNameModifiers={[id]}\n onFocusField={() => onFocusField(encryptedIdStr)}\n errorMessage={errorMessage}\n isValid={isValid}\n className={className}\n dir={dir}\n name={id}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType={encryptedIdStr}\n data-info={dataInfo}\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__input--error': errorMessage.length,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n })}\n />\n </Field>\n );\n};\n\nexport default AchSFInput;\n"],"names":["AchSFInput","id","dataInfo","className","label","focused","filled","errorMessage","isValid","onFocusField","dir","encryptedIdStr","capitalizeFirstLetter","h","Field","classNameModifiers","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","data-info","classNames","length"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AchSFInput.js","sources":["../../../../../../../src/components/Ach/components/AchInput/components/AchSFInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport Field from '../../../../internal/FormFields/Field';\nimport DataSfSpan from '../../../../Card/components/CardInput/components/DataSfSpan';\nimport { alternativeLabelContent } from '../../../../Card/components/CardInput/components/FieldLabelAlternative';\nimport { capitalizeFirstLetter } from '../../../../../utils/textUtils';\n\nconst AchSFInput = ({ id, dataInfo, className = '', label, focused, filled, errorMessage = '', isValid = false, onFocusField, dir }) => {\n const capitalisedId = capitalizeFirstLetter(id);\n const encryptedIdStr = `encrypted${capitalisedId}`;\n\n return (\n <Field\n label={label}\n focused={focused}\n filled={filled}\n classNameModifiers={[id]}\n onFocusField={() => onFocusField(encryptedIdStr)}\n errorMessage={errorMessage}\n isValid={isValid}\n className={className}\n dir={dir}\n name={id}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType={encryptedIdStr}\n data-info={dataInfo}\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__input--error': errorMessage.length,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n })}\n />\n </Field>\n );\n};\n\nexport default AchSFInput;\n"],"names":["AchSFInput","id","dataInfo","className","label","focused","filled","errorMessage","isValid","onFocusField","dir","encryptedIdStr","capitalizeFirstLetter","h","Field","classNameModifiers","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","data-info","classNames","length"],"mappings":"wcAOMA,MAAAA,EAAa,EAAGC,KAAIC,WAAUC,YAAY,GAAIC,QAAOC,UAASC,SAAQC,eAAe,GAAIC,WAAU,EAAOC,eAAcC,UAC1H,MACMC,EAAiB,YADDC,EAAsBX,KAG5C,OACIY,EAACC,EAAAA,CACGV,MAAOA,EACPC,QAASA,EACTC,OAAQA,EACRS,mBAAoB,CAACd,GACrBQ,aAAc,IAAMA,EAAaE,GACjCJ,aAAcA,EACdC,QAASA,EACTL,UAAWA,EACXO,IAAKA,EACLM,KAAMf,EACNgB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,GAE1BP,EAACQ,EAAAA,CACGC,mBAAoBX,EACpBY,YAAWrB,EACXC,UAAWqB,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,+BAAgCjB,EAAakB,OAC7C,+BAAgCpB,EAChC,+BAAgCG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as
|
|
1
|
+
import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";import a from"../../../_virtual/index.js";class p extends t{render({buttonColor:t,buttonType:p}){return e("button",{type:"button","aria-label":this.props.i18n.get("payButton"),lang:this.props.i18n.languageCode,className:a("adyen-checkout__applepay__button",`adyen-checkout__applepay__button--${t}`,`adyen-checkout__applepay__button--${p}`,"apple-pay","apple-pay-button",`apple-pay-button-${t}`,`apple-pay-button--type-${p}`),onClick:this.props.onClick})}}var o,n,l;l={onClick:()=>{},buttonColor:"black",buttonType:"plain"},(n="defaultProps")in(o=p)?Object.defineProperty(o,n,{value:l,enumerable:!0,configurable:!0,writable:!0}):o[n]=l;export{p as default};
|
|
2
2
|
//# sourceMappingURL=ApplePayButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplePayButton.js","sources":["../../../../../src/components/ApplePay/components/ApplePayButton.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport cx from 'classnames';\nimport './ApplePayButton.scss';\nimport Language from '../../../language/Language';\nimport { ApplePayButtonType } from '../types';\n\ninterface ApplePayButtonProps {\n i18n: Language;\n buttonColor: 'black' | 'white' | 'white-with-line';\n buttonType: ApplePayButtonType;\n onClick: (event) => void;\n}\n\nclass ApplePayButton extends Component<ApplePayButtonProps> {\n public static defaultProps = {\n onClick: () => {},\n buttonColor: 'black',\n buttonType: 'plain'\n };\n\n render({ buttonColor, buttonType }) {\n return (\n <button\n type=\"button\"\n aria-label={this.props.i18n.get('payButton')}\n lang={this.props.i18n.languageCode}\n className={cx(\n 'adyen-checkout__applepay__button',\n `adyen-checkout__applepay__button--${buttonColor}`,\n `adyen-checkout__applepay__button--${buttonType}`,\n 'apple-pay',\n 'apple-pay-button',\n `apple-pay-button-${buttonColor}`,\n `apple-pay-button--type-${buttonType}`\n )}\n onClick={this.props.onClick}\n />\n );\n }\n}\n\nexport default ApplePayButton;\n"],"names":["ApplePayButton","Component","render","buttonColor","buttonType","h","button","type","aria-label","this","props","i18n","get","lang","languageCode","className","cx","onClick","defaultProps"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApplePayButton.js","sources":["../../../../../src/components/ApplePay/components/ApplePayButton.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport cx from 'classnames';\nimport './ApplePayButton.scss';\nimport Language from '../../../language/Language';\nimport { ApplePayButtonType } from '../types';\n\ninterface ApplePayButtonProps {\n i18n: Language;\n buttonColor: 'black' | 'white' | 'white-with-line';\n buttonType: ApplePayButtonType;\n onClick: (event) => void;\n}\n\nclass ApplePayButton extends Component<ApplePayButtonProps> {\n public static defaultProps = {\n onClick: () => {},\n buttonColor: 'black',\n buttonType: 'plain'\n };\n\n render({ buttonColor, buttonType }) {\n return (\n <button\n type=\"button\"\n aria-label={this.props.i18n.get('payButton')}\n lang={this.props.i18n.languageCode}\n className={cx(\n 'adyen-checkout__applepay__button',\n `adyen-checkout__applepay__button--${buttonColor}`,\n `adyen-checkout__applepay__button--${buttonType}`,\n 'apple-pay',\n 'apple-pay-button',\n `apple-pay-button-${buttonColor}`,\n `apple-pay-button--type-${buttonType}`\n )}\n onClick={this.props.onClick}\n />\n );\n }\n}\n\nexport default ApplePayButton;\n"],"names":["ApplePayButton","Component","render","buttonColor","buttonType","h","button","type","aria-label","this","props","i18n","get","lang","languageCode","className","cx","onClick","defaultProps"],"mappings":"iIAaA,MAAMA,UAAuBC,EAOzBC,MAAAA,EAAOC,YAAEA,EAAWC,WAAEA,IAClB,OACIC,EAACC,SAAAA,CACGC,KAAK,SACLC,aAAYC,KAAKC,MAAMC,KAAKC,IAAI,aAChCC,KAAMJ,KAAKC,MAAMC,KAAKG,aACtBC,UAAWC,EACP,mCACA,qCAAqCb,IACrC,qCAAqCC,IACrC,YACA,mBACA,oBAAoBD,IACpB,0BAA0BC,KAE9Ba,QAASR,KAAKC,MAAMO,SAGhC,cAxB6B,CACzBA,QAAS,OACTd,YAAa,QACbC,WAAY,YAHFc,oBADZlB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as a,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as a,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../_virtual/index.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import r from"../../internal/FormFields/Field/Field.js";import c from"../../internal/FormFields/ConsentCheckbox/ConsentCheckbox.js";import{bacsFormatters as i,bacsValidationRules as s}from"./validate.js";import l from"../../../utils/useForm/useForm.js";import d from"../../../core/Context/useImage.js";import u from"../../internal/FormFields/InputText.js";import m from"../../internal/FormFields/InputEmail.js";import b from"../../internal/FormInstruction/FormInstruction.js";import{getErrorMessage as h}from"../../../utils/getErrorMessage.js";import{PREFIX as p}from"../../internal/Icon/constants.js";const k="enter-data",g="confirm-data";function f(f){var N,_;const{i18n:C}=t(),v=d(),{handleChangeFor:y,triggerValidation:I,data:x,valid:E,errors:F,isValid:j}=l({schema:["holderName","bankAccountNumber","bankLocationId","shopperEmail","amountConsentCheckbox","accountConsentCheckbox"],defaultData:f.data,formatters:i,rules:s}),[L,M]=a(k);this.setStatus=M,this.showValidation=I;return o((()=>{f.onChange({data:x,valid:E,errors:F,isValid:j})}),[x,E,F,j]),e("div",{className:n({"adyen-checkout__bacs":!0,"adyen-checkout__bacs--confirm":L===g||"loading"===L})},e(b,null),L==g&&e("div",{className:n({"adyen-checkout__bacs--edit":!0,"adyen-checkout__bacs--edit-dropin":f.isDropin})},e(u,{name:"bacsEdit",className:"adyen-checkout__bacs--edit-button",value:C.get("edit"),"aria-label":C.get("edit"),readonly:!0,onClick:()=>this.setStatus(k)})),e(r,{className:n({"adyen-checkout__bacs--holder-name":!0,"adyen-checkout__field--inactive":L===g||"loading"===L}),label:C.get("bacs.accountHolderName"),errorMessage:!!F.holderName&&C.get("bacs.accountHolderName.invalid"),isValid:E.holderName,name:"accountHolderName",i18n:C},e(u,{name:"bacs.accountHolderName",className:"adyen-checkout__bacs-input--holder-name",placeholder:f.placeholders.holderName,value:x.holderName,"aria-invalid":!E.holderName,"aria-label":C.get("bacs.accountHolderName"),"aria-required":"true",required:!0,readonly:L===g||"loading"===L,autocorrect:"off",onBlur:y("holderName","blur"),onInput:y("holderName","input")})),e("div",{className:"adyen-checkout__bacs__num-id adyen-checkout__field-wrapper"},e(r,{errorMessage:!!F.bankAccountNumber&&C.get("bacs.accountNumber.invalid"),label:C.get("bacs.accountNumber"),className:n({"adyen-checkout__bacs--bank-account-number":!0,"adyen-checkout__field--inactive":L===g||"loading"===L}),classNameModifiers:["col-70"],isValid:E.bankAccountNumber,name:"bankAccountNumber",i18n:C},e(u,{value:x.bankAccountNumber,className:"adyen-checkout__bacs-input--bank-account-number",placeholder:f.placeholders.bankAccountNumber,"aria-invalid":!E.bankAccountNumber,"aria-label":C.get("bacs.accountNumber"),"aria-required":"true",required:!0,readonly:L===g||"loading"===L,autocorrect:"off",onBlur:y("bankAccountNumber","blur"),onInput:y("bankAccountNumber","input")})),e(r,{errorMessage:!!F.bankLocationId&&C.get("bacs.bankLocationId.invalid"),label:C.get("bacs.bankLocationId"),className:n({"adyen-checkout__bacs--bank-location-id":!0,"adyen-checkout__field--inactive":L===g||"loading"===L}),classNameModifiers:["col-30"],isValid:E.bankLocationId,name:"bankLocationId",i18n:C},e(u,{value:x.bankLocationId,className:"adyen-checkout__bacs-input--bank-location-id",placeholder:f.placeholders.bankLocationId,"aria-invalid":!E.bankLocationId,"aria-label":C.get("bacs.bankLocationId"),"aria-required":"true",required:!0,readonly:L===g||"loading"===L,autocorrect:"off",onBlur:y("bankLocationId","blur"),onInput:y("bankLocationId","input")}))),e(r,{errorMessage:h(C,F.shopperEmail,C.get("shopperEmail")),label:C.get("shopperEmail"),className:n({"adyen-checkout__bacs--shopper-email":!0,"adyen-checkout__field--inactive":L===g||"loading"===L}),isValid:E.shopperEmail,name:"emailAddress",i18n:C},e(m,{value:x.shopperEmail,name:"shopperEmail",className:"adyen-checkout__bacs-input--shopper-email",classNameModifiers:["large"],placeholder:f.placeholders.shopperEmail,spellcheck:!1,"aria-invalid":!E.shopperEmail,"aria-label":C.get("shopperEmail"),"aria-required":"true",required:!0,readonly:L===g||"loading"===L,autocorrect:"off",onInput:y("shopperEmail","input"),onBlur:y("shopperEmail","blur")})),L===k&&e(c,{classNameModifiers:["amountConsentCheckbox"],errorMessage:!!F.amountConsentCheckbox,label:C.get("bacs.consent.amount"),onChange:y("amountConsentCheckbox"),checked:!!x.amountConsentCheckbox,i18n:C}),L===k&&e(c,{classNameModifiers:["accountConsentCheckbox"],errorMessage:!!F.accountConsentCheckbox,label:C.get("bacs.consent.account"),onChange:y("accountConsentCheckbox"),checked:!!x.accountConsentCheckbox,i18n:C}),f.showPayButton&&f.payButton({status:L,label:L===k?C.get("continue"):`${C.get("bacs.confirm")} ${(null===(N=f.amount)||void 0===N?void 0:N.value)&&(null===(_=f.amount)||void 0===_?void 0:_.currency)?C.amount(f.amount.value,f.amount.currency):""}`,icon:v({imageFolder:"components/"})(`${p}lock`),onClick:()=>j?L===k?this.setStatus(g):L===g?f.onSubmit():void 0:this.showValidation()}))}f.defaultProps={data:{},placeholders:{}};export{f as default};
|
|
2
2
|
//# sourceMappingURL=BacsInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BacsInput.js","sources":["../../../../../src/components/BacsDD/components/BacsInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport classNames from 'classnames';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Field from '../../internal/FormFields/Field';\nimport ConsentCheckbox from '../../internal/FormFields/ConsentCheckbox';\nimport { bacsValidationRules, bacsFormatters } from './validate';\nimport { BacsDataState, BacsInputProps } from './types';\nimport './BacsInput.scss';\n\nimport useForm from '../../../utils/useForm';\nimport useImage from '../../../core/Context/useImage';\nimport InputText from '../../internal/FormFields/InputText';\nimport InputEmail from '../../internal/FormFields/InputEmail';\nimport FormInstruction from '../../internal/FormInstruction';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport { PREFIX } from '../../internal/Icon/constants';\n\nconst ENTER_STATE = 'enter-data';\nconst CONFIRM_STATE = 'confirm-data';\n\nfunction BacsInput(props: BacsInputProps) {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<BacsDataState>({\n schema: ['holderName', 'bankAccountNumber', 'bankLocationId', 'shopperEmail', 'amountConsentCheckbox', 'accountConsentCheckbox'],\n defaultData: props.data,\n formatters: bacsFormatters,\n rules: bacsValidationRules\n });\n\n const [status, setStatus] = useState(ENTER_STATE);\n this.setStatus = setStatus;\n this.showValidation = triggerValidation;\n\n const handlePayButton = () => {\n if (!isValid) return this.showValidation();\n\n if (status === ENTER_STATE) {\n return this.setStatus(CONFIRM_STATE);\n } else if (status === CONFIRM_STATE) {\n return props.onSubmit();\n }\n };\n\n const handleEdit = () => {\n return this.setStatus(ENTER_STATE);\n };\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n return (\n <div\n className={classNames({\n 'adyen-checkout__bacs': true,\n 'adyen-checkout__bacs--confirm': status === CONFIRM_STATE || status === 'loading'\n })}\n >\n <FormInstruction />\n\n {status == CONFIRM_STATE && (\n <div\n className={classNames({\n 'adyen-checkout__bacs--edit': true,\n 'adyen-checkout__bacs--edit-dropin': props.isDropin\n })}\n >\n <InputText\n name={'bacsEdit'}\n className={'adyen-checkout__bacs--edit-button'}\n value={i18n.get('edit')}\n aria-label={i18n.get('edit')}\n readonly={true}\n onClick={handleEdit}\n />\n </div>\n )}\n\n <Field\n className={classNames({\n 'adyen-checkout__bacs--holder-name': true,\n 'adyen-checkout__field--inactive': status === CONFIRM_STATE || status === 'loading'\n })}\n label={i18n.get('bacs.accountHolderName')}\n errorMessage={errors.holderName ? i18n.get('bacs.accountHolderName.invalid') : false}\n isValid={valid.holderName}\n name={'accountHolderName'}\n i18n={i18n}\n >\n <InputText\n name={'bacs.accountHolderName'}\n className={'adyen-checkout__bacs-input--holder-name'}\n placeholder={props.placeholders.holderName}\n value={data.holderName}\n aria-invalid={!valid.holderName}\n aria-label={i18n.get('bacs.accountHolderName')}\n aria-required={'true'}\n required={true}\n readonly={status === CONFIRM_STATE || status === 'loading'}\n autocorrect={'off'}\n onBlur={handleChangeFor('holderName', 'blur')}\n onInput={handleChangeFor('holderName', 'input')}\n />\n </Field>\n\n <div className=\"adyen-checkout__bacs__num-id adyen-checkout__field-wrapper\">\n <Field\n errorMessage={!!errors.bankAccountNumber && i18n.get('bacs.accountNumber.invalid')}\n label={i18n.get('bacs.accountNumber')}\n className={classNames({\n 'adyen-checkout__bacs--bank-account-number': true,\n 'adyen-checkout__field--inactive': status === CONFIRM_STATE || status === 'loading'\n })}\n classNameModifiers={['col-70']}\n isValid={valid.bankAccountNumber}\n name={'bankAccountNumber'}\n i18n={i18n}\n >\n <InputText\n value={data.bankAccountNumber}\n className={'adyen-checkout__bacs-input--bank-account-number'}\n placeholder={props.placeholders.bankAccountNumber}\n aria-invalid={!valid.bankAccountNumber}\n aria-label={i18n.get('bacs.accountNumber')}\n aria-required={'true'}\n required={true}\n readonly={status === CONFIRM_STATE || status === 'loading'}\n autocorrect={'off'}\n onBlur={handleChangeFor('bankAccountNumber', 'blur')}\n onInput={handleChangeFor('bankAccountNumber', 'input')}\n />\n </Field>\n\n <Field\n errorMessage={!!errors.bankLocationId && i18n.get('bacs.bankLocationId.invalid')}\n label={i18n.get('bacs.bankLocationId')}\n className={classNames({\n 'adyen-checkout__bacs--bank-location-id': true,\n 'adyen-checkout__field--inactive': status === CONFIRM_STATE || status === 'loading'\n })}\n classNameModifiers={['col-30']}\n isValid={valid.bankLocationId}\n name={'bankLocationId'}\n i18n={i18n}\n >\n <InputText\n value={data.bankLocationId}\n className={'adyen-checkout__bacs-input--bank-location-id'}\n placeholder={props.placeholders.bankLocationId}\n aria-invalid={!valid.bankLocationId}\n aria-label={i18n.get('bacs.bankLocationId')}\n aria-required={'true'}\n required={true}\n readonly={status === CONFIRM_STATE || status === 'loading'}\n autocorrect={'off'}\n onBlur={handleChangeFor('bankLocationId', 'blur')}\n onInput={handleChangeFor('bankLocationId', 'input')}\n />\n </Field>\n </div>\n\n <Field\n errorMessage={getErrorMessage(i18n, errors.shopperEmail, i18n.get('shopperEmail'))}\n label={i18n.get('shopperEmail')}\n className={classNames({\n 'adyen-checkout__bacs--shopper-email': true,\n 'adyen-checkout__field--inactive': status === CONFIRM_STATE || status === 'loading'\n })}\n isValid={valid.shopperEmail}\n name={'emailAddress'}\n i18n={i18n}\n >\n <InputEmail\n value={data.shopperEmail}\n name={'shopperEmail'}\n className={'adyen-checkout__bacs-input--shopper-email'}\n classNameModifiers={['large']}\n placeholder={props.placeholders.shopperEmail}\n spellcheck={false}\n aria-invalid={!valid.shopperEmail}\n aria-label={i18n.get('shopperEmail')}\n aria-required={'true'}\n required={true}\n readonly={status === CONFIRM_STATE || status === 'loading'}\n autocorrect={'off'}\n onInput={handleChangeFor('shopperEmail', 'input')}\n onBlur={handleChangeFor('shopperEmail', 'blur')}\n />\n </Field>\n\n {status === ENTER_STATE && (\n <ConsentCheckbox\n classNameModifiers={['amountConsentCheckbox']}\n errorMessage={!!errors.amountConsentCheckbox}\n label={i18n.get('bacs.consent.amount')}\n onChange={handleChangeFor('amountConsentCheckbox')}\n checked={!!data.amountConsentCheckbox}\n i18n={i18n}\n />\n )}\n\n {status === ENTER_STATE && (\n <ConsentCheckbox\n classNameModifiers={['accountConsentCheckbox']}\n errorMessage={!!errors.accountConsentCheckbox}\n label={i18n.get('bacs.consent.account')}\n onChange={handleChangeFor('accountConsentCheckbox')}\n checked={!!data.accountConsentCheckbox}\n i18n={i18n}\n />\n )}\n\n {props.showPayButton &&\n props.payButton({\n status,\n label:\n status === ENTER_STATE\n ? i18n.get('continue')\n : `${i18n.get('bacs.confirm')} ${\n !!props.amount?.value && !!props.amount?.currency ? i18n.amount(props.amount.value, props.amount.currency) : ''\n }`,\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`),\n onClick: handlePayButton\n })}\n </div>\n );\n}\n\nBacsInput.defaultProps = {\n data: {},\n placeholders: {}\n};\n\nexport default BacsInput;\n"],"names":["ENTER_STATE","CONFIRM_STATE","BacsInput","props","i18n","useCoreContext","getImage","useImage","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","schema","defaultData","formatters","bacsFormatters","rules","bacsValidationRules","status","setStatus","useState","this","showValidation","useEffect","onChange","h","div","className","classNames","FormInstruction","isDropin","InputText","name","value","get","aria-label","readonly","onClick","Field","label","errorMessage","holderName","placeholder","placeholders","aria-invalid","aria-required","required","autocorrect","onBlur","onInput","bankAccountNumber","classNameModifiers","bankLocationId","getErrorMessage","shopperEmail","InputEmail","spellcheck","ConsentCheckbox","amountConsentCheckbox","checked","accountConsentCheckbox","showPayButton","payButton","amount","currency","icon","imageFolder","PREFIX","onSubmit","defaultProps"],"mappings":"q3BAkBA,MAAMA,EAAc,aACdC,EAAgB,eAEtB,SAASC,EAAUC,OAyMiBA,EAAyBA,EAxMzD,MAAMC,KAAEA,GAASC,IACXC,EAAWC,KAEXC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAAuB,CAChGC,OAAQ,CAAC,aAAc,oBAAqB,iBAAkB,eAAgB,wBAAyB,0BACvGC,YAAab,EAAMO,KACnBO,WAAYC,EACZC,MAAOC,KAGJC,EAAQC,GAAaC,EAASvB,GACrCwB,KAAKF,UAAYA,EACjBE,KAAKC,eAAiBhB,EAoBtB,OAJAiB,GAAU,KACNvB,EAAMwB,SAAS,CAAEjB,OAAMC,QAAOC,SAAQC,WAAQ,GAC/C,CAACH,EAAMC,EAAOC,EAAQC,IAGrBe,EAACC,MAAAA,CACGC,UAAWC,EAAW,CAClB,wBAAwB,EACxB,gCAAiCV,IAAWpB,GAA4B,YAAXoB,KAGjEO,EAACI,EAAAA,MAEAX,GAAUpB,GACP2B,EAACC,MAAAA,CACGC,UAAWC,EAAW,CAClB,8BAA8B,EAC9B,oCAAqC5B,EAAM8B,YAG/CL,EAACM,EAAAA,CACGC,KAAM,WACNL,UAAW,oCACXM,MAAOhC,EAAKiC,IAAI,QAChBC,aAAYlC,EAAKiC,IAAI,QACrBE,UAAU,EACVC,QA9BD,IACRhB,KAAKF,UAAUtB,MAkClB4B,EAACa,EAAAA,CACGX,UAAWC,EAAW,CAClB,qCAAqC,EACrC,kCAAmCV,IAAWpB,GAA4B,YAAXoB,IAEnEqB,MAAO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AAKqD,uBAChB3D,KAAMA,IAIbD,EAAM6D,eACH7D,EAAM8D,UAAU,CACZ5C,SACAqB,MACIrB,IAAWrB,EACLI,EAAKiC,IAAI,YACT,GAAGjC,EAAKiC,IAAI,oBACM,QAAZlC,EAAAA,EAAM+D,cAAN/D,IAAAA,OAAAA,EAAAA,EAAciC,SAAuB,QAAZjC,EAAAA,EAAM+D,kBAAN/D,SAAAA,EAAcgE,UAAW/D,EAAK8D,OAAO/D,EAAM+D,OAAO9B,MAAOjC,EAAM+D,OAAOC,UAAY,KAE3HC,KAAM9D,EAAS,CAAE+D,YAAa,eAAxB/D,CAAyC,GAAGgE,SAClD9B,QA7LQ,IACf3B,EAEDQ,IAAWrB,EACJwB,KAAKF,UAAUrB,GACfoB,IAAWpB,EACXE,EAAMoE,gBADV,EAJc/C,KAAKC,mBAgMlC,CAEAvB,EAAUsE,aAAe,CACrB9D,KAAM,CAAC,EACPoC,aAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"BacsInput.js","sources":["../../../../../src/components/BacsDD/components/BacsInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport classNames from 'classnames';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Field from '../../internal/FormFields/Field';\nimport ConsentCheckbox from '../../internal/FormFields/ConsentCheckbox';\nimport { bacsValidationRules, bacsFormatters } from './validate';\nimport { BacsDataState, BacsInputProps } from './types';\nimport './BacsInput.scss';\n\nimport useForm from '../../../utils/useForm';\nimport useImage from '../../../core/Context/useImage';\nimport InputText from '../../internal/FormFields/InputText';\nimport InputEmail from '../../internal/FormFields/InputEmail';\nimport FormInstruction from '../../internal/FormInstruction';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport { PREFIX } from '../../internal/Icon/constants';\n\nconst ENTER_STATE = 'enter-data';\nconst CONFIRM_STATE = 'confirm-data';\n\nfunction BacsInput(props: BacsInputProps) {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<BacsDataState>({\n schema: ['holderName', 'bankAccountNumber', 'bankLocationId', 'shopperEmail', 'amountConsentCheckbox', 'accountConsentCheckbox'],\n defaultData: props.data,\n formatters: bacsFormatters,\n rules: bacsValidationRules\n });\n\n const [status, setStatus] = useState(ENTER_STATE);\n this.setStatus = setStatus;\n this.showValidation = triggerValidation;\n\n const handlePayButton = () => {\n if (!isValid) return this.showValidation();\n\n if (status === ENTER_STATE) {\n return this.setStatus(CONFIRM_STATE);\n } else if (status === CONFIRM_STATE) {\n return props.onSubmit();\n }\n };\n\n const handleEdit = () => {\n return this.setStatus(ENTER_STATE);\n };\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n return (\n <div\n className={classNames({\n 'adyen-checkout__bacs': true,\n 'adyen-checkout__bacs--confirm': status === CONFIRM_STATE || status === 'loading'\n })}\n >\n <FormInstruction />\n\n {status == CONFIRM_STATE && (\n <div\n className={classNames({\n 'adyen-checkout__bacs--edit': true,\n 'adyen-checkout__bacs--edit-dropin': props.isDropin\n })}\n >\n <InputText\n name={'bacsEdit'}\n className={'adyen-checkout__bacs--edit-button'}\n value={i18n.get('edit')}\n aria-label={i18n.get('edit')}\n readonly={true}\n onClick={handleEdit}\n />\n </div>\n )}\n\n <Field\n className={classNames({\n 'adyen-checkout__bacs--holder-name': true,\n 'adyen-checkout__field--inactive': status === CONFIRM_STATE || status === 'loading'\n })}\n label={i18n.get('bacs.accountHolderName')}\n errorMessage={errors.holderName ? i18n.get('bacs.accountHolderName.invalid') : false}\n isValid={valid.holderName}\n name={'accountHolderName'}\n i18n={i18n}\n >\n <InputText\n name={'bacs.accountHolderName'}\n className={'adyen-checkout__bacs-input--holder-name'}\n placeholder={props.placeholders.holderName}\n value={data.holderName}\n aria-invalid={!valid.holderName}\n aria-label={i18n.get('bacs.accountHolderName')}\n aria-required={'true'}\n required={true}\n readonly={status === CONFIRM_STATE || status === 'loading'}\n autocorrect={'off'}\n onBlur={handleChangeFor('holderName', 'blur')}\n onInput={handleChangeFor('holderName', 'input')}\n />\n </Field>\n\n <div className=\"adyen-checkout__bacs__num-id adyen-checkout__field-wrapper\">\n <Field\n errorMessage={!!errors.bankAccountNumber && i18n.get('bacs.accountNumber.invalid')}\n label={i18n.get('bacs.accountNumber')}\n className={classNames({\n 'adyen-checkout__bacs--bank-account-number': true,\n 'adyen-checkout__field--inactive': status === CONFIRM_STATE || status === 'loading'\n })}\n classNameModifiers={['col-70']}\n isValid={valid.bankAccountNumber}\n name={'bankAccountNumber'}\n i18n={i18n}\n >\n <InputText\n value={data.bankAccountNumber}\n className={'adyen-checkout__bacs-input--bank-account-number'}\n placeholder={props.placeholders.bankAccountNumber}\n aria-invalid={!valid.bankAccountNumber}\n aria-label={i18n.get('bacs.accountNumber')}\n aria-required={'true'}\n required={true}\n readonly={status === CONFIRM_STATE || status === 'loading'}\n autocorrect={'off'}\n onBlur={handleChangeFor('bankAccountNumber', 'blur')}\n onInput={handleChangeFor('bankAccountNumber', 'input')}\n />\n </Field>\n\n <Field\n errorMessage={!!errors.bankLocationId && i18n.get('bacs.bankLocationId.invalid')}\n label={i18n.get('bacs.bankLocationId')}\n className={classNames({\n 'adyen-checkout__bacs--bank-location-id': true,\n 'adyen-checkout__field--inactive': status === CONFIRM_STATE || status === 'loading'\n })}\n classNameModifiers={['col-30']}\n isValid={valid.bankLocationId}\n name={'bankLocationId'}\n i18n={i18n}\n >\n <InputText\n value={data.bankLocationId}\n className={'adyen-checkout__bacs-input--bank-location-id'}\n placeholder={props.placeholders.bankLocationId}\n aria-invalid={!valid.bankLocationId}\n aria-label={i18n.get('bacs.bankLocationId')}\n aria-required={'true'}\n required={true}\n readonly={status === CONFIRM_STATE || status === 'loading'}\n autocorrect={'off'}\n onBlur={handleChangeFor('bankLocationId', 'blur')}\n onInput={handleChangeFor('bankLocationId', 'input')}\n />\n </Field>\n </div>\n\n <Field\n errorMessage={getErrorMessage(i18n, errors.shopperEmail, i18n.get('shopperEmail'))}\n label={i18n.get('shopperEmail')}\n className={classNames({\n 'adyen-checkout__bacs--shopper-email': true,\n 'adyen-checkout__field--inactive': status === CONFIRM_STATE || status === 'loading'\n })}\n isValid={valid.shopperEmail}\n name={'emailAddress'}\n i18n={i18n}\n >\n <InputEmail\n value={data.shopperEmail}\n name={'shopperEmail'}\n className={'adyen-checkout__bacs-input--shopper-email'}\n classNameModifiers={['large']}\n placeholder={props.placeholders.shopperEmail}\n spellcheck={false}\n aria-invalid={!valid.shopperEmail}\n aria-label={i18n.get('shopperEmail')}\n aria-required={'true'}\n required={true}\n readonly={status === CONFIRM_STATE || status === 'loading'}\n autocorrect={'off'}\n onInput={handleChangeFor('shopperEmail', 'input')}\n onBlur={handleChangeFor('shopperEmail', 'blur')}\n />\n </Field>\n\n {status === ENTER_STATE && (\n <ConsentCheckbox\n classNameModifiers={['amountConsentCheckbox']}\n errorMessage={!!errors.amountConsentCheckbox}\n label={i18n.get('bacs.consent.amount')}\n onChange={handleChangeFor('amountConsentCheckbox')}\n checked={!!data.amountConsentCheckbox}\n i18n={i18n}\n />\n )}\n\n {status === ENTER_STATE && (\n <ConsentCheckbox\n classNameModifiers={['accountConsentCheckbox']}\n errorMessage={!!errors.accountConsentCheckbox}\n label={i18n.get('bacs.consent.account')}\n onChange={handleChangeFor('accountConsentCheckbox')}\n checked={!!data.accountConsentCheckbox}\n i18n={i18n}\n />\n )}\n\n {props.showPayButton &&\n props.payButton({\n status,\n label:\n status === ENTER_STATE\n ? i18n.get('continue')\n : `${i18n.get('bacs.confirm')} ${\n !!props.amount?.value && !!props.amount?.currency ? i18n.amount(props.amount.value, props.amount.currency) : ''\n }`,\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`),\n onClick: handlePayButton\n })}\n </div>\n );\n}\n\nBacsInput.defaultProps = {\n data: {},\n placeholders: {}\n};\n\nexport default BacsInput;\n"],"names":["ENTER_STATE","CONFIRM_STATE","BacsInput","props","i18n","useCoreContext","getImage","useImage","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","schema","defaultData","formatters","bacsFormatters","rules","bacsValidationRules","status","setStatus","useState","this","showValidation","useEffect","onChange","h","div","className","classNames","FormInstruction","isDropin","InputText","name","value","get","aria-label","readonly","onClick","Field","label","errorMessage","holderName","placeholder","placeholders","aria-invalid","aria-required","required","autocorrect","onBlur","onInput","bankAccountNumber","classNameModifiers","bankLocationId","getErrorMessage","shopperEmail","InputEmail","spellcheck","ConsentCheckbox","amountConsentCheckbox","checked","accountConsentCheckbox","showPayButton","payButton","amount","currency","icon","imageFolder","PREFIX","onSubmit","defaultProps"],"mappings":"02BAkBA,MAAMA,EAAc,aACdC,EAAgB,eAEtB,SAASC,EAAUC,OAyMiBA,EAAyBA,EAxMzD,MAAMC,KAAEA,GAASC,IACXC,EAAWC,KAEXC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAAuB,CAChGC,OAAQ,CAAC,aAAc,oBAAqB,iBAAkB,eAAgB,wBAAyB,0BACvGC,YAAab,EAAMO,KACnBO,WAAYC,EACZC,MAAOC,KAGJC,EAAQC,GAAaC,EAASvB,GACrCwB,KAAKF,UAAYA,EACjBE,KAAKC,eAAiBhB,EAoBtB,OAJAiB,GAAU,KACNvB,EAAMwB,SAAS,CAAEjB,OAAMC,QAAOC,SAAQC,WAAQ,GAC/C,CAACH,EAAMC,EAAOC,EAAQC,IAGrBe,EAACC,MAAAA,CACGC,UAAWC,EAAW,CAClB,wBAAwB,EACxB,gCAAiCV,IAAWpB,GAA4B,YAAXoB,KAGjEO,EAACI,EAAAA,MAEAX,GAAUpB,GACP2B,EAACC,MAAAA,CACGC,UAAWC,EAAW,CAClB,8BAA8B,EAC9B,oCAAqC5B,EAAM8B,YAG/CL,EAACM,EAAAA,CACGC,KAAM,WACNL,UAAW,oCACXM,MAAOhC,EAAKiC,IAAI,QAChBC,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mD,sBAChBzD,KAAMA,IAIbiB,IAAWrB,GACR4B,EAACgC,EAAAA,CACGN,mBAAoB,CAAC,0BACrBX,eAAgB/B,EAAOmD,uBACvBrB,MAAOtC,EAAKiC,IAAI,wBAChBV,SAAUnB,EAAgB,0BAC1BsD,UAAWpD,EAAKqD,uBAChB3D,KAAMA,IAIbD,EAAM6D,eACH7D,EAAM8D,UAAU,CACZ5C,SACAqB,MACIrB,IAAWrB,EACLI,EAAKiC,IAAI,YACT,GAAGjC,EAAKiC,IAAI,oBACM,QAAZlC,EAAAA,EAAM+D,cAAN/D,IAAAA,OAAAA,EAAAA,EAAciC,SAAuB,QAAZjC,EAAAA,EAAM+D,kBAAN/D,SAAAA,EAAcgE,UAAW/D,EAAK8D,OAAO/D,EAAM+D,OAAO9B,MAAOjC,EAAM+D,OAAOC,UAAY,KAE3HC,KAAM9D,EAAS,CAAE+D,YAAa,eAAxB/D,CAAyC,GAAGgE,SAClD9B,QA7LQ,IACf3B,EAEDQ,IAAWrB,EACJwB,KAAKF,UAAUrB,GACfoB,IAAWpB,EACXE,EAAMoE,gBADV,EAJc/C,KAAKC,mBAgMlC,CAEAvB,EAAUsE,aAAe,CACrB9D,KAAM,CAAC,EACPoC,aAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Boleto.js","sources":["../../../../src/components/Boleto/Boleto.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport BoletoInput from './components/BoletoInput';\nimport { cleanCPFCNPJ } from '../internal/SocialSecurityNumberBrazil/utils';\nimport BoletoVoucherResult from './components/BoletoVoucherResult';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { TxVariants } from '../tx-variants';\nimport {
|
|
1
|
+
{"version":3,"file":"Boleto.js","sources":["../../../../src/components/Boleto/Boleto.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport BoletoInput from './components/BoletoInput';\nimport { cleanCPFCNPJ } from '../internal/SocialSecurityNumberBrazil/utils';\nimport BoletoVoucherResult from './components/BoletoVoucherResult';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { TxVariants } from '../tx-variants';\n\nimport type { BoletoConfiguration } from './types';\n\nexport class BoletoElement extends UIElement<BoletoConfiguration> {\n public static type = TxVariants.boletobancario;\n\n public static txVariants = [\n TxVariants.boletobancario,\n TxVariants.boletobancario_itau,\n TxVariants.boletobancario_santander,\n TxVariants.primeiropay_boleto\n ];\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const { data = {} } = this.state;\n const { billingAddress, shopperEmail, firstName, lastName, socialSecurityNumber = '' } = data;\n\n return {\n paymentMethod: {\n type: this.type\n },\n ...(billingAddress && { billingAddress }),\n ...(shopperEmail && { shopperEmail }),\n ...(firstName && lastName && { shopperName: { firstName, lastName } }),\n ...(socialSecurityNumber && { socialSecurityNumber: cleanCPFCNPJ(socialSecurityNumber) })\n };\n }\n\n private handleRef = ref => {\n this.componentRef = ref;\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.reference ? (\n <BoletoVoucherResult ref={this.handleRef} icon={this.icon} {...this.props} onActionHandled={this.onActionHandled} />\n ) : (\n <BoletoInput\n setComponentRef={this.handleRef}\n {...this.props}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default BoletoElement;\n"],"names":["BoletoElement","UIElement","isValid","this","state","formatData","data","billingAddress","shopperEmail","firstName","lastName","socialSecurityNumber","_object_spread","paymentMethod","type","shopperName","cleanCPFCNPJ","render","h","CoreProvider","i18n","props","loadingContext","resources","reference","BoletoVoucherResult","ref","handleRef","icon","onActionHandled","BoletoInput","setComponentRef","onChange","setState","onSubmit","submit","payButton","super","args","_define_property","componentRef","TxVariants","boletobancario","txVariants","boletobancario_itau","boletobancario_santander","primeiropay_boleto"],"mappings":"ivCAUO,MAAMA,UAAsBC,EAU/B,WAAIC,GACA,QAASC,KAAKC,MAAMF,OACxB,CAKAG,UAAAA,GACI,MAAMC,KAAEA,EAAO,IAAOH,KAAKC,OACrBG,eAAEA,EAAcC,aAAEA,EAAYC,UAAEA,EAASC,SAAEA,EAAQC,qBAAEA,EAAuB,IAAOL,EAEzF,OAAOM,EAAA,CACHC,cAAe,CACXC,KAAMX,KAAKW,OAEXP,GAAkB,CAAEA,kBACpBC,GAAgB,CAAEA,gBAClBC,GAAaC,GAAY,CAAEK,YAAa,CAAEN,YAAWC,aACrDC,GAAwB,CAAEA,qBAAsBK,EAAaL,IAEzE,CAMAM,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMjB,KAAKkB,MAAMD,KAAME,eAAgBnB,KAAKkB,MAAMC,eAAgBC,UAAWpB,KAAKoB,WAC3FpB,KAAKkB,MAAMG,UACRN,EAACO,EAAAA,EAAAA,EAAAA,CAAoBC,IAAKvB,KAAKwB,UAAWC,KAAMzB,KAAKyB,MAAUzB,KAAKkB,OAAK,CAAEQ,gBAAiB1B,KAAK0B,mBAEjGX,EAACY,EAAAA,EAAAA,EAAAA,CACGC,gBAAiB5B,KAAKwB,WAClBxB,KAAKkB,OAAK,CACdW,SAAU7B,KAAK8B,SACfC,SAAU/B,KAAKgC,OACfC,UAAWjC,KAAKiC,aAKpC,mBApDGC,SAgCHC,GAAAC,EAAApC,KAAQwB,aAAYD,IAChBvB,KAAKqC,aAAed,CAAAA,KAhCxBa,EADSvC,EACKc,OAAO2B,EAAWC,gBAEhCH,EAHSvC,EAGK2C,aAAa,CACvBF,EAAWC,eACXD,EAAWG,oBACXH,EAAWI,yBACXJ,EAAWK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as t,useMemo as o,useState as n,useCallback as s,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import l from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import i from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{ENCRYPTED_CARD_NUMBER as u,DATE_POLICY_REQUIRED as c,CVC_POLICY_REQUIRED as m}from"../../../internal/SecuredFields/lib/constants.js";import{cardInputFormatters as p,cardInputValidationRules as b,getRuleByNameAndMode as f}from"./validate.js";import y from"../../../internal/SecuredFields/binLookup/extensions.js";import h from"../../../../utils/useForm/useForm.js";import{handlePartialAddressMode as S,extractPropsForCardFields as N,extractPropsForSFP as g,getLayout as A}from"./utils.js";import v from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as j}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as O}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as F,getFocusHandler as P,getAddressHandler as w}from"./handlers.js";import C from"../../../../
|
|
1
|
+
import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as t,useMemo as o,useState as n,useCallback as s,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import l from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import i from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{ENCRYPTED_CARD_NUMBER as u,DATE_POLICY_REQUIRED as c,CVC_POLICY_REQUIRED as m}from"../../../internal/SecuredFields/lib/constants.js";import{cardInputFormatters as p,cardInputValidationRules as b,getRuleByNameAndMode as f}from"./validate.js";import y from"../../../internal/SecuredFields/binLookup/extensions.js";import h from"../../../../utils/useForm/useForm.js";import{handlePartialAddressMode as S,extractPropsForCardFields as N,extractPropsForSFP as g,getLayout as A}from"./utils.js";import v from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as j}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as O}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as F,getFocusHandler as P,getAddressHandler as w}from"./handlers.js";import C from"../../../../_virtual/index.js";import{getPartialAddressValidationRules as k}from"../../../internal/Address/validate.js";import R from"../../../../core/Context/useImage.js";import{getArrayDifferences as x}from"../../../../utils/arrayUtils.js";import I from"../../../internal/FormInstruction/FormInstruction.js";import{PREFIX as B}from"../../../internal/Icon/constants.js";import E from"./useSRPanelForCardInputErrors.js";function V(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function D(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),o.forEach((function(r){V(e,r,t[r])}))}return e}function q(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})),e}const M=i=>{var V,M;const _=t(null),L=t(!1),T=R(),K=t(null),H=e=>{K.current=e},U=t({});Object.keys(U.current).length||i.setComponentRef(U.current);const z=t(0),W=t(!1),$=o((()=>new v(i.specifications)),[i.specifications]);U.current.sfp=_;const[G,J]=n("ready"),[Q,X]=n({}),[Y,Z]=n(D({},i.holderNameRequired&&{holderName:!1}));var ee;const[re,te]=n(D({},i.hasHolderName&&{holderName:null!==(ee=i.data.holderName)&&void 0!==ee?ee:""})),[oe,ne]=n(""),[se,ae]=n(!1),[le,ie]=n(c),[de,ue]=n(m),[ce,me]=n(null),[pe,be]=n([]),[fe,ye]=n(i.storedPaymentMethodId?i.brand:""),he=i.billingAddressMode!==d.none&&i.billingAddressRequired,Se=S(i.billingAddressMode),Ne=t(Se&&(null===(M=i.data)||void 0===M||null===(V=M.billingAddress)||void 0===V?void 0:V.country)),[ge,Ae]=n(!1),[ve,je]=n(he?i.data.billingAddress:null),[Oe,Fe]=n(!1),[Pe,we]=n(""),[Ce,ke]=n({value:null}),[Re,xe]=n(null),[Ie,Be]=n("card"),{handleChangeFor:Ee,triggerValidation:Ve,data:De,valid:qe,errors:Me,setSchema:_e,setData:Le,setValid:Te,setErrors:Ke}=h({schema:[],defaultData:i.data,formatters:p,rules:b}),He=!!Object.keys(i.installmentOptions).length&&"debit"!==i.fundingSource;var Ue;const ze=null===(Ue=i.showInstallmentAmounts)||void 0===Ue||Ue,We="kr"===(null!=ce?ce:i.countryCode),$e=i.configuration.koreanAuthenticationRequired&&We,Ge=Oe&&"auto"===i.configuration.socialSecurityNumberMode||"show"===i.configuration.socialSecurityNumberMode,Je=(e,r)=>{i.onFocus({fieldType:e,event:r})},Qe=(e,r)=>{i.onBlur({fieldType:e,event:r})},Xe=s((e=>{Be(e.brand),i.onBrand(e)}),[]),Ye=P(ne,Je,Qe),Ze=()=>A(D({props:i,showKCP:$e,showBrazilianSSN:Ge},i.billingAddressRequired&&{countrySpecificSchemas:$.getAddressSchemaForCountry(null==ve?void 0:ve.country),billingAddressRequiredFields:i.billingAddressRequiredFields})),er=s((e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;xe(r)}),[]),rr=w(Le,Te,Ke),tr=F(W,_,Ze()),or=o((()=>y(i,{sfp:_},{dualBrandSelectElements:pe,setDualBrandSelectElements:be,setSelectedBrandValue:ye,issuingCountryCode:ce,setIssuingCountryCode:me},z)),[pe,ce]);U.current.showValidation=()=>{L.current=!0,null==ar||ar(),_.current.showValidation(),Ve(["holderName","socialSecurityNumber","taxNumber"]),(null==K?void 0:K.current)&&K.current.showValidation()},U.current.processBinLookupResponse=(e,r)=>{or.processBinLookup(e,r)},U.current.setStatus=J,a((()=>(U.current.setFocusOn=_.current.setFocusOn,U.current.updateStyles=_.current.updateStyles,U.current.handleUnsupportedCard=_.current.handleUnsupportedCard,()=>{_.current.destroy()})),[]),a((()=>{const e=[...i.hasHolderName?["holderName"]:[],...Ge?["socialSecurityNumber"]:[],...$e?["taxNumber"]:[],...he?["billingAddress"]:[]];_e(e)}),[i.hasHolderName,Ge,$e]),a((()=>{var e;te(q(D({},re),{holderName:null!==(e=De.holderName)&&void 0!==e?e:"",taxNumber:De.taxNumber})),we(De.socialSecurityNumber),he&&je(D({},De.billingAddress)),Z(q(D({},Y),{holderName:!i.holderNameRequired||qe.holderName,socialSecurityNumber:!!qe.socialSecurityNumber&&qe.socialSecurityNumber,taxNumber:!!qe.taxNumber&&qe.taxNumber,billingAddress:!!qe.billingAddress&&qe.billingAddress}));const r=!!Me.billingAddress&&Object.entries(Me.billingAddress).reduce(((e,[,r])=>e||null!=r),!1);X(q(D({},Q),{holderName:i.holderNameRequired&&Me.holderName?Me.holderName:null,socialSecurityNumber:Ge&&Me.socialSecurityNumber?Me.socialSecurityNumber:null,taxNumber:$e&&Me.taxNumber?Me.taxNumber:null,billingAddress:he&&r?Me.billingAddress:null}))}),[De,qe,Me]);const{sortedErrorList:nr,previousSortedErrors:sr,clearSRPanel:ar}=E({errors:Q,props:i,isValidating:L,retrieveLayout:Ze,specifications:$,billingAddress:ve,sfp:_});if(nr){const e=x(nr,sr,"field");null==e||e.forEach((e=>{const r={fieldType:e.field,errorCode:e.errorCode};i.onValidationErrorAnalytics(r)}))}a((()=>{const e=Y.holderName,r=se,t=!he||Y.billingAddress,o=!$e||!!Y.taxNumber&&!!Y.encryptedPassword,n=!Ge||!!Y.socialSecurityNumber,s=r&&e&&t&&o&&n,a=_.current.mapErrorsToValidationRuleResult(),l=D({},Q,a);i.onChange({data:re,valid:Y,errors:l,isValid:s,billingAddress:ve,selectedBrandValue:fe,storePaymentMethod:ge,socialSecurityNumber:Pe,installments:Ce})}),[re,Y,Q,fe,ge,Ce]);const lr=i.storedPaymentMethodId?j:O;return e(r,null,e(l,q(D({ref:_},g(i)),{styles:D({},i.styles),koreanAuthenticationRequired:i.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!i.configuration.koreanAuthenticationRequired||"kr"!==i.countryCode),onChange:(e,r)=>{if(e.autoCompleteName){if(!i.hasHolderName)return;const r=f("holderName","blur")(e.autoCompleteName)?e.autoCompleteName:null;r&&(Le("holderName",r),Te("holderName",!0),Ke("holderName",null))}else i.autoFocus&&z.current>0&&"handleOnFieldValid"===(null==r?void 0:r.event)&&(null==r?void 0:r.fieldType)===u&&e.valid.encryptedCardNumber&&tr(),te(D({},re,e.data)),X(D({},Q,e.errors)),Z(D({},Y,e.valid)),ae(e.isSfpValid),ue(e.cvcPolicy),Fe(e.showSocialSecurityNumber),ie(e.expiryDatePolicy)},onBrand:Xe,onFocus:Ye,type:i.brand,disableIOSArrowKeys:i.disableIOSArrowKeys?er:null,render:({setRootNode:r,setFocusOn:t},o)=>{var n;return e("div",{ref:r,className:C({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${null!==(n=i.fundingSource)&&void 0!==n?n:"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===G}),role:"form"},e(I,null),e(lr,q(D({},N(i)),{data:re,valid:Y,errors:Q,handleChangeFor:Ee,focusedElement:oe,setFocusOn:t,sfpState:o,cvcPolicy:de,hasInstallments:He,showAmountsInInstallments:ze,handleInstallments:ke,brandsIcons:i.brandsIcons,formData:De,formErrors:Me,formValid:qe,expiryDatePolicy:le,dualBrandSelectElements:pe,extensions:or,selectedBrandValue:fe,showKCP:$e,showBrazilianSSN:Ge,socialSecurityNumber:Pe,handleOnStoreDetails:Ae,setAddressRef:H,billingAddress:ve,billingAddressValidationRules:Se&&k(Ne.current),partialAddressSchema:Se,handleAddress:rr,onAddressLookup:i.onAddressLookup,onAddressSelected:i.onAddressSelected,addressSearchDebounceMs:i.addressSearchDebounceMs,iOSFocusedField:Re,onFieldFocusAnalytics:Je,onFieldBlurAnalytics:Qe})))}})),i.showPayButton&&i.payButton({status:G,variant:i.isPayButtonPrimaryVariant?"primary":"secondary",icon:T({imageFolder:"components/"})(`${B}lock`)}))};M.defaultProps=i;export{M as default};
|
|
2
2
|
//# sourceMappingURL=CardInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SortedErrorObject } from '../../../../core/Errors/types';\nimport { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout } from './utils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler } from './handlers';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CardBrandData, CardFocusData } from '../../../internal/SecuredFields/lib/types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\nimport useSRPanelForCardInputErrors from './useSRPanelForCardInputErrors';\n\nconst CardInput = (props: CardInputProps) => {\n const sfp = useRef(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data.holderName ?? '' })\n });\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? props.data.billingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsObj>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * This stores the brand as detected by the internal regEx.\n * It eventually gets overwritten by the brand as detected by the /binLookup, but will revert back to the regEx detection\n * if the PAN length drops below the /binLookup digit threshold.\n * Default value, 'card', indicates no brand detected\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [internallyDetectedBrand, setInternallyDetectedBrand] = useState('card');\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = !!Object.keys(props.installmentOptions).length && props.fundingSource !== 'debit';\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n const onBrand = useCallback((obj: CardBrandData) => {\n setInternallyDetectedBrand(obj.brand);\n props.onBrand(obj);\n }, []);\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn(sfState.autoCompleteName) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Use the custom hook to set (or clear) errors in the SRPanel\n const {\n sortedErrorList: currentErrorsSortedByLayout,\n previousSortedErrors,\n clearSRPanel\n } = useSRPanelForCardInputErrors({\n errors,\n props,\n isValidating,\n retrieveLayout,\n specifications,\n billingAddress,\n sfp\n });\n\n // Analytics: ValidationErrors\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n newErrors?.forEach(errorItem => {\n const aObj: FieldErrorAnalyticsObject = {\n fieldType: errorItem.field,\n errorCode: errorItem.errorCode\n };\n\n props.onValidationErrorAnalytics(aObj);\n });\n }\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onChange={handleSecuredFieldsChange}\n onBrand={onBrand}\n onFocus={handleFocus}\n type={props.brand}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n <FormInstruction />\n\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n {props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","status","setStatus","useState","errors","setErrors","valid","setValid","_object_spread","holderNameRequired","holderName","data","setData","hasHolderName","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","internallyDetectedBrand","setInternallyDetectedBrand","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","onBrand","useCallback","obj","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","extensions","CIExtensions","showValidation","clearSRPanel","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","_object_spread_props","taxNumber","addressHasErrors","entries","reduce","acc","error","sortedErrorList","currentErrorsSortedByLayout","previousSortedErrors","useSRPanelForCardInputErrors","newErrors","getArrayDifferences","forEach","errorItem","aObj","field","errorCode","onValidationErrorAnalytics","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","onChange","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","acHolderName","getRuleByNameAndMode","holderNameValidationFn","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","type","disableIOSArrowKeys","render","setRootNode","sfpState","div","className","classNames","role","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"u4EA+BA,MAAMA,EAAaC,QAkDsDA,EAAAA,EAjDrE,MAAMC,EAAMC,EAAO,MACbC,EAAeD,GAAO,GACtBE,EAAWC,IAEXC,EAAoBJ,EAAO,MAC3BK,EAAgBC,IAClBF,EAAkBG,QAAUD,CAAAA,EAG1BE,EAAeR,EAAqB,IAErCS,OAAOC,KAAKF,EAAaD,SAASI,QACnCb,EAAMc,gBAAgBJ,EAAaD,SAGvC,MAAMM,EAAkBb,EAAO,GACzBc,EAAgBd,GAAO,GAEvBe,EAAiBC,GAAQ,IAAM,IAAIC,EAAenB,EAAMi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AAWC,EAAW,CAClB,8BAA8B,EAC9B,sCAAsC,EACtC,CAAC,+BAAkD,QAAnBrM,EAAAA,EAAM6F,qBAAN7F,IAAAA,EAAAA,EAAuB,aAAa,EACpE,sCAAkD,YAAXoB,IAE3CkL,KAAM,QAENvB,EAACwB,EAAAA,MAEDxB,EAACH,GAAAA,EAAAA,EAAAA,CAAAA,EAEO4B,EAA0BxM,IAAAA,CAG9B8B,KAAMA,GACNL,MAAOA,EACPF,OAAQA,EACRoD,gBAAiBA,GACjB1C,eAAgBA,GAChBwG,WAAYA,EACZyD,SAAUA,EACV1J,UAAWA,GACXmD,gBAAiBA,GACjBG,0BAA2BA,GAC3B2G,mBAAoBpI,GAEpBqI,YAAa1M,EAAM0M,YACnB7H,SAAUA,GACVE,WAAYA,GACZD,UAAWA,GACXzC,iBAAkBA,GAClBQ,wBAAyBA,GACzBmF,WAAYA,GACZjF,mBAAoBA,GAEpBmD,QAASA,GAETG,iBAAkBA,GAClBnC,qBAAsBA,GAEtByI,qBAAsB7I,GAEtBvD,cAAeA,EACfoD,eAAgBA,GAChBiJ,8BAA+BpJ,IAAwBqJ,EAAiCnJ,GAAsBjD,SAC9G+C,qBAAsBA,GACtBoE,cAAeA,GACfkF,gBAAiB9M,EAAM8M,gBACvBC,kBAAmB/M,EAAM+M,kBACzBC,wBAAyBhN,EAAMgN,wBAE/BzI,gBAAiBA,GAEjBgC,sBAAuBA,GACvBM,qBAAsBA,WAKrC7G,EAAMiN,eACHjN,EAAMkN,UAAU,CACZ9L,SACA+L,QAASnN,EAAMoN,0BAA4B,UAAY,YACvDC,KAAMjN,EAAS,CAAEkN,YAAa,eAAxBlN,CAAyC,GAAGmN,WACtD,EAKhBxN,EAAUyN,aAAeA"}
|
|
1
|
+
{"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SortedErrorObject } from '../../../../core/Errors/types';\nimport { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout } from './utils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler } from './handlers';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CardBrandData, CardFocusData } from '../../../internal/SecuredFields/lib/types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\nimport useSRPanelForCardInputErrors from './useSRPanelForCardInputErrors';\n\nconst CardInput = (props: CardInputProps) => {\n const sfp = useRef(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data.holderName ?? '' })\n });\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? props.data.billingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsObj>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * This stores the brand as detected by the internal regEx.\n * It eventually gets overwritten by the brand as detected by the /binLookup, but will revert back to the regEx detection\n * if the PAN length drops below the /binLookup digit threshold.\n * Default value, 'card', indicates no brand detected\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [internallyDetectedBrand, setInternallyDetectedBrand] = useState('card');\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = !!Object.keys(props.installmentOptions).length && props.fundingSource !== 'debit';\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n const onBrand = useCallback((obj: CardBrandData) => {\n setInternallyDetectedBrand(obj.brand);\n props.onBrand(obj);\n }, []);\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn(sfState.autoCompleteName) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Use the custom hook to set (or clear) errors in the SRPanel\n const {\n sortedErrorList: currentErrorsSortedByLayout,\n previousSortedErrors,\n clearSRPanel\n } = useSRPanelForCardInputErrors({\n errors,\n props,\n isValidating,\n retrieveLayout,\n specifications,\n billingAddress,\n sfp\n });\n\n // Analytics: ValidationErrors\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n newErrors?.forEach(errorItem => {\n const aObj: FieldErrorAnalyticsObject = {\n fieldType: errorItem.field,\n errorCode: errorItem.errorCode\n };\n\n props.onValidationErrorAnalytics(aObj);\n });\n }\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onChange={handleSecuredFieldsChange}\n onBrand={onBrand}\n onFocus={handleFocus}\n type={props.brand}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n <FormInstruction />\n\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n {props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","status","setStatus","useState","errors","setErrors","valid","setValid","_object_spread","holderNameRequired","holderName","data","setData","hasHolderName","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","internallyDetectedBrand","setInternallyDetectedBrand","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","onBrand","useCallback","obj","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","extensions","CIExtensions","showValidation","clearSRPanel","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","_object_spread_props","taxNumber","addressHasErrors","entries","reduce","acc","error","sortedErrorList","currentErrorsSortedByLayout","previousSortedErrors","useSRPanelForCardInputErrors","newErrors","getArrayDifferences","forEach","errorItem","aObj","field","errorCode","onValidationErrorAnalytics","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","onChange","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","acHolderName","getRuleByNameAndMode","holderNameValidationFn","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","type","disableIOSArrowKeys","render","setRootNode","sfpState","div","className","classNames","role","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"43EA+BA,MAAMA,EAAaC,QAkDsDA,EAAAA,EAjDrE,MAAMC,EAAMC,EAAO,MACbC,EAAeD,GAAO,GACtBE,EAAWC,IAEXC,EAAoBJ,EAAO,MAC3BK,EAAgBC,IAClBF,EAAkBG,QAAUD,CAAAA,EAG1BE,EAAeR,EAAqB,IAErCS,OAAOC,KAAKF,EAAaD,SAASI,QACnCb,EAAMc,gBAAgBJ,EAAaD,SAGvC,MAAMM,EAAkBb,EAAO,GACzBc,EAAgBd,GAAO,GAEvBe,EAAiBC,GAAQ,IAAM,IAAIC,EAAenB,EAAMiB,iBAAiB,CAACjB,EAAMiB,iBAGtFP,EAAaD,QAAQR,IAAMA,EAK3B,MAAOmB,EAAQC,GAAaC,EAAS,UAE9BC,EAAQC,GAAaF,EAA8B,CAAA,IACnDG,EAAOC,GAAYJ,EAA8BK,EAChD3B,CAAAA,EAAAA,EAAM4B,oBAAsB,CAAEC,YAAY,KAGL7B,IAAAA,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AEO4B,EAA0BxM,IAAAA,CAG9B8B,KAAMA,GACNL,MAAOA,EACPF,OAAQA,EACRoD,gBAAiBA,GACjB1C,eAAgBA,GAChBwG,WAAYA,EACZyD,SAAUA,EACV1J,UAAWA,GACXmD,gBAAiBA,GACjBG,0BAA2BA,GAC3B2G,mBAAoBpI,GAEpBqI,YAAa1M,EAAM0M,YACnB7H,SAAUA,GACVE,WAAYA,GACZD,UAAWA,GACXzC,iBAAkBA,GAClBQ,wBAAyBA,GACzBmF,WAAYA,GACZjF,mBAAoBA,GAEpBmD,QAASA,GAETG,iBAAkBA,GAClBnC,qBAAsBA,GAEtByI,qBAAsB7I,GAEtBvD,cAAeA,EACfoD,eAAgBA,GAChBiJ,8BAA+BpJ,IAAwBqJ,EAAiCnJ,GAAsBjD,SAC9G+C,qBAAsBA,GACtBoE,cAAeA,GACfkF,gBAAiB9M,EAAM8M,gBACvBC,kBAAmB/M,EAAM+M,kBACzBC,wBAAyBhN,EAAMgN,wBAE/BzI,gBAAiBA,GAEjBgC,sBAAuBA,GACvBM,qBAAsBA,WAKrC7G,EAAMiN,eACHjN,EAAMkN,UAAU,CACZ9L,SACA+L,QAASnN,EAAMoN,0BAA4B,UAAY,YACvDC,KAAMjN,EAAS,CAAEkN,YAAa,eAAxBlN,CAAyC,GAAGmN,WACtD,EAKhBxN,EAAUyN,aAAeA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as a}from"../../../../../../external/preact/dist/preact.js";import r from"../../../../../../
|
|
1
|
+
import{createElement as a}from"../../../../../../external/preact/dist/preact.js";import r from"../../../../../../_virtual/index.js";import e from"../../../../../internal/Img/Img.js";import{getFullBrandName as n}from"../../utils.js";const t=({brands:t,activeBrand:s})=>{if(!(null==t?void 0:t.length))return null;return a("span",{className:r("adyen-checkout__card__brands",{"adyen-checkout__card__brands--hidden":"card"!==s})},t.map((({name:r,icon:t})=>a("span",{key:r,className:"adyen-checkout__card__brands__brand-wrapper"},a(e,{src:t,alt:n(r)})))))};export{t as default};
|
|
2
2
|
//# sourceMappingURL=AvailableBrands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvailableBrands.js","sources":["../../../../../../../../src/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport Img from '../../../../../internal/Img';\nimport './AvailableBrands.scss';\nimport { BrandConfiguration } from '../../../../types';\nimport { getFullBrandName } from '../../utils';\n\ntype AvailableBrands = Array<BrandConfiguration>;\n\ninterface PaymentMethodBrandsProps {\n brands: AvailableBrands;\n activeBrand: string;\n}\n\nconst AvailableBrands = ({ brands, activeBrand }: PaymentMethodBrandsProps) => {\n if (!brands?.length) {\n return null;\n }\n\n const isValidBrand = activeBrand !== 'card';\n return (\n <span\n className={classNames('adyen-checkout__card__brands', {\n 'adyen-checkout__card__brands--hidden': isValidBrand\n })}\n >\n {brands.map(({ name, icon }) => (\n <span key={name} className=\"adyen-checkout__card__brands__brand-wrapper\">\n <Img src={icon} alt={getFullBrandName(name)} />\n </span>\n ))}\n </span>\n );\n};\n\nexport default AvailableBrands;\n"],"names":["AvailableBrands","brands","activeBrand","length","h","span","className","classNames","map","name","icon","key","Img","src","alt","getFullBrandName"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AvailableBrands.js","sources":["../../../../../../../../src/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport Img from '../../../../../internal/Img';\nimport './AvailableBrands.scss';\nimport { BrandConfiguration } from '../../../../types';\nimport { getFullBrandName } from '../../utils';\n\ntype AvailableBrands = Array<BrandConfiguration>;\n\ninterface PaymentMethodBrandsProps {\n brands: AvailableBrands;\n activeBrand: string;\n}\n\nconst AvailableBrands = ({ brands, activeBrand }: PaymentMethodBrandsProps) => {\n if (!brands?.length) {\n return null;\n }\n\n const isValidBrand = activeBrand !== 'card';\n return (\n <span\n className={classNames('adyen-checkout__card__brands', {\n 'adyen-checkout__card__brands--hidden': isValidBrand\n })}\n >\n {brands.map(({ name, icon }) => (\n <span key={name} className=\"adyen-checkout__card__brands__brand-wrapper\">\n <Img src={icon} alt={getFullBrandName(name)} />\n </span>\n ))}\n </span>\n );\n};\n\nexport default AvailableBrands;\n"],"names":["AvailableBrands","brands","activeBrand","length","h","span","className","classNames","map","name","icon","key","Img","src","alt","getFullBrandName"],"mappings":"wOAcA,MAAMA,EAAkB,EAAGC,SAAQC,kBAC/B,KAAKD,aAAAA,EAAAA,EAAQE,QACT,OAAO,KAIX,OACIC,EAACC,OAAAA,CACGC,UAAWC,EAAW,+BAAgC,CAClD,uCAJyB,SAAhBL,KAOZD,EAAOO,KAAI,EAAGC,OAAMC,UACjBN,EAACC,OAAAA,CAAKM,IAAKF,EAAMH,UAAU,+CACvBF,EAACQ,EAAAA,CAAIC,IAAKH,EAAMI,IAAKC,EAAiBN"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as r}from"../../../../../external/preact/dist/preact.js";import{getCardImageUrl as o,getFullBrandName as
|
|
1
|
+
import{createElement as r}from"../../../../../external/preact/dist/preact.js";import{getCardImageUrl as o,getFullBrandName as t}from"../utils.js";import a from"../../../../../core/Context/useImage.js";import{useState as e}from"../../../../../external/preact/hooks/dist/hooks.js";import n from"../../../../../_virtual/index.js";function c({brand:c,brandsConfiguration:i={}}){var d;const s=a(),u="card"===c?"nocard":c;var m;const l=null!==(m=null===(d=i[c])||void 0===d?void 0:d.icon)&&void 0!==m?m:o(u,s),[p,_]=e(!1),f=n({"adyen-checkout-card-input__icon":!0,"adyen-checkout__card__cardNumber__brandIcon":!0,"adyen-checkout-card-input__icon--hidden":!p});return r("img",{className:f,onLoad:()=>{_(!0)},onError:()=>{_(!1)},alt:t(c),src:l})}export{c as default};
|
|
2
2
|
//# sourceMappingURL=BrandIcon.js.map
|