@adyen/adyen-web 6.28.0 → 6.30.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 +15 -14
- 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 +2688 -2566
- package/dist/es/adyen.css +15 -14
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
- package/dist/es/components/Econtext/Econtext.js +1 -1
- package/dist/es/components/Econtext/Econtext.js.map +1 -1
- package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
- package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
- package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js +1 -1
- package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.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/Iris/Iris.js +2 -0
- package/dist/es/components/Iris/Iris.js.map +1 -0
- package/dist/es/components/Iris/components/IrisComponent.js +2 -0
- package/dist/es/components/Iris/components/IrisComponent.js.map +1 -0
- package/dist/es/components/Iris/components/IrisComponent.module.scss.js +2 -0
- package/dist/es/components/Iris/components/IrisComponent.module.scss.js.map +1 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.js +2 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.js.map +1 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.module.scss.js +2 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.module.scss.js.map +1 -0
- package/dist/es/components/Iris/components/IrisQrCodeInstructions.js +2 -0
- package/dist/es/components/Iris/components/IrisQrCodeInstructions.js.map +1 -0
- package/dist/es/components/Iris/constants.js +2 -0
- package/dist/es/components/Iris/constants.js.map +1 -0
- package/dist/es/components/Iris/types.js +2 -0
- package/dist/es/components/Iris/types.js.map +1 -0
- package/dist/es/components/Iris/utils.js +2 -0
- package/dist/es/components/Iris/utils.js.map +1 -0
- package/dist/es/components/PayTo/components/PayToComponent.js +1 -1
- package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es/components/Pix/components/PixQRDetails.js +1 -1
- package/dist/es/components/Pix/components/PixQRDetails.js.map +1 -1
- package/dist/es/components/UPI/UPI.js +1 -1
- package/dist/es/components/UPI/UPI.js.map +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es/components/UPI/constants.js +1 -1
- package/dist/es/components/UPI/constants.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/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es/components/index.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/Countdown/index.js +1 -1
- package/dist/es/components/internal/Countdown/index.js.map +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
- package/dist/es/components/internal/QRLoader/components/QRDetails.js +1 -1
- package/dist/es/components/internal/QRLoader/components/QRDetails.js.map +1 -1
- package/dist/es/components/internal/QRLoader/components/QRImage.js +1 -1
- package/dist/es/components/internal/QRLoader/components/QRImage.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js +2 -0
- package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -0
- 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/internal/Voucher/utils.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/Analytics/Analytics.js +1 -1
- package/dist/es/core/Analytics/Analytics.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/utils.js +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/index.d.ts +2688 -2566
- package/dist/es/index.js +1 -1
- package/dist/es/language/Language.js.map +1 -1
- package/dist/es/utils/createSdkData.js +2 -0
- package/dist/es/utils/createSdkData.js.map +1 -0
- package/dist/es-legacy/adyen.css +15 -14
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/utils/payment-request.js +1 -1
- package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js.map +1 -1
- package/dist/es-legacy/components/Card/Card.js +1 -1
- package/dist/es-legacy/components/Card/Card.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/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/Installments/Installments.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
- package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
- package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.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/GooglePay/GooglePay.js +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/requests.js +1 -1
- package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
- package/dist/es-legacy/components/Iris/Iris.js +2 -0
- package/dist/es-legacy/components/Iris/Iris.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.module.scss.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.module.scss.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.module.scss.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.module.scss.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisQrCodeInstructions.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisQrCodeInstructions.js.map +1 -0
- package/dist/es-legacy/components/Iris/constants.js +2 -0
- package/dist/es-legacy/components/Iris/constants.js.map +1 -0
- package/dist/es-legacy/components/Iris/types.js +2 -0
- package/dist/es-legacy/components/Iris/types.js.map +1 -0
- package/dist/es-legacy/components/Iris/utils.js +2 -0
- package/dist/es-legacy/components/Iris/utils.js.map +1 -0
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es-legacy/components/Pix/components/PixQRDetails.js +1 -1
- package/dist/es-legacy/components/Pix/components/PixQRDetails.js.map +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
- package/dist/es-legacy/components/UPI/UPI.js +1 -1
- package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es-legacy/components/UPI/constants.js +1 -1
- package/dist/es-legacy/components/UPI/constants.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/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/index.js +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
- package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
- package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
- package/dist/es-legacy/components/internal/Countdown/index.js +1 -1
- package/dist/es-legacy/components/internal/Countdown/index.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/ConsentCheckbox/ConsentCheckbox.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.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/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/IssuerList/IssuerList.js +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerList.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/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRDetails.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRImage.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRImage.js.map +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.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/SegmentedControl/SegmentedControlRegion.js +2 -0
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -0
- package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js +1 -1
- package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
- package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
- package/dist/es-legacy/components/internal/Voucher/utils.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/Analytics/Analytics.js +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js +1 -1
- package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
- package/dist/es-legacy/core/Context/Resources.js +1 -1
- package/dist/es-legacy/core/Context/Resources.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
- package/dist/es-legacy/index.js +1 -1
- package/dist/es-legacy/language/Language.js.map +1 -1
- package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
- package/dist/es-legacy/utils/commonUtils.js.map +1 -1
- package/dist/es-legacy/utils/createSdkData.js +2 -0
- package/dist/es-legacy/utils/createSdkData.js.map +1 -0
- package/dist/es-legacy/utils/useForm/reducer.js +1 -1
- package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
- package/package.json +12 -12
- package/styles/adyen.css +15 -14
- package/dist/es/components/UPI/components/VpaInput/VpaInput.js +0 -2
- package/dist/es/components/UPI/components/VpaInput/VpaInput.js.map +0 -1
- package/dist/es/components/UPI/components/VpaInput/validate.js +0 -2
- package/dist/es/components/UPI/components/VpaInput/validate.js.map +0 -1
- package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js +0 -2
- package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js.map +0 -1
- package/dist/es-legacy/components/UPI/components/VpaInput/validate.js +0 -2
- package/dist/es-legacy/components/UPI/components/VpaInput/validate.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sources":["../../../../../src/components/internal/Modal/Modal.tsx"],"sourcesContent":["import { ComponentChildren, h } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport cx from 'classnames';\nimport './Modal.scss';\nimport { useModal } from './useModal';\n\ntype ModalRenderFnProps = {\n /**\n * Function used to properly trigger the Modal close mechanism. It takes into account the element that the Modal needs\n * to set focus when it is dismissed.\n */\n onCloseModal(): void;\n};\n\ntype ModalProps = {\n children: ({ onCloseModal }: ModalRenderFnProps) => ComponentChildren;\n classNameModifiers?: string[];\n onClose(): void;\n isOpen: boolean;\n isDismissible?: boolean;\n labelledBy: string;\n describedBy: string;\n /**\n * Reference to the element that should be focused when the modal is opened\n */\n focusFirst: HTMLElement;\n /**\n * Reference to the element that should be focused when the modal is closed\n */\n focusAfterClose: HTMLElement;\n};\n\nconst Modal = ({\n children,\n classNameModifiers = [],\n isOpen,\n onClose,\n isDismissible = true,\n labelledBy,\n describedBy,\n focusFirst,\n focusAfterClose,\n ...props\n}: ModalProps) => {\n const modalContainerRef = useRef<HTMLDivElement>();\n const { closeModal, handleClickOutside } = useModal({\n modalElement: modalContainerRef.current,\n isOpen,\n isDismissible,\n focusFirst,\n focusAfterClose,\n onClose\n });\n\n /**\n * It shouldn't propagate ENTER key event to the parent component. This effect suppress the event propagation\n * (e.g. ENTER key press might trigger the payment flow for Card)\n */\n useEffect(() => {\n if (!modalContainerRef.current) return;\n\n const suppressKeyPress = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.code === 'Enter') event.stopPropagation();\n };\n\n modalContainerRef.current.addEventListener('keypress', suppressKeyPress, { capture: true });\n return () => {\n modalContainerRef.current.removeEventListener('keypress', suppressKeyPress);\n };\n }, [modalContainerRef.current]);\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions\n <div\n className={cx(\n 'adyen-checkout__modal-wrapper',\n classNameModifiers.map(m => `adyen-checkout__modal-wrapper--${m}`),\n { 'adyen-checkout__modal-wrapper--open': isOpen }\n )}\n role=\"dialog\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n aria-modal=\"true\"\n aria-hidden={!isOpen}\n onClick={handleClickOutside}\n {...props}\n >\n <div className=\"adyen-checkout__modal\" ref={modalContainerRef}>\n {children({ onCloseModal: closeModal })}\n </div>\n </div>\n );\n};\n\nexport { Modal };\n"],"names":["Modal","
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../../../../src/components/internal/Modal/Modal.tsx"],"sourcesContent":["import { ComponentChildren, h } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport cx from 'classnames';\nimport './Modal.scss';\nimport { useModal } from './useModal';\n\ntype ModalRenderFnProps = {\n /**\n * Function used to properly trigger the Modal close mechanism. It takes into account the element that the Modal needs\n * to set focus when it is dismissed.\n */\n onCloseModal(): void;\n};\n\ntype ModalProps = {\n children: ({ onCloseModal }: ModalRenderFnProps) => ComponentChildren;\n classNameModifiers?: string[];\n onClose(): void;\n isOpen: boolean;\n isDismissible?: boolean;\n labelledBy: string;\n describedBy: string;\n /**\n * Reference to the element that should be focused when the modal is opened\n */\n focusFirst: HTMLElement;\n /**\n * Reference to the element that should be focused when the modal is closed\n */\n focusAfterClose: HTMLElement;\n};\n\nconst Modal = ({\n children,\n classNameModifiers = [],\n isOpen,\n onClose,\n isDismissible = true,\n labelledBy,\n describedBy,\n focusFirst,\n focusAfterClose,\n ...props\n}: ModalProps) => {\n const modalContainerRef = useRef<HTMLDivElement>();\n const { closeModal, handleClickOutside } = useModal({\n modalElement: modalContainerRef.current,\n isOpen,\n isDismissible,\n focusFirst,\n focusAfterClose,\n onClose\n });\n\n /**\n * It shouldn't propagate ENTER key event to the parent component. This effect suppress the event propagation\n * (e.g. ENTER key press might trigger the payment flow for Card)\n */\n useEffect(() => {\n if (!modalContainerRef.current) return;\n\n const suppressKeyPress = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.code === 'Enter') event.stopPropagation();\n };\n\n modalContainerRef.current.addEventListener('keypress', suppressKeyPress, { capture: true });\n return () => {\n modalContainerRef.current.removeEventListener('keypress', suppressKeyPress);\n };\n }, [modalContainerRef.current]);\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions\n <div\n className={cx(\n 'adyen-checkout__modal-wrapper',\n classNameModifiers.map(m => `adyen-checkout__modal-wrapper--${m}`),\n { 'adyen-checkout__modal-wrapper--open': isOpen }\n )}\n role=\"dialog\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n aria-modal=\"true\"\n aria-hidden={!isOpen}\n onClick={handleClickOutside}\n {...props}\n >\n <div className=\"adyen-checkout__modal\" ref={modalContainerRef}>\n {children({ onCloseModal: closeModal })}\n </div>\n </div>\n );\n};\n\nexport { Modal };\n"],"names":["Modal","_0","children","classNameModifiers","isOpen","onClose","isDismissible","labelledBy","describedBy","focusFirst","focusAfterClose","props","modalContainerRef","useRef","closeModal","handleClickOutside","useModal","modalElement","current","useEffect","suppressKeyPress","event","key","code","stopPropagation","addEventListener","capture","removeEventListener","h","div","className","cx","map","m","role","aria-labelledby","aria-describedby","aria-modal","aria-hidden","onClick","ref","onCloseModal"],"mappings":"y9BAgCA,MAAMA,EAAQC,QAACC,SACXA,EAAQC,mBACRA,EAAqB,GAAEC,OACvBA,EAAMC,QACNA,EAAOC,cACPA,GAAgB,EAAIC,WACpBA,EAAUC,YACVA,EAAWC,WACXA,EAAUC,gBACVA,GAEST,EADNU,EAAAA,EAAAA,EAAAA,gIAEH,MAAMC,EAAoBC,KACpBC,WAAEA,EAAUC,mBAAEA,GAAuBC,EAAS,CAChDC,aAAcL,EAAkBM,QAChCd,SACAE,gBACAG,aACAC,kBACAL,YAoBJ,OAbAc,EAAU,KACN,IAAKP,EAAkBM,QAAS,OAEhC,MAAME,EAAoBC,IACJ,UAAdA,EAAMC,KAAkC,UAAfD,EAAME,MAAkBF,EAAMG,mBAI/D,OADAZ,EAAkBM,QAAQO,iBAAiB,WAAYL,EAAkB,CAAEM,SAAS,IAC7E,KACHd,EAAkBM,QAAQS,oBAAoB,WAAYP,KAE/D,CAACR,EAAkBM,UAIlBU,EAACC,wUAAAA,CAAAA,CACGC,UAAWC,EACP,gCACA5B,EAAmB6B,IAAIC,GAAK,kCAAkCA,KAC9D,CAAE,sCAAuC7B,IAE7C8B,KAAK,SACLC,kBAAiB5B,EACjB6B,mBAAkB5B,EAClB6B,aAAW,OACXC,eAAclC,EACdmC,QAASxB,GACLJ,GAEJiB,EAACC,MAAAA,CAAIC,UAAU,wBAAwBU,IAAK5B,GACvCV,EAAS,CAAEuC,aAAc3B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as r,useState as s,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import n from"../CompanyDetails/CompanyDetails.js";import i from"../PersonalDetails/PersonalDetails.js";import a from"../Address/Address.js";import l from"../FormFields/Checkbox/Checkbox.js";import d from"../FormFields/ConsentCheckbox/ConsentCheckbox.js";import{getInitialActiveFieldsets as c,fieldsetsSchema as u,getActiveFieldsData as b}from"./utils.js";import p from"../IbanInput/IbanInput.js";import m from"../FormFields/Field/Field.js";import y from"../FormInstruction/FormInstruction.js";import f from"./useSRPanelForOpenInvoiceErrors.js";import v from"../../../_virtual/index.js";function h(e,r,s){return r in e?Object.defineProperty(e,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[r]=s,e}function C(e){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{},o=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),o.forEach(function(r){h(e,r,s[r])})}return e}function g(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 s=Object.getOwnPropertySymbols(e);r.push.apply(r,s)}return r}(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))}),e}const A={isValid:!1,errorMessage:"consent.checkbox.invalid",error:"consent.checkbox.invalid"};function k(h){var k,j;const{countryCode:
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as r,useState as s,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import n from"../CompanyDetails/CompanyDetails.js";import i from"../PersonalDetails/PersonalDetails.js";import a from"../Address/Address.js";import l from"../FormFields/Checkbox/Checkbox.js";import d from"../FormFields/ConsentCheckbox/ConsentCheckbox.js";import{getInitialActiveFieldsets as c,fieldsetsSchema as u,getActiveFieldsData as b}from"./utils.js";import p from"../IbanInput/IbanInput.js";import m from"../FormFields/Field/Field.js";import y from"../FormInstruction/FormInstruction.js";import f from"./useSRPanelForOpenInvoiceErrors.js";import v from"../../../_virtual/index.js";function h(e,r,s){return r in e?Object.defineProperty(e,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[r]=s,e}function C(e){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{},o=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),o.forEach(function(r){h(e,r,s[r])})}return e}function g(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 s=Object.getOwnPropertySymbols(e);r.push.apply(r,s)}return r}(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))}),e}const A={isValid:!1,errorMessage:"consent.checkbox.invalid",error:"consent.checkbox.invalid"};function k(h){var k,j,D,O;const{countryCode:x,visibility:w}=h,{i18n:F}=t(),P=r({});var S;Object.keys(P.current).length||(null===(S=h.setComponentRef)||void 0===S||S.call(h,P.current));const R=r(!1),E=c(w,h.data),[I,q]=s(E),{current:V}=r(u.reduce((e,r)=>(e[r]=e=>{V[r].current=e},e),{})),M=!!h.consentCheckboxLabel,N=!M&&Object.keys(I).every(e=>!I[e]),_="editable"===w.deliveryAddress&&"hidden"!==w.billingAddress,[L,B]=s(C({},h.data,M&&{consentCheckbox:!1})),[z,G]=s({}),[H,J]=s({}),[K,Q]=s("ready");P.current.showValidation=()=>{R.current=!0,u.forEach(e=>{V[e].current&&V[e].current.showValidation()}),G(C({},M&&{consentCheckbox:L.consentCheckbox?null:A}))},P.current.setStatus=Q,f({errors:z,data:L,props:h,isValidating:R}),o(()=>{const e=Object.keys(I).every(e=>!I[e]||!!H[e]),r=!M||!!H.consentCheckbox,s=e&&r,o=b(I,L);h.onChange({data:o,errors:z,valid:H,isValid:s})},[L,I]);const T=e=>r=>{B(s=>g(C({},s),{[e]:r.data})),J(s=>g(C({},s),{[e]:r.isValid})),G(s=>g(C({},s),{[e]:r.errors}))};return e("div",{className:v({"adyen-checkout__open-invoice":!0,"adyen-checkout__open-invoice--loading":"loading"===K})},e(y,null),I.companyDetails&&e(n,{data:h.data.companyDetails,label:"companyDetails",onChange:T("companyDetails"),setComponentRef:V.companyDetails,visibility:w.companyDetails}),I.personalDetails&&e(i,{data:h.data.personalDetails,requiredFields:h.personalDetailsRequiredFields,label:"personalDetails",onChange:T("personalDetails"),setComponentRef:V.personalDetails,visibility:w.personalDetails}),I.bankAccount&&e(p,{holderName:!0,label:"ach.bankAccount",data:L.bankAccount,onChange:T("bankAccount"),ref:V.bankAccount}),I.billingAddress&&e(a,{allowedCountries:null!==(k=null==h||null===(D=h.billingAddressSpecification)||void 0===D?void 0:D.allowedCountries)&&void 0!==k?k:h.allowedCountries,countryCode:x,requiredFields:h.billingAddressRequiredFields,specifications:h.billingAddressSpecification,data:L.billingAddress,label:"billingAddress",onChange:T("billingAddress"),setComponentRef:V.billingAddress,visibility:w.billingAddress}),_&&e(m,{classNameModifiers:["separateDeliveryAddress","consentCheckbox"],name:"separateDeliveryAddress",useLabelElement:!1,showErrorElement:!1},e(l,{label:F.get("separateDeliveryAddress"),checked:I.deliveryAddress,classNameModifiers:["separateDeliveryAddress"],name:"separateDeliveryAddress",onChange:()=>{q(e=>g(C({},e),{deliveryAddress:!I.deliveryAddress}))}})),I.deliveryAddress&&e(a,{allowedCountries:null!==(j=null==h||null===(O=h.deliveryAddressSpecification)||void 0===O?void 0:O.allowedCountries)&&void 0!==j?j:h.allowedCountries,countryCode:x,requiredFields:h.deliveryAddressRequiredFields,specifications:h.deliveryAddressSpecification,data:L.deliveryAddress,label:"deliveryAddress",onChange:T("deliveryAddress"),setComponentRef:V.deliveryAddress,visibility:w.deliveryAddress}),M&&e(d,{data:L,errorMessage:!!z.consentCheckbox,label:h.consentCheckboxLabel,onChange:e=>{const{checked:r}=e.target;B(e=>g(C({},e),{consentCheckbox:r})),J(e=>g(C({},e),{consentCheckbox:r})),G(e=>C({},e,{consentCheckbox:r?null:A}))},i18n:F}),h.showPayButton&&h.payButton({status:K,classNameModifiers:[...N?["standalone"]:[]],label:F.get("confirmPurchase")}))}export{k as default};
|
|
2
2
|
//# sourceMappingURL=OpenInvoice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenInvoice.js","sources":["../../../../../src/components/internal/OpenInvoice/OpenInvoice.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport CompanyDetails from '../CompanyDetails';\nimport PersonalDetails from '../PersonalDetails';\nimport Address from '../Address';\nimport Checkbox from '../FormFields/Checkbox';\nimport ConsentCheckbox from '../FormFields/ConsentCheckbox';\nimport { getActiveFieldsData, getInitialActiveFieldsets, fieldsetsSchema } from './utils';\nimport {\n OpenInvoiceActiveFieldsets,\n OpenInvoiceFieldsetsRefs,\n OpenInvoiceProps,\n OpenInvoiceStateData,\n OpenInvoiceStateError,\n OpenInvoiceStateValid\n} from './types';\nimport './OpenInvoice.scss';\nimport IbanInput from '../IbanInput';\nimport { GenericError } from '../../../core/Errors/types';\nimport Field from '../FormFields/Field';\nimport FormInstruction from '../FormInstruction';\nimport { ComponentMethodsRef } from '../UIElement/types';\nimport useSRPanelForOpenInvoiceErrors from './useSRPanelForOpenInvoiceErrors';\nimport classNames from 'classnames';\n\nconst consentCBErrorObj: GenericError = {\n isValid: false,\n errorMessage: 'consent.checkbox.invalid',\n error: 'consent.checkbox.invalid'\n};\n\nexport default function OpenInvoice(props: OpenInvoiceProps) {\n const { countryCode, visibility } = props;\n const { i18n } = useCoreContext();\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const openInvoiceRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(openInvoiceRef.current).length) {\n props.setComponentRef?.(openInvoiceRef.current);\n }\n\n const isValidating = useRef(false);\n\n const initialActiveFieldsets: OpenInvoiceActiveFieldsets = getInitialActiveFieldsets(visibility, props.data);\n const [activeFieldsets, setActiveFieldsets] = useState<OpenInvoiceActiveFieldsets>(initialActiveFieldsets);\n\n const { current: fieldsetsRefs } = useRef<OpenInvoiceFieldsetsRefs>(\n fieldsetsSchema.reduce((acc, fieldset) => {\n acc[fieldset] = ref => {\n fieldsetsRefs[fieldset].current = ref;\n };\n return acc;\n }, {})\n );\n\n const checkFieldsets = () => Object.keys(activeFieldsets).every(fieldset => !activeFieldsets[fieldset] || !!valid[fieldset]);\n const hasConsentCheckbox = !!props.consentCheckboxLabel;\n const isStandAloneButton = !hasConsentCheckbox && Object.keys(activeFieldsets).every(key => !activeFieldsets[key]);\n const showSeparateDeliveryAddressCheckbox = visibility.deliveryAddress === 'editable' && visibility.billingAddress !== 'hidden';\n\n const [data, setData] = useState<OpenInvoiceStateData>({\n ...props.data,\n ...(hasConsentCheckbox && { consentCheckbox: false })\n });\n const [errors, setErrors] = useState<OpenInvoiceStateError>({});\n const [valid, setValid] = useState<OpenInvoiceStateValid>({});\n const [status, setStatus] = useState('ready');\n\n // Expose methods expected by parent\n openInvoiceRef.current.showValidation = () => {\n isValidating.current = true;\n fieldsetsSchema.forEach(fieldset => {\n if (fieldsetsRefs[fieldset].current) fieldsetsRefs[fieldset].current.showValidation();\n });\n\n setErrors({\n ...(hasConsentCheckbox && { consentCheckbox: data.consentCheckbox ? null : consentCBErrorObj })\n });\n };\n\n openInvoiceRef.current.setStatus = setStatus;\n\n useSRPanelForOpenInvoiceErrors({ errors, data, props, isValidating });\n\n useEffect(() => {\n const fieldsetsAreValid: boolean = checkFieldsets();\n const consentCheckboxValid: boolean = !hasConsentCheckbox || !!valid.consentCheckbox;\n const isValid: boolean = fieldsetsAreValid && consentCheckboxValid;\n const newData: OpenInvoiceStateData = getActiveFieldsData(activeFieldsets, data);\n props.onChange({ data: newData, errors, valid, isValid });\n }, [data, activeFieldsets]);\n\n const handleFieldset = key => state => {\n setData(prevData => ({ ...prevData, [key]: state.data }));\n setValid(prevValid => ({ ...prevValid, [key]: state.isValid }));\n setErrors(prevErrors => ({ ...prevErrors, [key]: state.errors }));\n };\n\n const handleSeparateDeliveryAddress = () => {\n setActiveFieldsets(prevActiveFields => ({\n ...prevActiveFields,\n deliveryAddress: !activeFieldsets.deliveryAddress\n }));\n };\n\n const handleConsentCheckbox = e => {\n const { checked } = e.target;\n setData(prevData => ({ ...prevData, consentCheckbox: checked }));\n setValid(prevValid => ({ ...prevValid, consentCheckbox: checked }));\n setErrors(prevErrors => ({ ...prevErrors, ...{ consentCheckbox: !checked ? consentCBErrorObj : null } }));\n };\n return (\n <div\n className={classNames({\n 'adyen-checkout__open-invoice': true,\n 'adyen-checkout__open-invoice--loading': status === 'loading'\n })}\n >\n <FormInstruction />\n\n {activeFieldsets.companyDetails && (\n <CompanyDetails\n data={props.data.companyDetails}\n label=\"companyDetails\"\n onChange={handleFieldset('companyDetails')}\n setComponentRef={fieldsetsRefs.companyDetails}\n visibility={visibility.companyDetails}\n />\n )}\n\n {activeFieldsets.personalDetails && (\n <PersonalDetails\n data={props.data.personalDetails}\n requiredFields={props.personalDetailsRequiredFields}\n label=\"personalDetails\"\n onChange={handleFieldset('personalDetails')}\n setComponentRef={fieldsetsRefs.personalDetails}\n visibility={visibility.personalDetails}\n />\n )}\n\n {activeFieldsets.bankAccount && (\n <IbanInput\n holderName={true}\n label=\"ach.bankAccount\"\n data={data.bankAccount}\n onChange={handleFieldset('bankAccount')}\n ref={fieldsetsRefs.bankAccount}\n />\n )}\n\n {activeFieldsets.billingAddress && (\n <Address\n allowedCountries={props?.billingAddressSpecification?.allowedCountries ?? props.allowedCountries}\n countryCode={countryCode}\n requiredFields={props.billingAddressRequiredFields}\n specifications={props.billingAddressSpecification}\n data={data.billingAddress}\n label=\"billingAddress\"\n onChange={handleFieldset('billingAddress')}\n setComponentRef={fieldsetsRefs.billingAddress}\n visibility={visibility.billingAddress}\n />\n )}\n\n {showSeparateDeliveryAddressCheckbox && (\n <Field\n classNameModifiers={['separateDeliveryAddress', 'consentCheckbox']}\n name={'separateDeliveryAddress'}\n useLabelElement={false}\n showErrorElement={false}\n >\n <Checkbox\n label={i18n.get('separateDeliveryAddress')}\n checked={activeFieldsets.deliveryAddress}\n classNameModifiers={['separateDeliveryAddress']}\n name={'separateDeliveryAddress'}\n onChange={handleSeparateDeliveryAddress}\n />\n </Field>\n )}\n\n {activeFieldsets.deliveryAddress && (\n <Address\n allowedCountries={props?.deliveryAddressSpecification?.allowedCountries ?? props.allowedCountries}\n countryCode={countryCode}\n requiredFields={props.deliveryAddressRequiredFields}\n specifications={props.deliveryAddressSpecification}\n data={data.deliveryAddress}\n label=\"deliveryAddress\"\n onChange={handleFieldset('deliveryAddress')}\n setComponentRef={fieldsetsRefs.deliveryAddress}\n visibility={visibility.deliveryAddress}\n />\n )}\n\n {hasConsentCheckbox && (\n <ConsentCheckbox\n data={data}\n errorMessage={!!errors.consentCheckbox}\n label={props.consentCheckboxLabel}\n onChange={handleConsentCheckbox}\n i18n={i18n}\n />\n )}\n\n {props.showPayButton &&\n props.payButton({\n status,\n classNameModifiers: [...(isStandAloneButton ? ['standalone'] : [])],\n label: i18n.get('confirmPurchase')\n })}\n </div>\n );\n}\n"],"names":["consentCBErrorObj","isValid","errorMessage","error","OpenInvoice","props","countryCode","visibility","i18n","useCoreContext","openInvoiceRef","useRef","Object","keys","current","length","setComponentRef","isValidating","initialActiveFieldsets","getInitialActiveFieldsets","data","activeFieldsets","setActiveFieldsets","useState","fieldsetsRefs","fieldsetsSchema","reduce","acc","fieldset","ref","hasConsentCheckbox","consentCheckboxLabel","isStandAloneButton","every","key","showSeparateDeliveryAddressCheckbox","deliveryAddress","billingAddress","setData","_object_spread","consentCheckbox","errors","setErrors","valid","setValid","status","setStatus","showValidation","forEach","useSRPanelForOpenInvoiceErrors","useEffect","fieldsetsAreValid","consentCheckboxValid","newData","getActiveFieldsData","onChange","handleFieldset","state","prevData","_object_spread_props","prevValid","prevErrors","h","div","className","classNames","FormInstruction","companyDetails","CompanyDetails","label","personalDetails","PersonalDetails","requiredFields","personalDetailsRequiredFields","bankAccount","IbanInput","holderName","Address","allowedCountries","billingAddressSpecification","billingAddressRequiredFields","specifications","Field","classNameModifiers","name","useLabelElement","showErrorElement","Checkbox","get","checked","prevActiveFields","deliveryA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iBiD,KACrD7C,EAASgB,GAAcD,EAAApB,EAAA,CAAA,EAAKqB,GAAAA,CAAWpB,gBAAiBiD,KACxD/C,EAAUmB,GAAetB,EAAA,CAAA,EAAKsB,EAAe,CAAErB,gBAAkBiD,EAA8B,KAApBzF,MA6F/DQ,KAAMA,IAIbH,EAAM2F,eACH3F,EAAM4F,UAAU,CACZpD,SACAsC,mBAAoB,IAAKnD,EAAqB,CAAC,cAAgB,IAC/DqC,MAAO7D,EAAKgF,IAAI,qBAIpC"}
|
|
1
|
+
{"version":3,"file":"OpenInvoice.js","sources":["../../../../../src/components/internal/OpenInvoice/OpenInvoice.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport CompanyDetails from '../CompanyDetails';\nimport PersonalDetails from '../PersonalDetails';\nimport Address from '../Address';\nimport Checkbox from '../FormFields/Checkbox';\nimport ConsentCheckbox from '../FormFields/ConsentCheckbox';\nimport { getActiveFieldsData, getInitialActiveFieldsets, fieldsetsSchema } from './utils';\nimport {\n OpenInvoiceActiveFieldsets,\n OpenInvoiceFieldsetsRefs,\n OpenInvoiceProps,\n OpenInvoiceStateData,\n OpenInvoiceStateError,\n OpenInvoiceStateValid\n} from './types';\nimport './OpenInvoice.scss';\nimport IbanInput from '../IbanInput';\nimport { GenericError } from '../../../core/Errors/types';\nimport Field from '../FormFields/Field';\nimport FormInstruction from '../FormInstruction';\nimport { ComponentMethodsRef } from '../UIElement/types';\nimport useSRPanelForOpenInvoiceErrors from './useSRPanelForOpenInvoiceErrors';\nimport classNames from 'classnames';\n\nconst consentCBErrorObj: GenericError = {\n isValid: false,\n errorMessage: 'consent.checkbox.invalid',\n error: 'consent.checkbox.invalid'\n};\n\nexport default function OpenInvoice(props: OpenInvoiceProps) {\n const { countryCode, visibility } = props;\n const { i18n } = useCoreContext();\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const openInvoiceRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(openInvoiceRef.current).length) {\n props.setComponentRef?.(openInvoiceRef.current);\n }\n\n const isValidating = useRef(false);\n\n const initialActiveFieldsets: OpenInvoiceActiveFieldsets = getInitialActiveFieldsets(visibility, props.data);\n const [activeFieldsets, setActiveFieldsets] = useState<OpenInvoiceActiveFieldsets>(initialActiveFieldsets);\n\n const { current: fieldsetsRefs } = useRef<OpenInvoiceFieldsetsRefs>(\n fieldsetsSchema.reduce((acc, fieldset) => {\n acc[fieldset] = ref => {\n fieldsetsRefs[fieldset].current = ref;\n };\n return acc;\n }, {})\n );\n\n const checkFieldsets = () => Object.keys(activeFieldsets).every(fieldset => !activeFieldsets[fieldset] || !!valid[fieldset]);\n const hasConsentCheckbox = !!props.consentCheckboxLabel;\n const isStandAloneButton = !hasConsentCheckbox && Object.keys(activeFieldsets).every(key => !activeFieldsets[key]);\n const showSeparateDeliveryAddressCheckbox = visibility.deliveryAddress === 'editable' && visibility.billingAddress !== 'hidden';\n\n const [data, setData] = useState<OpenInvoiceStateData>({\n ...props.data,\n ...(hasConsentCheckbox && { consentCheckbox: false })\n });\n const [errors, setErrors] = useState<OpenInvoiceStateError>({});\n const [valid, setValid] = useState<OpenInvoiceStateValid>({});\n const [status, setStatus] = useState('ready');\n\n // Expose methods expected by parent\n openInvoiceRef.current.showValidation = () => {\n isValidating.current = true;\n fieldsetsSchema.forEach(fieldset => {\n if (fieldsetsRefs[fieldset].current) fieldsetsRefs[fieldset].current.showValidation();\n });\n\n setErrors({\n ...(hasConsentCheckbox && { consentCheckbox: data.consentCheckbox ? null : consentCBErrorObj })\n });\n };\n\n openInvoiceRef.current.setStatus = setStatus;\n\n useSRPanelForOpenInvoiceErrors({ errors, data, props, isValidating });\n\n useEffect(() => {\n const fieldsetsAreValid: boolean = checkFieldsets();\n const consentCheckboxValid: boolean = !hasConsentCheckbox || !!valid.consentCheckbox;\n const isValid: boolean = fieldsetsAreValid && consentCheckboxValid;\n const newData: OpenInvoiceStateData = getActiveFieldsData(activeFieldsets, data);\n props.onChange({ data: newData, errors, valid, isValid });\n }, [data, activeFieldsets]);\n\n const handleFieldset = key => state => {\n setData(prevData => ({ ...prevData, [key]: state.data }));\n setValid(prevValid => ({ ...prevValid, [key]: state.isValid }));\n setErrors(prevErrors => ({ ...prevErrors, [key]: state.errors }));\n };\n\n const handleSeparateDeliveryAddress = () => {\n setActiveFieldsets(prevActiveFields => ({\n ...prevActiveFields,\n deliveryAddress: !activeFieldsets.deliveryAddress\n }));\n };\n\n const handleConsentCheckbox = e => {\n const { checked } = e.target;\n setData(prevData => ({ ...prevData, consentCheckbox: checked }));\n setValid(prevValid => ({ ...prevValid, consentCheckbox: checked }));\n setErrors(prevErrors => ({ ...prevErrors, ...{ consentCheckbox: !checked ? consentCBErrorObj : null } }));\n };\n return (\n <div\n className={classNames({\n 'adyen-checkout__open-invoice': true,\n 'adyen-checkout__open-invoice--loading': status === 'loading'\n })}\n >\n <FormInstruction />\n\n {activeFieldsets.companyDetails && (\n <CompanyDetails\n data={props.data.companyDetails}\n label=\"companyDetails\"\n onChange={handleFieldset('companyDetails')}\n setComponentRef={fieldsetsRefs.companyDetails}\n visibility={visibility.companyDetails}\n />\n )}\n\n {activeFieldsets.personalDetails && (\n <PersonalDetails\n data={props.data.personalDetails}\n requiredFields={props.personalDetailsRequiredFields}\n label=\"personalDetails\"\n onChange={handleFieldset('personalDetails')}\n setComponentRef={fieldsetsRefs.personalDetails}\n visibility={visibility.personalDetails}\n />\n )}\n\n {activeFieldsets.bankAccount && (\n <IbanInput\n holderName={true}\n label=\"ach.bankAccount\"\n data={data.bankAccount}\n onChange={handleFieldset('bankAccount')}\n ref={fieldsetsRefs.bankAccount}\n />\n )}\n\n {activeFieldsets.billingAddress && (\n <Address\n allowedCountries={props?.billingAddressSpecification?.allowedCountries ?? props.allowedCountries}\n countryCode={countryCode}\n requiredFields={props.billingAddressRequiredFields}\n specifications={props.billingAddressSpecification}\n data={data.billingAddress}\n label=\"billingAddress\"\n onChange={handleFieldset('billingAddress')}\n setComponentRef={fieldsetsRefs.billingAddress}\n visibility={visibility.billingAddress}\n />\n )}\n\n {showSeparateDeliveryAddressCheckbox && (\n <Field\n classNameModifiers={['separateDeliveryAddress', 'consentCheckbox']}\n name={'separateDeliveryAddress'}\n useLabelElement={false}\n showErrorElement={false}\n >\n <Checkbox\n label={i18n.get('separateDeliveryAddress')}\n checked={activeFieldsets.deliveryAddress}\n classNameModifiers={['separateDeliveryAddress']}\n name={'separateDeliveryAddress'}\n onChange={handleSeparateDeliveryAddress}\n />\n </Field>\n )}\n\n {activeFieldsets.deliveryAddress && (\n <Address\n allowedCountries={props?.deliveryAddressSpecification?.allowedCountries ?? props.allowedCountries}\n countryCode={countryCode}\n requiredFields={props.deliveryAddressRequiredFields}\n specifications={props.deliveryAddressSpecification}\n data={data.deliveryAddress}\n label=\"deliveryAddress\"\n onChange={handleFieldset('deliveryAddress')}\n setComponentRef={fieldsetsRefs.deliveryAddress}\n visibility={visibility.deliveryAddress}\n />\n )}\n\n {hasConsentCheckbox && (\n <ConsentCheckbox\n data={data}\n errorMessage={!!errors.consentCheckbox}\n label={props.consentCheckboxLabel}\n onChange={handleConsentCheckbox}\n i18n={i18n}\n />\n )}\n\n {props.showPayButton &&\n props.payButton({\n status,\n classNameModifiers: [...(isStandAloneButton ? ['standalone'] : [])],\n label: i18n.get('confirmPurchase')\n })}\n </div>\n );\n}\n"],"names":["consentCBErrorObj","isValid","errorMessage","error","OpenInvoice","props","countryCode","visibility","i18n","useCoreContext","openInvoiceRef","useRef","Object","keys","current","length","setComponentRef","isValidating","initialActiveFieldsets","getInitialActiveFieldsets","data","activeFieldsets","setActiveFieldsets","useState","fieldsetsRefs","fieldsetsSchema","reduce","acc","fieldset","ref","hasConsentCheckbox","consentCheckboxLabel","isStandAloneButton","every","key","showSeparateDeliveryAddressCheckbox","deliveryAddress","billingAddress","setData","_object_spread","consentCheckbox","errors","setErrors","valid","setValid","status","setStatus","showValidation","forEach","useSRPanelForOpenInvoiceErrors","useEffect","fieldsetsAreValid","consentCheckboxValid","newData","getActiveFieldsData","onChange","handleFieldset","state","prevData","_object_spread_props","prevValid","prevErrors","h","div","className","classNames","FormInstruction","companyDetails","CompanyDetails","label","personalDetails","PersonalDetails","requiredFields","personalDetailsRequiredFields","bankAccount","IbanInput","holderName","Address","allowedCountries","_ref","billingAddressSpecification","billingAddressRequiredFields","specifications","Field","classNameModifiers","name","useLabelElement","showErrorElement","Checkbox","get","checked","prevActiveFields","_ref1","deliveryAddressSpecification","deliveryAddressRequiredFields","ConsentCheckbox","e","target","showPayButton","payButton"],"mappings":"smDA0BA,MAAMA,EAAkC,CACpCC,SAAS,EACTC,aAAc,2BACdC,MAAO,4BAGI,SAASC,EAAYC,WA2HEA,EA+BAA,EAzJlC,MAAMC,YAAEA,EAAWC,WAAEA,GAAeF,GAC9BG,KAAEA,GAASC,IAGXC,EAAiBC,EAA4B,IAG/CN,IAAAA,EADCO,OAAOC,KAAKH,EAAeI,SAASC,SAChB,QAArBV,EAAAA,EAAMW,2BAANX,GAAAA,EAAAA,KAAAA,EAAwBK,EAAeI,UAG3C,MAAMG,EAAeN,GAAO,GAEtBO,EAAqDC,EAA0BZ,EAAYF,EAAMe,OAChGC,EAAiBC,GAAsBC,EAAqCL,IAE3EJ,QAASU,GAAkBb,EAC/Bc,EAAgBC,OAAO,CAACC,EAAKC,KACzBD,EAAIC,GAAYC,IACZL,EAAcI,GAAUd,QAAUe,GAE/BF,GACR,CAAA,IAIDG,IAAuBzB,EAAM0B,qBAC7BC,GAAsBF,GAAsBlB,OAAOC,KAAKQ,GAAiBY,MAAMC,IAAQb,EAAgBa,IACvGC,EAAqE,aAA/B5B,EAAW6B,iBAAgE,WAA9B7B,EAAW8B,gBAE7FjB,EAAMkB,GAAWf,EAA+BgB,EAAA,GAChDlC,EAAMe,KACLU,GAAsB,CAAEU,iBAAiB,MAE1CC,EAAQC,GAAanB,EAAgC,CAAA,IACrDoB,EAAOC,G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gB,gBACXiC,MAAM,kBACNd,SAAUC,EAAe,mBACzBxC,gBAAiBQ,EAAcY,gBAC/B7B,WAAYA,EAAW6B,kBAI9BN,GACGgC,EAACiC,EAAAA,CACG3E,KAAMA,EACNlB,eAAgBuC,EAAOD,gBACvB6B,MAAOhE,EAAM0B,qBACbwB,SAhGcyC,IAC1B,MAAMN,QAAEA,GAAYM,EAAEC,OACtB3D,EAAQoB,GAAaC,EAAApB,EAAA,CAAA,EAAKmB,GAAAA,CAAUlB,gBAAiBkD,KACrD9C,EAASgB,GAAcD,EAAApB,EAAA,CAAA,EAAKqB,GAAAA,CAAWpB,gBAAiBkD,KACxDhD,EAAUmB,GAAetB,EAAA,CAAA,EAAKsB,EAAe,CAAErB,gBAAkBkD,EAA8B,KAApB1F,MA6F/DQ,KAAMA,IAIbH,EAAM6F,eACH7F,EAAM8F,UAAU,CACZtD,SACAuC,mBAAoB,IAAKpD,EAAqB,CAAC,cAAgB,IAC/DqC,MAAO7D,EAAKiF,IAAI,qBAIpC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useState as e,useMemo as r,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{enhanceErrorObjectKeys as t}from"../../../core/Errors/utils.js";import{COMPANY_DETAILS_SCHEMA as s}from"../CompanyDetails/CompanyDetails.js";import{PERSONAL_DETAILS_SCHEMA as l}from"../PersonalDetails/PersonalDetails.js";import{ERROR_ACTION_BLUR_SCENARIO as
|
|
1
|
+
import{useState as e,useMemo as r,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{enhanceErrorObjectKeys as t}from"../../../core/Errors/utils.js";import{COMPANY_DETAILS_SCHEMA as s}from"../CompanyDetails/CompanyDetails.js";import{PERSONAL_DETAILS_SCHEMA as l}from"../PersonalDetails/PersonalDetails.js";import{ERROR_ACTION_BLUR_SCENARIO as n,ERROR_ACTION_FOCUS_FIELD as i}from"../../../core/Errors/constants.js";import c from"../../../core/Errors/useSRPanelContext.js";import a from"../Address/Specifications.js";import{setFocusOnField as d}from"../../../utils/setFocus.js";import{usePrevious as u}from"../../../utils/hookUtils.js";import{getArrayDifferences as f}from"../../../utils/arrayUtils.js";import{mapFieldKey as p}from"./utils.js";function y(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function m(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{},t=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),t.forEach(function(r){y(e,r,o[r])})}return e}function b(e,r){if(null==e)return{};var o,t,s,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(e),s=0;s<o.length;s++)t=o[s],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(l[t]=e[t]);return l}if(l=function(e,r){if(null==e)return{};var o,t,s={},l=Object.getOwnPropertyNames(e);for(t=0;t<l.length;t++)o=l[t],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o]);return s}(e,r),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(e),s=0;s<o.length;s++)t=o[s],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(l[t]=e[t]);return l}const v=({errors:y,data:v,props:g,isValidating:j})=>{const[O,h]=e(null),A=u(O),{setSRMessagesFromObjects:F,setSRMessagesFromStrings:S,clearSRPanel:w,shouldMoveFocusSR:k}=c(),P=null==F?void 0:F({fieldTypeMappingFn:p}),D=r(()=>new a,[]),E=r(()=>new a(g.deliveryAddressSpecification),[]);o(()=>{try{var e,r,o,c,a;const u="deliveryAddress:",p="billingAddress:",{companyDetails:O,personalDetails:F,bankAccount:C,billingAddress:R,deliveryAddress:x}=y,T=b(y,["companyDetails","personalDetails","bankAccount","billingAddress","deliveryAddress"]),M=t(R,p),$=t(x,u),L=m({},"object"==typeof O&&O,"object"==typeof F&&F,"object"==typeof C&&C,"object"==typeof M&&M,"object"==typeof $&&$,T),_=s,I=null!==(e=g.personalDetailsRequiredFields)&&void 0!==e?e:l,K=l.filter(e=>null==I?void 0:I.includes(e)),U=["holder","iban"],V=D.getAddressSchemaForCountryFlat(null===(r=v.billingAddress)||void 0===r?void 0:r.country).map(e=>`${p}${e}`),q=E.getAddressSchemaForCountryFlat(null===(o=v.deliveryAddress)||void 0===o?void 0:o.country).map(e=>`${u}${e}`),B=_.concat(K,U,V,q,["consentCheckbox"]),N=D.getAddressLabelsForCountry(null===(c=v.billingAddress)||void 0===c?void 0:c.country),z=E.getAddressLabelsForCountry(null===(a=v.deliveryAddress)||void 0===a?void 0:a.country),G=null==P?void 0:P({errors:L,isValidating:j.current,layout:B,countrySpecificLabels:m({},N,z)}),H=null==G?void 0:G.currentErrorsSortedByLayout;switch(h(H),null==G?void 0:G.action){case i:{const e=G.fieldToFocus.includes(":")?G.fieldToFocus.split(":")[1]:G.fieldToFocus;let r="";const o=G.fieldToFocus.includes(":")?G.fieldToFocus.split(":")[0]:"";o.length&&(r=`.adyen-checkout__fieldset--${o} `),k&&d(".adyen-checkout__open-invoice",e,r),setTimeout(()=>{j.current=!1},300);break}case n:{const e=f(H,A,"field"),r=null==e?void 0:e[0];if(r){const e="shopperEmail"===r.field&&"field.error.invalid"===r.errorCode?r.errorMessage:null;S(e)}else w();break}}}catch(e){}},[y,v])};export{v as default};
|
|
2
2
|
//# sourceMappingURL=useSRPanelForOpenInvoiceErrors.js.map
|
package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSRPanelForOpenInvoiceErrors.js","sources":["../../../../../src/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.ts"],"sourcesContent":["import { useEffect, useState, useMemo, MutableRef } from 'preact/hooks';\nimport { enhanceErrorObjectKeys } from '../../../core/Errors/utils';\nimport { COMPANY_DETAILS_SCHEMA } from '../CompanyDetails/CompanyDetails';\nimport { PERSONAL_DETAILS_SCHEMA } from '../PersonalDetails/PersonalDetails';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport Specifications from '../Address/Specifications';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport { usePrevious } from '../../../utils/hookUtils';\nimport { getArrayDifferences } from '../../../utils/arrayUtils';\nimport { mapFieldKey } from './utils';\nimport { OpenInvoiceProps, OpenInvoiceStateData, OpenInvoiceStateError } from './types';\n\ninterface UseSRPanelForErrorsProps {\n errors: OpenInvoiceStateError;\n data: OpenInvoiceStateData;\n props: OpenInvoiceProps;\n isValidating: MutableRef<boolean>;\n}\n\nconst useSRPanelForOpenInvoiceErrors = ({ errors, data, props, isValidating }: UseSRPanelForErrorsProps) => {\n // Relates to onBlur errors\n const [sortedErrorList, setSortedErrorList] = useState(null);\n // Get the previous value (Relates to onBlur errors)\n const previousSortedErrors = usePrevious(sortedErrorList);\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const billingAddressSpecifications = useMemo(() => new Specifications(), []);\n const deliveryAddressSpecifications = useMemo(() => new Specifications(props.deliveryAddressSpecification), []);\n\n useEffect(() => {\n try {\n const DELIVERY_ADDRESS_PREFIX = 'deliveryAddress:';\n const BILLING_ADDRESS_PREFIX = 'billingAddress:';\n\n /** Create messages for SRPanel */\n // Extract nested errors from the various child components...\n const {\n companyDetails: extractedCompanyDetailsErrors,\n personalDetails: extractedPersonalDetailsErrors,\n bankAccount: extractedBankAccountErrors,\n billingAddress: extractedBillingAddressErrors,\n deliveryAddress: extractedDeliveryAddressErrors,\n ...remainingErrors\n } = errors;\n\n // Differentiate between billingAddress and deliveryAddress errors by adding a prefix.\n // This also allows overlapping errors e.g. now that addresses can contain first & last name fields\n const enhancedBillingAddressErrors = enhanceErrorObjectKeys(extractedBillingAddressErrors, BILLING_ADDRESS_PREFIX);\n const enhancedDeliveryAddressErrors = enhanceErrorObjectKeys(extractedDeliveryAddressErrors, DELIVERY_ADDRESS_PREFIX);\n\n // ...and then collate the errors into a new object so that they all sit at top level\n const errorsForPanel = {\n ...(typeof extractedCompanyDetailsErrors === 'object' && extractedCompanyDetailsErrors),\n ...(typeof extractedPersonalDetailsErrors === 'object' && extractedPersonalDetailsErrors),\n ...(typeof extractedBankAccountErrors === 'object' && extractedBankAccountErrors),\n ...(typeof enhancedBillingAddressErrors === 'object' && enhancedBillingAddressErrors),\n ...(typeof enhancedDeliveryAddressErrors === 'object' && enhancedDeliveryAddressErrors),\n ...remainingErrors\n };\n\n // Create layout\n const companyDetailsLayout: string[] = COMPANY_DETAILS_SCHEMA;\n\n const personalDetailsReqFields: string[] = props.personalDetailsRequiredFields ?? PERSONAL_DETAILS_SCHEMA;\n const personalDetailLayout: string[] = PERSONAL_DETAILS_SCHEMA.filter(x => personalDetailsReqFields?.includes(x));\n\n const bankAccountLayout = ['holder', 'iban'];\n\n const billingAddressLayout = billingAddressSpecifications.getAddressSchemaForCountryFlat(data.billingAddress?.country);\n // In order to sort the address errors the layout entries need to have the same (prefixed) identifier as the errors themselves\n const billingAddressLayoutEnhanced = billingAddressLayout.map(item => `${BILLING_ADDRESS_PREFIX}${item}`);\n\n const deliveryAddressLayout = deliveryAddressSpecifications.getAddressSchemaForCountryFlat(data.deliveryAddress?.country);\n const deliveryAddressLayoutEnhanced = deliveryAddressLayout.map(item => `${DELIVERY_ADDRESS_PREFIX}${item}`);\n\n const fullLayout = companyDetailsLayout.concat(\n personalDetailLayout,\n bankAccountLayout,\n billingAddressLayoutEnhanced,\n deliveryAddressLayoutEnhanced,\n ['consentCheckbox']\n );\n\n // Country specific address labels\n const countrySpecificLabels_billing = billingAddressSpecifications.getAddressLabelsForCountry(data.billingAddress?.country);\n const countrySpecificLabels_delivery = deliveryAddressSpecifications.getAddressLabelsForCountry(data.deliveryAddress?.country);\n\n // Set messages: Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: fullLayout,\n countrySpecificLabels: { ...countrySpecificLabels_billing, ...countrySpecificLabels_delivery }\n });\n\n // Relates to onBlur errors\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout); // Relates to onBlur errors\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD: {\n /**\n * For prefixed fields (ones that can occur twice but in different contexts i.e. billingAddress & deliveryAddress) - consider the prefix...\n */\n // ...Firstly strip it to gain a \"clean\" reference to the field...\n const fieldToFocus = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[1] : srPanelResp.fieldToFocus; // country, street etc\n\n // ...Secondly use the prefix to add context for when we try to select it\n let focusContextSelector = '';\n const focusContext = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[0] : ''; // 'billingAddress' | 'deliveryAddress'\n if (focusContext.length) {\n focusContextSelector = `.adyen-checkout__fieldset--${focusContext} `;\n }\n\n // Focus first field in error, if required\n if (shouldMoveFocusSR) setFocusOnField('.adyen-checkout__open-invoice', fieldToFocus, focusContextSelector);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n }\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Is error actually a blur based one - depends on the specific fields in a component as to whether they validate on blur\n const isBlurBasedError = latestErrorMsg.field === 'shopperEmail' && latestErrorMsg.errorCode === 'field.error.invalid';\n\n // Only add blur based errors to the error panel - doing this step prevents the non-blur based errors from being read out twice\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n clearSRPanel();\n }\n\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors, data]);\n};\n\nexport default useSRPanelForOpenInvoiceErrors;\n"],"names":["useSRPanelForOpenInvoiceErrors","errors","data","props","isValidating","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressSpecifications","useMemo","Specifications","deliveryAddressSpecifications","deliveryAddressSpecification","useEffect","DELIVERY_ADDRESS_PREFIX","BILLING_ADDRESS_PREFIX","companyDetails","extractedCompanyDetailsErrors","personalDetails","extractedPersonalDetailsErrors","bankAccount","extractedBankAccountErrors","billingAddress","extractedBillingAddressErrors","deliveryAddress","extractedDeliveryAddressErrors","remainingErrors","enhancedBillingAddressErrors","enhanceErrorObjectKeys","enhancedDeliveryAddressErrors","errorsForPanel","_object_spread","companyDetailsLayout","COMPANY_DETAILS_SCHEMA","personalDetailsReqFields","personalDetailsRequiredFields","PERSONAL_DETAILS_SCHEMA","personalDetailLayout","filter","x","includes","bankAccountLayout","billingAddressLayoutEnhanced","getAddressSchemaForCountryFlat","country","map","item","deliveryAddressLayoutEnhanced","fullLayout","concat","countrySpecificLabels_billing","getAddressLabelsForCountry","countrySpecificLabels_delivery","srPanelResp","current","layout","countrySpecificLabels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","split","focusContextSelector","focusContext","length","setFocusOnField","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","field","errorCode","errorMessage","_"],"mappings":"6iDAsBA,MAAMA,EAAiC,EAAGC,SAAQC,OAAMC,QAAOC,mBAE3D,MAAOC,EAAiBC,GAAsBC,EAAS,MAEjDC,EAAuBC,EAAYJ,IACnCK,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAE1FC,EAAuCL,aAAAA,EAAAA,EAA2B,CACpEM,mBAAoBC,IAGlBC,EAA+BC,EAAQ,IAAM,IAAIC,EAAkB,IACnEC,EAAgCF,EAAQ,IAAM,IAAIC,EAAejB,EAAMmB,8BAA+B,IAE5GC,EAAU,KACN,IAsC6FrB,IAAAA,EAIEA,EAYGA,EACEA,EAtDhG,MAAMsB,EAA0B,mBAC1BC,EAAyB,mBAK3BC,eAAgBC,EAChBC,gBAAiBC,EACjBC,YAAaC,EACbC,eAAgBC,EAChBC,gBAAiBC,GAEjBlC,EADGmC,EAAAA,EACHnC,EAAAA,CANAyB,iBACAE,kBACAE,cACAE,iBACAE,oBAMEG,EAA+BC,EAAuBL,EAA+BR,GACrFc,EAAgCD,EAAuBH,EAAgCX,GAGvFgB,EAAiBC,KAC0B,iBAAlCd,GAA8CA,EACX,iBAAnCE,GAA+CA,EAChB,iBAA/BE,GAA2CA,EACV,iBAAjCM,GAA6CA,EACX,iBAAlCE,GAA8CA,EACtDH,GAIDM,EAAiCC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AgB,gCAAiCL,EAAcE,GAEtFI,WAAW,KACPxE,EAAa4D,SAAU,GACxB,KACH,KACJ,CAKA,KAAKa,EAA4B,CAC7B,MAAMC,EAAaC,EAAoBZ,EAA6B3D,EAAsB,SAEpFwE,EAAiBF,aAAAA,EAAAA,EAAa,GAEpC,GAAIE,EAAgB,CAEhB,MAGMC,EAH4C,iBAAzBD,EAAeE,OAAyD,wBAA7BF,EAAeG,UAG1CH,EAAeI,aAAe,KACvEzE,EAAyBsE,EAC7B,MAEIrE,IAGJ,KACJ,EAIR,CAAE,MAAOyE,GAET,GACD,CAACpF,EAAQC"}
|
|
1
|
+
{"version":3,"file":"useSRPanelForOpenInvoiceErrors.js","sources":["../../../../../src/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.ts"],"sourcesContent":["import { useEffect, useState, useMemo, MutableRef } from 'preact/hooks';\nimport { enhanceErrorObjectKeys } from '../../../core/Errors/utils';\nimport { COMPANY_DETAILS_SCHEMA } from '../CompanyDetails/CompanyDetails';\nimport { PERSONAL_DETAILS_SCHEMA } from '../PersonalDetails/PersonalDetails';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport Specifications from '../Address/Specifications';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport { usePrevious } from '../../../utils/hookUtils';\nimport { getArrayDifferences } from '../../../utils/arrayUtils';\nimport { mapFieldKey } from './utils';\nimport { OpenInvoiceProps, OpenInvoiceStateData, OpenInvoiceStateError } from './types';\n\ninterface UseSRPanelForErrorsProps {\n errors: OpenInvoiceStateError;\n data: OpenInvoiceStateData;\n props: OpenInvoiceProps;\n isValidating: MutableRef<boolean>;\n}\n\nconst useSRPanelForOpenInvoiceErrors = ({ errors, data, props, isValidating }: UseSRPanelForErrorsProps) => {\n // Relates to onBlur errors\n const [sortedErrorList, setSortedErrorList] = useState(null);\n // Get the previous value (Relates to onBlur errors)\n const previousSortedErrors = usePrevious(sortedErrorList);\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const billingAddressSpecifications = useMemo(() => new Specifications(), []);\n const deliveryAddressSpecifications = useMemo(() => new Specifications(props.deliveryAddressSpecification), []);\n\n useEffect(() => {\n try {\n const DELIVERY_ADDRESS_PREFIX = 'deliveryAddress:';\n const BILLING_ADDRESS_PREFIX = 'billingAddress:';\n\n /** Create messages for SRPanel */\n // Extract nested errors from the various child components...\n const {\n companyDetails: extractedCompanyDetailsErrors,\n personalDetails: extractedPersonalDetailsErrors,\n bankAccount: extractedBankAccountErrors,\n billingAddress: extractedBillingAddressErrors,\n deliveryAddress: extractedDeliveryAddressErrors,\n ...remainingErrors\n } = errors;\n\n // Differentiate between billingAddress and deliveryAddress errors by adding a prefix.\n // This also allows overlapping errors e.g. now that addresses can contain first & last name fields\n const enhancedBillingAddressErrors = enhanceErrorObjectKeys(extractedBillingAddressErrors, BILLING_ADDRESS_PREFIX);\n const enhancedDeliveryAddressErrors = enhanceErrorObjectKeys(extractedDeliveryAddressErrors, DELIVERY_ADDRESS_PREFIX);\n\n // ...and then collate the errors into a new object so that they all sit at top level\n const errorsForPanel = {\n ...(typeof extractedCompanyDetailsErrors === 'object' && extractedCompanyDetailsErrors),\n ...(typeof extractedPersonalDetailsErrors === 'object' && extractedPersonalDetailsErrors),\n ...(typeof extractedBankAccountErrors === 'object' && extractedBankAccountErrors),\n ...(typeof enhancedBillingAddressErrors === 'object' && enhancedBillingAddressErrors),\n ...(typeof enhancedDeliveryAddressErrors === 'object' && enhancedDeliveryAddressErrors),\n ...remainingErrors\n };\n\n // Create layout\n const companyDetailsLayout: string[] = COMPANY_DETAILS_SCHEMA;\n\n const personalDetailsReqFields: string[] = props.personalDetailsRequiredFields ?? PERSONAL_DETAILS_SCHEMA;\n const personalDetailLayout: string[] = PERSONAL_DETAILS_SCHEMA.filter(x => personalDetailsReqFields?.includes(x));\n\n const bankAccountLayout = ['holder', 'iban'];\n\n const billingAddressLayout = billingAddressSpecifications.getAddressSchemaForCountryFlat(data.billingAddress?.country);\n // In order to sort the address errors the layout entries need to have the same (prefixed) identifier as the errors themselves\n const billingAddressLayoutEnhanced = billingAddressLayout.map(item => `${BILLING_ADDRESS_PREFIX}${item}`);\n\n const deliveryAddressLayout = deliveryAddressSpecifications.getAddressSchemaForCountryFlat(data.deliveryAddress?.country);\n const deliveryAddressLayoutEnhanced = deliveryAddressLayout.map(item => `${DELIVERY_ADDRESS_PREFIX}${item}`);\n\n const fullLayout = companyDetailsLayout.concat(\n personalDetailLayout,\n bankAccountLayout,\n billingAddressLayoutEnhanced,\n deliveryAddressLayoutEnhanced,\n ['consentCheckbox']\n );\n\n // Country specific address labels\n const countrySpecificLabels_billing = billingAddressSpecifications.getAddressLabelsForCountry(data.billingAddress?.country);\n const countrySpecificLabels_delivery = deliveryAddressSpecifications.getAddressLabelsForCountry(data.deliveryAddress?.country);\n\n // Set messages: Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: fullLayout,\n countrySpecificLabels: { ...countrySpecificLabels_billing, ...countrySpecificLabels_delivery }\n });\n\n // Relates to onBlur errors\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout); // Relates to onBlur errors\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD: {\n /**\n * For prefixed fields (ones that can occur twice but in different contexts i.e. billingAddress & deliveryAddress) - consider the prefix...\n */\n // ...Firstly strip it to gain a \"clean\" reference to the field...\n const fieldToFocus = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[1] : srPanelResp.fieldToFocus; // country, street etc\n\n // ...Secondly use the prefix to add context for when we try to select it\n let focusContextSelector = '';\n const focusContext = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[0] : ''; // 'billingAddress' | 'deliveryAddress'\n if (focusContext.length) {\n focusContextSelector = `.adyen-checkout__fieldset--${focusContext} `;\n }\n\n // Focus first field in error, if required\n if (shouldMoveFocusSR) setFocusOnField('.adyen-checkout__open-invoice', fieldToFocus, focusContextSelector);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n }\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Is error actually a blur based one - depends on the specific fields in a component as to whether they validate on blur\n const isBlurBasedError = latestErrorMsg.field === 'shopperEmail' && latestErrorMsg.errorCode === 'field.error.invalid';\n\n // Only add blur based errors to the error panel - doing this step prevents the non-blur based errors from being read out twice\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n clearSRPanel();\n }\n\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors, data]);\n};\n\nexport default useSRPanelForOpenInvoiceErrors;\n"],"names":["useSRPanelForOpenInvoiceErrors","errors","data","props","isValidating","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressSpecifications","useMemo","Specifications","deliveryAddressSpecifications","deliveryAddressSpecification","useEffect","DELIVERY_ADDRESS_PREFIX","BILLING_ADDRESS_PREFIX","companyDetails","extractedCompanyDetailsErrors","personalDetails","extractedPersonalDetailsErrors","bankAccount","extractedBankAccountErrors","billingAddress","extractedBillingAddressErrors","deliveryAddress","extractedDeliveryAddressErrors","remainingErrors","enhancedBillingAddressErrors","enhanceErrorObjectKeys","enhancedDeliveryAddressErrors","errorsForPanel","_object_spread","companyDetailsLayout","COMPANY_DETAILS_SCHEMA","personalDetailsReqFields","personalDetailsRequiredFields","PERSONAL_DETAILS_SCHEMA","personalDetailLayout","filter","x","includes","bankAccountLayout","billingAddressLayoutEnhanced","getAddressSchemaForCountryFlat","country","map","item","deliveryAddressLayoutEnhanced","fullLayout","concat","countrySpecificLabels_billing","getAddressLabelsForCountry","countrySpecificLabels_delivery","srPanelResp","current","layout","countrySpecificLabels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","split","focusContextSelector","focusContext","length","setFocusOnField","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","field","errorCode","errorMessage","_"],"mappings":"0yDAsBA,MAAMA,EAAiC,EAAGC,SAAQC,OAAMC,QAAOC,mBAE3D,MAAOC,EAAiBC,GAAsBC,EAAS,MAEjDC,EAAuBC,EAAYJ,IACnCK,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAE1FC,EAAuCL,aAAAA,EAAAA,EAA2B,CACpEM,mBAAoBC,IAGlBC,EAA+BC,EAA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AA,EAAsBoD,SAGhHS,EAAyChD,aAAAA,EAAAA,EAAgB,CAC3Dd,OAAQuC,EACRpC,aAAcA,EAAa4D,QAC3BC,OAAQP,EACRQ,sBAAuBzB,KAAKmB,EAAkCE,KAI5DK,EAA8BJ,aAAAA,EAAAA,EAAaI,4BAQjD,OALA7D,EAAmB6D,GAKXJ,aAAAA,EAAAA,EAAaK,QAEjB,KAAKC,EAA0B,CAK3B,MAAMC,EAAeP,EAAYO,aAAapB,SAAS,KAAOa,EAAYO,aAAaC,MAAM,KAAK,GAAKR,EAAYO,aAGnH,IAAIE,EAAuB,GAC3B,MAAMC,EAAeV,EAAYO,aAAapB,SAAS,KAAOa,EAAYO,aAAaC,MAAM,KAAK,GAAK,GACnGE,EAAaC,SACbF,EAAuB,8BAA8BC,MAIrD5D,GAAmB8D,EAAgB,gCAAiCL,EAAcE,GAEtFI,WAAW,KACPxE,EAAa4D,SAAU,GACxB,KACH,KACJ,CAKA,KAAKa,EAA4B,CAC7B,MAAMC,EAAaC,EAAoBZ,EAA6B3D,EAAsB,SAEpFwE,EAAiBF,aAAAA,EAAAA,EAAa,GAEpC,GAAIE,EAAgB,CAEhB,MAGMC,EAH4C,iBAAzBD,EAAeE,OAAyD,wBAA7BF,EAAeG,UAG1CH,EAAeI,aAAe,KACvEzE,EAAyBsE,EAC7B,MAEIrE,IAGJ,KACJ,EAIR,CAAE,MAAOyE,GAET,GACD,CAACpF,EAAQC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../Button/Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{payAmountLabel as n,secondaryAmountLabel as o}from"./utils.js";import
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../Button/Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{payAmountLabel as n,secondaryAmountLabel as o}from"./utils.js";import l from"./components/SecondaryButtonLabel.js";function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function i(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}const s=s=>{let{amount:u,secondaryAmount:p,classNameModifiers:f=[],label:b}=s,y=i(s,["amount","secondaryAmount","classNameModifiers","label"]);const{i18n:O}=r(),m=u&&{}.hasOwnProperty.call(u,"value")&&0===u.value,j=m?O.get("confirmPreauthorization"):n(O,u),d=u&&"number"==typeof u.value&&!!u.currency,g=p&&Object.keys(p).length>0,P=!m&&!b&&d&&g?o(O,p):null;return e(t,a(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){c(e,t,r[t])})}return e}({},y),{disabled:y.disabled||"loading"===y.status,classNameModifiers:[...f,"pay"],label:b||j}),P&&e(l,{label:P}))};export{s as default,n as payAmountLabel};
|
|
2
2
|
//# sourceMappingURL=PayButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayButton.js","sources":["../../../../../src/components/internal/PayButton/PayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Button from '../Button';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps } from '../Button/types';\nimport { payAmountLabel, secondaryAmountLabel } from './utils';\nimport { PaymentAmountExtended } from '../../../types/global-types';\nimport SecondaryButtonLabel from './components/SecondaryButtonLabel';\n\nexport interface PayButtonProps extends ButtonProps {\n /**\n * Class name modifiers will be used as: `adyen-checkout__image--${modifier}`\n */\n classNameModifiers?: string[];\n label?: string;\n amount?: PaymentAmountExtended;\n secondaryAmount?: PaymentAmountExtended;\n status?: string;\n disabled?: boolean;\n icon?: string;\n onClick?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n}\n\nconst PayButton = ({ amount, secondaryAmount, classNameModifiers = [], label, ...props }: PayButtonProps) => {\n const { i18n } = useCoreContext();\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n const defaultLabel = isZeroAuth ? i18n.get('confirmPreauthorization') : payAmountLabel(i18n, amount);\n\n /**\n * Show the secondaryLabel if:\n * - it's not zero auth, and\n * - we don't have a predefined label (i.e. redirect, qrcode, await based comps...), and\n * - we do have an amount object (merchant might not be passing this in order to not show the amount on the button), and\n * - we have a secondaryAmount object with some properties\n */\n const hasValidAmount = amount && typeof amount.value === 'number' && !!amount.currency;\n const hasSecondaryAmount = secondaryAmount && Object.keys(secondaryAmount).length > 0;\n\n const secondaryLabel = !isZeroAuth && !label && hasValidAmount && hasSecondaryAmount ? secondaryAmountLabel(i18n, secondaryAmount) : null;\n\n return (\n <Button\n {...props}\n disabled={props.disabled || props.status === 'loading'}\n classNameModifiers={[...classNameModifiers, 'pay']}\n label={label || defaultLabel}\n >\n {secondaryLabel && <SecondaryButtonLabel label={secondaryLabel} />}\n </Button>\n );\n};\n\nexport default PayButton;\nexport { payAmountLabel };\n"],"names":["PayButton","
|
|
1
|
+
{"version":3,"file":"PayButton.js","sources":["../../../../../src/components/internal/PayButton/PayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Button from '../Button';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps } from '../Button/types';\nimport { payAmountLabel, secondaryAmountLabel } from './utils';\nimport { PaymentAmountExtended } from '../../../types/global-types';\nimport SecondaryButtonLabel from './components/SecondaryButtonLabel';\n\nexport interface PayButtonProps extends ButtonProps {\n /**\n * Class name modifiers will be used as: `adyen-checkout__image--${modifier}`\n */\n classNameModifiers?: string[];\n label?: string;\n amount?: PaymentAmountExtended;\n secondaryAmount?: PaymentAmountExtended;\n status?: string;\n disabled?: boolean;\n icon?: string;\n onClick?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n}\n\nconst PayButton = ({ amount, secondaryAmount, classNameModifiers = [], label, ...props }: PayButtonProps) => {\n const { i18n } = useCoreContext();\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n const defaultLabel = isZeroAuth ? i18n.get('confirmPreauthorization') : payAmountLabel(i18n, amount);\n\n /**\n * Show the secondaryLabel if:\n * - it's not zero auth, and\n * - we don't have a predefined label (i.e. redirect, qrcode, await based comps...), and\n * - we do have an amount object (merchant might not be passing this in order to not show the amount on the button), and\n * - we have a secondaryAmount object with some properties\n */\n const hasValidAmount = amount && typeof amount.value === 'number' && !!amount.currency;\n const hasSecondaryAmount = secondaryAmount && Object.keys(secondaryAmount).length > 0;\n\n const secondaryLabel = !isZeroAuth && !label && hasValidAmount && hasSecondaryAmount ? secondaryAmountLabel(i18n, secondaryAmount) : null;\n\n return (\n <Button\n {...props}\n disabled={props.disabled || props.status === 'loading'}\n classNameModifiers={[...classNameModifiers, 'pay']}\n label={label || defaultLabel}\n >\n {secondaryLabel && <SecondaryButtonLabel label={secondaryLabel} />}\n </Button>\n );\n};\n\nexport default PayButton;\nexport { payAmountLabel };\n"],"names":["PayButton","_0","amount","secondaryAmount","classNameModifiers","label","props","i18n","useCoreContext","isZeroAuth","hasOwnProperty","call","value","defaultLabel","get","payAmountLabel","hasValidAmount","currency","hasSecondaryAmount","Object","keys","length","secondaryLabel","secondaryAmountLabel","h","Button","disabled","status","SecondaryButtonLabel"],"mappings":"k4CAsBA,MAAMA,EAAYC,QAACC,OAAEA,EAAMC,gBAAEA,EAAeC,mBAAEA,EAAqB,GAAEC,MAAEA,GAAiCJ,EAAvBK,EAAAA,EAAAA,EAAAA,2DAC7E,MAAMC,KAAEA,GAASC,IACXC,EAAaP,GAAU,CAAC,EAAEQ,eAAeC,KAAKT,EAAQ,UAA6B,IAAjBA,EAAOU,MACzEC,EAAeJ,EAAaF,EAAKO,IAAI,2BAA6BC,EAAeR,EAAML,GASvFc,EAAiBd,GAAkC,iBAAjBA,EAAOU,SAAwBV,EAAOe,SACxEC,EAAqBf,GAAmBgB,OAAOC,KAAKjB,GAAiBkB,OAAS,EAE9EC,GAAkBb,IAAeJ,GAASW,GAAkBE,EAAqBK,EAAqBhB,EAAMJ,GAAmB,KAErI,OACIqB,EAACC,EAAAA,oUAAAA,CAAAA,CAAAA,EACOnB,GAAAA,CACJoB,SAAUpB,EAAMoB,UAA6B,YAAjBpB,EAAMqB,OAClCvB,mBAAoB,IAAIA,EAAoB,OAC5CC,MAAOA,GAASQ,IAEfS,GAAkBE,EAACI,EAAAA,CAAqBvB,MAAOiB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useMemo as r,useRef as t,useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import l from"../FormFields/Fieldset/Fieldset.js";import s from"../FormFields/Field/Field.js";import i from"./ReadOnlyPersonalDetails.js";import{personalDetailsValidationRules as o}from"./validate.js";import{useCoreContext as n}from"../../../core/Context/CoreProvider.js";import{checkDateInputSupport as m}from"../FormFields/InputDate/utils.js";import{getFormattedData as p}from"./utils.js";import u from"../../../utils/useForm/useForm.js";import d from"../FormFields/InputText.js";import f from"../FormFields/InputDate/InputDate.js";import c from"../FormFields/InputEmail.js";import h from"../FormFields/InputTelephone.js";import{getErrorMessage as b}from"../../../utils/getErrorMessage.js";function N(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function O(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},a=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.forEach(function(r){N(e,r,t[r])})}return e}function g(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 j=["firstName","lastName","dateOfBirth","shopperEmail","telephoneNumber"];function F(N){const{label:j="",namePrefix:F,placeholders:y,requiredFields:v,visibility:M}=N,{i18n:B}=n(),E=r(m,[]),{handleChangeFor:P,triggerValidation:I,data:w,valid:D,errors:C,isValid:q}=u({schema:v,rules:O({},o,N.validationRules),defaultData:N.data}),k=t({showValidation:()=>{I()}});a(()=>{N.setComponentRef(k.current)},[N.setComponentRef]);const x=e=>r=>{const{name:t}=r.target,a=t.split(`${F}.`).pop();P(a,e)(r)},R=e=>`${F?`${F}.`:""}${e}`;return a(()=>{const e=p(w);N.onChange({data:e,valid:D,errors:C,isValid:q})},[w,D,C,q]),"hidden"===M?null:"readOnly"===M?e(i,g(O({},N),{data:w})):e(l,{classNameModifiers:["personalDetails"],label:j},v.includes("firstName")&&e(s,{label:B.get("firstName"),classNameModifiers:["col-50","firstName"],errorMessage:b(B,C.firstName,B.get("firstName")),name:"firstName",i18n:B},e(d,{name:R("firstName"),value:w.firstName,classNameModifiers:["firstName"],onInput:x("input"),onBlur:x("blur"),placeholder:y.firstName,spellCheck:!1,required:!0})),v.includes("lastName")&&e(s,{label:B.get("lastName"),classNameModifiers:["col-50","lastName"],errorMessage:b(B,C.lastName,B.get("lastName")),name:"lastName",i18n:B},e(d,{name:R("lastName"),value:w.lastName,classNameModifiers:["lastName"],onInput:x("input"),onBlur:x("blur"),placeholder:y.lastName,spellCheck:!1,required:!0})),v.includes("dateOfBirth")&&e(s,{label:B.get("dateOfBirth"),classNameModifiers:["col-50","dateOfBirth"],errorMessage:b(B,C.dateOfBirth,B.get("dateOfBirth")),helper:E?null:B.get("dateOfBirth.format"),name:"dateOfBirth",i18n:B},e(f,{name:R("dateOfBirth"),value:w.dateOfBirth,classNameModifiers:["dateOfBirth"],onInput:x("input"),onBlur:x("blur"),placeholder:y.dateOfBirth,required:!0})),v.includes("shopperEmail")&&e(s,{label:B.get("shopperEmail"),classNameModifiers:["shopperEmail"],errorMessage:b(B,C.shopperEmail,B.get("shopperEmail")),dir:"ltr",name:"emailAddress",i18n:B},e(c,{name:R("shopperEmail"),value:w.shopperEmail,classNameModifiers:["shopperEmail"],onInput:x("input"),onBlur:x("blur"),placeholder:y.shopperEmail,required:!0})),v.includes("telephoneNumber")&&e(s,{label:B.get("telephoneNumber"),classNameModifiers:["telephoneNumber"],errorMessage:b(B,C.telephoneNumber,B.get("telephoneNumber")),dir:"ltr",name:"telephoneNumber",i18n:B},e(h,{name:R("telephoneNumber"),value:w.telephoneNumber,classNameModifiers:["telephoneNumber"],onInput:x("input"),onBlur:x("blur"),placeholder:y.telephoneNumber,required:!0})))}F.defaultProps={data:{},onChange:()=>{},placeholders:{},requiredFields:j,validationRules:o,visibility:"editable"};export{j as PERSONAL_DETAILS_SCHEMA,F as default};
|
|
2
2
|
//# sourceMappingURL=PersonalDetails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonalDetails.js","sources":["../../../../../src/components/internal/PersonalDetails/PersonalDetails.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useEffect, useMemo, useRef } from 'preact/hooks';\nimport Fieldset from '../FormFields/Fieldset';\nimport Field from '../FormFields/Field';\nimport ReadOnlyPersonalDetails from './ReadOnlyPersonalDetails';\nimport { personalDetailsValidationRules } from './validate';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { PersonalDetailsProps } from './types';\nimport { checkDateInputSupport } from '../FormFields/InputDate/utils';\nimport { PersonalDetailsSchema } from '../../../types';\nimport { getFormattedData } from './utils';\nimport useForm from '../../../utils/useForm';\nimport './PersonalDetails.scss';\nimport InputText from '../FormFields/InputText';\nimport InputDate from '../FormFields/InputDate';\nimport InputEmail from '../FormFields/InputEmail';\nimport InputTelephone from '../FormFields/InputTelephone';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport { ComponentMethodsRef } from '../UIElement/types';\nimport { HandleChangeForModeType } from '../../../utils/useForm/types';\n\nexport const PERSONAL_DETAILS_SCHEMA = ['firstName', 'lastName', 'dateOfBirth', 'shopperEmail', 'telephoneNumber'];\n\nexport default function PersonalDetails(props: PersonalDetailsProps) {\n const { label = '', namePrefix, placeholders, requiredFields, visibility } = props;\n\n const { i18n } = useCoreContext();\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const personalDetailsRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(personalDetailsRef.current).length) {\n props.setComponentRef?.(personalDetailsRef.current);\n }\n\n const isDateInputSupported = useMemo(checkDateInputSupport, []);\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<PersonalDetailsSchema>({\n schema: requiredFields,\n // Ensure any passed validation rules are merged with the default ones\n rules: { ...personalDetailsValidationRules, ...props.validationRules },\n defaultData: props.data\n });\n\n // Expose method expected by (parent) PersonalDetails.tsx\n personalDetailsRef.current.showValidation = () => {\n triggerValidation();\n };\n\n const eventHandler =\n (mode: HandleChangeForModeType): h.JSX.GenericEventHandler<EventTarget> =>\n (e: Event): void => {\n const { name } = e.target as HTMLInputElement;\n const key = name.split(`${namePrefix}.`).pop();\n\n handleChangeFor(key, mode)(e);\n };\n\n const generateFieldName = (name: string): string => `${namePrefix ? `${namePrefix}.` : ''}${name}`;\n\n useEffect(() => {\n const formattedData = getFormattedData(data);\n props.onChange({ data: formattedData, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n if (visibility === 'hidden') return null;\n if (visibility === 'readOnly') return <ReadOnlyPersonalDetails {...props} data={data} />;\n\n return (\n <Fragment>\n <Fieldset classNameModifiers={['personalDetails']} label={label}>\n {requiredFields.includes('firstName') && (\n <Field\n label={i18n.get('firstName')}\n classNameModifiers={['col-50', 'firstName']}\n errorMessage={getErrorMessage(i18n, errors.firstName, i18n.get('firstName'))}\n name={'firstName'}\n i18n={i18n}\n >\n <InputText\n name={generateFieldName('firstName')}\n value={data.firstName}\n classNameModifiers={['firstName']}\n onInput={eventHandler('input')}\n onBlur={eventHandler('blur')}\n placeholder={placeholders.firstName}\n spellCheck={false}\n required={true}\n />\n </Field>\n )}\n\n {requiredFields.includes('lastName') && (\n <Field\n label={i18n.get('lastName')}\n classNameModifiers={['col-50', 'lastName']}\n errorMessage={getErrorMessage(i18n, errors.lastName, i18n.get('lastName'))}\n name={'lastName'}\n i18n={i18n}\n >\n <InputText\n name={generateFieldName('lastName')}\n value={data.lastName}\n classNameModifiers={['lastName']}\n onInput={eventHandler('input')}\n onBlur={eventHandler('blur')}\n placeholder={placeholders.lastName}\n spellCheck={false}\n required={true}\n />\n </Field>\n )}\n\n {requiredFields.includes('dateOfBirth') && (\n <Field\n label={i18n.get('dateOfBirth')}\n classNameModifiers={['col-50', 'dateOfBirth']}\n errorMessage={getErrorMessage(i18n, errors.dateOfBirth, i18n.get('dateOfBirth'))}\n helper={isDateInputSupported ? null : i18n.get('dateOfBirth.format')}\n name={'dateOfBirth'}\n i18n={i18n}\n >\n <InputDate\n name={generateFieldName('dateOfBirth')}\n value={data.dateOfBirth}\n classNameModifiers={['dateOfBirth']}\n onInput={eventHandler('input')}\n onBlur={eventHandler('blur')}\n placeholder={placeholders.dateOfBirth}\n required={true}\n />\n </Field>\n )}\n\n {requiredFields.includes('shopperEmail') && (\n <Field\n label={i18n.get('shopperEmail')}\n classNameModifiers={['shopperEmail']}\n errorMessage={getErrorMessage(i18n, errors.shopperEmail, i18n.get('shopperEmail'))}\n dir={'ltr'}\n name={'emailAddress'}\n i18n={i18n}\n >\n <InputEmail\n name={generateFieldName('shopperEmail')}\n value={data.shopperEmail}\n classNameModifiers={['shopperEmail']}\n onInput={eventHandler('input')}\n onBlur={eventHandler('blur')}\n placeholder={placeholders.shopperEmail}\n required={true}\n />\n </Field>\n )}\n\n {requiredFields.includes('telephoneNumber') && (\n <Field\n label={i18n.get('telephoneNumber')}\n classNameModifiers={['telephoneNumber']}\n errorMessage={getErrorMessage(i18n, errors.telephoneNumber, i18n.get('telephoneNumber'))}\n dir={'ltr'}\n name={'telephoneNumber'}\n i18n={i18n}\n >\n <InputTelephone\n name={generateFieldName('telephoneNumber')}\n value={data.telephoneNumber}\n classNameModifiers={['telephoneNumber']}\n onInput={eventHandler('input')}\n onBlur={eventHandler('blur')}\n placeholder={placeholders.telephoneNumber}\n required={true}\n />\n </Field>\n )}\n </Fieldset>\n </Fragment>\n );\n}\n\nPersonalDetails.defaultProps = {\n data: {},\n onChange: () => {},\n placeholders: {},\n requiredFields: PERSONAL_DETAILS_SCHEMA,\n validationRules: personalDetailsValidationRules,\n visibility: 'editable'\n};\n"],"names":["PERSONAL_DETAILS_SCHEMA","PersonalDetails","props","label","namePrefix","placeholders","requiredFields","visibility","i18n","useCoreContext","personalDetailsRef","useRef","Object","keys","current","length","setComponentRef","isDateInputSupported","useMemo","checkDateInputSupport","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","schema","rules","_object_spread","personalDetailsValidationRules","validationRules","defaultData","showValidation","eventHandler","mode","e","name","target","key","split","pop","generateFieldName","useEffect","formattedData","getFormattedData","onChange","h","ReadOnlyPersonalDetails","Fragment","Fieldset","classNameModifiers","includes","Field","get","errorMessage","getErrorMessage","firstName","InputText","value","onInput","onBlur","placeholder","spellCheck","required","lastName","dateOfBirth","helper","InputDate","shopperEmail","dir","InputEmail","telephoneNumber","InputTelephone","defaultProps"],"mappings":"2pDAqBaA,EAA0B,CAAC,YAAa,WAAY,cAAe,eAAgB,mBAEjF,SAASC,EAAgBC,GACpC,MAAMC,MAAEA,EAAQ,GAAEC,WAAEA,EAAUC,aAAEA,EAAYC,eAAEA,EAAcC,WAAEA,GAAeL,GAEvEM,KAAEA,GAASC,IAGXC,EAAqBC,EAA4B,IAGnDT,IAAAA,EADCU,OAAOC,KAAKH,EAAmBI,SAASC,SACpB,QAArBb,EAAAA,EAAMc,2BAANd,GAAAA,EAAAA,KAAAA,EAAwBQ,EAAmBI,UAG/C,MAAMG,EAAuBC,EAAQC,EAAuB,KACtDC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAA+B,CACxGC,OAAQrB,EAERsB,MAAOC,EAAA,CAAA,EAAKC,EAAmC5B,EAAM6B,iBACrDC,YAAa9B,EAAMoB,OAIvBZ,EAAmBI,QAAQmB,eAAiB,KACxCZ,KAGJ,MAAMa,EACDC,GACAC,IACG,MAAMC,KAAEA,GAASD,EAAEE,OACbC,EAAMF,EAAKG,MAAM,GAAGpC,MAAeqC,MAEzCrB,EAAgBmB,EAAKJ,EAArBf,CAA2BgB,IAG7BM,EAAqBL,GAAyB,GAAGjC,EAAa,GAAGA,KAAgB,KAAKiC,IAO5F,OALAM,EAAU,KACN,MAAMC,EAAgBC,EAAiBvB,GACvCpB,EAAM4C,SAAS,CAAExB,KAAMsB,EAAerB,QAAOC,SAAQC,aACt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ACG/B,KAAMK,EAAkB,eACxBiB,MAAOrC,EAAK4C,YACZf,mBAAoB,CAAC,eACrBS,QAAS1B,EAAa,SACtB2B,OAAQ3B,EAAa,QACrB4B,YAAazD,EAAa6D,YAC1BF,UAAU,KAKrB1D,EAAe8C,SAAS,iBACrBL,EAACM,EAAAA,CACGlD,MAAOK,EAAK8C,IAAI,gBAChBH,mBAAoB,CAAC,gBACrBI,aAAcC,EAAgBhD,EAAMgB,EAAO6C,aAAc7D,EAAK8C,IAAI,iBAClEgB,IAAK,MACLjC,KAAM,eACN7B,KAAMA,GAENuC,EAACwB,EAAAA,CACGlC,KAAMK,EAAkB,gBACxBiB,MAAOrC,EAAK+C,aACZlB,mBAAoB,CAAC,gBACrBS,QAAS1B,EAAa,SACtB2B,OAAQ3B,EAAa,QACrB4B,YAAazD,EAAagE,aAC1BL,UAAU,KAKrB1D,EAAe8C,SAAS,oBACrBL,EAACM,EAAAA,CACGlD,MAAOK,EAAK8C,IAAI,mBAChBH,mBAAoB,CAAC,mBACrBI,aAAcC,EAAgBhD,EAAMgB,EAAOgD,gBAAiBhE,EAAK8C,IAAI,oBACrEgB,IAAK,MACLjC,KAAM,kBACN7B,KAAMA,GAENuC,EAAC0B,EAAAA,CACGpC,KAAMK,EAAkB,mBACxBiB,MAAOrC,EAAKkD,gBACZrB,mBAAoB,CAAC,mBACrBS,QAAS1B,EAAa,SACtB2B,OAAQ3B,EAAa,QACrB4B,YAAazD,EAAamE,gBAC1BR,UAAU,MAOtC,CAEA/D,EAAgByE,aAAe,CAC3BpD,KAAM,CAAA,EACNwB,SAAU,OACVzC,aAAc,CAAA,EACdC,eAAgBN,EAChB+B,gBAAiBD,EACjBvB,WAAY"}
|
|
1
|
+
{"version":3,"file":"PersonalDetails.js","sources":["../../../../../src/components/internal/PersonalDetails/PersonalDetails.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useMemo, useRef } from 'preact/hooks';\nimport Fieldset from '../FormFields/Fieldset';\nimport Field from '../FormFields/Field';\nimport ReadOnlyPersonalDetails from './ReadOnlyPersonalDetails';\nimport { personalDetailsValidationRules } from './validate';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { PersonalDetailsProps } from './types';\nimport { checkDateInputSupport } from '../FormFields/InputDate/utils';\nimport { PersonalDetailsSchema } from '../../../types';\nimport { getFormattedData } from './utils';\nimport useForm from '../../../utils/useForm';\nimport InputText from '../FormFields/InputText';\nimport InputDate from '../FormFields/InputDate';\nimport InputEmail from '../FormFields/InputEmail';\nimport InputTelephone from '../FormFields/InputTelephone';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport { ComponentMethodsRef } from '../UIElement/types';\nimport { HandleChangeForModeType } from '../../../utils/useForm/types';\nimport './PersonalDetails.scss';\n\nexport const PERSONAL_DETAILS_SCHEMA = ['firstName', 'lastName', 'dateOfBirth', 'shopperEmail', 'telephoneNumber'];\n\nexport default function PersonalDetails(props: Readonly<PersonalDetailsProps>) {\n const { label = '', namePrefix, placeholders, requiredFields, visibility } = props;\n\n const { i18n } = useCoreContext();\n\n const isDateInputSupported = useMemo(checkDateInputSupport, []);\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<PersonalDetailsSchema>({\n schema: requiredFields,\n // Ensure any passed validation rules are merged with the default ones\n rules: { ...personalDetailsValidationRules, ...props.validationRules },\n defaultData: props.data\n });\n\n const personalDetailsRef = useRef<ComponentMethodsRef>({\n showValidation: () => {\n triggerValidation();\n }\n });\n\n useEffect(() => {\n props.setComponentRef(personalDetailsRef.current);\n }, [props.setComponentRef]);\n\n const eventHandler =\n (mode: HandleChangeForModeType): h.JSX.GenericEventHandler<EventTarget> =>\n (e: Event): void => {\n const { name } = e.target as HTMLInputElement;\n const key = name.split(`${namePrefix}.`).pop();\n\n handleChangeFor(key, mode)(e);\n };\n\n const generateFieldName = (name: string): string => `${namePrefix ? `${namePrefix}.` : ''}${name}`;\n\n useEffect(() => {\n const formattedData = getFormattedData(data);\n props.onChange({ data: formattedData, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n if (visibility === 'hidden') return null;\n if (visibility === 'readOnly') return <ReadOnlyPersonalDetails {...props} data={data} />;\n\n return (\n <Fieldset classNameModifiers={['personalDetails']} label={label}>\n {requiredFields.includes('firstName') && (\n <Field\n label={i18n.get('firstName')}\n classNameModifiers={['col-50', 'firstName']}\n errorMessage={getErrorMessage(i18n, errors.firstName, i18n.get('firstName'))}\n name={'firstName'}\n i18n={i18n}\n >\n <InputText\n name={generateFieldName('firstName')}\n value={data.firstName}\n classNameModifiers={['firstName']}\n onInput={eventHandler('input')}\n onBlur={eventHandler('blur')}\n placeholder={placeholders.firstName}\n spellCheck={false}\n required={true}\n />\n </Field>\n )}\n\n {requiredFields.includes('lastName') && (\n <Field\n label={i18n.get('lastName')}\n classNameModifiers={['col-50', 'lastName']}\n errorMessage={getErrorMessage(i18n, errors.lastName, i18n.get('lastName'))}\n name={'lastName'}\n i18n={i18n}\n >\n <InputText\n name={generateFieldName('lastName')}\n value={data.lastName}\n classNameModifiers={['lastName']}\n onInput={eventHandler('input')}\n onBlur={eventHandler('blur')}\n placeholder={placeholders.lastName}\n spellCheck={false}\n required={true}\n />\n </Field>\n )}\n\n {requiredFields.includes('dateOfBirth') && (\n <Field\n label={i18n.get('dateOfBirth')}\n classNameModifiers={['col-50', 'dateOfBirth']}\n errorMessage={getErrorMessage(i18n, errors.dateOfBirth, i18n.get('dateOfBirth'))}\n helper={isDateInputSupported ? null : i18n.get('dateOfBirth.format')}\n name={'dateOfBirth'}\n i18n={i18n}\n >\n <InputDate\n name={generateFieldName('dateOfBirth')}\n value={data.dateOfBirth}\n classNameModifiers={['dateOfBirth']}\n onInput={eventHandler('input')}\n onBlur={eventHandler('blur')}\n placeholder={placeholders.dateOfBirth}\n required={true}\n />\n </Field>\n )}\n\n {requiredFields.includes('shopperEmail') && (\n <Field\n label={i18n.get('shopperEmail')}\n classNameModifiers={['shopperEmail']}\n errorMessage={getErrorMessage(i18n, errors.shopperEmail, i18n.get('shopperEmail'))}\n dir={'ltr'}\n name={'emailAddress'}\n i18n={i18n}\n >\n <InputEmail\n name={generateFieldName('shopperEmail')}\n value={data.shopperEmail}\n classNameModifiers={['shopperEmail']}\n onInput={eventHandler('input')}\n onBlur={eventHandler('blur')}\n placeholder={placeholders.shopperEmail}\n required={true}\n />\n </Field>\n )}\n\n {requiredFields.includes('telephoneNumber') && (\n <Field\n label={i18n.get('telephoneNumber')}\n classNameModifiers={['telephoneNumber']}\n errorMessage={getErrorMessage(i18n, errors.telephoneNumber, i18n.get('telephoneNumber'))}\n dir={'ltr'}\n name={'telephoneNumber'}\n i18n={i18n}\n >\n <InputTelephone\n name={generateFieldName('telephoneNumber')}\n value={data.telephoneNumber}\n classNameModifiers={['telephoneNumber']}\n onInput={eventHandler('input')}\n onBlur={eventHandler('blur')}\n placeholder={placeholders.telephoneNumber}\n required={true}\n />\n </Field>\n )}\n </Fieldset>\n );\n}\n\nPersonalDetails.defaultProps = {\n data: {},\n onChange: () => {},\n placeholders: {},\n requiredFields: PERSONAL_DETAILS_SCHEMA,\n validationRules: personalDetailsValidationRules,\n visibility: 'editable'\n};\n"],"names":["PERSONAL_DETAILS_SCHEMA","PersonalDetails","props","label","namePrefix","placeholders","requiredFields","visibility","i18n","useCoreContext","isDateInputSupported","useMemo","checkDateInputSupport","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","schema","rules","_object_spread","personalDetailsValidationRules","validationRules","defaultData","personalDetailsRef","useRef","showValidation","useEffect","setComponentRef","current","eventHandler","mode","e","name","target","key","split","pop","generateFieldName","formattedData","getFormattedData","onChange","h","ReadOnlyPersonalDetails","Fieldset","classNameModifiers","includes","Field","get","errorMessage","getErrorMessage","firstName","InputText","value","onInput","onBlur","placeholder","spellCheck","required","lastName","dateOfBirth","helper","InputDate","shopperEmail","dir","InputEmail","telephoneNumber","InputTelephone","defaultProps"],"mappings":"6oDAqBaA,EAA0B,CAAC,YAAa,WAAY,cAAe,eAAgB,mB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,OAAQzB,EAAa,QACrB0B,YAAarD,EAAa4D,aAC1BL,UAAU,KAKrBtD,EAAe0C,SAAS,oBACrBJ,EAACK,EAAAA,CACG9C,MAAOK,EAAK0C,IAAI,mBAChBH,mBAAoB,CAAC,mBACrBI,aAAcC,EAAgB5C,EAAMS,EAAOmD,gBAAiB5D,EAAK0C,IAAI,oBACrEgB,IAAK,MACL/B,KAAM,kBACN3B,KAAMA,GAENoC,EAACyB,EAAAA,CACGlC,KAAMK,EAAkB,mBACxBe,MAAOxC,EAAKqD,gBACZrB,mBAAoB,CAAC,mBACrBS,QAASxB,EAAa,SACtByB,OAAQzB,EAAa,QACrB0B,YAAarD,EAAa+D,gBAC1BR,UAAU,KAMlC,CAEA3D,EAAgBqE,aAAe,CAC3BvD,KAAM,CAAA,EACN4B,SAAU,OACVtC,aAAc,CAAA,EACdC,eAAgBN,EAChBwB,gBAAiBD,EACjBhB,WAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e,Fragment as r}from"../../../external/preact/dist/preact.js";import{useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../FormFields/Field/Field.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import l from"../FormFields/Select/Select.js";import
|
|
1
|
+
import{createElement as e,Fragment as r}from"../../../external/preact/dist/preact.js";import{useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../FormFields/Field/Field.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import l from"../FormFields/Select/Select.js";import p from"../FormFields/InputText.js";function i(e,r){if(null==e)return{};var o,n,t,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(e),t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,r){if(null==e)return{};var o,n,t={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)o=l[n],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(t[o]=e[o]);return t}(e,r),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(e),t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function a(a){let{getError:u,showNumber:c,showPrefix:m,form:h,canSelectPrefix:s=!0}=a,d=i(a,["getError","showNumber","showPrefix","form","canSelectPrefix"]);var f,b,y;const{i18n:x}=t(),{handleChangeFor:N,data:g,valid:P}=h;return o(()=>{g.phoneNumber&&N("phoneNumber","blur")(g.phoneNumber)},[g.phonePrefix]),e(r,null,m&&e(n,{className:"adyen-checkout-field--phone-prefix",label:x.get("telephonePrefix"),errorMessage:u("phonePrefix"),showValidIcon:!1,isValid:P.phonePrefix,dir:"ltr",i18n:x,name:"phonePrefix"},e(l,{readonly:!s,className:"adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector",name:"phonePrefix",items:d.items,onChange:N("phonePrefix"),placeholder:null==d||null===(f=d.placeholders)||void 0===f?void 0:f.phonePrefix,selectedValue:g.phonePrefix})),c&&e(n,{className:"adyen-checkout-field--phone-number",label:d.phoneNumberKey?x.get(d.phoneNumberKey):x.get("telephoneNumber"),errorMessage:u("phoneNumber"),isValid:P.phoneNumber,filled:(null==g||null===(b=g.phoneNumber)||void 0===b?void 0:b.length)>0,dir:"ltr",i18n:x,name:"phoneNumber"},e(p,{className:"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number",type:"tel",name:"phoneNumber",value:g.phoneNumber,onInput:N("phoneNumber","input"),onBlur:N("phoneNumber","blur"),placeholder:null==d||null===(y=d.placeholders)||void 0===y?void 0:y.phoneNumber,autoCorrect:"off",required:!0})))}export{a as default};
|
|
2
2
|
//# sourceMappingURL=PhoneInputFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInputFields.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputFields.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport Field from '../FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport Select from '../FormFields/Select';\nimport { PhoneInputSchema } from './types';\nimport InputText from '../FormFields/InputText';\nimport { DataSet } from '../../../core/Services/data-set';\nimport { Form } from '../../../utils/useForm/types';\n\nexport interface PhoneInputFieldProps {\n items: DataSet;\n requiredFields?: string[];\n form: Form<PhoneInputSchema>;\n getError: (key: string) => string | boolean;\n phoneNumberKey?: string;\n phonePrefixErrorKey?: string;\n phoneNumberErrorKey?: string;\n placeholders?: PhoneInputSchema;\n showPrefix?: boolean;\n showNumber?: boolean;\n canSelectPrefix?: boolean;\n}\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nexport default function PhoneInputFields({ getError, showNumber, showPrefix, form, canSelectPrefix = true, ...props }: PhoneInputFieldProps) {\n const { i18n } = useCoreContext();\n\n const { handleChangeFor, data, valid } = form;\n\n // Force re-validation of the phoneNumber when data.phonePrefix changes (since the validation rules will also change)\n useEffect((): void => {\n if (data.phoneNumber) {\n handleChangeFor('phoneNumber', 'blur')(data.phoneNumber);\n }\n }, [data.phonePrefix]);\n\n return (\n <Fragment>\n {showPrefix && (\n <Field\n className={'adyen-checkout-field--phone-prefix'}\n label={i18n.get('telephonePrefix')}\n errorMessage={getError('phonePrefix')}\n showValidIcon={false}\n isValid={valid.phonePrefix}\n dir={'ltr'}\n i18n={i18n}\n name={'phonePrefix'}\n >\n <Select\n readonly={!canSelectPrefix}\n className={'adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector'}\n name={'phonePrefix'}\n items={props.items}\n onChange={handleChangeFor('phonePrefix')}\n placeholder={props?.placeholders?.phonePrefix}\n selectedValue={data.phonePrefix}\n />\n </Field>\n )}\n\n {showNumber && (\n <Field\n className={'adyen-checkout-field--phone-number'}\n label={props.phoneNumberKey ? i18n.get(props.phoneNumberKey) : i18n.get('telephoneNumber')}\n errorMessage={getError('phoneNumber')}\n isValid={valid.phoneNumber}\n filled={data?.phoneNumber?.length > 0}\n dir={'ltr'}\n i18n={i18n}\n name={'phoneNumber'}\n >\n <InputText\n className=\"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number\"\n type=\"tel\"\n name=\"phoneNumber\"\n value={data.phoneNumber}\n onInput={handleChangeFor('phoneNumber', 'input')}\n onBlur={handleChangeFor('phoneNumber', 'blur')}\n placeholder={props?.placeholders?.phoneNumber}\n autoCorrect=\"off\"\n required={true}\n />\n </Field>\n )}\n </Fragment>\n );\n}\n"],"names":["PhoneInputFields","
|
|
1
|
+
{"version":3,"file":"PhoneInputFields.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputFields.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport Field from '../FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport Select from '../FormFields/Select';\nimport { PhoneInputSchema } from './types';\nimport InputText from '../FormFields/InputText';\nimport { DataSet } from '../../../core/Services/data-set';\nimport { Form } from '../../../utils/useForm/types';\n\nexport interface PhoneInputFieldProps {\n items: DataSet;\n requiredFields?: string[];\n form: Form<PhoneInputSchema>;\n getError: (key: string) => string | boolean;\n phoneNumberKey?: string;\n phonePrefixErrorKey?: string;\n phoneNumberErrorKey?: string;\n placeholders?: PhoneInputSchema;\n showPrefix?: boolean;\n showNumber?: boolean;\n canSelectPrefix?: boolean;\n}\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nexport default function PhoneInputFields({ getError, showNumber, showPrefix, form, canSelectPrefix = true, ...props }: PhoneInputFieldProps) {\n const { i18n } = useCoreContext();\n\n const { handleChangeFor, data, valid } = form;\n\n // Force re-validation of the phoneNumber when data.phonePrefix changes (since the validation rules will also change)\n useEffect((): void => {\n if (data.phoneNumber) {\n handleChangeFor('phoneNumber', 'blur')(data.phoneNumber);\n }\n }, [data.phonePrefix]);\n\n return (\n <Fragment>\n {showPrefix && (\n <Field\n className={'adyen-checkout-field--phone-prefix'}\n label={i18n.get('telephonePrefix')}\n errorMessage={getError('phonePrefix')}\n showValidIcon={false}\n isValid={valid.phonePrefix}\n dir={'ltr'}\n i18n={i18n}\n name={'phonePrefix'}\n >\n <Select\n readonly={!canSelectPrefix}\n className={'adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector'}\n name={'phonePrefix'}\n items={props.items}\n onChange={handleChangeFor('phonePrefix')}\n placeholder={props?.placeholders?.phonePrefix}\n selectedValue={data.phonePrefix}\n />\n </Field>\n )}\n\n {showNumber && (\n <Field\n className={'adyen-checkout-field--phone-number'}\n label={props.phoneNumberKey ? i18n.get(props.phoneNumberKey) : i18n.get('telephoneNumber')}\n errorMessage={getError('phoneNumber')}\n isValid={valid.phoneNumber}\n filled={data?.phoneNumber?.length > 0}\n dir={'ltr'}\n i18n={i18n}\n name={'phoneNumber'}\n >\n <InputText\n className=\"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number\"\n type=\"tel\"\n name=\"phoneNumber\"\n value={data.phoneNumber}\n onInput={handleChangeFor('phoneNumber', 'input')}\n onBlur={handleChangeFor('phoneNumber', 'blur')}\n placeholder={props?.placeholders?.phoneNumber}\n autoCorrect=\"off\"\n required={true}\n />\n </Field>\n )}\n </Fragment>\n );\n}\n"],"names":["PhoneInputFields","_0","getError","showNumber","showPrefix","form","canSelectPrefix","props","data","i18n","useCoreContext","handleChangeFor","valid","useEffect","phoneNumber","phonePrefix","h","Fragment","Field","className","label","get","errorMessage","showValidIcon","isValid","dir","name","Select","readonly","items","onChange","placeholder","placeholders","selectedValue","phoneNumberKey","filled","length","InputText","type","value","onInput","onBlur","autoCorrect","required"],"mappings":"29BA6Be,SAASA,EAAiBC,OAAAC,SAAEA,EAAQC,WAAEA,EAAUC,WAAEA,EAAUC,KAAEA,EAAIC,gBAAEA,GAAkB,GAAsCL,EAA7BM,EAAAA,EAAAA,EAAA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/dist/preact.js";import{useEffect as r,useRef as t,useCallback as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../utils/useForm/useForm.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import{phoneFormatters as s,phoneValidationRules as l}from"./validate.js";import a from"../FormFields/Fieldset/Fieldset.js";import u from"./PhoneInputFields.js";function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(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){c(e,r,t[r])})}return e}function f(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}function m(c){var m,d;const{i18n:b}=i(),h=c.requiredFields||[...(null==c||null===(m=c.items)||void 0===m?void 0:m.length)?["phonePrefix"]:[],"phoneNumber"],O=h.includes("phonePrefix")&&!!(null==c||null===(d=c.items)||void 0===d?void 0:d.length),j=h.includes("phoneNumber"),y=n(f(p({i18n:b},c),{schema:h,defaultData:c.data,rules:l,formatters:s}));r(()=>{y.setSchema(h)},[h.toString()]);const{data:g,valid:P,errors:v,isValid:w,triggerValidation:x}=y;r(()=>{c.onChange({data:g,valid:P,errors:v,isValid:w})},[g,P,v,w]);const F=t({showValidation:x});r(()=>{c.setComponentRef(F.current)},[c.setComponentRef]);const E=o(e=>{if(v[e]){const t="phoneNumber"===e?"phoneNumberErrorKey":"phonePrefixErrorKey",o=c[t]?c[t]:v[e].errorMessage;
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as r,useRef as t,useCallback as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../utils/useForm/useForm.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import{phoneFormatters as s,phoneValidationRules as l}from"./validate.js";import a from"../FormFields/Fieldset/Fieldset.js";import u from"./PhoneInputFields.js";function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(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){c(e,r,t[r])})}return e}function f(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}function m(c){var m,d;const{i18n:b}=i(),h=c.requiredFields||[...(null==c||null===(m=c.items)||void 0===m?void 0:m.length)?["phonePrefix"]:[],"phoneNumber"],O=h.includes("phonePrefix")&&!!(null==c||null===(d=c.items)||void 0===d?void 0:d.length),j=h.includes("phoneNumber"),y=n(f(p({i18n:b},c),{schema:h,defaultData:c.data,rules:l,formatters:s}));r(()=>{y.setSchema(h)},[h.toString()]);const{data:g,valid:P,errors:v,isValid:w,triggerValidation:x}=y;r(()=>{c.onChange({data:g,valid:P,errors:v,isValid:w})},[g,P,v,w]);const F=t({showValidation:x});r(()=>{c.setComponentRef(F.current)},[c.setComponentRef]);const E=o(e=>{if(v[e]){var r;const t="phoneNumber"===e?"phoneNumberErrorKey":"phonePrefixErrorKey",o=c[t]?c[t]:v[e].errorMessage;return null!==(r=b.get(o))&&void 0!==r?r:null}return null},[v]);return e(a,{classNameModifiers:["phone-input"]},e(u,p({getError:E,showNumber:j,showPrefix:O,form:y},c)))}m.defaultProps={phoneLabel:"telephoneNumber"};export{m as default};
|
|
2
2
|
//# sourceMappingURL=PhoneInputForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInputForm.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputForm.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useCallback, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport { phoneFormatters, phoneValidationRules } from './validate';\nimport { PhoneInputFormProps, PhoneInputSchema } from './types';\nimport Fieldset from '../FormFields/Fieldset';\nimport PhoneInputFields from './PhoneInputFields';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nfunction PhoneInputForm(props: PhoneInputFormProps) {\n const { i18n } = useCoreContext();\n\n const schema = props.requiredFields || [...(props?.items?.length ? ['phonePrefix'] : []), 'phoneNumber'];\n const showPrefix = schema.includes('phonePrefix') && !!props?.items?.length;\n const showNumber = schema.includes('phoneNumber');\n\n const form = useForm<PhoneInputSchema>({\n i18n,\n ...props,\n schema,\n defaultData: props.data,\n rules: phoneValidationRules,\n formatters: phoneFormatters\n });\n\n useEffect(() => {\n form.setSchema(schema);\n }, [schema.toString()]);\n\n const { data, valid, errors, isValid, triggerValidation } = form;\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const componentRef = useRef<ComponentMethodsRef>({\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n props.setComponentRef(componentRef.current);\n }, [props.setComponentRef]);\n\n // This is here for MBWay, prob should be moved up\n // MBWay has a weird way of loading its error messages\n // They come form the prop phoneNumberErrorKey: 'mobileNumber.invalid'\n // Strangely it's defined as invalidPhoneNumber in the validation rules\n const getPhoneFieldError = useCallback(\n (field: string) => {\n if (errors[field]) {\n const propsField = field === 'phoneNumber' ? 'phoneNumberErrorKey' : 'phonePrefixErrorKey';\n const key = props[propsField] ? props[propsField] : errors[field].errorMessage;\n return i18n.get(key) ?? null;\n }\n return null;\n },\n [errors]\n );\n\n return (\n <Fieldset classNameModifiers={['phone-input']}>\n <PhoneInputFields getError={getPhoneFieldError} showNumber={showNumber} showPrefix={showPrefix} form={form} {...props} />\n </Fieldset>\n );\n}\n\nPhoneInputForm.defaultProps = {\n phoneLabel: 'telephoneNumber'\n};\n\nexport default PhoneInputForm;\n"],"names":["PhoneInputForm","props","i18n","useCoreContext","schema","requiredFields","items","length","showPrefix","includes","showNumber","form","useForm","_object_spread_props","_object_spread","defaultData","data","rules","phoneValidationRules","formatters","phoneFormatters","useEffect","setSchema","toString","valid","errors","isValid","triggerValidation","onChange","componentRef","useRef","showValidation","setComponentRef","current","getPhoneFieldError","useCallback","field","propsField","key","errorMessage","get","h","Fieldset","classNameModifiers","PhoneInputFields","getError","defaultProps","phoneLabel"],"mappings":"gvCAgBA,SAASA,EAAeC,OAGwBA,EACWA,EAHvD,MAAMC,KAAEA,GAASC,IAEXC,EAASH,EAAMI,gBAAkB,KAAKJ,SAAY,QAAZA,EAAAA,EAAOK,aAAPL,IAAAA,SAAAA,EAAcM,QAAS,CAAC,eAAiB,GAAK,eACpFC,EAAaJ,EAAOK,SAAS,mBAAoBR,SAAY,QAAZA,EAAAA,EAAOK,aAAPL,IAAAA,OAAAA,EAAAA,EAAcM,QAC/DG,EAAaN,EAAOK,SAAS,eAE7BE,EAAOC,EAA0BC,EAAAC,EAAA,CACnCZ,QACGD,GAAAA,CACHG,SACAW,YAAad,EAAMe,KACnBC,MAAOC,EACPC,WAAYC,KAGhBC,EAAU,KACNV,EAAKW,UAAUlB,IAChB,CAACA,EAAOmB,aAEX,MAAMP,KAAEA,EAAIQ,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,kBAAEA,GAAsBhB,EAE5DU,EAAU,KACNpB,EAAM2B,SAAS,CAAEZ,OAAMQ,QAAOC,SAAQC,aACvC,CAACV,EAAMQ,EAAOC,EAAQC,IAEzB,MAAMG,EAAeC,EAA4B,CAC7CC,eAAgBJ,IAGpBN,EAAU,KACNpB,EAAM+B,gBAAgBH,EAAaI,UACpC,CAAChC,EAAM+B,kBAMV,MAAME,EAAqBC,EACtBC,IACG,GAAIX,EAAOW,GAAQ,
|
|
1
|
+
{"version":3,"file":"PhoneInputForm.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputForm.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useCallback, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport { phoneFormatters, phoneValidationRules } from './validate';\nimport { PhoneInputFormProps, PhoneInputSchema } from './types';\nimport Fieldset from '../FormFields/Fieldset';\nimport PhoneInputFields from './PhoneInputFields';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nfunction PhoneInputForm(props: PhoneInputFormProps) {\n const { i18n } = useCoreContext();\n\n const schema = props.requiredFields || [...(props?.items?.length ? ['phonePrefix'] : []), 'phoneNumber'];\n const showPrefix = schema.includes('phonePrefix') && !!props?.items?.length;\n const showNumber = schema.includes('phoneNumber');\n\n const form = useForm<PhoneInputSchema>({\n i18n,\n ...props,\n schema,\n defaultData: props.data,\n rules: phoneValidationRules,\n formatters: phoneFormatters\n });\n\n useEffect(() => {\n form.setSchema(schema);\n }, [schema.toString()]);\n\n const { data, valid, errors, isValid, triggerValidation } = form;\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const componentRef = useRef<ComponentMethodsRef>({\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n props.setComponentRef(componentRef.current);\n }, [props.setComponentRef]);\n\n // This is here for MBWay, prob should be moved up\n // MBWay has a weird way of loading its error messages\n // They come form the prop phoneNumberErrorKey: 'mobileNumber.invalid'\n // Strangely it's defined as invalidPhoneNumber in the validation rules\n const getPhoneFieldError = useCallback(\n (field: string) => {\n if (errors[field]) {\n const propsField = field === 'phoneNumber' ? 'phoneNumberErrorKey' : 'phonePrefixErrorKey';\n const key = props[propsField] ? props[propsField] : errors[field].errorMessage;\n return i18n.get(key) ?? null;\n }\n return null;\n },\n [errors]\n );\n\n return (\n <Fieldset classNameModifiers={['phone-input']}>\n <PhoneInputFields getError={getPhoneFieldError} showNumber={showNumber} showPrefix={showPrefix} form={form} {...props} />\n </Fieldset>\n );\n}\n\nPhoneInputForm.defaultProps = {\n phoneLabel: 'telephoneNumber'\n};\n\nexport default PhoneInputForm;\n"],"names":["PhoneInputForm","props","i18n","useCoreContext","schema","requiredFields","items","length","showPrefix","includes","showNumber","form","useForm","_object_spread_props","_object_spread","defaultData","data","rules","phoneValidationRules","formatters","phoneFormatters","useEffect","setSchema","toString","valid","errors","isValid","triggerValidation","onChange","componentRef","useRef","showValidation","setComponentRef","current","getPhoneFieldError","useCallback","field","propsField","key","errorMessage","get","h","Fieldset","classNameModifiers","PhoneInputFields","getError","defaultProps","phoneLabel"],"mappings":"gvCAgBA,SAASA,EAAeC,OAGwBA,EACWA,EAHvD,MAAMC,KAAEA,GAASC,IAEXC,EAASH,EAAMI,gBAAkB,KAAKJ,SAAY,QAAZA,EAAAA,EAAOK,aAAPL,IAAAA,SAAAA,EAAcM,QAAS,CAAC,eAAiB,GAAK,eACpFC,EAAaJ,EAAOK,SAAS,mBAAoBR,SAAY,QAAZA,EAAAA,EAAOK,aAAPL,IAAAA,OAAAA,EAAAA,EAAcM,QAC/DG,EAAaN,EAAOK,SAAS,eAE7BE,EAAOC,EAA0BC,EAAAC,EAAA,CACnCZ,QACGD,GAAAA,CACHG,SACAW,YAAad,EAAMe,KACnBC,MAAOC,EACPC,WAAYC,KAGhBC,EAAU,KACNV,EAAKW,UAAUlB,IAChB,CAACA,EAAOmB,aAEX,MAAMP,KAAEA,EAAIQ,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,kBAAEA,GAAsBhB,EAE5DU,EAAU,KACNpB,EAAM2B,SAAS,CAAEZ,OAAMQ,QAAOC,SAAQC,aACvC,CAACV,EAAMQ,EAAOC,EAAQC,IAEzB,MAAMG,EAAeC,EAA4B,CAC7CC,eAAgBJ,IAGpBN,EAAU,KACNpB,EAAM+B,gBAAgBH,EAAaI,UACpC,CAAChC,EAAM+B,kBAMV,MAAME,EAAqBC,EACtBC,IACG,GAAIX,EAAOW,GAAQ,CAGRlC,IAAAA,EAFP,MAAMmC,EAAuB,gBAAVD,EAA0B,sBAAwB,sBAC/DE,EAAMrC,EAAMoC,GAAcpC,EAAMoC,GAAcZ,EAAOW,GAAOG,aAClE,OAAgBD,QAATpC,EAAAA,EAAKsC,IAAIF,cAATpC,EAAAA,EAAiB,IAC5B,CACA,OAAO,MAEX,CAACuB,IAGL,OACIgB,EAACC,EAAAA,CAASC,mBAAoB,CAAC,gBAC3BF,EAACG,EAAAA,EAAAA,CAAiBC,SAAUX,EAAoBxB,WAAYA,EAAYF,WAAYA,EAAYG,KAAMA,GAAUV,IAG5H,CAEAD,EAAe8C,aAAe,CAC1BC,WAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import{usePaymentStatusTimer as o}from"../../../hooks/usePaymentStatusTimer/usePaymentStatusTimer.js";import{DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS as r,DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS as a,DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS as n,DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN as i}from"../../../hooks/usePaymentStatusTimer/constants.js";import c from"../../../utils/useAutoFocus.js";import l from"../Button/Button.js";import d from"../ContentSeparator/ContentSeparator.js";import{AnalyticsInfoEvent as s,UiTarget as m,InfoEventType as u}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";import p from"../Spinner/Spinner.js";import{QRDetails as y}from"./components/QRDetails.js";import{QRFinalState as _}from"./components/QRFinalState.js";import{QRLoaderDetailsProvider as h}from"./QRLoaderDetailsProvider.js";import{redirectToApp as g}from"../../../utils/urls.js";function f(r){var a;const{i18n:n,loadingContext:i}=t(),{state:f,actions:q}=o({loadingContext:i,paymentData:r.paymentData,clientKey:r.clientKey,delay:r.delay,throttleTime:r.throttleTime,throttleInterval:r.throttledInterval,type:r.type,onError:r.onError,onComplete:r.onComplete,onActionHandled:r.onActionHandled}),{completed:C,expired:k,loading:v,percentage:b}=f,{onTick:T,onTimeUp:j}=q,{amount:N,showAmount:w,url:A,brandLogo:D,brandName:I,countdownTime:P,type:S,onActionHandled:x}=r,$=r.qrCodeData?`${i}utility/v1/barcode.png?type=qrCode&data=${r.qrCodeData}&clientKey=${r.clientKey}`:r.qrCodeImage,B=c();if(k)return e(_,{image:"error",message:n.get("error.subtitle.payment")});if(C)return e(_,{image:"success",message:n.get("creditCard.success")});if(v)return e("div",{className:"adyen-checkout__qr-loader"},D&&e("div",{className:"adyen-checkout__qr-loader__brand-logo-wrapper"},e("img",{alt:I,src:D,className:"adyen-checkout__qr-loader__brand-logo"})),e(p,null));const E=r.classNameModifiers.map(e=>`adyen-checkout__qr-loader--${e}`);return e("div",{className:`adyen-checkout__qr-loader adyen-checkout__qr-loader--${S} ${E.join(" ")}`},D&&e("div",{className:"adyen-checkout__qr-loader__brand-logo-wrapper"},e("img",{src:D,alt:I,className:"adyen-checkout__qr-loader__brand-logo"})),w&&N&&null!==N.value&&!!N.currency&&e("h1",{className:"adyen-checkout__qr-loader__payment_amount"},n.amount(N.value,N.currency)),A&&e("div",{className:"adyen-checkout__qr-loader__app-link"},r.redirectIntroduction&&e("p",{className:"adyen-checkout__qr-loader__subtitle"},n.get(r.redirectIntroduction)),e(l,{classNameModifiers:["qr-loader"],onClick:()=>g(A),label:n.get(r.buttonLabel)}),e(d,null)),e("p",{ref:B,tabIndex:0,className:"adyen-checkout__qr-loader__subtitle"},"string"==typeof r.introduction?n.get(r.introduction):null===(a=r.introduction)||void 0===a?void 0:a.call(r)),e(h,{qrCodeImage:$,qrCodeData:r.qrCodeData,percentage:b,timeToPay:r.timeToPay,copyBtn:r.copyBtn,instructions:r.instructions,countdownTime:P,onTick:e=>T(e),onQRCodeLoad:()=>{null==x||x({componentType:r.type,actionDescription:"qr-code-loaded"})},onTimeUp:()=>j(),handleCopy:()=>{const e=new s({component:r.type,type:u.download,target:m.qrDownloadButton});r.onSubmitAnalytics(e)}},r.children?r.children:e(y,null)))}f.defaultProps={countdownTime:i,delay:n,throttleTime:a,throttledInterval:r,onError:()=>{},onComplete:()=>{},classNameModifiers:[],introduction:"wechatpay.scanqrcode",timeToPay:"wechatpay.timetopay",buttonLabel:"openApp",showAmount:!0};export{f as QRLoader};
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import{usePaymentStatusTimer as o}from"../../../hooks/usePaymentStatusTimer/usePaymentStatusTimer.js";import{DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS as r,DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS as a,DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS as n,DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN as i}from"../../../hooks/usePaymentStatusTimer/constants.js";import c from"../../../utils/useAutoFocus.js";import l from"../Button/Button.js";import d from"../ContentSeparator/ContentSeparator.js";import{AnalyticsInfoEvent as s,UiTarget as m,InfoEventType as u}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";import p from"../Spinner/Spinner.js";import{QRDetails as y}from"./components/QRDetails.js";import{QRFinalState as _}from"./components/QRFinalState.js";import{QRLoaderDetailsProvider as h}from"./QRLoaderDetailsProvider.js";import{redirectToApp as g}from"../../../utils/urls.js";function f(r){var a;const{i18n:n,loadingContext:i}=t(),{state:f,actions:q}=o({loadingContext:i,paymentData:r.paymentData,clientKey:r.clientKey,delay:r.delay,throttleTime:r.throttleTime,throttleInterval:r.throttledInterval,type:r.type,onError:r.onError,onComplete:r.onComplete,onActionHandled:r.onActionHandled}),{completed:C,expired:k,loading:v,percentage:b}=f,{onTick:T,onTimeUp:j}=q,{amount:N,showAmount:w,url:A,brandLogo:D,brandName:I,countdownTime:P,type:S,onActionHandled:x}=r,$=r.qrCodeData?`${i}utility/v1/barcode.png?type=qrCode&data=${r.qrCodeData}&clientKey=${r.clientKey}`:r.qrCodeImage,B=c();if(k)return e(_,{image:"error",message:n.get("error.subtitle.payment")});if(C)return e(_,{image:"success",message:n.get("creditCard.success")});if(v)return e("div",{className:"adyen-checkout__qr-loader"},D&&e("div",{className:"adyen-checkout__qr-loader__brand-logo-wrapper"},e("img",{alt:I,src:D,className:"adyen-checkout__qr-loader__brand-logo"})),e(p,null));const E=r.classNameModifiers.map(e=>`adyen-checkout__qr-loader--${e}`);return e("div",{className:`adyen-checkout__qr-loader adyen-checkout__qr-loader--${S} ${E.join(" ")}`,"data-testid":`${S}-qr-loader`},D&&e("div",{className:"adyen-checkout__qr-loader__brand-logo-wrapper"},e("img",{src:D,alt:I,className:"adyen-checkout__qr-loader__brand-logo"})),w&&N&&null!==N.value&&!!N.currency&&e("h1",{className:"adyen-checkout__qr-loader__payment_amount"},n.amount(N.value,N.currency)),A&&e("div",{className:"adyen-checkout__qr-loader__app-link"},r.redirectIntroduction&&e("p",{className:"adyen-checkout__qr-loader__subtitle"},n.get(r.redirectIntroduction)),e(l,{classNameModifiers:["qr-loader"],onClick:()=>g(A),label:n.get(r.buttonLabel)}),e(d,null)),e("p",{ref:B,tabIndex:0,className:"adyen-checkout__qr-loader__subtitle"},"string"==typeof r.introduction?n.get(r.introduction):null===(a=r.introduction)||void 0===a?void 0:a.call(r)),e(h,{type:S,qrCodeImage:$,qrCodeData:r.qrCodeData,percentage:b,timeToPay:r.timeToPay,copyBtn:r.copyBtn,instructions:r.instructions,countdownTime:P,onTick:e=>T(e),onQRCodeLoad:()=>{null==x||x({componentType:r.type,actionDescription:"qr-code-loaded"})},onTimeUp:()=>j(),handleCopy:()=>{const e=new s({component:r.type,type:u.download,target:m.qrDownloadButton});r.onSubmitAnalytics(e)}},r.children?r.children:e(y,null)))}f.defaultProps={countdownTime:i,delay:n,throttleTime:a,throttledInterval:r,onError:()=>{},onComplete:()=>{},classNameModifiers:[],introduction:"wechatpay.scanqrcode",timeToPay:"wechatpay.timetopay",buttonLabel:"openApp",showAmount:!0};export{f as QRLoader};
|
|
2
2
|
//# sourceMappingURL=QRLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRLoader.js","sources":["../../../../../src/components/internal/QRLoader/QRLoader.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport {\n usePaymentStatusTimer,\n DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from '../../../hooks/usePaymentStatusTimer';\nimport useAutoFocus from '../../../utils/useAutoFocus';\nimport Button from '../Button';\nimport ContentSeparator from '../ContentSeparator';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { CountdownTime } from '../Countdown/types';\nimport Spinner from '../Spinner';\nimport { QRDetails } from './components/QRDetails';\nimport { QRFinalState } from './components/QRFinalState';\nimport { QRLoaderDetailsProvider } from './QRLoaderDetailsProvider';\nimport { QRLoaderProps } from './types';\nimport { redirectToApp } from '../../../utils/urls';\nimport './QRLoader.scss';\n\nconst QRCODE_URL = 'utility/v1/barcode.png?type=qrCode&data=';\n\nexport function QRLoader(props: QRLoaderProps) {\n const { i18n, loadingContext } = useCoreContext();\n\n const { state: timerState, actions: timerActions } = usePaymentStatusTimer({\n loadingContext,\n paymentData: props.paymentData,\n clientKey: props.clientKey,\n delay: props.delay,\n throttleTime: props.throttleTime,\n throttleInterval: props.throttledInterval,\n type: props.type,\n onError: props.onError,\n onComplete: props.onComplete,\n onActionHandled: props.onActionHandled\n });\n\n const { completed, expired, loading, percentage } = timerState;\n const { onTick, onTimeUp } = timerActions;\n\n const { amount, showAmount, url, brandLogo, brandName, countdownTime, type, onActionHandled } = props;\n\n const qrCodeImage = props.qrCodeData ? `${loadingContext}${QRCODE_URL}${props.qrCodeData}&clientKey=${props.clientKey}` : props.qrCodeImage;\n\n const handleCopy = () => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.download,\n target: UiTarget.qrDownloadButton\n });\n props.onSubmitAnalytics(event);\n };\n\n const onQrCodeLoad = () => {\n onActionHandled?.({\n componentType: props.type,\n actionDescription: 'qr-code-loaded'\n });\n };\n\n const qrSubtitleRef = useAutoFocus();\n\n if (expired) {\n return <QRFinalState image=\"error\" message={i18n.get('error.subtitle.payment')} />;\n }\n\n if (completed) {\n return <QRFinalState image=\"success\" message={i18n.get('creditCard.success')} />;\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__qr-loader\">\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img alt={brandName} src={brandLogo} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n <Spinner />\n </div>\n );\n }\n\n const classnames = props.classNameModifiers.map(m => `adyen-checkout__qr-loader--${m}`);\n\n return (\n <div className={`adyen-checkout__qr-loader adyen-checkout__qr-loader--${type} ${classnames.join(' ')}`}>\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img src={brandLogo} alt={brandName} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n\n {showAmount && amount && amount.value !== null && !!amount.currency && (\n <h1 className=\"adyen-checkout__qr-loader__payment_amount\">{i18n.amount(amount.value, amount.currency)}</h1>\n )}\n\n {url && (\n <div className=\"adyen-checkout__qr-loader__app-link\">\n {props.redirectIntroduction && <p className=\"adyen-checkout__qr-loader__subtitle\">{i18n.get(props.redirectIntroduction)}</p>}\n <Button classNameModifiers={['qr-loader']} onClick={() => redirectToApp(url)} label={i18n.get(props.buttonLabel)} />\n <ContentSeparator />\n </div>\n )}\n\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <p ref={qrSubtitleRef} tabIndex={0} className=\"adyen-checkout__qr-loader__subtitle\">\n {typeof props.introduction === 'string' ? i18n.get(props.introduction) : props.introduction?.()}\n </p>\n\n <QRLoaderDetailsProvider\n qrCodeImage={qrCodeImage}\n qrCodeData={props.qrCodeData}\n percentage={percentage}\n timeToPay={props.timeToPay}\n copyBtn={props.copyBtn}\n instructions={props.instructions}\n countdownTime={countdownTime}\n onTick={(time: CountdownTime) => onTick(time)}\n onQRCodeLoad={onQrCodeLoad}\n onTimeUp={() => onTimeUp()}\n handleCopy={handleCopy}\n >\n {props.children ? props.children : <QRDetails />}\n </QRLoaderDetailsProvider>\n </div>\n );\n}\n\nQRLoader.defaultProps = {\n countdownTime: DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n delay: DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n throttleTime: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS,\n throttledInterval: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n onError: () => {},\n onComplete: () => {},\n classNameModifiers: [],\n introduction: 'wechatpay.scanqrcode',\n timeToPay: 'wechatpay.timetopay',\n buttonLabel: 'openApp',\n showAmount: true\n};\n"],"names":["QRLoader","props","i18n","loadingContext","useCoreContext","state","timerState","actions","timerActions","usePaymentStatusTimer","paymentData","clientKey","delay","throttleTime","throttleInterval","throttledInterval","type","onError","onComplete","onActionHandled","completed","expired","loading","percentage","onTick","onTimeUp","amount","showAmount","url","brandLogo","brandName","countdownTime","qrCodeImage","qrCodeData","qrSubtitleRef","useAutoFocus","h","QRFinalState","image","message","get","div","className","img","alt","src","Spinner","classnames","classNameModifiers","map","m","join","value","currency","h1","redirectIntroduction","p","Button","onClick","redirectToApp","label","buttonLabel","ContentSeparator","ref","tabIndex","introduction","QRLoaderDetailsProvider","timeToPay","copyBtn","instructions","time","onQRCodeLoad","componentType","actionDescription","handleCopy","event","AnalyticsInfoEvent","component","InfoEventType","download","target","UiTarget","qrDownloadButton","onSubmitAnalytics","children","QRDetails","defaultProps","DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS"],"mappings":"shCAwBO,SAASA,EAASC,GAsFgEA,IAAAA,EArFrF,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,KAEzBC,MAAOC,EAAYC,QAASC,GAAiBC,EAAsB,CACvEN,iBACAO,YAAaT,EAAMS,YACnBC,UAAWV,EAAMU,UACjBC,MAAOX,EAAMW,MACbC,aAAcZ,EAAMY,aACpBC,iBAAkBb,EAAMc,kBACxBC,KAAMf,EAAMe,KACZC,QAAShB,EAAMgB,QACfC,WAAYjB,EAAMiB,WAClBC,gBAAiBlB,EAAMkB,mBAGrBC,UAAEA,EAASC,QAAEA,EAAOC,QAAEA,EAAOC,WAAEA,GAAejB,GAC9CkB,OAAEA,EAAMC,SAAEA,GAAajB,GAEvBkB,OAAEA,EAAMC,WAAEA,EAAUC,IAAEA,EAAGC,UAAEA,EAASC,UAAEA,EAASC,cAAEA,EAAaf,KAAEA,EAAIG,gBAAEA,GAAoBlB,EAE1F+B,EAAc/B,EAAMgC,WAAa,GAAG9B,4CAA8BF,EAAMgC,wBAAwBhC,EAAMU,YAAcV,EAAM+B,YAkB1HE,EAAgBC,IAEtB,GAAId,EACA,OAAOe,EAACC,EAAAA,CAAaC,MAAM,QAAQC,QAASrC,EAAKsC,IAAI,4BAGzD,GAAIpB,EACA,OAAOgB,EAACC,EAAAA,CAAaC,MAAM,UAAUC,QAASrC,EAAKsC,IAAI,wBAG3D,GAAIlB,EACA,OACIc,EAACK,MAAAA,CAAIC,UAAU,6BACVb,GACGO,EAACK,MAAAA,CAAIC,UAAU,iDACXN,EAACO,MAAAA,CAAIC,IAAKd,EAAWe,IAAKhB,EAAWa,UAAU,2CAGvDN,EAACU,EAAAA,OAKb,MAAMC,EAAa9C,EAAM+C,mBAAmBC,IAAIC,GAAK,8BAA8BA,KAEnF,OACId,EAACK,MAAAA,CAAIC,UAAW,wDAAwD1B,KAAQ+B,EAAWI,KAAK,
|
|
1
|
+
{"version":3,"file":"QRLoader.js","sources":["../../../../../src/components/internal/QRLoader/QRLoader.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport {\n usePaymentStatusTimer,\n DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from '../../../hooks/usePaymentStatusTimer';\nimport useAutoFocus from '../../../utils/useAutoFocus';\nimport Button from '../Button';\nimport ContentSeparator from '../ContentSeparator';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { CountdownTime } from '../Countdown/types';\nimport Spinner from '../Spinner';\nimport { QRDetails } from './components/QRDetails';\nimport { QRFinalState } from './components/QRFinalState';\nimport { QRLoaderDetailsProvider } from './QRLoaderDetailsProvider';\nimport { QRLoaderProps } from './types';\nimport { redirectToApp } from '../../../utils/urls';\nimport './QRLoader.scss';\n\nconst QRCODE_URL = 'utility/v1/barcode.png?type=qrCode&data=';\n\nexport function QRLoader(props: Readonly<QRLoaderProps>) {\n const { i18n, loadingContext } = useCoreContext();\n\n const { state: timerState, actions: timerActions } = usePaymentStatusTimer({\n loadingContext,\n paymentData: props.paymentData,\n clientKey: props.clientKey,\n delay: props.delay,\n throttleTime: props.throttleTime,\n throttleInterval: props.throttledInterval,\n type: props.type,\n onError: props.onError,\n onComplete: props.onComplete,\n onActionHandled: props.onActionHandled\n });\n\n const { completed, expired, loading, percentage } = timerState;\n const { onTick, onTimeUp } = timerActions;\n\n const { amount, showAmount, url, brandLogo, brandName, countdownTime, type, onActionHandled } = props;\n\n const qrCodeImage = props.qrCodeData ? `${loadingContext}${QRCODE_URL}${props.qrCodeData}&clientKey=${props.clientKey}` : props.qrCodeImage;\n\n const handleCopy = () => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.download,\n target: UiTarget.qrDownloadButton\n });\n props.onSubmitAnalytics(event);\n };\n\n const onQrCodeLoad = () => {\n onActionHandled?.({\n componentType: props.type,\n actionDescription: 'qr-code-loaded'\n });\n };\n\n const qrSubtitleRef = useAutoFocus();\n\n if (expired) {\n return <QRFinalState image=\"error\" message={i18n.get('error.subtitle.payment')} />;\n }\n\n if (completed) {\n return <QRFinalState image=\"success\" message={i18n.get('creditCard.success')} />;\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__qr-loader\">\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img alt={brandName} src={brandLogo} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n <Spinner />\n </div>\n );\n }\n\n const classnames = props.classNameModifiers.map(m => `adyen-checkout__qr-loader--${m}`);\n\n return (\n <div className={`adyen-checkout__qr-loader adyen-checkout__qr-loader--${type} ${classnames.join(' ')}`} data-testid={`${type}-qr-loader`}>\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img src={brandLogo} alt={brandName} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n\n {showAmount && amount && amount.value !== null && !!amount.currency && (\n <h1 className=\"adyen-checkout__qr-loader__payment_amount\">{i18n.amount(amount.value, amount.currency)}</h1>\n )}\n\n {url && (\n <div className=\"adyen-checkout__qr-loader__app-link\">\n {props.redirectIntroduction && <p className=\"adyen-checkout__qr-loader__subtitle\">{i18n.get(props.redirectIntroduction)}</p>}\n <Button classNameModifiers={['qr-loader']} onClick={() => redirectToApp(url)} label={i18n.get(props.buttonLabel)} />\n <ContentSeparator />\n </div>\n )}\n\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <p ref={qrSubtitleRef} tabIndex={0} className=\"adyen-checkout__qr-loader__subtitle\">\n {typeof props.introduction === 'string' ? i18n.get(props.introduction) : props.introduction?.()}\n </p>\n\n <QRLoaderDetailsProvider\n type={type}\n qrCodeImage={qrCodeImage}\n qrCodeData={props.qrCodeData}\n percentage={percentage}\n timeToPay={props.timeToPay}\n copyBtn={props.copyBtn}\n instructions={props.instructions}\n countdownTime={countdownTime}\n onTick={(time: CountdownTime) => onTick(time)}\n onQRCodeLoad={onQrCodeLoad}\n onTimeUp={() => onTimeUp()}\n handleCopy={handleCopy}\n >\n {props.children ? props.children : <QRDetails />}\n </QRLoaderDetailsProvider>\n </div>\n );\n}\n\nQRLoader.defaultProps = {\n countdownTime: DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n delay: DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n throttleTime: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS,\n throttledInterval: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n onError: () => {},\n onComplete: () => {},\n classNameModifiers: [],\n introduction: 'wechatpay.scanqrcode',\n timeToPay: 'wechatpay.timetopay',\n buttonLabel: 'openApp',\n showAmount: true\n};\n"],"names":["QRLoader","props","i18n","loadingContext","useCoreContext","state","timerState","actions","timerActions","usePaymentStatusTimer","paymentData","clientKey","delay","throttleTime","throttleInterval","throttledInterval","type","onError","onComplete","onActionHandled","completed","expired","loading","percentage","onTick","onTimeUp","amount","showAmount","url","brandLogo","brandName","countdownTime","qrCodeImage","qrCodeData","qrSubtitleRef","useAutoFocus","h","QRFinalState","image","message","get","div","className","img","alt","src","Spinner","classnames","classNameModifiers","map","m","join","data-testid","value","currency","h1","redirectIntroduction","p","Button","onClick","redirectToApp","label","buttonLabel","ContentSeparator","ref","tabIndex","introduction","QRLoaderDetailsProvider","timeToPay","copyBtn","instructions","time","onQRCodeLoad","componentType","actionDescription","handleCopy","event","AnalyticsInfoEvent","component","InfoEventType","download","target","UiTarget","qrDownloadButton","onSubmitAnalytics","children","QRDetails","defaultProps","DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS"],"mappings":"shCAwBO,SAASA,EAASC,GAsFgEA,IAAAA,EArFrF,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,KAEzBC,MAAOC,EAAYC,QAASC,GAAiBC,EAAsB,CACvEN,iBACAO,YAAaT,EAAMS,YACnBC,UAAWV,EAAMU,UACjBC,MAAOX,EAAMW,MACbC,aAAcZ,EAAMY,aACpBC,iBAAkBb,EAAMc,kBACxBC,KAAMf,EAAMe,KACZC,QAAShB,EAAMgB,QACfC,WAAYjB,EAAMiB,WAClBC,gBAAiBlB,EAAMkB,mBAGrBC,UAAEA,EAASC,QAAEA,EAAOC,QAAEA,EAAOC,WAAEA,GAAejB,GAC9CkB,OAAEA,EAAMC,SAAEA,GAAajB,GAEvBkB,OAAEA,EA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