@adyen/adyen-web 6.45.1 → 6.46.0-alpha.7c7199d
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 +7 -7
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +136 -71
- package/dist/es/adyen.css +7 -7
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/ANCV/ANCV.js +1 -1
- package/dist/es/components/ANCV/ANCV.js.map +1 -1
- package/dist/es/components/ANCV/components/ANCVInput.js +1 -1
- package/dist/es/components/ANCV/components/ANCVInput.js.map +1 -1
- package/dist/es/components/Ach/Ach.js +1 -1
- package/dist/es/components/Ach/Ach.js.map +1 -1
- package/dist/es/components/Ach/components/AchComponent.js +1 -1
- package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
- package/dist/es/components/Ach/components/useSRPanelForACHErrors.js.map +1 -1
- package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
- package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
- package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es/components/BacsDD/BacsDD.js +1 -1
- package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es/components/BankTransfer/BankTransfer.js +1 -1
- package/dist/es/components/BankTransfer/BankTransfer.js.map +1 -1
- package/dist/es/components/Blik/Blik.js +1 -1
- package/dist/es/components/Blik/Blik.js.map +1 -1
- package/dist/es/components/Blik/components/BlikInput.js +1 -1
- package/dist/es/components/Blik/components/BlikInput.js.map +1 -1
- package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
- package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/Doku/components/DokuInput/DokuInput.js +1 -1
- package/dist/es/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
- package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
- package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
- package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
- package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
- package/dist/es/components/Dropin/Dropin.js +1 -1
- package/dist/es/components/Dropin/Dropin.js.map +1 -1
- package/dist/es/components/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/Giftcard/Giftcard.js +1 -1
- package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardResult.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardResult.js.map +1 -1
- package/dist/es/components/Giropay/Giropay.js +1 -1
- package/dist/es/components/Giropay/Giropay.js.map +1 -1
- package/dist/es/components/Iris/Iris.js +1 -1
- package/dist/es/components/Iris/Iris.js.map +1 -1
- package/dist/es/components/Iris/components/IrisComponent.js +1 -1
- package/dist/es/components/Iris/components/IrisComponent.js.map +1 -1
- package/dist/es/components/Iris/components/IrisGenerateQRCode.js +1 -1
- package/dist/es/components/Iris/components/IrisGenerateQRCode.js.map +1 -1
- package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
- package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
- package/dist/es/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
- package/dist/es/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
- package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
- package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
- package/dist/es/components/Multibanco/Multibanco.js +1 -1
- package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
- package/dist/es/components/Oxxo/Oxxo.js +1 -1
- package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
- package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es/components/PayByBankPix/components/Enrollment/Enrollment.js +1 -1
- package/dist/es/components/PayByBankPix/components/Enrollment/Enrollment.js.map +1 -1
- package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
- package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
- package/dist/es/components/PayPal/Paypal.js +1 -1
- package/dist/es/components/PayPal/Paypal.js.map +1 -1
- package/dist/es/components/PayPalFastlane/Fastlane.js +1 -1
- package/dist/es/components/PayPalFastlane/Fastlane.js.map +1 -1
- package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js +1 -1
- package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
- package/dist/es/components/PayTo/PayTo.js +1 -1
- package/dist/es/components/PayTo/PayTo.js.map +1 -1
- package/dist/es/components/PayTo/components/PayToComponent.js +1 -1
- package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es/components/Pix/Pix.js +1 -1
- package/dist/es/components/Pix/Pix.js.map +1 -1
- package/dist/es/components/Pix/components/PixInput/PixInput.js +1 -1
- package/dist/es/components/Pix/components/PixInput/PixInput.js.map +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
- package/dist/es/components/Redirect/Redirect.js +1 -1
- package/dist/es/components/Redirect/Redirect.js.map +1 -1
- package/dist/es/components/Trustly/Trustly.js +1 -1
- package/dist/es/components/Trustly/Trustly.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/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
- package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
- package/dist/es/components/internal/Address/components/CountryField.js.map +1 -1
- package/dist/es/components/internal/Address/components/FieldContainer.js +1 -1
- package/dist/es/components/internal/Address/components/FieldContainer.js.map +1 -1
- package/dist/es/components/internal/Address/components/StateField.js.map +1 -1
- package/dist/es/components/internal/Address/constants.js +1 -1
- package/dist/es/components/internal/Address/constants.js.map +1 -1
- package/dist/es/components/internal/Address/validate.formats.js +1 -1
- package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
- package/dist/es/components/internal/Address/validate.js +1 -1
- package/dist/es/components/internal/Address/validate.js.map +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js +1 -1
- package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
- package/dist/es/components/internal/DisclaimerMessage/utils.js +2 -0
- package/dist/es/components/internal/DisclaimerMessage/utils.js.map +1 -0
- package/dist/es/components/internal/FormFields/utils.js +1 -1
- package/dist/es/components/internal/FormFields/utils.js.map +1 -1
- package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
- package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
- package/dist/es/components/internal/IssuerList/IssuerList.js +1 -1
- package/dist/es/components/internal/IssuerList/IssuerList.js.map +1 -1
- package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
- package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
- package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
- package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
- package/dist/es/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es/components/internal/PhoneInput/usePhonePrefixes.js.map +1 -1
- package/dist/es/components/internal/RedirectButton/RedirectButton.js +1 -1
- package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.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/UIElement/UIElement.js +1 -1
- package/dist/es/components/internal/UIElement/UIElement.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/Errors/AdyenCheckoutError.js.map +1 -1
- package/dist/es/core/Errors/SRPanelProvider.js.map +1 -1
- package/dist/es/core/RiskModule/RiskModule.js +1 -1
- package/dist/es/core/RiskModule/RiskModule.js.map +1 -1
- package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
- package/dist/es/core/Services/get-dataset.js.map +1 -1
- package/dist/es/core/Services/http.js +1 -1
- package/dist/es/core/Services/http.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/core/config.js.map +1 -1
- package/dist/es/core/core.js.map +1 -1
- package/dist/es/core/core.registry.js +1 -1
- package/dist/es/core/core.registry.js.map +1 -1
- package/dist/es/core/utils.js +1 -1
- package/dist/es/core/utils.js.map +1 -1
- package/dist/es/index.d.ts +136 -71
- package/dist/es/packages/server/translations/en-US.json.js +1 -1
- package/dist/es-legacy/adyen.css +7 -7
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
- package/dist/es-legacy/components/ANCV/components/ANCVInput.js +1 -1
- package/dist/es-legacy/components/ANCV/components/ANCVInput.js.map +1 -1
- package/dist/es-legacy/components/Ach/Ach.js +1 -1
- package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
- package/dist/es-legacy/components/Ach/components/AchComponent.js +1 -1
- package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
- package/dist/es-legacy/components/Ach/components/useSRPanelForACHErrors.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
- package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
- package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es-legacy/components/BankTransfer/BankTransfer.js +1 -1
- package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
- package/dist/es-legacy/components/Blik/Blik.js +1 -1
- package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
- package/dist/es-legacy/components/Blik/components/BlikInput.js +1 -1
- package/dist/es-legacy/components/Blik/components/BlikInput.js.map +1 -1
- package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
- package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
- package/dist/es-legacy/components/Card/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/CardFieldsWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
- package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js +1 -1
- package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
- package/dist/es-legacy/components/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/Giftcard/Giftcard.js +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js.map +1 -1
- package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
- package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
- package/dist/es-legacy/components/Iris/Iris.js +1 -1
- package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
- package/dist/es-legacy/components/Iris/components/IrisComponent.js +1 -1
- package/dist/es-legacy/components/Iris/components/IrisComponent.js.map +1 -1
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js +1 -1
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js.map +1 -1
- package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
- package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
- package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
- package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
- package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
- package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
- package/dist/es-legacy/components/Oxxo/Oxxo.js +1 -1
- package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/components/Enrollment/Enrollment.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/components/Enrollment/Enrollment.js.map +1 -1
- package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
- package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
- package/dist/es-legacy/components/PayPalFastlane/Fastlane.js +1 -1
- package/dist/es-legacy/components/PayPalFastlane/Fastlane.js.map +1 -1
- package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js +1 -1
- package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es-legacy/components/Pix/Pix.js +1 -1
- package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
- package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js +1 -1
- package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js.map +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
- package/dist/es-legacy/components/Redirect/Redirect.js +1 -1
- package/dist/es-legacy/components/Redirect/Redirect.js.map +1 -1
- package/dist/es-legacy/components/Trustly/Trustly.js +1 -1
- package/dist/es-legacy/components/Trustly/Trustly.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/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
- package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/components/CountryField.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/components/FieldContainer.js +1 -1
- package/dist/es-legacy/components/internal/Address/components/FieldContainer.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/components/StateField.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/constants.js +1 -1
- package/dist/es-legacy/components/internal/Address/constants.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
- package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/validate.js +1 -1
- package/dist/es-legacy/components/internal/Address/validate.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/DisclaimerMessage/DisclaimerMessage.js +1 -1
- package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
- package/dist/es-legacy/components/internal/DisclaimerMessage/utils.js +2 -0
- package/dist/es-legacy/components/internal/DisclaimerMessage/utils.js.map +1 -0
- package/dist/es-legacy/components/internal/FormFields/utils.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
- package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerList.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/PhoneInput/usePhonePrefixes.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/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/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.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/Errors/AdyenCheckoutError.js.map +1 -1
- package/dist/es-legacy/core/Errors/SRPanelProvider.js.map +1 -1
- package/dist/es-legacy/core/RiskModule/RiskModule.js +1 -1
- package/dist/es-legacy/core/RiskModule/RiskModule.js.map +1 -1
- package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
- package/dist/es-legacy/core/Services/get-dataset.js.map +1 -1
- package/dist/es-legacy/core/Services/http.js +1 -1
- package/dist/es-legacy/core/Services/http.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/config.js.map +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/dist/es-legacy/core/core.registry.js +1 -1
- package/dist/es-legacy/core/core.registry.js.map +1 -1
- package/dist/es-legacy/core/utils.js +1 -1
- package/dist/es-legacy/core/utils.js.map +1 -1
- package/dist/es-legacy/packages/server/translations/en-US.json.js +1 -1
- package/package.json +11 -11
- package/styles/adyen.css +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRLoaderContainer.js","sources":["../../../../../src/components/helpers/QRLoaderContainer/QRLoaderContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport { QRLoader } from '../../internal/QRLoader';\nimport RedirectButton from '../../internal/RedirectButton';\nimport { QRLoaderConfiguration } from './types';\n\nclass QRLoaderContainer<T extends QRLoaderConfiguration = QRLoaderConfiguration> extends UIElement<T> {\n // Using the generic here allow to fully extend the QRLoaderContainer (including it's props)\n protected static readonly defaultProps = {\n qrCodeImage: '',\n amount: null,\n paymentData: null,\n onError: () => {}\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...this.state.data\n }\n };\n }\n\n get isValid() {\n return true;\n }\n\n // Makes possible to extend the final QR code step\n public renderQRCode() {\n return (\n <QRLoader\n {...this.props}\n delay={this.props.delay}\n countdownTime={this.props.countdownTime}\n instructions={this.props.instructions}\n type={this.constructor['type']}\n brandLogo={this.props.brandLogo || this.icon}\n onComplete={this.onComplete}\n onActionHandled={this.onActionHandled}\n brandName={this.displayName}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return this.renderQRCode();\n }\n\n
|
|
1
|
+
{"version":3,"file":"QRLoaderContainer.js","sources":["../../../../../src/components/helpers/QRLoaderContainer/QRLoaderContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport { QRLoader } from '../../internal/QRLoader';\nimport RedirectButton from '../../internal/RedirectButton';\nimport { QRLoaderConfiguration } from './types';\n\nclass QRLoaderContainer<T extends QRLoaderConfiguration = QRLoaderConfiguration> extends UIElement<T> {\n // Using the generic here allow to fully extend the QRLoaderContainer (including it's props)\n protected static readonly defaultProps = {\n qrCodeImage: '',\n amount: null,\n paymentData: null,\n onError: () => {}\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...this.state.data\n }\n };\n }\n\n get isValid() {\n return true;\n }\n\n // Makes possible to extend the final QR code step\n public renderQRCode() {\n return (\n <QRLoader\n {...this.props}\n delay={this.props.delay}\n countdownTime={this.props.countdownTime}\n instructions={this.props.instructions}\n type={this.constructor['type']}\n brandLogo={this.props.brandLogo || this.icon}\n onComplete={this.onComplete}\n onActionHandled={this.onActionHandled}\n brandName={this.displayName}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return this.renderQRCode();\n }\n\n return (\n <RedirectButton\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n}\n\nexport default QRLoaderContainer;\n"],"names":["QRLoaderContainer","UIElement","formatData","paymentMethod","_object_spread","type","this","state","data","isValid","renderQRCode","h","QRLoader","props","delay","countdownTime","instructions","constructor","brandLogo","icon","onComplete","onActionHandled","brandName","displayName","onSubmitAnalytics","submitAnalytics","componentToRender","paymentData","RedirectButton","name","onSubmit","submit","payButton","setComponentRef","_define_property","defaultProps","qrCodeImage","amount","onError"],"mappings":"syCAMA,MAAMA,UAAmFC,EASrFC,UAAAA,GACI,MAAO,CACHC,cAAeC,EAAA,CACXC,KAAMC,KAAKD,MACRC,KAAKC,MAAMC,MAG1B,CAEA,WAAIC,GACA,OAAO,CACX,CAGOC,YAAAA,GACH,OACIC,EAACC,EAAAA,EAAAA,EAAAA,GACON,KAAKO,OAAK,CACdC,MAAOR,KAAKO,MAAMC,MAClBC,cAAeT,KAAKO,MAAME,cAC1BC,aAAcV,KAAKO,MAAMG,aACzBX,KAAMC,KAAKW,YAAY,KACvBC,UAAWZ,KAAKO,MAAMK,WAAaZ,KAAKa,KACxCC,WAAYd,KAAKc,WACjBC,gBAAiBf,KAAKe,gBACtBC,UAAWhB,KAAKiB,YAChBC,kBAAmBlB,KAAKmB,kBAGpC,CAEmBC,iBAAAA,GACf,OAAIpB,KAAKO,MAAMc,YACJrB,KAAKI,eAIZC,EAACiB,EAAAA,CACGC,KAAMvB,KAAKiB,YACXO,SAAUxB,KAAKyB,OACfC,UAAW1B,KAAK0B,UAChBC,gBAAiB3B,KAAK2B,iBAGlC,EAnDAC,EAFElC,EAEwBmC,eAAe,CACrCC,YAAa,GACbC,OAAQ,KACRV,YAAa,KACbW,QAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CountryField.js","sources":["../../../../../../src/components/internal/Address/components/CountryField.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useLayoutEffect, useState } from 'preact/hooks';\nimport Field from '../../FormFields/Field';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport getDataset from '../../../../core/Services/get-dataset';\nimport { CountryFieldProps, CountryFieldItem } from '../types';\nimport Select from '../../FormFields/Select';\n\nconst formatCountries = (countries: Array<CountryFieldItem>, allowedCountries: string[]) => {\n const applyFilter = (country: CountryFieldItem) => allowedCountries.includes(country.id);\n const applyMapper = (country: CountryFieldItem) => {\n return {\n ...country,\n name: country.name,\n selectedOptionName: country.name\n };\n };\n return allowedCountries.length ? countries.filter(applyFilter).map(applyMapper) : countries.map(applyMapper);\n};\n\nexport default function CountryField(props: Readonly<CountryFieldProps>) {\n const { allowedCountries = [], classNameModifiers = [], errorMessage, onDropdownChange, value, required } = props;\n const { i18n, loadingContext } = useCoreContext();\n const [countries, setCountries] = useState<CountryFieldItem[]>([]);\n const [loaded, setLoaded] = useState<boolean>(false);\n const [readOnly, setReadOnly] = useState(props.readOnly);\n\n useLayoutEffect(() => {\n getDataset('countries', loadingContext, i18n.locale)\n .then(response => {\n const newCountries = formatCountries(response, allowedCountries);\n setCountries(newCountries || []);\n setReadOnly(newCountries.length === 1 || readOnly);\n setLoaded(true);\n })\n .catch(error => {\n console.error(error);\n setCountries([]);\n setLoaded(true);\n });\n }, []);\n\n if (!loaded) return null;\n\n return (\n <Field\n name={'country'}\n label={i18n.get('country')}\n errorMessage={errorMessage}\n classNameModifiers={classNameModifiers}\n isValid={!!value}\n showValidIcon={false}\n i18n={i18n}\n readOnly={readOnly && !!value}\n >\n <Select\n onChange={onDropdownChange}\n name={'country'}\n selectedValue={value}\n items={countries}\n readonly={readOnly && !!value}\n required={required}\n />\n </Field>\n );\n}\n"],"names":["formatCountries","countries","allowedCountries","applyMapper","country","_object_spread_props","_object_spread","name","selectedOptionName","length","filter","includes","id","map","CountryField","props","classNameModifiers","errorMessage","onDropdownChange","value","required","i18n","loadingContext","useCoreContext","setCountries","useState","loaded","setLoaded","readOnly","setReadOnly","useLayoutEffect","getDataset","locale","then","response","newCountries","catch","error","console","h","Field","label","get","isValid","showValidIcon","Select","onChange","selectedValue","items","readonly"],"mappings":"k3BAQA,MAAMA,EAAkB,CAACC,EAAoCC,KACzD,MACMC,EAAeC,GACVC,oUAAAC,CAAA,CAAA,EACAF,GAAAA,CACHG,KAAMH,EAAQG,KACdC,mBAAoBJ,EAAQG,OAGpC,OAAOL,EAAiBO,OAASR,EAAUS,OARtBN,GAA8BF,EAAiBS,SAASP,EAAQQ,KAQtBC,IAAIV,GAAeF,EAAUY,IAAIV,IAGrF,SAASW,EAAaC,GACjC,MAAMb,iBAAEA,EAAmB,GAAEc,mBAAEA,EAAqB,GAAEC,aAAEA,EAAYC,iBAAEA,EAAgBC,MAAEA,EAAKC,SAAEA,GAAaL,GACtGM,KAAEA,EAAIC,eAAEA,GAAmBC,KAC1BtB,EAAWuB,GAAgBC,EAA6B,KACxDC,EAAQC,GAAaF,GAAkB,IACvCG,EAAUC,GAAeJ,EAASV,EAAMa,UAiB/C,OAfAE,EAAgB,KACZC,
|
|
1
|
+
{"version":3,"file":"CountryField.js","sources":["../../../../../../src/components/internal/Address/components/CountryField.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useLayoutEffect, useState } from 'preact/hooks';\nimport Field from '../../FormFields/Field';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport getDataset from '../../../../core/Services/get-dataset';\nimport { CountryFieldProps, CountryFieldItem } from '../types';\nimport Select from '../../FormFields/Select';\n\nconst formatCountries = (countries: Array<CountryFieldItem>, allowedCountries: string[]) => {\n const applyFilter = (country: CountryFieldItem) => allowedCountries.includes(country.id);\n const applyMapper = (country: CountryFieldItem) => {\n return {\n ...country,\n name: country.name,\n selectedOptionName: country.name\n };\n };\n return allowedCountries.length ? countries.filter(applyFilter).map(applyMapper) : countries.map(applyMapper);\n};\n\nexport default function CountryField(props: Readonly<CountryFieldProps>) {\n const { allowedCountries = [], classNameModifiers = [], errorMessage, onDropdownChange, value, required } = props;\n const { i18n, loadingContext } = useCoreContext();\n const [countries, setCountries] = useState<CountryFieldItem[]>([]);\n const [loaded, setLoaded] = useState<boolean>(false);\n const [readOnly, setReadOnly] = useState(props.readOnly);\n\n useLayoutEffect(() => {\n getDataset<CountryFieldItem[]>('countries', loadingContext, i18n.locale)\n .then(response => {\n const newCountries = formatCountries(response, allowedCountries);\n setCountries(newCountries || []);\n setReadOnly(newCountries.length === 1 || readOnly);\n setLoaded(true);\n })\n .catch(error => {\n console.error(error);\n setCountries([]);\n setLoaded(true);\n });\n }, []);\n\n if (!loaded) return null;\n\n return (\n <Field\n name={'country'}\n label={i18n.get('country')}\n errorMessage={errorMessage}\n classNameModifiers={classNameModifiers}\n isValid={!!value}\n showValidIcon={false}\n i18n={i18n}\n readOnly={readOnly && !!value}\n >\n <Select\n onChange={onDropdownChange}\n name={'country'}\n selectedValue={value}\n items={countries}\n readonly={readOnly && !!value}\n required={required}\n />\n </Field>\n );\n}\n"],"names":["formatCountries","countries","allowedCountries","applyMapper","country","_object_spread_props","_object_spread","name","selectedOptionName","length","filter","includes","id","map","CountryField","props","classNameModifiers","errorMessage","onDropdownChange","value","required","i18n","loadingContext","useCoreContext","setCountries","useState","loaded","setLoaded","readOnly","setReadOnly","useLayoutEffect","getDataset","locale","then","response","newCountries","catch","error","console","h","Field","label","get","isValid","showValidIcon","Select","onChange","selectedValue","items","readonly"],"mappings":"k3BAQA,MAAMA,EAAkB,CAACC,EAAoCC,KACzD,MACMC,EAAeC,GACVC,oUAAAC,CAAA,CAAA,EACAF,GAAAA,CACHG,KAAMH,EAAQG,KACdC,mBAAoBJ,EAAQG,OAGpC,OAAOL,EAAiBO,OAASR,EAAUS,OARtBN,GAA8BF,EAAiBS,SAASP,EAAQQ,KAQtBC,IAAIV,GAAeF,EAAUY,IAAIV,IAGrF,SAASW,EAAaC,GACjC,MAAMb,iBAAEA,EAAmB,GAAEc,mBAAEA,EAAqB,GAAEC,aAAEA,EAAYC,iBAAEA,EAAgBC,MAAEA,EAAKC,SAAEA,GAAaL,GACtGM,KAAEA,EAAIC,eAAEA,GAAmBC,KAC1BtB,EAAWuB,GAAgBC,EAA6B,KACxDC,EAAQC,GAAaF,GAAkB,IACvCG,EAAUC,GAAeJ,EAASV,EAAMa,UAiB/C,OAfAE,EAAgB,KACZC,EAA+B,YAAaT,EAAgBD,EAAKW,QAC5DC,KAAKC,IACF,MAAMC,EAAenC,EAAgBkC,EAAUhC,GAC/CsB,EAAaW,GAAgB,IAC7BN,EAAoC,IAAxBM,EAAa1B,QAAgBmB,GACzCD,GAAU,KAEbS,MAAMC,IACHC,QAAQD,MAAMA,GACdb,EAAa,IACbG,GAAU,MAEnB,IAEED,EAGDa,EAACC,EAAAA,CACGjC,KAAM,UACNkC,MAAOpB,EAAKqB,IAAI,WAChBzB,aAAcA,EACdD,mBAAoBA,EACpB2B,UAAWxB,EACXyB,eAAe,EACfvB,KAAMA,EACNO,SAAUA,KAAcT,GAExBoB,EAACM,EAAAA,CACGC,SAAU5B,EACVX,KAAM,UACNwC,cAAe5B,EACf6B,MAAO/C,EACPgD,SAAUrB,KAAcT,EACxBC,SAAUA,KAnBF,IAuBxB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../external/preact/dist/preact.js";import r from"../../FormFields/Field/Field.js";import o from"./StateField.js";import i from"./CountryField.js";import{useCoreContext as s}from"../../../../core/Context/CoreProvider.js";import t from"../../FormFields/InputText.js";import{ADDRESS_FIELD_TOKEN_MAP as n}from"../constants.js";function a(e,r){const o=n[e];if(o)return"billingAddress"===r?`billing ${o}`:"deliveryAddress"===r?`shipping ${o}`:o}function l(n){const{i18n:l}=s(),{classNameModifiers:d=[],data:c,errors:u,valid:m,fieldName:p,onInput:f,onBlur:g,trimOnBlur:F,maxLength:v,disabled:y,addressType:C}=n,M=c[p],b=c.country,j=n.specifications.countryHasOptionalField(b,p),h=n.specifications.getKeyForField(p,b),w=j?` ${l.get("field.title.optional")}`:"",x=`${l.get(h)}${w}`,B=function(e,r,o,i){var s,t;if("object"==typeof(null===(s=e[r])||void 0===s?void 0:s.errorMessage)){const{translationKey:i,translationObject:s}=e[r].errorMessage;return o.get(i,s)}return o.get(null===(t=e[r])||void 0===t?void 0:t.errorMessage,{values:{label:i.toLowerCase()}})||!!e[r]}(u,p,l,x);
|
|
1
|
+
import{createElement as e}from"../../../../external/preact/dist/preact.js";import r from"../../FormFields/Field/Field.js";import o from"./StateField.js";import i from"./CountryField.js";import{useCoreContext as s}from"../../../../core/Context/CoreProvider.js";import t from"../../FormFields/InputText.js";import{ADDRESS_FIELD_TOKEN_MAP as n}from"../constants.js";function a(e,r){const o=n[e];if(o)return"billingAddress"===r?`billing ${o}`:"deliveryAddress"===r?`shipping ${o}`:o}function l(n){const{i18n:l}=s(),{classNameModifiers:d=[],data:c,errors:u,valid:m,fieldName:p,onInput:f,onBlur:g,trimOnBlur:F,maxLength:v,disabled:y,addressType:C}=n,M=c[p],b=c.country,j=n.specifications.countryHasOptionalField(b,p),h=n.specifications.getKeyForField(p,b),w=j?` ${l.get("field.title.optional")}`:"",x=`${l.get(h)}${w}`,B=function(e,r,o,i){var s,t;if("object"==typeof(null===(s=e[r])||void 0===s?void 0:s.errorMessage)){const{translationKey:i,translationObject:s}=e[r].errorMessage;return o.get(i,s)}return o.get(null===(t=e[r])||void 0===t?void 0:t.errorMessage,{values:{label:i.toLowerCase()}})||!!e[r]}(u,p,l,x);return"country"===p?e(i,{allowedCountries:n.allowedCountries,classNameModifiers:d,label:x,errorMessage:B,onDropdownChange:n.onDropdownChange,value:M,required:!j}):"stateOrProvince"===p?e(o,{classNameModifiers:d,label:x,errorMessage:B,onDropdownChange:n.onDropdownChange,selectedCountry:b,specifications:n.specifications,value:M,required:!j}):e(r,{label:x,classNameModifiers:d,errorMessage:B,isValid:m[p],name:p,i18n:l,onFocus:e=>n.onFieldFocusAnalytics(p,e),onBlur:e=>n.onFieldBlurAnalytics(p,e)},e(t,{name:p,classNameModifiers:d,value:M,onInput:f,onBlur:g,maxlength:v,trimOnBlur:F,disabled:y,required:!j,autocomplete:a(p,C)}))}export{l as default};
|
|
2
2
|
//# sourceMappingURL=FieldContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldContainer.js","sources":["../../../../../../src/components/internal/Address/components/FieldContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Field from '../../FormFields/Field';\nimport StateField from './StateField';\nimport CountryField from './CountryField';\nimport { AddressStateError, AddressType, FieldContainerProps } from '../types';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport Language from '../../../../language/Language';\nimport InputText from '../../FormFields/InputText';\nimport { AutocompleteValue } from '../../FormFields/types';\nimport { ADDRESS_FIELD_TOKEN_MAP } from '../constants';\nimport { AddressField } from '../../../../types';\n\nfunction getErrorMessage(errors: AddressStateError, fieldName: string, i18n: Language, label: string): string | boolean {\n if (typeof errors[fieldName]?.errorMessage === 'object') {\n const { translationKey, translationObject } = errors[fieldName].errorMessage;\n return i18n.get(translationKey, translationObject);\n }\n // Default error msg: Enter the [label name]\n const errorMsg = i18n.get(errors[fieldName]?.errorMessage, { values: { label: label.toLowerCase() } });\n return errorMsg || !!errors[fieldName];\n}\n\n/**\n * USAGE: Specifically defined as a util to provide a wrapper for fields created within the Address component\n *\n * NOT TO BE USED: if you just want to add a Country or State dropdown outside of an Address component\n * - then you should implement <CountryField> or <StateField> directly\n */\nfunction getAddressAutocomplete(fieldName: string, addressType: AddressType): AutocompleteValue {\n const token = ADDRESS_FIELD_TOKEN_MAP[fieldName];\n if (!token) return undefined;\n if (addressType === 'billingAddress') return `billing ${token}` as AutocompleteValue;\n if (addressType === 'deliveryAddress') return `shipping ${token}` as AutocompleteValue;\n // Fallback: bare token (no prefix) when address type is unspecified\n return token as AutocompleteValue;\n}\n\nfunction FieldContainer(props: Readonly<FieldContainerProps>) {\n const { i18n } = useCoreContext();\n const { classNameModifiers = [], data, errors, valid, fieldName, onInput, onBlur, trimOnBlur, maxLength, disabled, addressType } = props;\n\n const value: string = data[fieldName];\n const selectedCountry: string = data.country;\n const isOptional: boolean = props.specifications.countryHasOptionalField(selectedCountry, fieldName as AddressField);\n const labelKey: string = props.specifications.getKeyForField(fieldName, selectedCountry);\n const optionalLabel = isOptional ? ` ${i18n.get('field.title.optional')}` : '';\n const label = `${i18n.get(labelKey)}${optionalLabel}`;\n const errorMessage = getErrorMessage(errors, fieldName, i18n, label);\n\n
|
|
1
|
+
{"version":3,"file":"FieldContainer.js","sources":["../../../../../../src/components/internal/Address/components/FieldContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Field from '../../FormFields/Field';\nimport StateField from './StateField';\nimport CountryField from './CountryField';\nimport { AddressStateError, AddressType, FieldContainerProps } from '../types';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport Language from '../../../../language/Language';\nimport InputText from '../../FormFields/InputText';\nimport { AutocompleteValue } from '../../FormFields/types';\nimport { ADDRESS_FIELD_TOKEN_MAP } from '../constants';\nimport { AddressField } from '../../../../types';\n\nfunction getErrorMessage(errors: AddressStateError, fieldName: string, i18n: Language, label: string): string | boolean {\n if (typeof errors[fieldName]?.errorMessage === 'object') {\n const { translationKey, translationObject } = errors[fieldName].errorMessage;\n return i18n.get(translationKey, translationObject);\n }\n // Default error msg: Enter the [label name]\n const errorMsg = i18n.get(errors[fieldName]?.errorMessage, { values: { label: label.toLowerCase() } });\n return errorMsg || !!errors[fieldName];\n}\n\n/**\n * USAGE: Specifically defined as a util to provide a wrapper for fields created within the Address component\n *\n * NOT TO BE USED: if you just want to add a Country or State dropdown outside of an Address component\n * - then you should implement <CountryField> or <StateField> directly\n */\nfunction getAddressAutocomplete(fieldName: string, addressType: AddressType): AutocompleteValue {\n const token = ADDRESS_FIELD_TOKEN_MAP[fieldName];\n if (!token) return undefined;\n if (addressType === 'billingAddress') return `billing ${token}` as AutocompleteValue;\n if (addressType === 'deliveryAddress') return `shipping ${token}` as AutocompleteValue;\n // Fallback: bare token (no prefix) when address type is unspecified\n return token as AutocompleteValue;\n}\n\nfunction FieldContainer(props: Readonly<FieldContainerProps>) {\n const { i18n } = useCoreContext();\n const { classNameModifiers = [], data, errors, valid, fieldName, onInput, onBlur, trimOnBlur, maxLength, disabled, addressType } = props;\n\n const value: string = data[fieldName];\n const selectedCountry: string = data.country;\n const isOptional: boolean = props.specifications.countryHasOptionalField(selectedCountry, fieldName as AddressField);\n const labelKey: string = props.specifications.getKeyForField(fieldName, selectedCountry);\n const optionalLabel = isOptional ? ` ${i18n.get('field.title.optional')}` : '';\n const label = `${i18n.get(labelKey)}${optionalLabel}`;\n const errorMessage = getErrorMessage(errors, fieldName, i18n, label);\n\n if (fieldName === 'country') {\n return (\n <CountryField\n allowedCountries={props.allowedCountries}\n classNameModifiers={classNameModifiers}\n label={label}\n errorMessage={errorMessage}\n onDropdownChange={props.onDropdownChange}\n value={value}\n required={!isOptional}\n />\n );\n }\n\n if (fieldName === 'stateOrProvince') {\n return (\n <StateField\n classNameModifiers={classNameModifiers}\n label={label}\n errorMessage={errorMessage}\n onDropdownChange={props.onDropdownChange}\n selectedCountry={selectedCountry}\n specifications={props.specifications}\n value={value}\n required={!isOptional}\n />\n );\n }\n\n return (\n <Field\n label={label}\n classNameModifiers={classNameModifiers}\n errorMessage={errorMessage}\n isValid={valid[fieldName]}\n name={fieldName}\n i18n={i18n}\n onFocus={e => props.onFieldFocusAnalytics(fieldName, e)}\n onBlur={e => props.onFieldBlurAnalytics(fieldName, e)}\n >\n <InputText\n name={fieldName}\n classNameModifiers={classNameModifiers}\n value={value}\n onInput={onInput}\n onBlur={onBlur}\n maxlength={maxLength}\n trimOnBlur={trimOnBlur}\n disabled={disabled}\n required={!isOptional}\n autocomplete={getAddressAutocomplete(fieldName, addressType)}\n />\n </Field>\n );\n}\n\nexport default FieldContainer;\n"],"names":["getAddressAutocomplete","fieldName","addressType","token","ADDRESS_FIELD_TOKEN_MAP","FieldContainer","props","i18n","useCoreContext","classNameModifiers","data","errors","valid","onInput","onBlur","trimOnBlur","maxLength","disabled","value","selectedCountry","country","isOptional","specifications","countryHasOptionalField","labelKey","getKeyForField","optionalLabel","get","label","errorMessage","translationKey","translationObject","values","toLowerCase","getErrorMessage","h","CountryField","allowedCountries","onDropdownChange","required","StateField","Field","isValid","name","onFocus","e","onFieldFocusAnalytics","onFieldBlurAnalytics","InputText","maxlength","autocomplete"],"mappings":"2WA4BA,SAASA,EAAuBC,EAAmBC,GAC/C,MAAMC,EAAQC,EAAwBH,GACtC,GAAKE,EACL,MAAoB,mBAAhBD,EAAyC,WAAWC,IACpC,oBAAhBD,EAA0C,YAAYC,IAEnDA,CACX,CAEA,SAASE,EAAeC,GACpB,MAAMC,KAAEA,GAASC,KACXC,mBAAEA,EAAqB,GAAEC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKX,UAAEA,EAASY,QAAEA,EAAOC,OAAEA,EAAMC,WAAEA,EAAUC,UAAEA,EAASC,SAAEA,EAAQf,YAAEA,GAAgBI,EAE7HY,EAAgBR,EAAKT,GACrBkB,EAA0BT,EAAKU,QAC/BC,EAAsBf,EAAMgB,eAAeC,wBAAwBJ,EAAiBlB,GACpFuB,EAAmBlB,EAAMgB,eAAeG,eAAexB,EAAWkB,GAClEO,EAAgBL,EAAa,IAAId,EAAKoB,IAAI,0BAA4B,GACtEC,EAAQ,GAAGrB,EAAKoB,IAAIH,KAAYE,IAChCG,EAnCV,SAAyBlB,EAA2BV,EAAmBM,EAAgBqB,OACxEjB,EAKeA,EAL1B,GAA+C,yBAApCA,EAAAA,EAAOV,UAAPU,IAAAA,OAAAA,EAAAA,EAAmBkB,cAA2B,CACrD,MAAMC,eAAEA,EAAcC,kBAAEA,GAAsBpB,EAAOV,GAAW4B,aAChE,OAAOtB,EAAKoB,IAAIG,EAAgBC,EACpC,CAGA,OADiBxB,EAAKoB,IAAqB,QAAjBhB,EAAAA,EAAOV,UAAPU,IAAAA,OAAAA,EAAAA,EAAmBkB,aAAc,CAAEG,OAAQ,CAAEJ,MAAOA,EAAMK,oBAC/DtB,EAAOV,EAChC,CA2ByBiC,CAAgBvB,EAAQV,EAAWM,EAAMqB,GAE9D,MAAkB,YAAd3B,EAEIkC,EAACC,EAAAA,CACGC,iBAAkB/B,EAAM+B,iBACxB5B,mBAAoBA,EACpBmB,MAAOA,EACPC,aAAcA,EACdS,iBAAkBhC,EAAMgC,iBACxBpB,MAAOA,EACPqB,UAAWlB,IAKL,oBAAdpB,EAEIkC,EAACK,EAAAA,CACG/B,mBAAoBA,EACpBmB,MAAOA,EACPC,aAAcA,EACdS,iBAAkBhC,EAAMgC,iBACxBnB,gBAAiBA,EACjBG,eAAgBhB,EAAMgB,eACtBJ,MAAOA,EACPqB,UAAWlB,IAMnBc,EAACM,EAAAA,CACGb,MAAOA,EACPnB,mBAAoBA,EACpBoB,aAAcA,EACda,QAAS9B,EAAMX,GACf0C,KAAM1C,EACNM,KAAMA,EACNqC,QAASC,GAAKvC,EAAMwC,sBAAsB7C,EAAW4C,GACrD/B,OAAQ+B,GAAKvC,EAAMyC,qBAAqB9C,EAAW4C,IAEnDV,EAACa,EAAAA,CACGL,KAAM1C,EACNQ,mBAAoBA,EACpBS,MAAOA,EACPL,QAASA,EACTC,OAAQA,EACRmC,UAAWjC,EACXD,WAAYA,EACZE,SAAUA,EACVsB,UAAWlB,EACX6B,aAAclD,EAAuBC,EAAWC,KAIhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateField.js","sources":["../../../../../../src/components/internal/Address/components/StateField.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useLayoutEffect } from 'preact/hooks';\nimport Field from '../../FormFields/Field';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport getDataset from '../../../../core/Services/get-dataset';\nimport { StateFieldItem, StateFieldProps } from '../types';\nimport Select from '../../FormFields/Select';\n\nexport default function StateField(props: Readonly<StateFieldProps>) {\n const { classNameModifiers, label, onDropdownChange, readOnly, selectedCountry, specifications, value, required } = props;\n const { i18n, loadingContext } = useCoreContext();\n const [states, setStates] = useState<StateFieldItem[]>([]);\n const [loaded, setLoaded] = useState<boolean>(false);\n\n useLayoutEffect(() => {\n if (!selectedCountry || !specifications.countryHasDataset(selectedCountry)) {\n setStates([]);\n setLoaded(true);\n return;\n }\n\n getDataset(`states/${selectedCountry}`, loadingContext, i18n.locale)\n .then(response => {\n const newStates = response && response.length ? response : [];\n setStates(newStates);\n setLoaded(true);\n })\n .catch(() => {\n setStates([]);\n setLoaded(true);\n });\n }, [selectedCountry]);\n\n if (!loaded || !states.length) return null;\n\n return (\n <Field\n label={label}\n classNameModifiers={classNameModifiers}\n errorMessage={props.errorMessage}\n isValid={!!value}\n showValidIcon={false}\n name={'stateOrProvince'}\n i18n={i18n}\n readOnly={readOnly && !!value}\n >\n <Select\n name={'stateOrProvince'}\n onChange={onDropdownChange}\n selectedValue={value}\n items={states}\n required={required}\n readonly={readOnly && !!value}\n />\n </Field>\n );\n}\n"],"names":["StateField","props","classNameModifiers","label","onDropdownChange","readOnly","selectedCountry","specifications","value","required","i18n","loadingContext","useCoreContext","states","setStates","useState","loaded","setLoaded","useLayoutEffect","countryHasDataset","getDataset","locale","then","response","newStates","length","catch","h","Field","errorMessage","isValid","showValidIcon","name","Select","onChange","selectedValue","items","readonly"],"mappings":"6YAQe,SAASA,EAAWC,GAC/B,MAAMC,mBAAEA,EAAkBC,MAAEA,EAAKC,iBAAEA,EAAgBC,SAAEA,EAAQC,gBAAEA,EAAeC,eAAEA,EAAcC,MAAEA,EAAKC,SAAEA,GAAaR,GAC9GS,KAAEA,EAAIC,eAAEA,GAAmBC,KAC1BC,EAAQC,GAAaC,EAA2B,KAChDC,EAAQC,GAAaF,GAAkB,GAqB9C,OAnBAG,EAAgB,KACZ,IAAKZ,IAAoBC,EAAeY,kBAAkBb,GAGtD,OAFAQ,EAAU,SACVG,GAAU,GAIdG,
|
|
1
|
+
{"version":3,"file":"StateField.js","sources":["../../../../../../src/components/internal/Address/components/StateField.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useLayoutEffect } from 'preact/hooks';\nimport Field from '../../FormFields/Field';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport getDataset from '../../../../core/Services/get-dataset';\nimport { StateFieldItem, StateFieldProps } from '../types';\nimport Select from '../../FormFields/Select';\n\nexport default function StateField(props: Readonly<StateFieldProps>) {\n const { classNameModifiers, label, onDropdownChange, readOnly, selectedCountry, specifications, value, required } = props;\n const { i18n, loadingContext } = useCoreContext();\n const [states, setStates] = useState<StateFieldItem[]>([]);\n const [loaded, setLoaded] = useState<boolean>(false);\n\n useLayoutEffect(() => {\n if (!selectedCountry || !specifications.countryHasDataset(selectedCountry)) {\n setStates([]);\n setLoaded(true);\n return;\n }\n\n getDataset<StateFieldItem[]>(`states/${selectedCountry}`, loadingContext, i18n.locale)\n .then(response => {\n const newStates = response && response.length ? response : [];\n setStates(newStates);\n setLoaded(true);\n })\n .catch(() => {\n setStates([]);\n setLoaded(true);\n });\n }, [selectedCountry]);\n\n if (!loaded || !states.length) return null;\n\n return (\n <Field\n label={label}\n classNameModifiers={classNameModifiers}\n errorMessage={props.errorMessage}\n isValid={!!value}\n showValidIcon={false}\n name={'stateOrProvince'}\n i18n={i18n}\n readOnly={readOnly && !!value}\n >\n <Select\n name={'stateOrProvince'}\n onChange={onDropdownChange}\n selectedValue={value}\n items={states}\n required={required}\n readonly={readOnly && !!value}\n />\n </Field>\n );\n}\n"],"names":["StateField","props","classNameModifiers","label","onDropdownChange","readOnly","selectedCountry","specifications","value","required","i18n","loadingContext","useCoreContext","states","setStates","useState","loaded","setLoaded","useLayoutEffect","countryHasDataset","getDataset","locale","then","response","newStates","length","catch","h","Field","errorMessage","isValid","showValidIcon","name","Select","onChange","selectedValue","items","readonly"],"mappings":"6YAQe,SAASA,EAAWC,GAC/B,MAAMC,mBAAEA,EAAkBC,MAAEA,EAAKC,iBAAEA,EAAgBC,SAAEA,EAAQC,gBAAEA,EAAeC,eAAEA,EAAcC,MAAEA,EAAKC,SAAEA,GAAaR,GAC9GS,KAAEA,EAAIC,eAAEA,GAAmBC,KAC1BC,EAAQC,GAAaC,EAA2B,KAChDC,EAAQC,GAAaF,GAAkB,GAqB9C,OAnBAG,EAAgB,KACZ,IAAKZ,IAAoBC,EAAeY,kBAAkBb,GAGtD,OAFAQ,EAAU,SACVG,GAAU,GAIdG,EAA6B,UAAUd,IAAmBK,EAAgBD,EAAKW,QAC1EC,KAAKC,IACF,MAAMC,EAAYD,GAAYA,EAASE,OAASF,EAAW,GAC3DT,EAAUU,GACVP,GAAU,KAEbS,MAAM,KACHZ,EAAU,IACVG,GAAU,MAEnB,CAACX,IAECU,GAAWH,EAAOY,OAGnBE,EAACC,EAAAA,CACGzB,MAAOA,EACPD,mBAAoBA,EACpB2B,aAAc5B,EAAM4B,aACpBC,UAAWtB,EACXuB,eAAe,EACfC,KAAM,kBACNtB,KAAMA,EACNL,SAAUA,KAAcG,GAExBmB,EAACM,EAAAA,CACGD,KAAM,kBACNE,SAAU9B,EACV+B,cAAe3B,EACf4B,MAAOvB,EACPJ,SAAUA,EACV4B,SAAUhC,KAAcG,KAnBE,IAuB1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e="N/A",s=["street","houseNumberOrName","postalCode","city","stateOrProvince","country"],[a,t,l,r,o,c]=s,d={street:"address-line1",houseNumberOrName:"address-line2",postalCode:"postal-code",city:"address-level2"},i={AU:{hasDataset:!0,labels:{[t]:"apartmentSuite",[o]:"state",[a]:"address"},optionalFields:[t],placeholders:{[o]:"select.state"},schema:[c,a,t,r,[[o,50],[l,50]]]},BR:{hasDataset:!0,labels:{[o]:"state"},placeholders:{[o]:"select.state"}},CA:{hasDataset:!0,labels:{[t]:"apartmentSuite",[o]:"provinceOrTerritory",[a]:"address"},optionalFields:[t],schema:[c,a,t,[[r,70],[l,30]],o]},GB:{labels:{[r]:"cityTown"},schema:[c,[[t,30],[a,70]],[[r,70],[l,30]],o]},US:{hasDataset:!0,labels:{[l]:"zipCode",[t]:"apartmentSuite",[o]:"state",[a]:"address"},optionalFields:[t],placeholders:{[o]:"select.state"},schema:[c,a,t,r,[[o,50],[l,50]]]},default:{optionalFields:[],placeholders:{[o]:"select.provinceOrTerritory"},schema:[c,[[a,70],[t,30]],[[l,30],[r,70]],o]}},p=Object.keys(i).reduce((e,s)=>(e[s]={labels:i[s].labels,schema:[l]},e),{}),
|
|
1
|
+
const e="N/A",s=["street","houseNumberOrName","postalCode","city","stateOrProvince","country"],[a,t,l,r,o,c]=s,d={street:"address-line1",houseNumberOrName:"address-line2",postalCode:"postal-code",city:"address-level2"},i={AU:{hasDataset:!0,labels:{[t]:"apartmentSuite",[o]:"state",[a]:"address"},optionalFields:[t],placeholders:{[o]:"select.state"},schema:[c,a,t,r,[[o,50],[l,50]]]},BR:{hasDataset:!0,labels:{[o]:"state"},placeholders:{[o]:"select.state"}},CA:{hasDataset:!0,labels:{[t]:"apartmentSuite",[o]:"provinceOrTerritory",[a]:"address"},optionalFields:[t],schema:[c,a,t,[[r,70],[l,30]],o]},GB:{labels:{[r]:"cityTown"},schema:[c,[[t,30],[a,70]],[[r,70],[l,30]],o]},JP:{hasDataset:!0,labels:{[o]:"prefecture",[r]:"cityTown",[a]:"streetNameAndBlockNumber",[t]:"buildingNameRoomNumber"},optionalFields:[t],schema:[c,[[l,50],[o,50]],r,a,t]},US:{hasDataset:!0,labels:{[l]:"zipCode",[t]:"apartmentSuite",[o]:"state",[a]:"address"},optionalFields:[t],placeholders:{[o]:"select.state"},schema:[c,a,t,r,[[o,50],[l,50]]]},default:{optionalFields:[],placeholders:{[o]:"select.provinceOrTerritory"},schema:[c,[[a,70],[t,30]],[[l,30],[r,70]],o]}},p=Object.keys(i).reduce((e,s)=>(e[s]={labels:i[s].labels,schema:[l]},e),{}),m=Object.keys(i);export{d as ADDRESS_FIELD_TOKEN_MAP,s as ADDRESS_SCHEMA,i as ADDRESS_SPECIFICATIONS,r as CITY,m as COUNTRIES_WITH_CUSTOM_SPECIFICATION,c as COUNTRY,e as FALLBACK_VALUE,t as HOUSE_NUMBER_OR_NAME,p as PARTIAL_ADDRESS_SCHEMA,l as POSTAL_CODE,o as STATE_OR_PROVINCE,a as STREET};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../../src/components/internal/Address/constants.ts"],"sourcesContent":["import { AddressSpecifications } from './types';\n\nexport const FALLBACK_VALUE = 'N/A';\nexport const ADDRESS_SCHEMA = ['street', 'houseNumberOrName', 'postalCode', 'city', 'stateOrProvince', 'country'] as const;\nexport const [STREET, HOUSE_NUMBER_OR_NAME, POSTAL_CODE, CITY, STATE_OR_PROVINCE, COUNTRY] = ADDRESS_SCHEMA;\n\n// WCAG 2.2 - Address field autocomplete tokens\nexport const ADDRESS_FIELD_TOKEN_MAP: Record<string, string> = {\n street: 'address-line1',\n houseNumberOrName: 'address-line2',\n postalCode: 'postal-code',\n city: 'address-level2'\n};\n\n// prettier-ignore\nexport const ADDRESS_SPECIFICATIONS: AddressSpecifications = {\n AU: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n BR: {\n hasDataset: true,\n labels: {\n [STATE_OR_PROVINCE]: 'state'\n },\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n },\n CA: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'provinceOrTerritory',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n GB: {\n labels: {\n [CITY]: 'cityTown'\n },\n schema: [COUNTRY, [[HOUSE_NUMBER_OR_NAME, 30], [STREET, 70]], [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n US: {\n hasDataset: true,\n labels: {\n [POSTAL_CODE]: 'zipCode',\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n default: {\n optionalFields: [],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.provinceOrTerritory'\n },\n schema: [COUNTRY, [[STREET, 70], [HOUSE_NUMBER_OR_NAME, 30]], [[POSTAL_CODE, 30], [CITY, 70]], STATE_OR_PROVINCE],\n }\n};\n\nexport const PARTIAL_ADDRESS_SCHEMA: AddressSpecifications = Object.keys(ADDRESS_SPECIFICATIONS).reduce((acc, countryCode) => {\n acc[countryCode] = {\n labels: ADDRESS_SPECIFICATIONS[countryCode].labels,\n schema: [POSTAL_CODE]\n };\n return acc;\n}, {} as AddressSpecifications);\n\nexport const COUNTRIES_WITH_CUSTOM_SPECIFICATION = Object.keys(ADDRESS_SPECIFICATIONS);\n"],"names":["FALLBACK_VALUE","ADDRESS_SCHEMA","STREET","HOUSE_NUMBER_OR_NAME","POSTAL_CODE","CITY","STATE_OR_PROVINCE","COUNTRY","ADDRESS_FIELD_TOKEN_MAP","street","houseNumberOrName","postalCode","city","ADDRESS_SPECIFICATIONS","AU","hasDataset","labels","optionalFields","placeholders","schema","BR","CA","GB","US","default","PARTIAL_ADDRESS_SCHEM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mB,IAAK,CAACF,EAAa,
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../src/components/internal/Address/constants.ts"],"sourcesContent":["import { AddressSpecifications } from './types';\n\nexport const FALLBACK_VALUE = 'N/A';\nexport const ADDRESS_SCHEMA = ['street', 'houseNumberOrName', 'postalCode', 'city', 'stateOrProvince', 'country'] as const;\nexport const [STREET, HOUSE_NUMBER_OR_NAME, POSTAL_CODE, CITY, STATE_OR_PROVINCE, COUNTRY] = ADDRESS_SCHEMA;\n\n// WCAG 2.2 - Address field autocomplete tokens\nexport const ADDRESS_FIELD_TOKEN_MAP: Record<string, string> = {\n street: 'address-line1',\n houseNumberOrName: 'address-line2',\n postalCode: 'postal-code',\n city: 'address-level2'\n};\n\n// prettier-ignore\nexport const ADDRESS_SPECIFICATIONS: AddressSpecifications = {\n AU: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n BR: {\n hasDataset: true,\n labels: {\n [STATE_OR_PROVINCE]: 'state'\n },\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n },\n CA: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'provinceOrTerritory',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n GB: {\n labels: {\n [CITY]: 'cityTown'\n },\n schema: [COUNTRY, [[HOUSE_NUMBER_OR_NAME, 30], [STREET, 70]], [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n JP: {\n hasDataset: true,\n labels: {\n [STATE_OR_PROVINCE]: 'prefecture',\n [CITY]: 'cityTown',\n [STREET]: 'streetNameAndBlockNumber',\n [HOUSE_NUMBER_OR_NAME]: 'buildingNameRoomNumber'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n schema: [COUNTRY, [[POSTAL_CODE, 50], [STATE_OR_PROVINCE, 50]], CITY, STREET, HOUSE_NUMBER_OR_NAME]\n },\n US: {\n hasDataset: true,\n labels: {\n [POSTAL_CODE]: 'zipCode',\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n default: {\n optionalFields: [],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.provinceOrTerritory'\n },\n schema: [COUNTRY, [[STREET, 70], [HOUSE_NUMBER_OR_NAME, 30]], [[POSTAL_CODE, 30], [CITY, 70]], STATE_OR_PROVINCE],\n }\n};\n\nexport const PARTIAL_ADDRESS_SCHEMA: AddressSpecifications = Object.keys(ADDRESS_SPECIFICATIONS).reduce((acc, countryCode) => {\n acc[countryCode] = {\n labels: ADDRESS_SPECIFICATIONS[countryCode].labels,\n schema: [POSTAL_CODE]\n };\n return acc;\n}, {} as AddressSpecifications);\n\nexport const COUNTRIES_WITH_CUSTOM_SPECIFICATION = Object.keys(ADDRESS_SPECIFICATIONS);\n"],"names":["FALLBACK_VALUE","ADDRESS_SCHEMA","STREET","HOUSE_NUMBER_OR_NAME","POSTAL_CODE","CITY","STATE_OR_PROVINCE","COUNTRY","ADDRESS_FIELD_TOKEN_MAP","street","houseNumberOrName","postalCode","city","ADDRESS_SPECIFICATIONS","AU","hasDataset","labels","optionalFields","placeholders","schema","BR","CA","GB","JP","US","default","PARTIAL_ADDRESS_SCHEMA","Object","keys","reduce","acc","countryCode","COUNTRIES_WITH_CUSTOM_SPECIFICATION"],"mappings":"AAEO,MAAMA,EAAiB,MACjBC,EAAiB,CAAC,SAAU,oBAAqB,aAAc,OAAQ,kBAAmB,YACzFC,EAAQC,EAAsBC,EAAaC,EAAMC,EAAmBC,GAAWN,EAGhFO,EAAkD,CAC3DC,OAAQ,gBACRC,kBAAmB,gBACnBC,WAAY,cACZC,KAAM,kBAIGC,EAAgD,CACzDC,GAAI,CACAC,YAAY,EACZC,OAAQ,CACJb,CAACA,GAAuB,iBACxBG,CAACA,GAAoB,QACrBJ,CAACA,GAAS,WAEde,eAAgB,CAACd,GACjBe,aAAc,CACVZ,CAACA,GAAoB,gBAEzBa,OAAQ,CAACZ,EAASL,EAAQC,EAAsBE,EAAM,CAAC,CAACC,EAAmB,IAAK,CAACF,EAAa,OAElGgB,GAAI,CACAL,YAAY,EACZC,OAAQ,CACJV,CAACA,GAAoB,SAEzBY,aAAc,CACVZ,CAACA,GAAoB,iBAG7Be,GAAI,CACAN,YAAY,EACZC,OAAQ,CACJb,CAACA,GAAuB,iBACxBG,CAACA,GAAoB,sBACrBJ,CAACA,GAAS,WAEde,eAAgB,CAACd,GACjBgB,OAAQ,CAACZ,EAASL,EAAQC,EAAsB,CAAC,CAACE,EAAM,IAAK,CAACD,EAAa,KAAME,IAErFgB,GAAI,CACAN,OAAQ,CACJX,CAACA,GAAO,YAEZc,OAAQ,CAACZ,EAAS,CAAC,CAACJ,EAAsB,IAAK,CAACD,EAAQ,KAAM,CAAC,CAACG,EAAM,IAAK,CAACD,EAAa,KAAME,IAEnGiB,GAAI,CACAR,YAAY,EACZC,OAAQ,CACJV,CAACA,GAAoB,aACrBD,CAACA,GAAO,WACRH,CAACA,GAAS,2BACVC,CAACA,GAAuB,0BAE5Bc,eAAgB,CAACd,GACjBgB,OAAQ,CAACZ,EAAS,CAAC,CAACH,EAAa,IAAK,CAACE,EAAmB,KAAMD,EAAMH,EAAQC,IAElFqB,GAAI,CACAT,YAAY,EACZC,OAAQ,CACJZ,CAACA,GAAc,UACfD,CAACA,GAAuB,iBACxBG,CAACA,GAAoB,QACrBJ,CAACA,GAAS,WAEde,eAAgB,CAACd,GACjBe,aAAc,CACVZ,CAACA,GAAoB,gBAEzBa,OAAQ,CAACZ,EAASL,EAAQC,EAAsBE,EAAM,CAAC,CAACC,EAAmB,IAAK,CAACF,EAAa,OAElGqB,QAAS,CACLR,eAAgB,GAChBC,aAAc,CACVZ,CAACA,GAAoB,8BAEzBa,OAAQ,CAACZ,EAAS,CAAC,CAACL,EAAQ,IAAK,CAACC,EAAsB,KAAM,CAAC,CAACC,EAAa,IAAK,CAACC,EAAM,KAAMC,KAI1FoB,EAAgDC,OAAOC,KAAKf,GAAwBgB,OAAO,CAACC,EAAKC,KAC1GD,EAAIC,GAAe,CACff,OAAQH,EAAuBkB,GAAaf,OAC5CG,OAAQ,CAACf,IAEN0B,GACR,CAAA,GAEUE,EAAsCL,OAAOC,KAAKf"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getFormattingRegEx as o,stripInvalidChars as t}from"../../../utils/validator-utils.js";const
|
|
1
|
+
import{getFormattingRegEx as o,stripInvalidChars as t}from"../../../utils/validator-utils.js";import{convertFullToHalf as a}from"../FormFields/utils.js";const e=t=>({formatterFn:a=>a.replace(o("^\\d","g"),"").substring(0,t),format:new Array(t).fill("9").join(""),maxlength:t}),r=o=>o,l={postalCode:{formatterFn:(o,t)=>{var a;const e=t.state.data.country,r=null===(a=s[e])||void 0===a?void 0:a.postalCode.formatterFn;return r?r(o):o}},street:{formatterFn:r},houseNumberOrName:{formatterFn:r},city:{formatterFn:r}},s={AT:{postalCode:e(4)},AU:{postalCode:e(4)},BE:{postalCode:e(4)},BG:{postalCode:e(4)},BR:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?9:8;return a.substring(0,e)},format:"12345678 or 12345-678",maxlength:9}},CA:{postalCode:{format:"A9A 9A9 or A9A9A9",maxlength:7}},CH:{postalCode:e(4)},CY:{postalCode:e(4)},CZ:{postalCode:{format:"999 99",maxlength:6}},DE:{postalCode:e(5)},DK:{postalCode:{format:"9999",maxlength:7}},EE:{postalCode:e(5)},ES:{postalCode:e(5)},FI:{postalCode:e(5)},FR:{postalCode:e(5)},GB:{postalCode:{formatterFn:o=>t(o).substring(0,8),format:"AA99 9AA or A99 9AA or A9 9AA",maxlength:8}},GR:{postalCode:{format:"999 99",maxlength:6}},HR:{postalCode:{format:"[1-5]9999",maxlength:5}},HU:{postalCode:e(4)},IE:{postalCode:{format:"A99 A999",maxlength:8}},IS:{postalCode:e(3)},IT:{postalCode:e(5)},LI:{postalCode:e(4)},LT:{postalCode:{format:"9999 or 99999 or LT-99999",maxlength:8}},LU:{postalCode:e(4)},LV:{postalCode:{format:"9999 or LV-9999",maxlength:7}},MC:{postalCode:{format:"980NN",maxlength:5}},MT:{postalCode:{format:"AA99 or AAA99 or AA9999 or AAA9999",maxlength:8}},MY:{postalCode:e(5)},NL:{postalCode:{format:"9999AA",maxlength:7}},NZ:{postalCode:e(4)},NO:{postalCode:e(4)},PL:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?6:5;return a.substring(0,e)},format:"99999 or 99-999",maxlength:6}},PT:{postalCode:{formatterFn:t=>t.replace(o("^\\d-","g"),"").substring(0,8),format:"9999-999",maxlength:8}},RO:{postalCode:e(6)},SI:{postalCode:{format:"9999 or SI-9999",maxlength:7}},SE:{postalCode:e(5)},SG:{postalCode:e(6)},SK:{postalCode:{format:"99999 or SK-99999",maxlength:8}},JP:{postalCode:{formatterFn:t=>a(t).replace(o("^\\d-","g"),"").substring(0,8),format:"999-9999",maxlength:8}},US:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?10:5;return a.substring(0,e)},format:"99999 or 99999-9999"}}};export{l as addressFormatters,s as countrySpecificFormatters};
|
|
2
2
|
//# sourceMappingURL=validate.formats.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.formats.js","sources":["../../../../../src/components/internal/Address/validate.formats.ts"],"sourcesContent":["import { FormatterContext } from '../../../utils/Formatters/types';\nimport { CountryFormatRules, FormatRules } from '../../../utils/Validator/types';\nimport { Formatter } from '../../../utils/useForm/types';\nimport { getFormattingRegEx, stripInvalidChars } from '../../../utils/validator-utils';\n\nconst asCountryFormatRules = <T extends CountryFormatRules>(rules: T): T & CountryFormatRules => rules;\n\nconst createFormatByDigits = (digits: number): Formatter => {\n const format = new Array(digits).fill('9').join('');\n return {\n // Formatter - excludes non digits and limits to maxlength\n formatterFn: val => val.replace(getFormattingRegEx('^\\\\d', 'g'), '').substring(0, digits),\n format,\n maxlength: digits\n };\n};\n\nconst defaultFormattingFn = (val: string) => val;\n\nexport const addressFormatters: FormatRules = {\n postalCode: {\n formatterFn: (val: string, context: FormatterContext) => {\n const country = context.state.data.country;\n\n // Country specific formatting rule\n const specificRule = countrySpecificFormatters[country]?.postalCode.formatterFn;\n if (specificRule) {\n return specificRule(val);\n }\n\n // Default formatting rule: allow anything\n return val;\n }\n },\n street: {\n formatterFn: defaultFormattingFn\n },\n houseNumberOrName: {\n formatterFn: defaultFormattingFn\n },\n city: {\n formatterFn: defaultFormattingFn\n }\n};\n\n// TODO make proper formatter fns for those entries that don't just have a straightforward, x number of digits, no spaces, format\n// check against our internal documentation on address postal code\n// which, for example, says BR isn't just 8 digits (it can be spilt by a hyphen) & CZ can also be 5 digits, no spaces\nexport const countrySpecificFormatters = asCountryFormatRules({\n AT: {\n postalCode: createFormatByDigits(4)\n },\n AU: {\n postalCode: createFormatByDigits(4)\n },\n BE: {\n postalCode: createFormatByDigits(4)\n },\n BG: {\n postalCode: createFormatByDigits(4)\n },\n BR: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 9 : 8;\n return nuVal.substring(0, maxlength);\n },\n format: '12345678 or 12345-678',\n maxlength: 9\n }\n },\n CA: {\n postalCode: {\n format: 'A9A 9A9 or A9A9A9',\n maxlength: 7\n }\n },\n CH: {\n postalCode: createFormatByDigits(4)\n },\n CY: {\n postalCode: createFormatByDigits(4)\n },\n CZ: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n DE: {\n postalCode: createFormatByDigits(5)\n },\n DK: {\n postalCode: {\n format: '9999',\n maxlength: 7\n }\n },\n EE: {\n postalCode: createFormatByDigits(5)\n },\n ES: {\n postalCode: createFormatByDigits(5)\n },\n FI: {\n postalCode: createFormatByDigits(5)\n },\n FR: {\n postalCode: createFormatByDigits(5)\n },\n GB: {\n postalCode: {\n formatterFn: val => stripInvalidChars(val).substring(0, 8),\n format: 'AA99 9AA or A99 9AA or A9 9AA',\n maxlength: 8\n }\n },\n GR: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n HR: {\n postalCode: {\n format: '[1-5]9999',\n maxlength: 5\n }\n },\n HU: {\n postalCode: createFormatByDigits(4)\n },\n IE: {\n postalCode: {\n format: 'A99 A999',\n maxlength: 8\n }\n },\n IS: {\n postalCode: createFormatByDigits(3)\n },\n IT: {\n postalCode: createFormatByDigits(5)\n },\n LI: {\n postalCode: createFormatByDigits(4)\n },\n LT: {\n postalCode: {\n format: '9999 or 99999 or LT-99999',\n maxlength: 8\n }\n },\n LU: {\n postalCode: createFormatByDigits(4)\n },\n LV: {\n postalCode: {\n format: '9999 or LV-9999',\n maxlength: 7\n }\n },\n MC: {\n postalCode: {\n format: '980NN',\n maxlength: 5\n }\n },\n MT: {\n postalCode: {\n format: 'AA99 or AAA99 or AA9999 or AAA9999',\n maxlength: 8\n }\n },\n MY: {\n postalCode: createFormatByDigits(5)\n },\n NL: {\n postalCode: {\n format: '9999AA',\n maxlength: 7\n }\n },\n NZ: {\n postalCode: createFormatByDigits(4)\n },\n NO: {\n postalCode: createFormatByDigits(4)\n },\n PL: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 6 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99-999',\n maxlength: 6\n }\n },\n PT: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n return nuVal.substring(0, 8);\n },\n format: '9999-999',\n maxlength: 8\n }\n },\n RO: {\n postalCode: createFormatByDigits(6)\n },\n SI: {\n postalCode: {\n format: '9999 or SI-9999',\n maxlength: 7\n }\n },\n SE: {\n postalCode: createFormatByDigits(5)\n },\n SG: {\n postalCode: createFormatByDigits(6)\n },\n SK: {\n postalCode: {\n format: '99999 or SK-99999',\n maxlength: 8\n }\n },\n JP: {\n postalCode: {\n format: '999-9999',\n maxlength: 8\n }\n },\n US: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 10 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99999-9999'\n }\n }\n});\n"],"names":["createFormatByDigits","digits","formatterFn","val","replace","getFormattingRegEx","substring","format","Array","fill","join","maxlength","defaultFormattingFn","addressFormatters","postalCode","context","countrySpecificFormatters","country","state","data","specificRule","street","houseNumberOrName","city","AT","AU","BE","BG","BR","nuVal","includes","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","stripInvalidChars","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NZ","NO","PL","PT","RO","SI","SE","SG","SK","JP","US"],"mappings":"8FAKA,MAEMA,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I,CACA/C,WAAYd,EAAqB,IAErC8D,GAAI,CACAhD,WAAY,CACRP,OAAQ,kBACRI,UAAW,IAGnBoD,GAAI,CACAjD,WAAYd,EAAqB,IAErCgE,GAAI,CACAlD,WAAYd,EAAqB,IAErCiE,GAAI,CACAnD,WAAY,CACRP,OAAQ,oBACRI,UAAW,IAGnBuD,GAAI,CACApD,WAAY,CACRP,OAAQ,WACRI,UAAW,IAGnBwD,GAAI,CACArD,WAAY,CACRZ,YAAaC,IACT,MAAM0B,EAAQ1B,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IACtDM,EAAYkB,EAAMC,SAAS,KAAO,GAAK,EAC7C,OAAOD,EAAMvB,UAAU,EAAGK,IAE9BJ,OAAQ"}
|
|
1
|
+
{"version":3,"file":"validate.formats.js","sources":["../../../../../src/components/internal/Address/validate.formats.ts"],"sourcesContent":["import { FormatterContext } from '../../../utils/Formatters/types';\nimport { CountryFormatRules, FormatRules } from '../../../utils/Validator/types';\nimport { Formatter } from '../../../utils/useForm/types';\nimport { getFormattingRegEx, stripInvalidChars } from '../../../utils/validator-utils';\nimport { convertFullToHalf } from '../FormFields/utils';\n\nconst asCountryFormatRules = <T extends CountryFormatRules>(rules: T): T & CountryFormatRules => rules;\n\nconst createFormatByDigits = (digits: number): Formatter => {\n const format = new Array(digits).fill('9').join('');\n return {\n // Formatter - excludes non digits and limits to maxlength\n formatterFn: val => val.replace(getFormattingRegEx('^\\\\d', 'g'), '').substring(0, digits),\n format,\n maxlength: digits\n };\n};\n\nconst defaultFormattingFn = (val: string) => val;\n\nexport const addressFormatters: FormatRules = {\n postalCode: {\n formatterFn: (val: string, context: FormatterContext) => {\n const country = context.state.data.country;\n\n // Country specific formatting rule\n const specificRule = countrySpecificFormatters[country]?.postalCode.formatterFn;\n if (specificRule) {\n return specificRule(val);\n }\n\n // Default formatting rule: allow anything\n return val;\n }\n },\n street: {\n formatterFn: defaultFormattingFn\n },\n houseNumberOrName: {\n formatterFn: defaultFormattingFn\n },\n city: {\n formatterFn: defaultFormattingFn\n }\n};\n\n// TODO make proper formatter fns for those entries that don't just have a straightforward, x number of digits, no spaces, format\n// check against our internal documentation on address postal code\n// which, for example, says BR isn't just 8 digits (it can be spilt by a hyphen) & CZ can also be 5 digits, no spaces\nexport const countrySpecificFormatters = asCountryFormatRules({\n AT: {\n postalCode: createFormatByDigits(4)\n },\n AU: {\n postalCode: createFormatByDigits(4)\n },\n BE: {\n postalCode: createFormatByDigits(4)\n },\n BG: {\n postalCode: createFormatByDigits(4)\n },\n BR: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 9 : 8;\n return nuVal.substring(0, maxlength);\n },\n format: '12345678 or 12345-678',\n maxlength: 9\n }\n },\n CA: {\n postalCode: {\n format: 'A9A 9A9 or A9A9A9',\n maxlength: 7\n }\n },\n CH: {\n postalCode: createFormatByDigits(4)\n },\n CY: {\n postalCode: createFormatByDigits(4)\n },\n CZ: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n DE: {\n postalCode: createFormatByDigits(5)\n },\n DK: {\n postalCode: {\n format: '9999',\n maxlength: 7\n }\n },\n EE: {\n postalCode: createFormatByDigits(5)\n },\n ES: {\n postalCode: createFormatByDigits(5)\n },\n FI: {\n postalCode: createFormatByDigits(5)\n },\n FR: {\n postalCode: createFormatByDigits(5)\n },\n GB: {\n postalCode: {\n formatterFn: val => stripInvalidChars(val).substring(0, 8),\n format: 'AA99 9AA or A99 9AA or A9 9AA',\n maxlength: 8\n }\n },\n GR: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n HR: {\n postalCode: {\n format: '[1-5]9999',\n maxlength: 5\n }\n },\n HU: {\n postalCode: createFormatByDigits(4)\n },\n IE: {\n postalCode: {\n format: 'A99 A999',\n maxlength: 8\n }\n },\n IS: {\n postalCode: createFormatByDigits(3)\n },\n IT: {\n postalCode: createFormatByDigits(5)\n },\n LI: {\n postalCode: createFormatByDigits(4)\n },\n LT: {\n postalCode: {\n format: '9999 or 99999 or LT-99999',\n maxlength: 8\n }\n },\n LU: {\n postalCode: createFormatByDigits(4)\n },\n LV: {\n postalCode: {\n format: '9999 or LV-9999',\n maxlength: 7\n }\n },\n MC: {\n postalCode: {\n format: '980NN',\n maxlength: 5\n }\n },\n MT: {\n postalCode: {\n format: 'AA99 or AAA99 or AA9999 or AAA9999',\n maxlength: 8\n }\n },\n MY: {\n postalCode: createFormatByDigits(5)\n },\n NL: {\n postalCode: {\n format: '9999AA',\n maxlength: 7\n }\n },\n NZ: {\n postalCode: createFormatByDigits(4)\n },\n NO: {\n postalCode: createFormatByDigits(4)\n },\n PL: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 6 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99-999',\n maxlength: 6\n }\n },\n PT: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n return nuVal.substring(0, 8);\n },\n format: '9999-999',\n maxlength: 8\n }\n },\n RO: {\n postalCode: createFormatByDigits(6)\n },\n SI: {\n postalCode: {\n format: '9999 or SI-9999',\n maxlength: 7\n }\n },\n SE: {\n postalCode: createFormatByDigits(5)\n },\n SG: {\n postalCode: createFormatByDigits(6)\n },\n SK: {\n postalCode: {\n format: '99999 or SK-99999',\n maxlength: 8\n }\n },\n JP: {\n postalCode: {\n // Formatter - converts full-width characters (common on Japanese keyboards, e.g. '107-0052') to their\n // half-width equivalent, then strips any remaining non-digit/hyphen characters (e.g. the postal mark '〒')\n formatterFn: val => convertFullToHalf(val).replace(getFormattingRegEx('^\\\\d-', 'g'), '').substring(0, 8),\n format: '999-9999',\n maxlength: 8\n }\n },\n US: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 10 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99999-9999'\n }\n }\n});\n"],"names":["createFormatByDigits","digits","formatterFn","val","replace","getFormattingRegEx","substring","format","Array","fill","join","maxlength","defaultFormattingFn","addressFormatters","postalCode","context","countrySpecificFormatters","country","state","data","specificRule","street","houseNumberOrName","city","AT","AU","BE","BG","BR","nuVal","includes","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","stripInvalidChars","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NZ","NO","PL","PT","RO","SI","SE","SG","SK","JP","convertFullToHalf","US"],"mappings":"yJAMA,MAEMA,EAAwBC,IAEnB,CAEHC,YAAaC,GAAOA,EAAIC,QAAQC,EAAmB,OAAQ,KAAM,IAAIC,UAAU,EAAGL,GAClFM,OAJW,IAAIC,MAAMP,GAAQQ,KAAK,KAAKC,KAAK,IAK5CC,UAAWV,IAIbW,EAAuBT,GAAgBA,EAEhCU,EAAiC,CAC1CC,WAAY,CACRZ,YAAa,CAACC,EAAaY,KAIFC,IAAAA,EAHrB,MAAMC,EAAUF,EAAQG,MAAMC,KAAKF,QAG7BG,UAAeJ,EAAAA,EAA0BC,UAA1BD,IAAAA,OAAAA,EAAAA,EAAoCF,WAAWZ,YACpE,OAAIkB,EACOA,EAAajB,GAIjBA,IAGfkB,OAAQ,CACJnB,YAAaU,GAEjBU,kBAAmB,CACfpB,YAAaU,GAEjBW,KAAM,CACFrB,YAAaU,IAORI,EAAiD,CAC1DQ,GAAI,CACAV,WAAYd,EAAqB,IAErCyB,GAAI,CACAX,WAAYd,EAAqB,IAErC0B,GAAI,CACAZ,WAAYd,EAAqB,IAErC2B,GAAI,CACAb,WAAYd,EAAqB,IAErC4B,GAAI,CACAd,WAAY,CAERZ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../core/Errors/constants.js";import{isEmpty as
|
|
1
|
+
import{countrySpecificFormatters as t}from"./validate.formats.js";import{ERROR_FIELD_REQUIRED as r,ERROR_INVALID_CHARACTERS as e,ERROR_INVALID_FORMAT_EXPECTS as a}from"../../../core/Errors/constants.js";import{isEmpty as d,validateForSpecialChars as n}from"../../../utils/validator-utils.js";const o=t=>({pattern:new RegExp(`\\d{${t}}`)}),s=(r,e,n)=>{if(e){var o,s;if(d(r))return null;n.postalCode.errorMessage={translationKey:a,translationObject:{values:{format:(null===(o=t[e])||void 0===o?void 0:o.postalCode.format)||null}}};const u=null===(s=l[e])||void 0===s?void 0:s.pattern;return u?u.test(r):!!r}return!d(r)||null},l={AT:o(4),AU:o(4),BE:{pattern:/(?:(?:[1-9])(?:\d{3}))/},BG:o(4),BR:{pattern:/^\d{5}-?\d{3}$/},CA:{pattern:/(?:[ABCEGHJ-NPRSTVXY]\d[A-Z][ -]?\d[A-Z]\d)/},CH:{pattern:/[1-9]\d{3}/},CY:o(4),CZ:{pattern:/\d{3}\s?\d{2}/},DE:o(5),DK:o(4),EE:o(5),ES:{pattern:/(?:0[1-9]|[1-4]\d|5[0-2])\d{3}/},FI:o(5),FR:o(5),GB:{pattern:/^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/},GE:o(4),GR:{pattern:/^\d{3}\s{0,1}\d{2}$/},HR:{pattern:/^([1-5])[0-9]{4}$/},HU:o(4),IE:{pattern:/(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/},IS:o(3),IT:o(5),JP:{pattern:/^\d{3}-?\d{4}$/},LI:o(4),LT:{pattern:/^(LT-\d{5}|\d{4,5})$/},LU:o(4),LV:{pattern:/^(LV-)[0-9]{4}$/},MC:{pattern:/^980\d{2}$/},MT:{pattern:/^[A-Za-z]{3}\d{4}$/},MY:o(5),NL:{pattern:/(?:NL-)?(?:[1-9]\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/},NO:o(4),PL:{pattern:/^\d{2}[-]{0,1}\d{3}$/},PT:{pattern:/^([1-9]\d{3})([- ]?(\d{3})? *)$/},RO:o(6),SI:o(4),SE:o(5),SG:o(6),SK:o(5),US:{pattern:/^\d{5}(?:-\d{4})?$/}},u=t=>{const e={postalCode:{modes:["blur"],validate:r=>s(r,t,e),errorMessage:r}};return e},p={modes:["blur"],validate:t=>!d(t)||null,errorMessage:r},i={modes:["blur"],validate:t=>n(t),errorMessage:e},m=t=>{const e={postalCode:{modes:["blur"],validate:(t,r)=>{const a=r.state.data.country;return s(t,a,e)},errorMessage:r},street:[p,i],houseNumberOrName:[{validate:(r,e)=>{var a,n;const o=null===(n=e.state)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.country;return o&&t.countryHasOptionalField(o,"houseNumberOrName")||!d(r)||null},modes:["blur"],errorMessage:r},i],city:[p,i],default:p};return e};export{m as getAddressValidationRules,u as getPartialAddressValidationRules,s as validatePostalCode};
|
|
2
2
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sources":["../../../../../src/components/internal/Address/validate.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule } from '../../../utils/Validator/types';\nimport { countrySpecificFormatters } from './validate.formats';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS, ERROR_INVALID_CHARACTERS } from '../../../core/Errors/constants';\nimport { isEmpty, validateForSpecialChars } from '../../../utils/validator-utils';\n\nconst createPatternByDigits = (digits: number) => {\n return {\n pattern: new RegExp(`\\\\d{${digits}}`)\n };\n};\n\nexport const validatePostalCode = (val: string, countryCode: string | null, validatorRules: ValidatorRules) => {\n if (countryCode) {\n // If there is no value, we display the 'required' error message\n if (isEmpty(val)) return null;\n\n // Dynamically create errorMessage\n (validatorRules.postalCode as ValidatorRule).errorMessage = {\n translationKey: ERROR_INVALID_FORMAT_EXPECTS,\n translationObject: {\n values: {\n format: countrySpecificFormatters[countryCode]?.postalCode.format || null\n }\n }\n };\n\n const pattern = postalCodePatterns[countryCode]?.pattern;\n return pattern ? pattern.test(val) : !!val; // No pattern? Accept any, filled, value.\n }\n // Default rule\n return isEmpty(val) ? null : true;\n};\n\nconst postalCodePatterns = {\n AT: createPatternByDigits(4),\n AU: createPatternByDigits(4),\n BE: { pattern: /(?:(?:[1-9])(?:\\d{3}))/ },\n BG: createPatternByDigits(4),\n BR: { pattern: /^\\d{5}-?\\d{3}$/ },\n CA: { pattern: /(?:[ABCEGHJ-NPRSTVXY]\\d[A-Z][ -]?\\d[A-Z]\\d)/ },\n CH: { pattern: /[1-9]\\d{3}/ },\n CY: createPatternByDigits(4),\n CZ: { pattern: /\\d{3}\\s?\\d{2}/ },\n DE: createPatternByDigits(5),\n DK: createPatternByDigits(4),\n EE: createPatternByDigits(5),\n ES: { pattern: /(?:0[1-9]|[1-4]\\d|5[0-2])\\d{3}/ },\n FI: createPatternByDigits(5),\n FR: createPatternByDigits(5),\n GB: { pattern: /^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/ },\n GE: createPatternByDigits(4),\n GR: { pattern: /^\\d{3}\\s{0,1}\\d{2}$/ },\n HR: { pattern: /^([1-5])[0-9]{4}$/ },\n HU: createPatternByDigits(4),\n IE: { pattern: /(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/ },\n IS: createPatternByDigits(3),\n IT: createPatternByDigits(5),\n LI: createPatternByDigits(4),\n LT: { pattern: /^(LT-\\d{5}|\\d{4,5})$/ },\n LU: createPatternByDigits(4),\n LV: { pattern: /^(LV-)[0-9]{4}$/ },\n MC: { pattern: /^980\\d{2}$/ },\n MT: { pattern: /^[A-Za-z]{3}\\d{4}$/ },\n MY: createPatternByDigits(5),\n NL: { pattern: /(?:NL-)?(?:[1-9]\\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/ },\n NO: createPatternByDigits(4),\n PL: { pattern: /^\\d{2}[-]{0,1}\\d{3}$/ },\n PT: { pattern: /^([1-9]\\d{3})([- ]?(\\d{3})? *)$/ },\n RO: createPatternByDigits(6),\n SI: createPatternByDigits(4),\n SE: createPatternByDigits(5),\n SG: createPatternByDigits(6),\n SK: createPatternByDigits(5),\n US: { pattern: /^\\d{5}(?:-\\d{4})?$/ }\n};\n\n/**\n * Validates only postalCode property. As the partial address form does not have the country selector, the country value\n * must be informed beforehand and can't be picked up from the form context\n *\n * @param country - Country that will be used to validate postal code\n */\nexport const getPartialAddressValidationRules = (country: string | null): ValidatorRules => {\n const validationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: val => {\n return validatePostalCode(val, country, validationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return validationRules;\n};\n\nconst ruleIsEmpty: ValidatorRule = {\n modes: ['blur'],\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: ERROR_FIELD_REQUIRED\n};\n\nconst ruleValidateForSpecialChars: ValidatorRule = {\n modes: ['blur'],\n validate: value => validateForSpecialChars(value),\n errorMessage: ERROR_INVALID_CHARACTERS\n};\n\nexport const getAddressValidationRules = (specifications): ValidatorRules => {\n const addressValidationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: (val, context) => {\n const country = context.state.data.country;\n return validatePostalCode(val, country, addressValidationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n },\n street: [
|
|
1
|
+
{"version":3,"file":"validate.js","sources":["../../../../../src/components/internal/Address/validate.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule } from '../../../utils/Validator/types';\nimport { countrySpecificFormatters } from './validate.formats';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS, ERROR_INVALID_CHARACTERS } from '../../../core/Errors/constants';\nimport { isEmpty, validateForSpecialChars } from '../../../utils/validator-utils';\n\nconst createPatternByDigits = (digits: number) => {\n return {\n pattern: new RegExp(`\\\\d{${digits}}`)\n };\n};\n\nexport const validatePostalCode = (val: string, countryCode: string | null, validatorRules: ValidatorRules) => {\n if (countryCode) {\n // If there is no value, we display the 'required' error message\n if (isEmpty(val)) return null;\n\n // Dynamically create errorMessage\n (validatorRules.postalCode as ValidatorRule).errorMessage = {\n translationKey: ERROR_INVALID_FORMAT_EXPECTS,\n translationObject: {\n values: {\n format: countrySpecificFormatters[countryCode]?.postalCode.format || null\n }\n }\n };\n\n const pattern = postalCodePatterns[countryCode]?.pattern;\n return pattern ? pattern.test(val) : !!val; // No pattern? Accept any, filled, value.\n }\n // Default rule\n return isEmpty(val) ? null : true;\n};\n\nconst postalCodePatterns = {\n AT: createPatternByDigits(4),\n AU: createPatternByDigits(4),\n BE: { pattern: /(?:(?:[1-9])(?:\\d{3}))/ },\n BG: createPatternByDigits(4),\n BR: { pattern: /^\\d{5}-?\\d{3}$/ },\n CA: { pattern: /(?:[ABCEGHJ-NPRSTVXY]\\d[A-Z][ -]?\\d[A-Z]\\d)/ },\n CH: { pattern: /[1-9]\\d{3}/ },\n CY: createPatternByDigits(4),\n CZ: { pattern: /\\d{3}\\s?\\d{2}/ },\n DE: createPatternByDigits(5),\n DK: createPatternByDigits(4),\n EE: createPatternByDigits(5),\n ES: { pattern: /(?:0[1-9]|[1-4]\\d|5[0-2])\\d{3}/ },\n FI: createPatternByDigits(5),\n FR: createPatternByDigits(5),\n GB: { pattern: /^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/ },\n GE: createPatternByDigits(4),\n GR: { pattern: /^\\d{3}\\s{0,1}\\d{2}$/ },\n HR: { pattern: /^([1-5])[0-9]{4}$/ },\n HU: createPatternByDigits(4),\n IE: { pattern: /(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/ },\n IS: createPatternByDigits(3),\n IT: createPatternByDigits(5),\n JP: { pattern: /^\\d{3}-?\\d{4}$/ },\n LI: createPatternByDigits(4),\n LT: { pattern: /^(LT-\\d{5}|\\d{4,5})$/ },\n LU: createPatternByDigits(4),\n LV: { pattern: /^(LV-)[0-9]{4}$/ },\n MC: { pattern: /^980\\d{2}$/ },\n MT: { pattern: /^[A-Za-z]{3}\\d{4}$/ },\n MY: createPatternByDigits(5),\n NL: { pattern: /(?:NL-)?(?:[1-9]\\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/ },\n NO: createPatternByDigits(4),\n PL: { pattern: /^\\d{2}[-]{0,1}\\d{3}$/ },\n PT: { pattern: /^([1-9]\\d{3})([- ]?(\\d{3})? *)$/ },\n RO: createPatternByDigits(6),\n SI: createPatternByDigits(4),\n SE: createPatternByDigits(5),\n SG: createPatternByDigits(6),\n SK: createPatternByDigits(5),\n US: { pattern: /^\\d{5}(?:-\\d{4})?$/ }\n};\n\n/**\n * Validates only postalCode property. As the partial address form does not have the country selector, the country value\n * must be informed beforehand and can't be picked up from the form context\n *\n * @param country - Country that will be used to validate postal code\n */\nexport const getPartialAddressValidationRules = (country: string | null): ValidatorRules => {\n const validationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: val => {\n return validatePostalCode(val, country, validationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return validationRules;\n};\n\nconst ruleIsEmpty: ValidatorRule = {\n modes: ['blur'],\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: ERROR_FIELD_REQUIRED\n};\n\nconst ruleValidateForSpecialChars: ValidatorRule = {\n modes: ['blur'],\n validate: value => validateForSpecialChars(value),\n errorMessage: ERROR_INVALID_CHARACTERS\n};\n\nexport const getAddressValidationRules = (specifications): ValidatorRules => {\n const addressValidationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: (val, context) => {\n const country = context.state.data.country;\n return validatePostalCode(val, country, addressValidationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n },\n street: [ruleIsEmpty, ruleValidateForSpecialChars],\n houseNumberOrName: [\n {\n validate: (value, context) => {\n const selectedCountry = context.state?.data?.country;\n const isOptional = selectedCountry && specifications.countryHasOptionalField(selectedCountry, 'houseNumberOrName');\n return isOptional || (isEmpty(value) ? null : true);\n },\n modes: ['blur'],\n errorMessage: ERROR_FIELD_REQUIRED\n },\n ruleValidateForSpecialChars\n ],\n city: [ruleIsEmpty, ruleValidateForSpecialChars],\n default: ruleIsEmpty\n };\n return addressValidationRules;\n};\n"],"names":["createPatternByDigits","digits","pattern","RegExp","validatePostalCode","val","countryCode","validatorRules","countrySpecificFormatters","postalCodePatterns","isEmpty","postalCode","errorMessage","translationKey","ERROR_INVALID_FORMAT_EXPECTS","translationObject","values","format","test","AT","AU","BE","BG","BR","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GE","GR","HR","HU","IE","IS","IT","JP","LI","LT","LU","LV","MC","MT","MY","NL","NO","PL","PT","RO","SI","SE","SG","SK","US","getPartialAddressValidationRules","country","validationRules","modes","validate","ERROR_FIELD_REQUIRED","ruleIsEmpty","value","ruleValidateForSpecialChars","validateForSpecialChars","ERROR_INVALID_CHARACTERS","getAddressValidationRules","specifications","addressValidationRules","context","state","data","street","houseNumberOrName","selectedCountry","countryHasOptionalField","city","default"],"mappings":"oSAKA,MAAMA,EAAyBC,IACpB,CACHC,QAAS,IAAIC,OAAO,OAAOF,QAItBG,EAAqB,CAACC,EAAaC,EAA4BC,KACxE,GAAID,EAAa,KASOE,EAKJC,EAZhB,GAAIC,EAAQL,GAAM,OAAO,KAGxBE,EAAeI,WAA6BC,aAAe,CACxDC,eAAgBC,EAChBC,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ItD,EAAsB,GAC1BuD,GAAIvD,EAAsB,GAC1BwD,GAAIxD,EAAsB,GAC1ByD,GAAIzD,EAAsB,GAC1B0D,GAAI1D,EAAsB,GAC1B2D,GAAI,CAAEzD,QAAS,uBASN0D,EAAoCC,IAC7C,MAAMC,EAAkC,CACpCnD,WAAY,CACRoD,MAAO,CAAC,QACRC,SAAU3D,GACCD,EAAmBC,EAAKwD,EAASC,GAE5ClD,aAAcqD,IAGtB,OAAOH,GAGLI,EAA6B,CAC/BH,MAAO,CAAC,QACRC,SAAUG,IAAUzD,EAAQyD,IAAS,KACrCvD,aAAcqD,GAGZG,EAA6C,CAC/CL,MAAO,CAAC,QACRC,SAAUG,GAASE,EAAwBF,GAC3CvD,aAAc0D,GAGLC,EAA6BC,IACtC,MAAMC,EAAyC,CAC3C9D,WAAY,CACRoD,MAAO,CAAC,QACRC,SAAU,CAAC3D,EAAKqE,KACZ,MAAMb,EAAUa,EAAQC,MAAMC,KAAKf,QACnC,OAAOzD,EAAmBC,EAAKwD,EAASY,IAE5C7D,aAAcqD,GAElBY,OAAQ,CAACX,EAAaE,GACtBU,kBAAmB,CACf,CACId,SAAU,CAACG,EAAOO,SACUA,EAAAA,EAAxB,MAAMK,EAA+B,QAAbL,EAAAA,EAAQC,iBAARD,GAAmB,QAAnBA,EAAAA,EAAeE,gBAAfF,OAAAA,EAAAA,EAAqBb,QAE7C,OADmBkB,GAAmBP,EAAeQ,wBAAwBD,EAAiB,uBACxErE,EAAQyD,IAAS,MAE3CJ,MAAO,CAAC,QACRnD,aAAcqD,GAElBG,GAEJa,KAAM,CAACf,EAAaE,GACpBc,QAAShB,GAEb,OAAOO"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{NO_CHECKOUT_ATTEMPT_ID as r}from"../../../core/Analytics/constants.js";import{on as n,off as s}from"../../../utils/listenerUtils.js";import{createSdkData as i}from"../../../utils/createSdkData.js";import a from"../../components-name-map.js";import{PAYMENT_METHOD_BEHAVIOR as c}from"../../../core/config.js";function u(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function p(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){u(t,e,o[e])})}return t}function h(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}class d{buildElementProps(t){this.props=this.formatProps(p({},this.constructor.defaultProps,t))}formatProps(t){return t}formatData(){return{}}submitAnalytics(t){return null}handleKeyDown(t){return null}setState(t){this.state=p({},this.state,t)}get data(){var t,e;const o=this.state.order||this.props.order,n=this.formatData(),s=Boolean(a(null===(e=n.paymentMethod)||void 0===e?void 0:e.type)),u=this.core.modules.risk.
|
|
1
|
+
import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{NO_CHECKOUT_ATTEMPT_ID as r}from"../../../core/Analytics/constants.js";import{on as n,off as s}from"../../../utils/listenerUtils.js";import{createSdkData as i}from"../../../utils/createSdkData.js";import a from"../../components-name-map.js";import{PAYMENT_METHOD_BEHAVIOR as c}from"../../../core/config.js";function u(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function p(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){u(t,e,o[e])})}return t}function h(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}class d{buildElementProps(t){this.props=this.formatProps(p({},this.constructor.defaultProps,t))}formatProps(t){return t}formatData(){return{}}submitAnalytics(t){return null}handleKeyDown(t){return null}setState(t){this.state=p({},this.state,t)}get data(){var t,e;const o=this.state.order||this.props.order,n=this.formatData(),s=Boolean(a(null===(e=n.paymentMethod)||void 0===e?void 0:e.type)),u=this.core.modules.risk.riskData,d=null!==(t=this.core.modules.analytics.checkoutAttemptId)&&void 0!==t?t:r,m=s?c.NATIVE:c.GENERIC,l=i(d,u,m);return n.paymentMethod&&d&&(n.paymentMethod.checkoutAttemptId=d),n.paymentMethod&&l&&(n.paymentMethod.sdkData=l),h(p({},u&&{riskData:{clientData:u}},o&&{order:{orderData:o.orderData,pspReference:o.pspReference}},n),{clientStateDataIndicator:!0})}activate(){}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const o="string"==typeof e?document.querySelector(e):e;if(!o)throw new Error("Component could not mount. Root node was not found.");return this._node&&this.unmount(),this._node=o,n(this._node,"keydown",this.handleKeyDown,!1),this._component=this.render(),t(this._component,o),this}update(t){return this.props=this.formatProps(p({},this.props,t)),this.state={},this.unmount().mount(this._node)}unmount(){return s(this._node,"keydown",this.handleKeyDown),this._node&&t(null,this._node),this}remove(){this.unmount(),this.core&&this.core.remove(this)}constructor(t,r){u(this,"_id",`${this.constructor.type}-${e()}`),u(this,"core",void 0),u(this,"props",void 0),u(this,"state",{}),u(this,"_component",void 0),u(this,"_node",null);const n=function(t){return!!t&&("function"==typeof t.initialize&&"function"==typeof t.createFromAction)}(t);if(!n)throw new o("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=t,this.buildElementProps(r),this.handleKeyDown=this.handleKeyDown.bind(this)}}u(d,"defaultProps",{});export{d as default};
|
|
2
2
|
//# sourceMappingURL=BaseElement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render, TargetedKeyboardEvent } from 'preact';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, BaseElementState, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport { off, on } from '../../../utils/listenerUtils';\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { createSdkData } from '../../../utils/createSdkData';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport { PAYMENT_METHOD_BEHAVIOR } from '../../../core/config';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps, S extends BaseElementState = BaseElementState> implements IBaseElement<P> {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: S = {} as S;\n public _component: ComponentChild | undefined;\n\n protected _node: HTMLElement = null;\n\n protected static readonly defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyDown = this.handleKeyDown.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): PaymentData {\n return {} as PaymentData;\n }\n\n protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent) {\n return null;\n }\n\n protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: S): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n const doesPaymentMethodHaveNativeComponent = Boolean(getComponentNameOfPaymentType(componentData.paymentMethod?.type));\n const clientData = this.core.modules.risk.data;\n const checkoutAttemptId = this.core.modules.analytics.checkoutAttemptId ?? NO_CHECKOUT_ATTEMPT_ID;\n const paymentMethodBehavior = doesPaymentMethodHaveNativeComponent ? PAYMENT_METHOD_BEHAVIOR.NATIVE : PAYMENT_METHOD_BEHAVIOR.GENERIC;\n\n const sdkData = createSdkData(checkoutAttemptId, clientData, paymentMethodBehavior);\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n if (componentData.paymentMethod && sdkData) {\n componentData.paymentMethod.sdkData = sdkData;\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n /**\n * Method used to make the payment method active\n * (Useful when there are different payment methods available and activating one PM must trigger a specific task)\n */\n public activate(): void {\n return;\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key down events, notably 'Enter' key presses\n on(this._node, 'keydown', this.handleKeyDown, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {} as S;\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keydown', this.handleKeyDown);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","_object_spread","constructor","formatData","submitAnalytics","_analyticsObj","handleKeyDown","_e","setState","newState","state","data","_this_core_modules_analytics_checkoutAttemptId","componentData","order","doesPaymentMethodHaveNativeComponent","Boolean","getComponentNameOfPaymentType","paymentMethod","type","clientData","core","modules","risk","checkoutAttemptId","analytics","NO_CHECKOUT_ATTEMPT_ID","paymentMethodBehavior","PAYMENT_METHOD_BEHAVIOR","NATIVE","GENERIC","sdkData","createSdkData","_object_spread_props","riskData","orderData","pspReference","clientStateDataIndicator","activate","render","Error","mount","domNode","node","document","querySelector","_node","unmount","on","_component","update","off","remove","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"owCAwBA,MAAeA,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAYC,EAAA,GAAKH,KAAKI,yBAAgCL,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,CAMA,UAAAI,GACI,MAAO,CAAA,CACX,CAEUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAEUC,aAAAA,CAAcC,GACpB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACfX,KAAKY,MAAQT,KAAKH,KAAKY,MAAUD,EACrC,CAMA,QAAWE,GAKmB,IAAAC,EAFyDC,EAFnF,MAAMC,EAAQhB,KAAKY,MAAMI,OAAShB,KAAKC,MAAMe,MACvCD,EAAgBf,KAAKK,aACrBY,EAAuCC,QAAQC,EAAyD,QAA3BJ,EAAAA,EAAcK,qBAAdL,IAAAA,OAAAA,EAAAA,EAA6BM,OAC1GC,EAAatB,KAAKuB,KAAKC,QAAQC,KAAKZ,KACpCa,EAAiE,QAA7CZ,EAAAd,KAAKuB,KAAKC,QAAQG,UAAUD,6BAA5BZ,EAAAA,EAAiDc,EACrEC,EAAwBZ,EAAuCa,EAAwBC,OAASD,EAAwBE,QAExHC,EAAUC,EAAcR,EAAmBJ,EAAYO,GAS7D,OARId,EAAcK,eAAiBM,IAC/BX,EAAcK,cAAcM,kBAAoBA,GAGhDX,EAAcK,eAAiBa,IAC/BlB,EAAcK,cAAca,QAAUA,GAGnCE,OACCb,GAAc,CAAEc,SAAU,CAAEd,eAC5BN,GAAS,CAAEA,MAAO,CAAEqB,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,uCAAuC/D,KAAKI,YAAY,6DAIhEJ,KAAKuB,KAAOgC,EACZvD,KAAKF,kBAAkBG,GAEvBD,KAAKQ,cAAgBR,KAAKQ,cAAcwD,KAAKhE,KACjD,EAhBAwD,EAVW3D,EAUeoE,eAAe"}
|
|
1
|
+
{"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render, TargetedKeyboardEvent } from 'preact';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, BaseElementState, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport { off, on } from '../../../utils/listenerUtils';\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { createSdkData } from '../../../utils/createSdkData';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport { PAYMENT_METHOD_BEHAVIOR } from '../../../core/config';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps, S extends BaseElementState = BaseElementState> implements IBaseElement<P> {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: S = {} as S;\n public _component: ComponentChild | undefined;\n\n protected _node: HTMLElement = null;\n\n protected static readonly defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyDown = this.handleKeyDown.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): PaymentData {\n return {} as PaymentData;\n }\n\n protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent) {\n return null;\n }\n\n protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: S): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n const doesPaymentMethodHaveNativeComponent = Boolean(getComponentNameOfPaymentType(componentData.paymentMethod?.type));\n const clientData = this.core.modules.risk.riskData;\n const checkoutAttemptId = this.core.modules.analytics.checkoutAttemptId ?? NO_CHECKOUT_ATTEMPT_ID;\n const paymentMethodBehavior = doesPaymentMethodHaveNativeComponent ? PAYMENT_METHOD_BEHAVIOR.NATIVE : PAYMENT_METHOD_BEHAVIOR.GENERIC;\n\n const sdkData = createSdkData(checkoutAttemptId, clientData, paymentMethodBehavior);\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n if (componentData.paymentMethod && sdkData) {\n componentData.paymentMethod.sdkData = sdkData;\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n /**\n * Method used to make the payment method active\n * (Useful when there are different payment methods available and activating one PM must trigger a specific task)\n */\n public activate(): void {\n return;\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key down events, notably 'Enter' key presses\n on(this._node, 'keydown', this.handleKeyDown, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {} as S;\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keydown', this.handleKeyDown);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","_object_spread","constructor","formatData","submitAnalytics","_analyticsObj","handleKeyDown","_e","setState","newState","state","data","_this_core_modules_analytics_checkoutAttemptId","componentData","order","doesPaymentMethodHaveNativeComponent","Boolean","getComponentNameOfPaymentType","paymentMethod","type","clientData","core","modules","risk","riskData","checkoutAttemptId","analytics","NO_CHECKOUT_ATTEMPT_ID","paymentMethodBehavior","PAYMENT_METHOD_BEHAVIOR","NATIVE","GENERIC","sdkData","createSdkData","_object_spread_props","orderData","pspReference","clientStateDataIndicator","activate","render","Error","mount","domNode","node","document","querySelector","_node","unmount","on","_component","update","off","remove","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"owCAwBA,MAAeA,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAYC,EAAA,GAAKH,KAAKI,yBAAgCL,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,CAMA,UAAAI,GACI,MAAO,CAAA,CACX,CAEUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAEUC,aAAAA,CAAcC,GACpB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACfX,KAAKY,MAAQT,KAAKH,KAAKY,MAAUD,EACrC,CAMA,QAAWE,GAKmB,IAAAC,EAFyDC,EAFnF,MAAMC,EAAQhB,KAAKY,MAAMI,OAAShB,KAAKC,MAAMe,MACvCD,EAAgBf,KAAKK,aACrBY,EAAuCC,QAAQC,EAAyD,QAA3BJ,EAAAA,EAAcK,qBAAdL,IAAAA,OAAAA,EAAAA,EAA6BM,OAC1GC,EAAatB,KAAKuB,KAAKC,QAAQC,KAAKC,SACpCC,EAAiE,QAA7Cb,EAAAd,KAAKuB,KAAKC,QAAQI,UAAUD,6BAA5Bb,EAAAA,EAAiDe,EACrEC,EAAwBb,EAAuCc,EAAwBC,OAASD,EAAwBE,QAExHC,EAAUC,EAAcR,EAAmBL,EAAYQ,GAS7D,OARIf,EAAcK,eAAiBO,IAC/BZ,EAAcK,cAAcO,kBAAoBA,GAGhDZ,EAAcK,eAAiBc,IAC/BnB,EAAcK,cAAcc,QAAUA,GAGnCE,OACCd,GAAc,CAAEI,SAAU,CAAEJ,eAC5BN,GAAS,CAAEA,MAAO,CAAEqB,UAAWrB,EAAMqB,UAAWC,aAActB,EAAMsB,eACrEvB,GAAAA,CACHwB,0BAA0B,GAElC,CAMA,QAAAC,GAEA,CAEOC,MAA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KQ,cAAcwD,KAAKhE,KACjD,EAhBAwD,EAVW3D,EAUeoE,eAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{isValidHttpUrl as r}from"../../../utils/isValidURL.js";import{interpolateElement as s}from"../../../language/utils.js";import n from"../Link/Link.js";function a({
|
|
1
|
+
import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{isValidHttpUrl as r}from"../../../utils/isValidURL.js";import{interpolateElement as s}from"../../../language/utils.js";import n from"../Link/Link.js";function a({id:t,message:r,urls:s=[]}){return e("span",{id:t,className:"adyen-checkout-disclaimer__label"},e(i,{message:r,urls:s}))}function i({message:a,urls:i=[]}){const l="string"==typeof a,o=i.every(e=>"string"==typeof e&&r(e));if(!l||!o)return null;let u;try{u=s(a,i.map(t=>function(r){return e(n,{to:t},r)}))}catch(e){u=a,console.warn(e)}return e(t,null,u)}export{i as LabelOnlyDisclaimerMessage,a as default};
|
|
2
2
|
//# sourceMappingURL=DisclaimerMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisclaimerMessage.js","sources":["../../../../../src/components/internal/DisclaimerMessage/DisclaimerMessage.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { isValidHttpUrl } from '../../../utils/isValidURL';\nimport './DisclaimerMessage.scss';\nimport { interpolateElement } from '../../../language/utils';\nimport Link from '../Link';\n\nexport interface DisclaimerMsgObject {\n message: string;\n linkText
|
|
1
|
+
{"version":3,"file":"DisclaimerMessage.js","sources":["../../../../../src/components/internal/DisclaimerMessage/DisclaimerMessage.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { isValidHttpUrl } from '../../../utils/isValidURL';\nimport './DisclaimerMessage.scss';\nimport { interpolateElement } from '../../../language/utils';\nimport Link from '../Link';\n\nexport interface DisclaimerMsgObject {\n message: string;\n linkText?: string | Array<string>;\n link?: string | Array<string>;\n}\n\nexport interface DisclaimerMessageProps {\n id?: string;\n message: string;\n urls?: Array<string>;\n}\n\n/**\n * props: {\n * message: 'By continuing you agree with the %#terms and conditions%#',\n * urls: ['https://www.adyen.com']\n * }\n * String inside the '%#' token pair will be rendered as an anchor element.\n *\n * Merchant configured disclaimers use the `%{placeholder}` format instead, and must be passed\n * through `formatDisclaimerMessage` to obtain these props.\n */\n\nexport default function DisclaimerMessage({ id, message, urls = [] }: Readonly<DisclaimerMessageProps>) {\n return (\n <span id={id} className=\"adyen-checkout-disclaimer__label\">\n <LabelOnlyDisclaimerMessage message={message} urls={urls} />\n </span>\n );\n}\n\nexport function LabelOnlyDisclaimerMessage({ message, urls = [] }: Readonly<DisclaimerMessageProps>) {\n const messageIsStr = typeof message === 'string';\n const validUrls = urls.every(url => typeof url === 'string' && isValidHttpUrl(url));\n if (!messageIsStr || !validUrls) return null;\n\n let content;\n try {\n content = interpolateElement(\n message,\n urls.map(\n // for each URL in the URLs array, return a createLink function\n url =>\n function createLink(translation) {\n return <Link to={url}>{translation}</Link>;\n }\n )\n );\n } catch (e) {\n // Fall back to raw message (i.e. the translation key) if interpolation fails\n content = message;\n // Report interpolation error to console\n console.warn(e);\n }\n\n return <Fragment>{content}</Fragment>;\n}\n"],"names":["DisclaimerMessage","id","message","urls","h","span","className","LabelOnlyDisclaimerMessage","messageIsStr","validUrls","every","url","isValidHttpUrl","content","interpolateElement","map","translation","Link","to","e","console","warn","Fragment"],"mappings":"mPA6Be,SAASA,GAAkBC,GAAEA,EAAEC,QAAEA,EAAOC,KAAEA,EAAO,KAC5D,OACIC,EAACC,OAAAA,CAAKJ,GAAIA,EAAIK,UAAU,oCACpBF,EAACG,EAAAA,CAA2BL,QAASA,EAASC,KAAMA,IAGhE,CAEO,SAASI,GAA2BL,QAAEA,EAAOC,KAAEA,EAAO,KACzD,MAAMK,EAAkC,iBAAZN,EACtBO,EAAYN,EAAKO,MAAMC,GAAsB,iBAARA,GAAoBC,EAAeD,IAC9E,IAAKH,IAAiBC,EAAW,OAAO,KAExC,IAAII,EACJ,IACIA,EAAUC,EACNZ,EACAC,EAAKY,IAEDJ,GACI,SAAoBK,GAChB,OAAOZ,EAACa,EAAAA,CAAKC,GAAIP,GAAMK,EAC3B,GAGhB,CAAE,MAAOG,GAELN,EAAUX,EAEVkB,QAAQC,KAAKF,EACjB,CAEA,OAAOf,EAACkB,EAAAA,KAAUT,EACtB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=/%\{[^}]*\}/g,r=e=>Array.isArray(e)?e:[e];function s({message:s,linkText:t,link:n}){if("string"!=typeof s)return{message:"",urls:[]};const i=r(t),o=r(n),g=[];let u=0;return{message:s.replace(e,()=>{const e=i[u],r=o[u];return u++,"string"!=typeof e?"":"string"!=typeof r?e:(g.push(r),`%#${e}%#`)}),urls:g}}export{s as formatDisclaimerMessage};
|
|
2
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/DisclaimerMessage/utils.ts"],"sourcesContent":["import type { DisclaimerMessageProps, DisclaimerMsgObject } from './DisclaimerMessage';\n\n/**\n * Matches a `%{placeholder}` link slot. Placeholder names are irrelevant, only their order matters.\n */\nconst LINK_SLOT_REGEX = /%\\{[^}]*\\}/g;\n\nconst toArray = <T>(value: T | Array<T>): Array<T> => (Array.isArray(value) ? value : [value]);\n\n/**\n * Converts the merchant facing disclaimer message config into the props of the DisclaimerMessage component.\n *\n * Each `%{placeholder}` in the message is replaced, in order of appearance, by the corresponding entry of\n * `linkText` wrapped in the `%#` token pair that DisclaimerMessage renders as an anchor element. A linkText\n * without a link degrades to plain text, while a slot without linkText is removed.\n *\n * @param disclaimerMessage - merchant provided disclaimer message\n * @returns the message with interpolation tokens and the urls matching the order of the tokens\n */\nexport function formatDisclaimerMessage({ message, linkText, link }: DisclaimerMsgObject): DisclaimerMessageProps {\n if (typeof message !== 'string') return { message: '', urls: [] };\n\n const linkTexts = toArray(linkText);\n const links = toArray(link);\n const urls: Array<string> = [];\n let index = 0;\n\n const formattedMessage = message.replace(LINK_SLOT_REGEX, () => {\n const text = linkTexts[index];\n const url = links[index];\n index++;\n if (typeof text !== 'string') return '';\n if (typeof url !== 'string') return text;\n urls.push(url);\n return `%#${text}%#`;\n });\n\n return { message: formattedMessage, urls };\n}\n"],"names":["LINK_SLOT_REGEX","toArray","value","Array","isArray","formatDisclaimerMessage","message","linkText","link","urls","linkTexts","links","index","replace","text","url","push"],"mappings":"AAKA,MAAMA,EAAkB,cAElBC,EAAcC,GAAmCC,MAAMC,QAAQF,GAASA,EAAQ,CAACA,GAYhF,SAASG,GAAwBC,QAAEA,EAAOC,SAAEA,EAAQC,KAAEA,IACzD,GAAuB,iBAAZF,EAAsB,MAAO,CAAEA,QAAS,GAAIG,KAAM,IAE7D,MAAMC,EAAYT,EAAQM,GACpBI,EAAQV,EAAQO,GAChBC,EAAsB,GAC5B,IAAIG,EAAQ,EAYZ,MAAO,CAAEN,QAVgBA,EAAQO,QAAQb,EAAiB,KACtD,MAAMc,EAAOJ,EAAUE,GACjBG,EAAMJ,EAAMC,GAElB,OADAA,IACoB,iBAATE,EAA0B,GAClB,iBAARC,EAAyBD,GACpCL,EAAKO,KAAKD,GACH,KAAKD,SAGoBL,OACxC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const o=o=>{const
|
|
1
|
+
const o=o=>o.replace(/[!-~]/g,o=>String.fromCharCode(o.charCodeAt(0)-65248)),e=o=>{const e=o.parentNode,t=window.getComputedStyle(e,null),p=parseInt(t.getPropertyValue("border-top-width")),l=o.offsetTop-e.offsetTop<e.scrollTop,r=o.offsetTop-e.offsetTop+o.clientHeight-p>e.scrollTop+e.clientHeight;(l||r)&&(e.scrollTop=o.offsetTop-e.offsetTop-e.clientHeight/2-p+o.clientHeight/2)};export{o as convertFullToHalf,e as simulateFocusScroll};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/FormFields/utils.ts"],"sourcesContent":["const convertFullToHalf = str => str.replace(/[!-~]/g, r => String.fromCharCode(r.charCodeAt(0) - 0xfee0));\n\n/**\n * This function scrolls and element to view and simulates the default behaviour of .focus() by a given browser\n * This function is inspired, yet simplified of the code found here https://gist.github.com/hsablonniere/2581101\n * @param element - element to focus\n */\nconst simulateFocusScroll = (element: HTMLElement) => {\n const parent = element.parentNode as HTMLElement;\n const parentComputedStyle = window.getComputedStyle(parent, null);\n const parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'));\n const overTop = element.offsetTop - parent.offsetTop < parent.scrollTop;\n const overBottom = element.offsetTop - parent.offsetTop + element.clientHeight - parentBorderTopWidth > parent.scrollTop + parent.clientHeight;\n\n if (overTop || overBottom) {\n parent.scrollTop = element.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + element.clientHeight / 2;\n }\n};\n\nexport { convertFullToHalf, simulateFocusScroll };\n"],"names":["simulateFocusScroll","element","parent","parentNode","parentComputedStyle","window","getComputedStyle","parentBorderTopWidth","parseInt","getPropertyValue","overTop","offsetTop","scrollTop","overBottom","clientHeight"],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/FormFields/utils.ts"],"sourcesContent":["const convertFullToHalf = str => str.replace(/[!-~]/g, r => String.fromCharCode(r.charCodeAt(0) - 0xfee0));\n\n/**\n * This function scrolls and element to view and simulates the default behaviour of .focus() by a given browser\n * This function is inspired, yet simplified of the code found here https://gist.github.com/hsablonniere/2581101\n * @param element - element to focus\n */\nconst simulateFocusScroll = (element: HTMLElement) => {\n const parent = element.parentNode as HTMLElement;\n const parentComputedStyle = window.getComputedStyle(parent, null);\n const parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'));\n const overTop = element.offsetTop - parent.offsetTop < parent.scrollTop;\n const overBottom = element.offsetTop - parent.offsetTop + element.clientHeight - parentBorderTopWidth > parent.scrollTop + parent.clientHeight;\n\n if (overTop || overBottom) {\n parent.scrollTop = element.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + element.clientHeight / 2;\n }\n};\n\nexport { convertFullToHalf, simulateFocusScroll };\n"],"names":["convertFullToHalf","str","replace","r","String","fromCharCode","charCodeAt","simulateFocusScroll","element","parent","parentNode","parentComputedStyle","window","getComputedStyle","parentBorderTopWidth","parseInt","getPropertyValue","overTop","offsetTop","scrollTop","overBottom","clientHeight"],"mappings":"AAAA,MAAMA,EAAoBC,GAAOA,EAAIC,QAAQ,SAAUC,GAAKC,OAAOC,aAAaF,EAAEG,WAAW,GAAK,QAO5FC,EAAuBC,IACzB,MAAMC,EAASD,EAAQE,WACjBC,EAAsBC,OAAOC,iBAAiBJ,EAAQ,MACtDK,EAAuBC,SAASJ,EAAoBK,iBAAiB,qBACrEC,EAAUT,EAAQU,UAAYT,EAAOS,UAAYT,EAAOU,UACxDC,EAAaZ,EAAQU,UAAYT,EAAOS,UAAYV,EAAQa,aAAeP,EAAuBL,EAAOU,UAAYV,EAAOY,cAE9HJ,GAAWG,KACXX,EAAOU,UAAYX,EAAQU,UAAYT,EAAOS,UAAYT,EAAOY,aAAe,EAAIP,EAAuBN,EAAQa,aAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import{useCoreContext as a}from"../../../core/Context/CoreProvider.js";import r from"../FormFields/Field/Field.js";import{isValidHolder as n,checkIbanStatus as s}from"./validate.js";import{electronicFormat as i,formatIban as o,getCountryCode as l,getNextCursorPosition as d}from"./utils.js";import u from"../FormFields/Fieldset/Fieldset.js";import h from"../FormFields/InputText.js";function b(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function c(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},r=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(a).filter(function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),r.forEach(function(t){b(e,t,a[t])})}return e}function m(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 a=Object.getOwnPropertySymbols(e);t.push.apply(t,a)}return t}(Object(t)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}),e}const p={isValid:!1,errorMessage:"ach.accountHolderNameField.invalid",error:"ach.accountHolderNameField.invalid"},N={isValid:!1,errorMessage:"sepaDirectDebit.ibanField.invalid",error:"sepaDirectDebit.ibanField.invalid"};class
|
|
1
|
+
import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import{useCoreContext as a}from"../../../core/Context/CoreProvider.js";import r from"../FormFields/Field/Field.js";import{isValidHolder as n,checkIbanStatus as s}from"./validate.js";import{electronicFormat as i,formatIban as o,getCountryCode as l,getNextCursorPosition as d}from"./utils.js";import u from"../FormFields/Fieldset/Fieldset.js";import h from"../FormFields/InputText.js";function b(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function c(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},r=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(a).filter(function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),r.forEach(function(t){b(e,t,a[t])})}return e}function m(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 a=Object.getOwnPropertySymbols(e);t.push.apply(t,a)}return t}(Object(t)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}),e}const p={isValid:!1,errorMessage:"ach.accountHolderNameField.invalid",error:"ach.accountHolderNameField.invalid"},N={isValid:!1,errorMessage:"sepaDirectDebit.ibanField.invalid",error:"sepaDirectDebit.ibanField.invalid"};class v extends e{setStatus(e){this.setState({status:e})}onChange(){const e=!this.props.holderName||n(this.state.data.ownerName),t="valid"===s(this.state.data.ibanNumber).status&&e,a={data:this.state.data,isValid:t,errors:this.state.errors};this.props.onChange(a)}showValidation(){const e=s(this.state.data.ibanNumber).status,t=n(this.state.data.ownerName);this.setError("iban","valid"===e?null:N);const a=t?null:p;this.setError("holder",a,this.onChange)}render({placeholders:e},{data:n,errors:s,valid:i}){var o,l;const{i18n:d}=a();return t(u,{classNameModifiers:["iban-input"],label:this.props.label},this.props.holderName&&t(r,{className:"adyen-checkout__field--owner-name",label:d.get("sepa.ownerName"),filled:n.ownerName&&n.ownerName.length,errorMessage:!!s.holder&&d.get(s.holder.error),dir:"ltr",i18n:d,name:"ownerName"},t(h,{name:"ownerName",className:"adyen-checkout__iban-input__owner-name",placeholder:null==e?void 0:e.ownerName,value:n.ownerName,"aria-invalid":!!this.state.errors.holder,"aria-label":d.get("sepa.ownerName"),onInput:e=>this.handleHolderInput(e.target.value),onBlur:e=>this.handleHolderInput(e.target.value),autocomplete:"name"})),t(r,{className:"adyen-checkout__field--iban-number",label:d.get("sepa.ibanNumber"),errorMessage:!!s.iban&&d.get(s.iban.error),filled:n.ibanNumber&&n.ibanNumber.length,isValid:i.iban,onBlur:this.handleIbanBlur,dir:"ltr",i18n:d,name:"ibanNumber"},t(h,{name:"ibanNumber",className:"adyen-checkout__iban-input__iban-number",classNameModifiers:["large"],placeholder:null==e?void 0:e.ibanNumber,value:n.ibanNumber,onInput:this.handleIbanInput,"aria-invalid":!!this.state.errors.iban,"aria-label":d.get("sepa.ibanNumber"),autocorrect:"off",spellcheck:!1,autocomplete:void 0})),null===(o=(l=this.props).payButton)||void 0===o?void 0:o.call(l,{status:this.state.status}))}constructor(e){var t,a,r;if(super(e),b(this,"setError",(e,t,a)=>{this.setState(a=>({errors:m(c({},a.errors),{[e]:t})}),a)}),b(this,"handleHolderInput",e=>{this.setState(t=>({data:m(c({},t.data),{ownerName:e})}),()=>{const e=n(this.state.data.ownerName),t=e&&!e?p:null;this.setError("holder",t,this.onChange)})}),b(this,"handleIbanInput",e=>{const t=e.target.value,a=i(t),r=o(a),n=s(r).status,u=l(a),h=e.target.selectionStart,b=this.state.data.ibanNumber,p=d(h,r,b);this.setState(e=>({data:m(c({},e.data),{ibanNumber:r,countryCode:u}),errors:m(c({},e.errors),{iban:"invalid"===n?N:null}),valid:m(c({},e.valid),{iban:"valid"===n})}),()=>{e.target.setSelectionRange(p,p),this.onChange()})}),b(this,"handleIbanBlur",e=>{const t=e.target.value;if(t.length>0){const e=s(t).status;this.setError("iban","valid"===e?null:N,this.onChange)}else this.setError("iban",null,this.onChange)}),this.state={status:"ready",data:{ownerName:(null==e||null===(t=e.data)||void 0===t?void 0:t.ownerName)||"",ibanNumber:(null==e||null===(a=e.data)||void 0===a?void 0:a.ibanNumber)||"",countryCode:(null==e||null===(r=e.data)||void 0===r?void 0:r.countryCode)||""},isValid:!1,cursor:0,errors:{},valid:{}},this.state.data.ibanNumber){const e=i(this.state.data.ibanNumber);this.state.data.ibanNumber=o(e)}if(this.state.data.ibanNumber||this.state.data.ownerName){const e=!this.props.holderName||n(this.state.data.ownerName),t=!!this.state.data.ibanNumber&&"valid"===s(this.state.data.ibanNumber).status&&e,a={data:this.state.data,isValid:t};this.props.onChange(a)}}}b(v,"defaultProps",{onChange:()=>{},countryCode:null,holderName:!0,placeholders:{},label:null});export{v as default};
|
|
2
2
|
//# sourceMappingURL=IbanInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IbanInput.js","sources":["../../../../../src/components/internal/IbanInput/IbanInput.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Field from '../FormFields/Field';\nimport { checkIbanStatus, isValidHolder } from './validate';\nimport { electronicFormat, formatIban, getCountryCode, getNextCursorPosition } from './utils';\nimport Fieldset from '../FormFields/Fieldset';\nimport { GenericError } from '../../../core/Errors/types';\nimport InputText from '../FormFields/InputText';\nimport { UIElementStatus } from '../UIElement/types';\nimport { PayButtonProps } from '../PayButton/PayButton';\n\nexport interface IbanData {\n ownerName?: string;\n ibanNumber?: string;\n countryCode?: string;\n}\n\ninterface IbanInputOnChangeData {\n data: IbanData;\n isValid: boolean;\n errors?: Record<string, GenericError | null>;\n}\n\ninterface IbanInputProps {\n holderName?: boolean;\n placeholders?: Omit<IbanData, 'countryCode'>;\n countryCode?: string;\n showPayButton?: boolean;\n payButton?: (props: PayButtonProps) => h.JSX.Element;\n onChange: (data: IbanInputOnChangeData) => void;\n label: string;\n data?: IbanData;\n}\n\ninterface IbanInputState {\n data: IbanData;\n errors: Record<string, GenericError | null>;\n valid: Record<string, boolean>;\n status: string;\n isValid: boolean;\n cursor: number;\n}\n\nconst ibanHolderNameErrorObj: GenericError = {\n isValid: false,\n errorMessage: 'ach.accountHolderNameField.invalid', // TODO create bespoke translation key\n error: 'ach.accountHolderNameField.invalid'\n};\n\nconst ibanErrorObj: GenericError = {\n isValid: false,\n errorMessage: 'sepaDirectDebit.ibanField.invalid',\n error: 'sepaDirectDebit.ibanField.invalid'\n};\n\nclass IbanInput extends Component<Readonly<IbanInputProps>, IbanInputState> {\n constructor(props) {\n super(props);\n\n this.state = {\n status: 'ready',\n data: {\n ownerName: props?.data?.ownerName || '',\n ibanNumber: props?.data?.ibanNumber || '',\n countryCode: props?.data?.countryCode || ''\n },\n isValid: false,\n cursor: 0,\n errors: {},\n valid: {}\n };\n\n if (this.state.data['ibanNumber']) {\n const electronicFormatIban = electronicFormat(this.state.data['ibanNumber']); // example: NL13TEST0123456789\n this.state.data['ibanNumber'] = formatIban(electronicFormatIban); // example: NL13 TEST 0123 4567 89\n }\n\n if (this.state.data['ibanNumber'] || this.state.data['ownerName']) {\n const holderNameValid = this.props.holderName ? isValidHolder(this.state.data['ownerName']) : true;\n const ibanValid = this.state.data['ibanNumber'] ? checkIbanStatus(this.state.data['ibanNumber']).status === 'valid' : false;\n const isValid = ibanValid && holderNameValid;\n const data = { data: this.state.data, isValid };\n\n this.props.onChange(data);\n }\n }\n\n public static readonly defaultProps = {\n onChange: () => {},\n countryCode: null,\n holderName: true,\n placeholders: {},\n label: null\n };\n\n setStatus(status: UIElementStatus) {\n this.setState({ status });\n }\n\n onChange() {\n const holderNameValid = this.props.holderName ? isValidHolder(this.state.data['ownerName']) : true;\n const ibanValid = checkIbanStatus(this.state.data['ibanNumber']).status === 'valid';\n const isValid = ibanValid && holderNameValid;\n const data = { data: this.state.data, isValid, errors: this.state.errors };\n\n this.props.onChange(data);\n }\n\n public setError = (key, value, cb?) => {\n this.setState(prevState => ({ errors: { ...prevState.errors, [key]: value } }), cb);\n };\n\n public handleHolderInput = holder => {\n this.setState(\n prevState => ({ data: { ...prevState.data, ownerName: holder } }),\n () => {\n const holderStatus = isValidHolder(this.state.data['ownerName']);\n const holderErr = holderStatus && !holderStatus ? ibanHolderNameErrorObj : null;\n\n this.setError('holder', holderErr, this.onChange);\n }\n );\n };\n\n public handleIbanInput = e => {\n const inputValue = e.target.value;\n const electronicFormatIban = electronicFormat(inputValue); // example: NL13TEST0123456789\n const iban = formatIban(electronicFormatIban); // example: NL13 TEST 0123 4567 89\n const validationStatus = checkIbanStatus(iban).status;\n\n const countryCode = getCountryCode(electronicFormatIban);\n\n // calculate cursor's new position\n const cursor = e.target.selectionStart;\n const previousIban = this.state.data['ibanNumber'];\n const newCursorPosition = getNextCursorPosition(cursor, iban, previousIban);\n\n this.setState(\n prevState => ({\n data: { ...prevState.data, ibanNumber: iban, countryCode: countryCode },\n errors: {\n ...prevState.errors,\n iban: validationStatus === 'invalid' ? ibanErrorObj : null\n },\n valid: { ...prevState.valid, iban: validationStatus === 'valid' }\n }),\n () => {\n e.target.setSelectionRange(newCursorPosition, newCursorPosition);\n this.onChange();\n }\n );\n };\n\n public handleIbanBlur = e => {\n const currentIban = e.target.value;\n\n if (currentIban.length > 0) {\n const validationStatus = checkIbanStatus(currentIban).status;\n this.setError('iban', validationStatus === 'valid' ? null : ibanErrorObj, this.onChange);\n } else {\n // Empty field is not in error\n this.setError('iban', null, this.onChange);\n }\n };\n\n showValidation() {\n const validationStatus = checkIbanStatus(this.state.data['ibanNumber']).status;\n const holderStatus = isValidHolder(this.state.data['ownerName']);\n this.setError('iban', validationStatus === 'valid' ? null : ibanErrorObj);\n\n const holderErr = holderStatus ? null : ibanHolderNameErrorObj;\n\n this.setError('holder', holderErr, this.onChange); // add callback param to force propagation of state to parent comp\n }\n\n render({ placeholders }: IbanInputProps, { data, errors, valid }) {\n const { i18n } = useCoreContext();\n return (\n <Fieldset classNameModifiers={['iban-input']} label={this.props.label}>\n {this.props.holderName && (\n <Field\n className={'adyen-checkout__field--owner-name'}\n label={i18n.get('sepa.ownerName')}\n filled={data['ownerName'] && data['ownerName'].length}\n errorMessage={errors.holder ? i18n.get(errors.holder.error) : false}\n dir={'ltr'}\n i18n={i18n}\n name={'ownerName'}\n >\n <InputText\n name={'ownerName'}\n className={'adyen-checkout__iban-input__owner-name'}\n placeholder={placeholders?.ownerName}\n value={data['ownerName']}\n aria-invalid={!!this.state.errors.holder}\n aria-label={i18n.get('sepa.ownerName')}\n onInput={e => this.handleHolderInput((e.target as HTMLInputElement).value)}\n onBlur={e => this.handleHolderInput((e.target as HTMLInputElement).value)}\n autocomplete={'name'}\n />\n </Field>\n )}\n\n <Field\n className={'adyen-checkout__field--iban-number'}\n label={i18n.get('sepa.ibanNumber')}\n errorMessage={errors.iban ? i18n.get(errors.iban.error) : false}\n filled={data['ibanNumber'] && data['ibanNumber'].length}\n isValid={valid.iban}\n onBlur={this.handleIbanBlur}\n dir={'ltr'}\n i18n={i18n}\n name={'ibanNumber'}\n >\n <InputText\n name={'ibanNumber'}\n className={'adyen-checkout__iban-input__iban-number'}\n classNameModifiers={['large']}\n placeholder={placeholders?.ibanNumber}\n value={data['ibanNumber']}\n onInput={this.handleIbanInput}\n aria-invalid={!!this.state.errors.iban}\n aria-label={i18n.get('sepa.ibanNumber')}\n autocorrect={'off'}\n spellcheck={false}\n autocomplete={undefined}\n />\n </Field>\n\n {this.props.showPayButton && this.props.payButton({ status: this.state.status })}\n </Fieldset>\n );\n }\n}\n\nexport default IbanInput;\n"],"names":["ibanHolderNameErrorObj","isValid","errorMessage","error","ibanErrorObj","IbanInput","Component","setStatus","status","this","setState","onChange","holderNameValid","props","holderName","isValidHolder","state","data","checkIbanStatus","errors","showValidation","validationStatus","holderStatus","setError","holderErr","render","placeholders","valid","i18n","useCoreContext","h","Fieldset","classNameModifiers","label","Field","className","get","filled","length","holder","dir","name","InputText","placeholder","ownerName","value","aria-invalid","aria-label","onInput","e","handleHolderInput","target","onBlur","autocomplete","iban","handleIbanBlur","ibanNumber","handleIbanInput","autocorrect","spellcheck","undefined","showPayButton","payButton","constructor","super","_define_property","key","cb","prevState","_object_spread_props","_object_spread","inputValue","electronicFormatIban","electronicFormat","formatIban","countryCode","getCountryCode","cursor","selectionStart","previousIban","newCursorPosition","getNextCursorPosition","setSelectionRange","currentIban","defaultProps"],"mappings":"+vCA2CA,MAAMA,EAAuC,CACzCC,SAAS,EACTC,aAAc,qCACdC,MAAO,sCAGLC,EAA6B,CAC/BH,SAAS,EACTC,aAAc,oCACdC,MAAO,qCAGX,MAAME,UAAkBC,EAwCpBC,SAAAA,CAAUC,GACNC,KAAKC,SAAS,CAAEF,UACpB,CAEAG,QAAAA,GACI,MAAMC,GAAkBH,KAAKI,MAAMC,YAAaC,EAAcN,KAAKO,MAAMC,gBAEnEhB,EADsE,UAA1DiB,EAAgBT,KAAKO,MAAMC,KAAK,YAAeT,QACpCI,EACvBK,EAAO,CAAEA,KAAMR,KAAKO,MAAMC,KAAMhB,UAASkB,OAAQV,KAAKO,MAAMG,QAElEV,KAAKI,MAAMF,SAASM,EACxB,CA2DAG,cAAAA,GAC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C,EAAgBT,KAAKO,MAAMC,iBAAoBT,QACpEI,EACvBK,EAAO,CAAEA,KAAMR,KAAKO,MAAMC,KAAMhB,WAEtCQ,KAAKI,MAAMF,SAASM,EACxB,CACJ,EAEAgD,EAhCE5D,EAgCqB+E,eAAe,CAClCzE,SAAU,OACVgE,YAAa,KACb7D,YAAY,EACZY,aAAc,CAAA,EACdO,MAAO"}
|
|
1
|
+
{"version":3,"file":"IbanInput.js","sources":["../../../../../src/components/internal/IbanInput/IbanInput.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Field from '../FormFields/Field';\nimport { checkIbanStatus, isValidHolder } from './validate';\nimport { electronicFormat, formatIban, getCountryCode, getNextCursorPosition } from './utils';\nimport Fieldset from '../FormFields/Fieldset';\nimport { GenericError } from '../../../core/Errors/types';\nimport InputText from '../FormFields/InputText';\nimport { UIElementStatus } from '../UIElement/types';\nimport { PayButtonProps } from '../PayButton/PayButton';\n\nexport interface IbanData {\n ownerName?: string;\n ibanNumber?: string;\n countryCode?: string;\n}\n\ninterface IbanInputOnChangeData {\n data: IbanData;\n isValid: boolean;\n errors?: Record<string, GenericError | null>;\n}\n\ninterface IbanInputProps {\n holderName?: boolean;\n placeholders?: Omit<IbanData, 'countryCode'>;\n countryCode?: string;\n showPayButton?: boolean;\n payButton?: (props: PayButtonProps) => h.JSX.Element;\n onChange: (data: IbanInputOnChangeData) => void;\n label: string;\n data?: IbanData;\n}\n\ninterface IbanInputState {\n data: IbanData;\n errors: Record<string, GenericError | null>;\n valid: Record<string, boolean>;\n status: string;\n isValid: boolean;\n cursor: number;\n}\n\nconst ibanHolderNameErrorObj: GenericError = {\n isValid: false,\n errorMessage: 'ach.accountHolderNameField.invalid', // TODO create bespoke translation key\n error: 'ach.accountHolderNameField.invalid'\n};\n\nconst ibanErrorObj: GenericError = {\n isValid: false,\n errorMessage: 'sepaDirectDebit.ibanField.invalid',\n error: 'sepaDirectDebit.ibanField.invalid'\n};\n\nclass IbanInput extends Component<Readonly<IbanInputProps>, IbanInputState> {\n constructor(props) {\n super(props);\n\n this.state = {\n status: 'ready',\n data: {\n ownerName: props?.data?.ownerName || '',\n ibanNumber: props?.data?.ibanNumber || '',\n countryCode: props?.data?.countryCode || ''\n },\n isValid: false,\n cursor: 0,\n errors: {},\n valid: {}\n };\n\n if (this.state.data['ibanNumber']) {\n const electronicFormatIban = electronicFormat(this.state.data['ibanNumber']); // example: NL13TEST0123456789\n this.state.data['ibanNumber'] = formatIban(electronicFormatIban); // example: NL13 TEST 0123 4567 89\n }\n\n if (this.state.data['ibanNumber'] || this.state.data['ownerName']) {\n const holderNameValid = this.props.holderName ? isValidHolder(this.state.data['ownerName']) : true;\n const ibanValid = this.state.data['ibanNumber'] ? checkIbanStatus(this.state.data['ibanNumber']).status === 'valid' : false;\n const isValid = ibanValid && holderNameValid;\n const data = { data: this.state.data, isValid };\n\n this.props.onChange(data);\n }\n }\n\n public static readonly defaultProps = {\n onChange: () => {},\n countryCode: null,\n holderName: true,\n placeholders: {},\n label: null\n };\n\n setStatus(status: UIElementStatus) {\n this.setState({ status });\n }\n\n onChange() {\n const holderNameValid = this.props.holderName ? isValidHolder(this.state.data['ownerName']) : true;\n const ibanValid = checkIbanStatus(this.state.data['ibanNumber']).status === 'valid';\n const isValid = ibanValid && holderNameValid;\n const data = { data: this.state.data, isValid, errors: this.state.errors };\n\n this.props.onChange(data);\n }\n\n public setError = (key, value, cb?) => {\n this.setState(prevState => ({ errors: { ...prevState.errors, [key]: value } }), cb);\n };\n\n public handleHolderInput = holder => {\n this.setState(\n prevState => ({ data: { ...prevState.data, ownerName: holder } }),\n () => {\n const holderStatus = isValidHolder(this.state.data['ownerName']);\n const holderErr = holderStatus && !holderStatus ? ibanHolderNameErrorObj : null;\n\n this.setError('holder', holderErr, this.onChange);\n }\n );\n };\n\n public handleIbanInput = e => {\n const inputValue = e.target.value;\n const electronicFormatIban = electronicFormat(inputValue); // example: NL13TEST0123456789\n const iban = formatIban(electronicFormatIban); // example: NL13 TEST 0123 4567 89\n const validationStatus = checkIbanStatus(iban).status;\n\n const countryCode = getCountryCode(electronicFormatIban);\n\n // calculate cursor's new position\n const cursor = e.target.selectionStart;\n const previousIban = this.state.data['ibanNumber'];\n const newCursorPosition = getNextCursorPosition(cursor, iban, previousIban);\n\n this.setState(\n prevState => ({\n data: { ...prevState.data, ibanNumber: iban, countryCode: countryCode },\n errors: {\n ...prevState.errors,\n iban: validationStatus === 'invalid' ? ibanErrorObj : null\n },\n valid: { ...prevState.valid, iban: validationStatus === 'valid' }\n }),\n () => {\n e.target.setSelectionRange(newCursorPosition, newCursorPosition);\n this.onChange();\n }\n );\n };\n\n public handleIbanBlur = e => {\n const currentIban = e.target.value;\n\n if (currentIban.length > 0) {\n const validationStatus = checkIbanStatus(currentIban).status;\n this.setError('iban', validationStatus === 'valid' ? null : ibanErrorObj, this.onChange);\n } else {\n // Empty field is not in error\n this.setError('iban', null, this.onChange);\n }\n };\n\n showValidation() {\n const validationStatus = checkIbanStatus(this.state.data['ibanNumber']).status;\n const holderStatus = isValidHolder(this.state.data['ownerName']);\n this.setError('iban', validationStatus === 'valid' ? null : ibanErrorObj);\n\n const holderErr = holderStatus ? null : ibanHolderNameErrorObj;\n\n this.setError('holder', holderErr, this.onChange); // add callback param to force propagation of state to parent comp\n }\n\n render({ placeholders }: IbanInputProps, { data, errors, valid }) {\n const { i18n } = useCoreContext();\n return (\n <Fieldset classNameModifiers={['iban-input']} label={this.props.label}>\n {this.props.holderName && (\n <Field\n className={'adyen-checkout__field--owner-name'}\n label={i18n.get('sepa.ownerName')}\n filled={data['ownerName'] && data['ownerName'].length}\n errorMessage={errors.holder ? i18n.get(errors.holder.error) : false}\n dir={'ltr'}\n i18n={i18n}\n name={'ownerName'}\n >\n <InputText\n name={'ownerName'}\n className={'adyen-checkout__iban-input__owner-name'}\n placeholder={placeholders?.ownerName}\n value={data['ownerName']}\n aria-invalid={!!this.state.errors.holder}\n aria-label={i18n.get('sepa.ownerName')}\n onInput={e => this.handleHolderInput((e.target as HTMLInputElement).value)}\n onBlur={e => this.handleHolderInput((e.target as HTMLInputElement).value)}\n autocomplete={'name'}\n />\n </Field>\n )}\n\n <Field\n className={'adyen-checkout__field--iban-number'}\n label={i18n.get('sepa.ibanNumber')}\n errorMessage={errors.iban ? i18n.get(errors.iban.error) : false}\n filled={data['ibanNumber'] && data['ibanNumber'].length}\n isValid={valid.iban}\n onBlur={this.handleIbanBlur}\n dir={'ltr'}\n i18n={i18n}\n name={'ibanNumber'}\n >\n <InputText\n name={'ibanNumber'}\n className={'adyen-checkout__iban-input__iban-number'}\n classNameModifiers={['large']}\n placeholder={placeholders?.ibanNumber}\n value={data['ibanNumber']}\n onInput={this.handleIbanInput}\n aria-invalid={!!this.state.errors.iban}\n aria-label={i18n.get('sepa.ibanNumber')}\n autocorrect={'off'}\n spellcheck={false}\n autocomplete={undefined}\n />\n </Field>\n\n {/* IbanInput is also embedded in OpenInvoice, which owns the pay button and passes none down */}\n {this.props.payButton?.({ status: this.state.status })}\n </Fieldset>\n );\n }\n}\n\nexport default IbanInput;\n"],"names":["ibanHolderNameErrorObj","isValid","errorMessage","error","ibanErrorObj","IbanInput","Component","setStatus","status","this","setState","onChange","holderNameValid","props","holderName","isValidHolder","state","data","checkIbanStatus","errors","showValidation","validationStatus","holderStatus","setError","holderErr","render","placeholders","valid","_this_props_payButton","_this_props","i18n","useCoreContext","h","Fieldset","classNameModifiers","label","Field","className","get","filled","length","holder","dir","name","InputText","placeholder","ownerName","value","aria-invalid","aria-label","onInput","e","handleHolderInput","target","onBlur","autocomplete","iban","handleIbanBlur","ibanNumber","handleIbanInput","autocorrect","spellcheck","undefined","payButton","call","constructor","super","_define_property","key","cb","prevState","_object_spread_props","_object_spread","inputValue","electronicFormatIban","electronicFormat","formatIban","countryCode","getCountryCode","cursor","selectionStart","previousIban","newCursorPosition","getNextCursorPosition","setSelectionRange","currentIban","defaultProps"],"mappings":"+vCA2CA,M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