@adyen/adyen-web 6.10.0 → 6.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adyen.css +3 -3
- 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 +89 -99
- package/dist/es/adyen.css +3 -3
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/ANCV/components/ANCVAwait/config.js +1 -1
- package/dist/es/components/ANCV/components/ANCVAwait/config.js.map +1 -1
- package/dist/es/components/Ach/Ach.js +1 -1
- package/dist/es/components/Ach/Ach.js.map +1 -1
- package/dist/es/components/Ach/components/AccountTypeSelector.js +2 -0
- package/dist/es/components/Ach/components/AccountTypeSelector.js.map +1 -0
- package/dist/es/components/Ach/components/AchComponent.js +2 -0
- package/dist/es/components/Ach/components/AchComponent.js.map +1 -0
- package/dist/es/components/Ach/components/useSRPanelForACHErrors.js +2 -0
- package/dist/es/components/Ach/components/useSRPanelForACHErrors.js.map +1 -0
- package/dist/es/components/Ach/components/validate.js +2 -0
- package/dist/es/components/Ach/components/validate.js.map +1 -0
- package/dist/es/components/Ach/defaultProps.js +2 -0
- package/dist/es/components/Ach/defaultProps.js.map +1 -0
- package/dist/es/components/AmazonPay/utils.js +1 -1
- package/dist/es/components/ApplePay/ApplePay.js +1 -1
- package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es/components/ApplePay/defaultProps.js +1 -1
- package/dist/es/components/ApplePay/defaultProps.js.map +1 -1
- package/dist/es/components/Atome/Atome.js +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es/components/BcmcMobile/BcmcMobile.js +1 -1
- package/dist/es/components/Boleto/components/BoletoInput/validate.js +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVCHint.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFields.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardNumber.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/DataSfSpan.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/validate.js +1 -1
- package/dist/es/components/Donation/components/DonationComponent.js +1 -1
- package/dist/es/components/DuitNow/DuitNow.js +1 -1
- package/dist/es/components/GooglePay/GooglePay.js +1 -1
- package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es/components/PayNow/PayNow.js +1 -1
- package/dist/es/components/PayPal/constants.js +1 -1
- package/dist/es/components/PayPal/constants.js.map +1 -1
- package/dist/es/components/PayTo/PayTo.js.map +1 -1
- package/dist/es/components/Pix/PixInput/PixInput.js.map +1 -1
- package/dist/es/components/PromptPay/PromptPay.js +1 -1
- package/dist/es/components/Redirect/Redirect.js +1 -1
- package/dist/es/components/Riverty/Riverty.js +1 -1
- package/dist/es/components/Riverty/config.js +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es/components/WeChat/WeChat.js +1 -1
- package/dist/es/components/internal/Address/Address.js +1 -1
- package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
- package/dist/es/components/internal/Countdown/utils.js.map +1 -1
- package/dist/es/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
- package/dist/es/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
- package/dist/es/components/internal/FormFields/InputDate/utils.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es/components/internal/IbanInput/validate.js +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/useSRPanelForOpenInvoiceErrors.js +1 -1
- package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
- package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +1 -1
- package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
- package/dist/es/components/internal/PhoneInput/validate.js +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleTab.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleTab.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/tabbing/utils.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/userAgent.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/userAgent.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/utilities/addContextTranslations.js +1 -1
- package/dist/es/components/internal/StoreDetails/StoreDetails.js +1 -1
- package/dist/es/components/internal/StoreDetails/StoreDetails.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/core/Analytics/Analytics.js +1 -1
- package/dist/es/core/Analytics/Analytics.js.map +1 -1
- package/dist/es/core/Analytics/constants.js +1 -1
- package/dist/es/core/Analytics/constants.js.map +1 -1
- package/dist/es/core/Analytics/utils.js +1 -1
- package/dist/es/core/Errors/constants.js +1 -1
- package/dist/es/core/Errors/constants.js.map +1 -1
- package/dist/es/core/Errors/utils.js +1 -1
- package/dist/es/core/Errors/utils.js.map +1 -1
- package/dist/es/core/RiskModule/components/DeviceFingerprint/utils.js +1 -1
- package/dist/es/core/RiskModule/constants.js +1 -1
- package/dist/es/core/RiskModule/constants.js.map +1 -1
- package/dist/es/core/Services/analytics/collect-id.js +1 -1
- package/dist/es/core/Services/http.js +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/external/preact/dist/preact.js +1 -1
- package/dist/es/external/preact/dist/preact.js.map +1 -1
- package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
- package/dist/es/index.d.ts +89 -99
- package/dist/es/index.js +1 -1
- package/dist/es/utils/Validator/defaultRules.js +1 -1
- package/dist/es/utils/base64.js.map +1 -1
- package/dist/es/utils/browserInfo.js +1 -1
- package/dist/es/utils/browserInfo.js.map +1 -1
- package/dist/es/utils/detectInIframe.js +2 -0
- package/dist/es/utils/detectInIframe.js.map +1 -0
- package/dist/es/utils/setFocus.js +1 -1
- package/dist/es/utils/setFocus.js.map +1 -1
- package/dist/es/utils/textUtils.js +1 -1
- package/dist/es/utils/textUtils.js.map +1 -1
- package/dist/es/utils/useForm/useForm.js +1 -1
- package/dist/es-legacy/adyen.css +3 -3
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ANCV/components/ANCVAwait/config.js +1 -1
- package/dist/es-legacy/components/ANCV/components/ANCVAwait/config.js.map +1 -1
- package/dist/es-legacy/components/Ach/Ach.js +1 -1
- package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
- package/dist/es-legacy/components/Ach/components/AccountTypeSelector.js +2 -0
- package/dist/es-legacy/components/Ach/components/AccountTypeSelector.js.map +1 -0
- package/dist/es-legacy/components/Ach/components/AchComponent.js +2 -0
- package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -0
- package/dist/es-legacy/components/Ach/components/useSRPanelForACHErrors.js +2 -0
- package/dist/es-legacy/components/Ach/components/useSRPanelForACHErrors.js.map +1 -0
- package/dist/es-legacy/components/Ach/components/validate.js +2 -0
- package/dist/es-legacy/components/Ach/components/validate.js.map +1 -0
- package/dist/es-legacy/components/Ach/defaultProps.js +2 -0
- package/dist/es-legacy/components/Ach/defaultProps.js.map +1 -0
- package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/defaultProps.js +1 -1
- package/dist/es-legacy/components/ApplePay/defaultProps.js.map +1 -1
- package/dist/es-legacy/components/Atome/Atome.js +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es-legacy/components/BcmcMobile/BcmcMobile.js +1 -1
- package/dist/es-legacy/components/Boleto/components/BoletoInput/validate.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/DataSfSpan.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/validate.js +1 -1
- package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
- package/dist/es-legacy/components/DuitNow/DuitNow.js +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es-legacy/components/PayNow/PayNow.js +1 -1
- package/dist/es-legacy/components/PayPal/constants.js +1 -1
- package/dist/es-legacy/components/PayPal/constants.js.map +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
- package/dist/es-legacy/components/Pix/PixInput/PixInput.js.map +1 -1
- package/dist/es-legacy/components/PromptPay/PromptPay.js +1 -1
- package/dist/es-legacy/components/Redirect/Redirect.js +1 -1
- package/dist/es-legacy/components/Riverty/Riverty.js +1 -1
- package/dist/es-legacy/components/Riverty/config.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es-legacy/components/WeChat/WeChat.js +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js +1 -1
- package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js +1 -1
- package/dist/es-legacy/components/internal/Countdown/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputDate/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/IbanInput/validate.js +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/useSRPanelForOpenInvoiceErrors.js +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleTab.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleTab.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/tabbing/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/userAgent.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/userAgent.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/addContextTranslations.js +1 -1
- package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js +1 -1
- package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
- package/dist/es-legacy/core/Analytics/constants.js +1 -1
- package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js +1 -1
- package/dist/es-legacy/core/Errors/constants.js +1 -1
- package/dist/es-legacy/core/Errors/constants.js.map +1 -1
- package/dist/es-legacy/core/Errors/utils.js +1 -1
- package/dist/es-legacy/core/Errors/utils.js.map +1 -1
- package/dist/es-legacy/core/RiskModule/RiskModule.js +1 -1
- package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/utils.js +1 -1
- package/dist/es-legacy/core/RiskModule/constants.js +1 -1
- package/dist/es-legacy/core/RiskModule/constants.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/external/preact/dist/preact.js +1 -1
- package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
- package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
- package/dist/es-legacy/index.js +1 -1
- package/dist/es-legacy/utils/Validator/defaultRules.js +1 -1
- package/dist/es-legacy/utils/base64.js.map +1 -1
- package/dist/es-legacy/utils/browserInfo.js +1 -1
- package/dist/es-legacy/utils/browserInfo.js.map +1 -1
- package/dist/es-legacy/utils/detectInIframe.js +2 -0
- package/dist/es-legacy/utils/detectInIframe.js.map +1 -0
- package/dist/es-legacy/utils/setFocus.js +1 -1
- package/dist/es-legacy/utils/setFocus.js.map +1 -1
- package/dist/es-legacy/utils/textUtils.js +1 -1
- package/dist/es-legacy/utils/textUtils.js.map +1 -1
- package/dist/es-legacy/utils/useForm/useForm.js +1 -1
- package/package.json +22 -21
- package/styles/adyen.css +3 -3
- package/dist/es/components/Ach/components/AchInput/AchInput.js +0 -2
- package/dist/es/components/Ach/components/AchInput/AchInput.js.map +0 -1
- package/dist/es/components/Ach/components/AchInput/components/AchSFInput.js +0 -2
- package/dist/es/components/Ach/components/AchInput/components/AchSFInput.js.map +0 -1
- package/dist/es/components/Ach/components/AchInput/components/AchSecuredFields.js +0 -2
- package/dist/es/components/Ach/components/AchInput/components/AchSecuredFields.js.map +0 -1
- package/dist/es/components/Ach/components/AchInput/defaultProps.js +0 -2
- package/dist/es/components/Ach/components/AchInput/defaultProps.js.map +0 -1
- package/dist/es/components/Ach/components/AchInput/defaultStyles.js +0 -2
- package/dist/es/components/Ach/components/AchInput/defaultStyles.js.map +0 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/tabbing/tabScenarioACH.js +0 -2
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/tabbing/tabScenarioACH.js.map +0 -1
- package/dist/es/utils/inIframe.js +0 -2
- package/dist/es/utils/inIframe.js.map +0 -1
- package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js +0 -2
- package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +0 -1
- package/dist/es-legacy/components/Ach/components/AchInput/components/AchSFInput.js +0 -2
- package/dist/es-legacy/components/Ach/components/AchInput/components/AchSFInput.js.map +0 -1
- package/dist/es-legacy/components/Ach/components/AchInput/components/AchSecuredFields.js +0 -2
- package/dist/es-legacy/components/Ach/components/AchInput/components/AchSecuredFields.js.map +0 -1
- package/dist/es-legacy/components/Ach/components/AchInput/defaultProps.js +0 -2
- package/dist/es-legacy/components/Ach/components/AchInput/defaultProps.js.map +0 -1
- package/dist/es-legacy/components/Ach/components/AchInput/defaultStyles.js +0 -2
- package/dist/es-legacy/components/Ach/components/AchInput/defaultStyles.js.map +0 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/tabbing/tabScenarioACH.js +0 -2
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/tabbing/tabScenarioACH.js.map +0 -1
- package/dist/es-legacy/utils/inIframe.js +0 -2
- package/dist/es-legacy/utils/inIframe.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectButton.js","sources":["../../../../../../../src/components/internal/FormFields/Select/components/SelectButton.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport cx from 'classnames';\nimport { SelectButtonProps } from '../types';\nimport Img from '../../../Img';\n\nfunction SelectButtonElement({ filterable, toggleButtonRef, ...props }) {\n if (filterable) {\n // Even if passed, we can't add an id to this div since it is not allowed to associate a div with a label element\n const { id, ...strippedProps } = props;\n return <div {...strippedProps} ref={toggleButtonRef} />;\n }\n\n return <button id={props.id} aria-describedby={props.ariaDescribedBy} type={'button'} {...props} ref={toggleButtonRef} />;\n}\n\nfunction SelectButton(props: Readonly<SelectButtonProps>) {\n const { active, selected, inputText, readonly, showList, required } = props;\n\n // display fallback order\n const displayText = selected.selectedOptionName || selected.name || props.placeholder || '';\n // displayInputText only used for the text input for the filter\n // display the \"typed\" filter text when showing the dropdown,\n // hide it and show the \"selected\" value when collapsed\n const displayInputText = showList ? inputText : displayText;\n\n const setFocus = (e: Event) => {\n e.preventDefault();\n if (document.activeElement === props.filterInputRef.current) {\n if (!props.showList) {\n props.toggleList(e);\n }\n } else if (props.filterInputRef.current) props.filterInputRef.current.focus();\n };\n\n // 1. If readonly we ignore the click action\n // 2. If filterable we want to show the list and focus on the input\n // 3. Otherwise we just toggle the list\n const onClickHandler = readonly ? null : props.filterable ? setFocus : props.toggleList;\n\n const onFocusHandler = readonly ? null : props.onFocus;\n\n // check COWEB-1301 [Investigate] Drop-in Accessibility - ADA Compliance questions\n const currentSelectedItemId = active.id ? `listItem-${active.id}` : '';\n\n return (\n <SelectButtonElement\n className={cx({\n 'adyen-checkout__dropdown__button': true,\n 'adyen-checkout__dropdown__button--readonly': readonly,\n 'adyen-checkout__dropdown__button--active': showList,\n 'adyen-checkout__dropdown__button--invalid': props.isInvalid,\n 'adyen-checkout__dropdown__button--valid': props.isValid,\n 'adyen-checkout__dropdown__button--disabled': selected.disabled\n })}\n disabled={props.disabled}\n filterable={props.filterable}\n onClick={onClickHandler}\n onKeyDown={!readonly ? props.onButtonKeyDown : null}\n toggleButtonRef={props.toggleButtonRef}\n // Only for some dropdowns e.g. the one found in installments when it is just in the form of a single dropdown, do we want to add an id that links to a label's for attr\n // If we allow an id to be added to the buttons in CtPCardsList, for example, unit tests start failing because it seems a button with an id no longer has a name property that can be used\n // as a qualifier in findByRole\n {...(props.allowIdOnButton && props.id && { id: props.id })}\n >\n {!props.filterable ? (\n <Fragment>\n {selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <span
|
|
1
|
+
{"version":3,"file":"SelectButton.js","sources":["../../../../../../../src/components/internal/FormFields/Select/components/SelectButton.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport cx from 'classnames';\nimport { SelectButtonProps } from '../types';\nimport Img from '../../../Img';\nimport { useMemo } from 'preact/hooks';\nimport classnames from 'classnames';\n\nfunction SelectButtonElement({ filterable, toggleButtonRef, ...props }) {\n if (filterable) {\n // Even if passed, we can't add an id to this div since it is not allowed to associate a div with a label element\n const { id, ...strippedProps } = props;\n return <div {...strippedProps} ref={toggleButtonRef} />;\n }\n\n return <button id={props.id} aria-describedby={props.ariaDescribedBy} type={'button'} {...props} ref={toggleButtonRef} />;\n}\n\nfunction SelectButton(props: Readonly<SelectButtonProps>) {\n const { active, selected, inputText, readonly, showList, required } = props;\n\n const isShowingPlaceholder = useMemo(() => {\n const displayText = selected.selectedOptionName || selected.name;\n const isValidValue = typeof displayText === 'string' && displayText.trim() !== '';\n return isValidValue !== true;\n }, [selected, props.placeholder]);\n\n // display fallback order\n const displayText = selected.selectedOptionName || selected.name || props.placeholder || '';\n // displayInputText only used for the text input for the filter\n // display the \"typed\" filter text when showing the dropdown,\n // hide it and show the \"selected\" value when collapsed\n const displayInputText = showList ? inputText : displayText;\n\n const setFocus = (e: Event) => {\n e.preventDefault();\n if (document.activeElement === props.filterInputRef.current) {\n if (!props.showList) {\n props.toggleList(e);\n }\n } else if (props.filterInputRef.current) props.filterInputRef.current.focus();\n };\n\n // 1. If readonly we ignore the click action\n // 2. If filterable we want to show the list and focus on the input\n // 3. Otherwise we just toggle the list\n const onClickHandler = readonly ? null : props.filterable ? setFocus : props.toggleList;\n\n const onFocusHandler = readonly ? null : props.onFocus;\n\n // check COWEB-1301 [Investigate] Drop-in Accessibility - ADA Compliance questions\n const currentSelectedItemId = active.id ? `listItem-${active.id}` : '';\n\n return (\n <SelectButtonElement\n className={cx({\n 'adyen-checkout__dropdown__button': true,\n 'adyen-checkout__dropdown__button--readonly': readonly,\n 'adyen-checkout__dropdown__button--active': showList,\n 'adyen-checkout__dropdown__button--invalid': props.isInvalid,\n 'adyen-checkout__dropdown__button--valid': props.isValid,\n 'adyen-checkout__dropdown__button--disabled': selected.disabled\n })}\n disabled={props.disabled}\n filterable={props.filterable}\n onClick={onClickHandler}\n onKeyDown={!readonly ? props.onButtonKeyDown : null}\n toggleButtonRef={props.toggleButtonRef}\n // Only for some dropdowns e.g. the one found in installments when it is just in the form of a single dropdown, do we want to add an id that links to a label's for attr\n // If we allow an id to be added to the buttons in CtPCardsList, for example, unit tests start failing because it seems a button with an id no longer has a name property that can be used\n // as a qualifier in findByRole\n {...(props.allowIdOnButton && props.id && { id: props.id })}\n >\n {!props.filterable ? (\n <Fragment>\n {selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <span\n className={classnames('adyen-checkout__dropdown__button__text', {\n 'adyen-checkout__dropdown__button__text-placeholder': isShowingPlaceholder\n })}\n >\n {displayText}\n </span>\n {selected.secondaryText && <span className=\"adyen-checkout__dropdown__button__secondary-text\">{selected.secondaryText}</span>}\n </Fragment>\n ) : (\n <Fragment>\n {!showList && selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <input\n value={displayInputText}\n aria-autocomplete=\"list\"\n aria-controls={props.selectListId}\n aria-expanded={showList}\n aria-owns={props.selectListId}\n autoComplete=\"off\"\n className=\"adyen-checkout__filter-input\"\n onInput={props.onInput}\n onFocus={onFocusHandler}\n ref={props.filterInputRef}\n role=\"combobox\"\n aria-activedescendant={currentSelectedItemId}\n type=\"text\"\n readOnly={props.readonly}\n id={props.id}\n aria-describedby={props.ariaDescribedBy}\n required={required}\n />\n {!showList && selected.secondaryText && (\n <span className=\"adyen-checkout__dropdown__button__secondary-text\">{selected.secondaryText}</span>\n )}\n </Fragment>\n )}\n </SelectButtonElement>\n );\n}\n\nexport default SelectButton;\n"],"names":["SelectButtonElement","filterable","toggleButtonRef","props","id","strippedProps","h","div","ref","button","aria-describedby","ariaDescribedBy","type","SelectButton","active","selected","inputText","readonly","showList","required","isShowingPlaceholder","useMemo","displayText","selectedOptionName","name","trim","placeholder","displayInputText","onClickHandler","e","preventDefault","document","activeElement","filterInputRef","current","toggleList","focus","onFocusHandler","onFocus","currentSelectedItemId","className","cx","isInvalid","isValid","disabled","onClick","onKeyDown","onButtonKeyDown","allowIdOnButton","Fragment","icon","Img","src","alt","input","value","aria-autocomplete","aria-controls","selectListId","aria-expanded","aria-owns","autoComplete","onInput","role","aria-activedescendant","readOnly","secondaryText","span","classnames"],"mappings":"4PAOA,SAASA,GAAoBC,WAAEA,EAAUC,gBAAEA,KAAoBC,IAC3D,GAAIF,EAAY,CAEZ,MAAMG,GAAEA,KAAOC,GAAkBF,EACjC,OAAOG,EAACC,MAAAA,IAAQF,EAAeG,IAAKN,GACxC,CAEA,OAAOI,EAACG,SAAAA,CAAOL,GAAID,EAAMC,GAAIM,mBAAkBP,EAAMQ,gBAAiBC,KAAM,YAAcT,EAAOK,IAAKN,GAC1G,CAEA,SAASW,EAAaV,GAClB,MAAMW,OAAEA,EAAMC,SAAEA,EAAQC,UAAEA,EAASC,SAAEA,EAAQC,SAAEA,EAAQC,SAAEA,GAAahB,EAEhEiB,EAAuBC,GAAQ,KACjC,MAAMC,EAAcP,EAASQ,oBAAsBR,EAASS,KAE5D,OAAwB,KADoB,iBAAhBF,GAAmD,KAAvBA,EAAYG,OAC5C,GACzB,CAACV,EAAUZ,EAAMuB,cAGdJ,EAAcP,EAASQ,oBAAsBR,EAASS,MAAQrB,EAAMuB,aAAe,GAInFC,EAAmBT,EAAWF,EAAYM,EAc1CM,EAAiBX,EAAW,KAAOd,EAAMF,WAZ7B4B,IACdA,EAAEC,iBACEC,SAASC,gBAAkB7B,EAAM8B,eAAeC,QAC3C/B,EAAMe,UACPf,EAAMgC,WAAWN,GAEd1B,EAAM8B,eAAeC,SAAS/B,EAAM8B,eAAeC,QAAQE,OAAK,EAMRjC,EAAMgC,WAEvEE,EAAiBpB,EAAW,KAAOd,EAAMmC,QAGzCC,EAAwBzB,EAAOV,GAAK,YAAYU,EAAOV,KAAO,GAEpE,OACIE,EAACN,EAAAA,CACGwC,UAAWC,EAAG,CACV,oCAAoC,EACpC,6CAA8CxB,EAC9C,2CAA4CC,EAC5C,4CAA6Cf,EAAMuC,UACnD,0CAA2CvC,EAAMwC,QACjD,6CAA8C5B,EAAS6B,WAE3DA,SAAUzC,EAAMyC,SAChB3C,WAAYE,EAAMF,WAClB4C,QAASjB,EACTkB,UAAY7B,EAAmC,KAAxBd,EAAM4C,gBAC7B7C,gBAAiBC,EAAMD,mBAIlBC,EAAM6C,iBAAmB7C,EAAMC,IAAM,CAAEA,GAAID,EAAMC,KAEpDD,EAAMF,WAaJK,EAAC2C,EAAAA,MACK/B,GAAYH,EAASmC,MAAQ5C,EAAC6C,EAAAA,CAAIX,UAAU,yCAAyCY,IAAKrC,EAASmC,KAAMG,IAAKtC,EAASS,OACzHlB,EAACgD,QAAAA,CACGC,MAAO5B,EACP6B,oBAAkB,OAClBC,gBAAetD,EAAMuD,aACrBC,gBAAezC,EACf0C,YAAWzD,EAAMuD,aACjBG,aAAa,MACbrB,UAAU,+BACVsB,QAAS3D,EAAM2D,QACfxB,QAASD,EACT7B,IAAKL,EAAM8B,eACX8B,KAAK,WACLC,wBAAuBzB,EACvB3B,KAAK,OACLqD,SAAU9D,EAAMc,SAChBb,GAAID,EAAMC,GACVM,mBAAkBP,EAAMQ,gBACxBQ,SAAUA,KAEZD,GAAYH,EAASmD,eACnB5D,EAAC6D,OAAAA,CAAK3B,UAAU,oDAAoDzB,EAASmD,gBAlCrF5D,EAAC2C,OACIlC,EAASmC,MAAQ5C,EAAC6C,EAAAA,CAAIX,UAAU,yCAAyCY,IAAKrC,EAASmC,KAAMG,IAAKtC,EAASS,OAC5GlB,EAAC6D,OAAAA,CACG3B,UAAW4B,EAAW,yCAA0C,CAC5D,qDAAsDhD,KAGzDE,GAEJP,EAASmD,eAAiB5D,EAAC6D,OAAAA,CAAK3B,UAAU,oDAAoDzB,EAASmD,gBA+B5H"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{electronicFormat as t,getCountryCode as n,
|
|
1
|
+
import{electronicFormat as t,getCountryCode as n,getIbanCountrySpecification as e,iso13616Prepare as i,iso7064Mod97_10 as l,regex as s}from"./utils.js";import{isEmpty as o}from"../../../utils/validator-utils.js";function r(t,n=null){this.status=t,this.code=n}const a=n=>{const e=t(n),o=i(e);return 1===l(o)&&(t=>{const n=t.slice(0,2),e=s(t,n);return e.test&&e.test(t.slice(4))||!1})(e)},u=i=>{const l=t(i);if(i.length<2)return new r("no-validate","TOO_SHORT");const s=n(l),o=e(s);return o?l.length>o.length?new r("invalid","TOO_LONG"):l.length===o.length?a(i)?new r("valid","VALID"):new r("invalid","INVALID_IBAN"):new r("no-validate","UNKNOWN"):new r("invalid","INVALID_COUNTRY")},c=t=>!o(t)||null;export{u as checkIbanStatus,c as isValidHolder,a as isValidIBAN};
|
|
2
2
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e,Fragment as s}from"../../../external/preact/dist/preact.js";import{useState as t,useCallback as r,useRef as o,useEffect as i}from"../../../external/preact/hooks/dist/hooks.js";import a from"../../../utils/useForm/useForm.js";import n from"../FormFields/Field/Field.js";import l from"./IssuerButtonGroup/IssuerButtonGroup.js";import u from"../ContentSeparator/ContentSeparator.js";import{useCoreContext as m}from"../../../core/Context/CoreProvider.js";import d from"../../../core/Errors/useSRPanelContext.js";import{ERROR_ACTION_FOCUS_FIELD as c}from"../../../core/Errors/constants.js";import{setFocusOnField as g}from"../../../utils/setFocus.js";import h from"../DisclaimerMessage/DisclaimerMessage.js";import p from"../FormFields/Select/Select.js";import{
|
|
1
|
+
import{createElement as e,Fragment as s}from"../../../external/preact/dist/preact.js";import{useState as t,useCallback as r,useRef as o,useEffect as i}from"../../../external/preact/hooks/dist/hooks.js";import a from"../../../utils/useForm/useForm.js";import n from"../FormFields/Field/Field.js";import l from"./IssuerButtonGroup/IssuerButtonGroup.js";import u from"../ContentSeparator/ContentSeparator.js";import{useCoreContext as m}from"../../../core/Context/CoreProvider.js";import d from"../../../core/Errors/useSRPanelContext.js";import{ERROR_ACTION_FOCUS_FIELD as c}from"../../../core/Errors/constants.js";import{setFocusOnField as g}from"../../../utils/setFocus.js";import h from"../DisclaimerMessage/DisclaimerMessage.js";import p from"../FormFields/Select/Select.js";import{ANALYTICS_LIST as f,ANALYTICS_FEATURED_ISSUER as C,ANALYTICS_SELECTED_STR as j,ANALYTICS_DISPLAYED_STR as y,ANALYTICS_SEARCH_DEBOUNCE_TIME as F,ANALYTICS_LIST_SEARCH as x,ANALYTICS_INPUT_STR as S}from"../../../core/Analytics/constants.js";import{debounce as _}from"../../../utils/debounce.js";const b=({issuer:e,items:s},t)=>{const r=s.find((s=>s.id===e))?.name;return e&&r?`${t.get("continueTo")} ${r}`:t.get("continue")},v=["issuer"],I={issuer:{validate:e=>!!e&&e.length>0,errorMessage:"issuerList.selectField.contextualText",modes:["blur"]}};function M({items:M,placeholder:A,issuer:k,highlightedIds:E=[],showContextualElement:V,contextualText:w,...T}){const{i18n:B}=m(),{handleChangeFor:N,triggerValidation:P,data:R,valid:D,errors:L,isValid:G}=a({schema:v,defaultData:{issuer:k},rules:I}),[$,K]=t("ready"),[O,q]=t(1),{setSRMessagesFromObjects:z,shouldMoveFocusSR:H}=d(),J=z?.({});this.setStatus=e=>{K(e)};const Q=r((e=>s=>{const t=1===e?f:C,r=M.find((e=>e.id===s.target.value));T.onSubmitAnalytics({type:j,target:t,issuer:r.name}),q(e),N("issuer")(s)}),[N]),U=r((e=>{e&&T.onSubmitAnalytics({type:y,target:f})}),[]),W=o(_(T.onSubmitAnalytics,F)),X=r((()=>{W.current({type:S,target:x})}),[]);i((()=>{T.onChange({data:R,valid:D,errors:L,isValid:G});const e=J?.({errors:L,isValidating:!0});e?.action===c&&H&&g(".adyen-checkout__issuer-list","issuer-list")}),[R,D,L,G]),this.showValidation=()=>{P()};const{highlightedItems:Y}=M.reduce(((e,s)=>(E.includes(s.id)&&e.highlightedItems.push({...s}),e)),{highlightedItems:[]});return e("div",{className:"adyen-checkout__issuer-list"},!!Y.length&&e(s,null,e(l,{selectedIssuerId:0===O?R.issuer:null,items:Y,onChange:Q(0)}),e(u,null)),e(n,{label:B.get("issuerList.selectField.label"),errorMessage:(Z=L.issuer,Z&&Z.errorMessage?B.get(Z.errorMessage):!!Z),classNameModifiers:["issuer-list"],name:"issuer",showContextualElement:V,contextualText:w},e(p,{items:M,selectedValue:1===O?R.issuer:null,placeholder:A,name:"issuer",className:"adyen-checkout__issuer-list__dropdown",onChange:Q(1),onListToggle:U,onInput:X})),T.termsAndConditions&&e("div",{className:"adyen-checkout__issuer-list__termsAndConditions"},e(h,{message:B.get(T.termsAndConditions.translationKey),urls:T.termsAndConditions.urls})),T.showPayButton&&T.payButton({status:$,label:b({issuer:R.issuer,items:[...M,...Y]},B)}));var Z}M.defaultProps={onChange:()=>{}};export{M as default};
|
|
2
2
|
//# sourceMappingURL=IssuerList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IssuerList.js","sources":["../../../../../src/components/internal/IssuerList/IssuerList.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useState, useEffect, useCallback, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport Field from '../FormFields/Field';\nimport IssuerButtonGroup from './IssuerButtonGroup';\nimport ContentSeparator from '../ContentSeparator';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ValidatorRules } from '../../../utils/Validator/types';\nimport { IssuerListProps } from './types';\nimport './IssuerList.scss';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport DisclaimerMessage from '../DisclaimerMessage';\nimport Select from '../FormFields/Select';\nimport { SelectTargetObject } from '../FormFields/Select/types';\nimport {\n ANALYTICS_DISPLAYED_STR,\n ANALYTICS_FEATURED_ISSUER,\n ANALYTICS_INPUT_STR,\n ANALYTICS_LIST,\n ANALYTICS_LIST_SEARCH,\n ANALYTICS_SEARCH_DEBOUNCE_TIME,\n ANALYTICS_SELECTED_STR\n} from '../../../core/Analytics/constants';\nimport { debounce } from '../../../utils/debounce';\n\nconst payButtonLabel = ({ issuer, items }, i18n): string => {\n const issuerName = items.find(i => i.id === issuer)?.name;\n if (!issuer || !issuerName) return i18n.get('continue');\n return `${i18n.get('continueTo')} ${issuerName}`;\n};\n\nconst schema = ['issuer'];\nconst validationRules: ValidatorRules = {\n issuer: {\n validate: issuer => !!issuer && issuer.length > 0,\n errorMessage: 'issuerList.selectField.contextualText',\n modes: ['blur']\n }\n};\n\nenum IssuerListInputTypes {\n ButtonGroup,\n Dropdown\n}\n\nfunction IssuerList({ items, placeholder, issuer, highlightedIds = [], showContextualElement, contextualText, ...props }: IssuerListProps) {\n const { i18n } = useCoreContext();\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm({\n schema,\n defaultData: { issuer },\n rules: validationRules\n });\n const [status, setStatus] = useState('ready');\n const [inputType, setInputType] = useState<IssuerListInputTypes>(IssuerListInputTypes.Dropdown);\n\n const { setSRMessagesFromObjects, shouldMoveFocusSR } = useSRPanelContext();\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({});\n\n const getErrorMessage = error => (error && error.errorMessage ? i18n.get(error.errorMessage) : !!error);\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const handleInputChange = useCallback(\n (type: IssuerListInputTypes) => (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n const target = type === IssuerListInputTypes.Dropdown ? ANALYTICS_LIST : ANALYTICS_FEATURED_ISSUER;\n const issuerObj = items.find(issuer => issuer.id === (event.target as SelectTargetObject).value);\n props.onSubmitAnalytics({ type: ANALYTICS_SELECTED_STR, target, issuer: issuerObj.name });\n\n setInputType(type);\n handleChangeFor('issuer')(event);\n },\n [handleChangeFor]\n );\n\n const handleListToggle = useCallback((isOpen: boolean) => {\n if (isOpen) {\n props.onSubmitAnalytics({ type: ANALYTICS_DISPLAYED_STR, target: ANALYTICS_LIST });\n }\n }, []);\n\n const debounceSearchAnalytics = useRef(debounce(props.onSubmitAnalytics, ANALYTICS_SEARCH_DEBOUNCE_TIME));\n\n const handleSearch = useCallback(() => {\n debounceSearchAnalytics.current({ type: ANALYTICS_INPUT_STR, target: ANALYTICS_LIST_SEARCH });\n }, []);\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({ errors, isValidating: true });\n if (srPanelResp?.action === ERROR_ACTION_FOCUS_FIELD) {\n // Focus field in error, if required\n if (shouldMoveFocusSR) setFocusOnField('.adyen-checkout__issuer-list', srPanelResp.fieldToFocus);\n }\n }, [data, valid, errors, isValid]);\n\n this.showValidation = () => {\n triggerValidation();\n };\n\n const { highlightedItems } = items.reduce(\n (memo, item) => {\n if (highlightedIds.includes(item.id)) memo.highlightedItems.push({ ...item });\n return memo;\n },\n { highlightedItems: [] }\n );\n\n return (\n <div className=\"adyen-checkout__issuer-list\">\n {!!highlightedItems.length && (\n <Fragment>\n <IssuerButtonGroup\n selectedIssuerId={inputType === IssuerListInputTypes.ButtonGroup ? data['issuer'] : null}\n items={highlightedItems}\n onChange={handleInputChange(IssuerListInputTypes.ButtonGroup)}\n />\n <ContentSeparator />\n </Fragment>\n )}\n\n <Field\n label={i18n.get('issuerList.selectField.label')}\n errorMessage={getErrorMessage(errors.issuer)}\n classNameModifiers={['issuer-list']}\n name={'issuer'}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <Select\n items={items}\n selectedValue={inputType === IssuerListInputTypes.Dropdown ? data['issuer'] : null}\n placeholder={placeholder}\n name={'issuer'}\n className={'adyen-checkout__issuer-list__dropdown'}\n onChange={handleInputChange(IssuerListInputTypes.Dropdown)}\n onListToggle={handleListToggle}\n onInput={handleSearch}\n />\n </Field>\n\n {props.termsAndConditions && (\n <div className=\"adyen-checkout__issuer-list__termsAndConditions\">\n <DisclaimerMessage message={i18n.get(props.termsAndConditions.translationKey)} urls={props.termsAndConditions.urls} />\n </div>\n )}\n\n {props.showPayButton &&\n props.payButton({\n status,\n label: payButtonLabel({ issuer: data['issuer'], items: [...items, ...highlightedItems] }, i18n)\n })}\n </div>\n );\n}\n\nIssuerList.defaultProps = {\n onChange: () => {}\n};\n\nexport default IssuerList;\n"],"names":["payButtonLabel","issuer","items","i18n","issuerName","find","i","id","name","get","schema","validationRules","validate","length","errorMessage","modes","IssuerList","placeholder","highlightedIds","showContextualElement","contextualText","props","useCoreContext","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","defaultData","rules","status","setStatus","useState","inputType","setInputType","setSRMessagesFromObjects","shouldMoveFocusSR","useSRPanelContext","setSRMessages","this","newStatus","handleInputChange","useCallback","type","event","target","ANALYTICS_LIST","ANALYTICS_FEATURED_ISSUER","issuerObj","value","onSubmitAnalytics","ANALYTICS_SELECTED_STR","handleListToggle","isOpen","ANALYTICS_DISPLAYED_STR","debounceSearchAnalytics","useRef","debounce","ANALYTICS_SEARCH_DEBOUNCE_TIME","handleSearch","current","ANALYTICS_INPUT_STR","ANALYTICS_LIST_SEARCH","useEffect","onChange","srPanelResp","isValidating","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnField","fieldToFocus","showValidation","highlightedItems","reduce","memo","item","includes","push","h","div","className","Fragment","IssuerButtonGroup","selectedIssuerId","ContentSeparator","Field","label","error","classNameModifiers","Select","selectedValue","onListToggle","onInput","termsAndConditions","DisclaimerMessage","message","translationKey","urls","showPayButton","payButton","defaultProps"],"mappings":"mjCA6BA,MAAMA,EAAiB,EAAGC,SAAQC,SAASC,KACvC,MAAMC,EAAaF,EAAMG,MAAKC,GAAKA,EAAEC,KAAON,KAASO,KACrD,OAAKP,GAAWG,EACT,GAAGD,EAAKM,IAAI,iBAAiBL,IADDD,EAAKM,IAAI,WACI,EAG9CC,EAAS,CAAC,UACVC,EAAkC,CACpCV,OAAQ,CACJW,SAAUX,KAAYA,GAAUA,EAAOY,OAAS,EAChDC,aAAc,wCACdC,MAAO,CAAC,UAShB,SAASC,GAAWd,MAAEA,EAAKe,YAAEA,EAAWhB,OAAEA,EAAMiB,eAAEA,EAAiB,GAAEC,sBAAEA,EAAqBC,eAAEA,KAAmBC,IAC7G,MAAMlB,KAAEA,GAASmB,KACXC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAAQ,CACjFnB,SACAoB,YAAa,CAAE7B,UACf8B,MAAOpB,KAEJqB,EAAQC,GAAaC,EAAS,UAC9BC,EAAWC,GAAgBF,EAAAA,IAE5BG,yBAAEA,EAAwBC,kBAAEA,GAAsBC,IAClDC,EAAuCH,IAA2B,IAIxEI,KAAKR,UAAYS,IACbT,EAAUS,EAAAA,EAGd,MAAMC,EAAoBC,GACrBC,GAAgCC,IAC7B,MAAMC,MAASF,EAAyCG,EAAiBC,EACnEC,EAAYhD,EAAMG,MAAKJ,GAAUA,EAAOM,KAAQuC,EAAMC,OAA8BI,QAC1F9B,EAAM+B,kBAAkB,CAAEP,KAAMQ,EAAwBN,SAAQ9C,OAAQiD,EAAU1C,OAElF4B,EAAaS,GACbtB,EAAgB,SAAhBA,CAA0BuB,EAAAA,GAE9B,CAACvB,IAGC+B,EAAmBV,GAAaW,IAC9BA,GACAlC,EAAM+B,kBAAkB,CAAEP,KAAMW,EAAyBT,OAAQC,GACrE,GACD,IAEGS,EAA0BC,EAAOC,EAAStC,EAAM+B,kBAAmBQ,IAEnEC,EAAejB,GAAY,KAC7Ba,EAAwBK,QAAQ,CAAEjB,KAAMkB,EAAqBhB,OAAQiB,GAAsB,GAC5F,IAEHC,GAAU,KACN5C,EAAM6C,SAAS,CAAEzC,OAAMC,QAAOC,SAAQC,YAEtC,MAAMuC,EAAyC3B,IAAgB,CAAEb,SAAQyC,cAAc,IACnFD,GAAaE,SAAWC,GAEpBhC,GAAmBiC,EAAgB,+BAAgCJ,EAAYK,aACvF,GACD,CAAC/C,EAAMC,EAAOC,EAAQC,IAEzBa,KAAKgC,eAAiB,KAClBjD,GAAAA,EAGJ,MAAMkD,iBAAEA,GAAqBxE,EAAMyE,QAC/B,CAACC,EAAMC,KACC3D,EAAe4D,SAASD,EAAKtE,KAAKqE,EAAKF,iBAAiBK,KAAK,IAAKF,IAC/DD,IAEX,CAAEF,iBAAkB,KAGxB,OACIM,EAACC,MAAAA,CAAIC,UAAU,iCACRR,EAAiB7D,QAChBmE,EAACG,OACGH,EAACI,EAAAA,CACGC,iBAAmE5D,IAAjDU,EAAiDV,EAAK,OAAY,KACpFvB,MAAOwE,EACPR,SAAUvB,EAAAA,KAEdqC,EAACM,SAITN,EAACO,EAAAA,CACGC,MAAOrF,EAAKM,IAAI,gCAChBK,cAnEY2E,EAmEkB9D,EAAO1B,OAnEfwF,GAASA,EAAM3E,aAAeX,EAAKM,IAAIgF,EAAM3E,gBAAkB2E,GAoErFC,mBAAoB,CAAC,eACrBlF,KAAM,SACNW,sBAAuBA,EACvBC,eAAgBA,GAEhB4D,EAACW,EAAAA,CACGzF,MAAOA,EACP0F,cAA6DnE,IAA9CU,EAA8CV,EAAK,OAAY,KAC9ER,YAAaA,EACbT,KAAM,SACN0E,UAAW,wCACXhB,SAAUvB,EAAAA,GACVkD,aAAcvC,EACdwC,QAASjC,KAIhBxC,EAAM0E,oBACHf,EAACC,MAAAA,CAAIC,UAAU,mDACXF,EAACgB,EAAAA,CAAkBC,QAAS9F,EAAKM,IAAIY,EAAM0E,mBAAmBG,gBAAiBC,KAAM9E,EAAM0E,mBAAmBI,QAIrH9E,EAAM+E,eACH/E,EAAMgF,UAAU,CACZrE,SACAwD,MAAOxF,EAAe,CAAEC,OAAQwB,EAAc,OAAEvB,MAAO,IAAIA,KAAUwE,IAAqBvE,MA9FlFsF,IAAAA,CAkG5B,CAEAzE,EAAWsF,aAAe,CACtBpC,SAAU"}
|
|
1
|
+
{"version":3,"file":"IssuerList.js","sources":["../../../../../src/components/internal/IssuerList/IssuerList.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useState, useEffect, useCallback, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport Field from '../FormFields/Field';\nimport IssuerButtonGroup from './IssuerButtonGroup';\nimport ContentSeparator from '../ContentSeparator';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ValidatorRules } from '../../../utils/Validator/types';\nimport { IssuerListProps } from './types';\nimport './IssuerList.scss';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport DisclaimerMessage from '../DisclaimerMessage';\nimport Select from '../FormFields/Select';\nimport { SelectTargetObject } from '../FormFields/Select/types';\nimport {\n ANALYTICS_DISPLAYED_STR,\n ANALYTICS_FEATURED_ISSUER,\n ANALYTICS_INPUT_STR,\n ANALYTICS_LIST,\n ANALYTICS_LIST_SEARCH,\n ANALYTICS_SEARCH_DEBOUNCE_TIME,\n ANALYTICS_SELECTED_STR\n} from '../../../core/Analytics/constants';\nimport { debounce } from '../../../utils/debounce';\n\nconst payButtonLabel = ({ issuer, items }, i18n): string => {\n const issuerName = items.find(i => i.id === issuer)?.name;\n if (!issuer || !issuerName) return i18n.get('continue');\n return `${i18n.get('continueTo')} ${issuerName}`;\n};\n\nconst schema = ['issuer'];\nconst validationRules: ValidatorRules = {\n issuer: {\n validate: issuer => !!issuer && issuer.length > 0,\n errorMessage: 'issuerList.selectField.contextualText',\n modes: ['blur']\n }\n};\n\nenum IssuerListInputTypes {\n ButtonGroup,\n Dropdown\n}\n\nfunction IssuerList({ items, placeholder, issuer, highlightedIds = [], showContextualElement, contextualText, ...props }: IssuerListProps) {\n const { i18n } = useCoreContext();\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm({\n schema,\n defaultData: { issuer },\n rules: validationRules\n });\n const [status, setStatus] = useState('ready');\n const [inputType, setInputType] = useState<IssuerListInputTypes>(IssuerListInputTypes.Dropdown);\n\n const { setSRMessagesFromObjects, shouldMoveFocusSR } = useSRPanelContext();\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({});\n\n const getErrorMessage = error => (error && error.errorMessage ? i18n.get(error.errorMessage) : !!error);\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const handleInputChange = useCallback(\n (type: IssuerListInputTypes) => (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n const target = type === IssuerListInputTypes.Dropdown ? ANALYTICS_LIST : ANALYTICS_FEATURED_ISSUER;\n const issuerObj = items.find(issuer => issuer.id === (event.target as SelectTargetObject).value);\n props.onSubmitAnalytics({ type: ANALYTICS_SELECTED_STR, target, issuer: issuerObj.name });\n\n setInputType(type);\n handleChangeFor('issuer')(event);\n },\n [handleChangeFor]\n );\n\n const handleListToggle = useCallback((isOpen: boolean) => {\n if (isOpen) {\n props.onSubmitAnalytics({ type: ANALYTICS_DISPLAYED_STR, target: ANALYTICS_LIST });\n }\n }, []);\n\n const debounceSearchAnalytics = useRef(debounce(props.onSubmitAnalytics, ANALYTICS_SEARCH_DEBOUNCE_TIME));\n\n const handleSearch = useCallback(() => {\n debounceSearchAnalytics.current({ type: ANALYTICS_INPUT_STR, target: ANALYTICS_LIST_SEARCH });\n }, []);\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({ errors, isValidating: true });\n if (srPanelResp?.action === ERROR_ACTION_FOCUS_FIELD) {\n // Focus field in error, if required\n if (shouldMoveFocusSR) setFocusOnField('.adyen-checkout__issuer-list', 'issuer-list');\n }\n }, [data, valid, errors, isValid]);\n\n this.showValidation = () => {\n triggerValidation();\n };\n\n const { highlightedItems } = items.reduce(\n (memo, item) => {\n if (highlightedIds.includes(item.id)) memo.highlightedItems.push({ ...item });\n return memo;\n },\n { highlightedItems: [] }\n );\n\n return (\n <div className=\"adyen-checkout__issuer-list\">\n {!!highlightedItems.length && (\n <Fragment>\n <IssuerButtonGroup\n selectedIssuerId={inputType === IssuerListInputTypes.ButtonGroup ? data['issuer'] : null}\n items={highlightedItems}\n onChange={handleInputChange(IssuerListInputTypes.ButtonGroup)}\n />\n <ContentSeparator />\n </Fragment>\n )}\n\n <Field\n label={i18n.get('issuerList.selectField.label')}\n errorMessage={getErrorMessage(errors.issuer)}\n classNameModifiers={['issuer-list']}\n name={'issuer'}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <Select\n items={items}\n selectedValue={inputType === IssuerListInputTypes.Dropdown ? data['issuer'] : null}\n placeholder={placeholder}\n name={'issuer'}\n className={'adyen-checkout__issuer-list__dropdown'}\n onChange={handleInputChange(IssuerListInputTypes.Dropdown)}\n onListToggle={handleListToggle}\n onInput={handleSearch}\n />\n </Field>\n\n {props.termsAndConditions && (\n <div className=\"adyen-checkout__issuer-list__termsAndConditions\">\n <DisclaimerMessage message={i18n.get(props.termsAndConditions.translationKey)} urls={props.termsAndConditions.urls} />\n </div>\n )}\n\n {props.showPayButton &&\n props.payButton({\n status,\n label: payButtonLabel({ issuer: data['issuer'], items: [...items, ...highlightedItems] }, i18n)\n })}\n </div>\n );\n}\n\nIssuerList.defaultProps = {\n onChange: () => {}\n};\n\nexport default IssuerList;\n"],"names":["payButtonLabel","issuer","items","i18n","issuerName","find","i","id","name","get","schema","validationRules","validate","length","errorMessage","modes","IssuerList","placeholder","highlightedIds","showContextualElement","contextualText","props","useCoreContext","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","defaultData","rules","status","setStatus","useState","inputType","setInputType","setSRMessagesFromObjects","shouldMoveFocusSR","useSRPanelContext","setSRMessages","this","newStatus","handleInputChange","useCallback","type","event","target","ANALYTICS_LIST","ANALYTICS_FEATURED_ISSUER","issuerObj","value","onSubmitAnalytics","ANALYTICS_SELECTED_STR","handleListToggle","isOpen","ANALYTICS_DISPLAYED_STR","debounceSearchAnalytics","useRef","debounce","ANALYTICS_SEARCH_DEBOUNCE_TIME","handleSearch","current","ANALYTICS_INPUT_STR","ANALYTICS_LIST_SEARCH","useEffect","onChange","srPanelResp","isValidating","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnField","showValidation","highlightedItems","reduce","memo","item","includes","push","h","div","className","Fragment","IssuerButtonGroup","selectedIssuerId","ContentSeparator","Field","label","error","classNameModifiers","Select","selectedValue","onListToggle","onInput","termsAndConditions","DisclaimerMessage","message","translationKey","urls","showPayButton","payButton","defaultProps"],"mappings":"mjCA6BA,MAAMA,EAAiB,EAAGC,SAAQC,SAASC,KACvC,MAAMC,EAAaF,EAAMG,MAAKC,GAAKA,EAAEC,KAAON,KAASO,KACrD,OAAKP,GAAWG,EACT,GAAGD,EAAKM,IAAI,iBAAiBL,IADDD,EAAKM,IAAI,WACI,EAG9CC,EAAS,CAAC,UACVC,EAAkC,CACpCV,OAAQ,CACJW,SAAUX,KAAYA,GAAUA,EAAOY,OAAS,EAChDC,aAAc,wCACdC,MAAO,CAAC,UAShB,SAASC,GAAWd,MAAEA,EAAKe,YAAEA,EAAWhB,OAAEA,EAAMiB,eAAEA,EAAiB,GAAEC,sBAAEA,EAAqBC,eAAEA,KAAmBC,IAC7G,MAAMlB,KAAEA,GAASmB,KACXC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAAQ,CACjFnB,SACAoB,YAAa,CAAE7B,UACf8B,MAAOpB,KAEJqB,EAAQC,GAAaC,EAAS,UAC9BC,EAAWC,GAAgBF,EAAAA,IAE5BG,yBAAEA,EAAwBC,kBAAEA,GAAsBC,IAClDC,EAAuCH,IAA2B,IAIxEI,KAAKR,UAAYS,IACbT,EAAUS,EAAAA,EAGd,MAAMC,EAAoBC,GACrBC,GAAgCC,IAC7B,MAAMC,MAASF,EAAyCG,EAAiBC,EACnEC,EAAYhD,EAAMG,MAAKJ,GAAUA,EAAOM,KAAQuC,EAAMC,OAA8BI,QAC1F9B,EAAM+B,kBAAkB,CAAEP,KAAMQ,EAAwBN,SAAQ9C,OAAQiD,EAAU1C,OAElF4B,EAAaS,GACbtB,EAAgB,SAAhBA,CAA0BuB,EAAAA,GAE9B,CAACvB,IAGC+B,EAAmBV,GAAaW,IAC9BA,GACAlC,EAAM+B,kBAAkB,CAAEP,KAAMW,EAAyBT,OAAQC,GACrE,GACD,IAEGS,EAA0BC,EAAOC,EAAStC,EAAM+B,kBAAmBQ,IAEnEC,EAAejB,GAAY,KAC7Ba,EAAwBK,QAAQ,CAAEjB,KAAMkB,EAAqBhB,OAAQiB,GAAsB,GAC5F,IAEHC,GAAU,KACN5C,EAAM6C,SAAS,CAAEzC,OAAMC,QAAOC,SAAQC,YAEtC,MAAMuC,EAAyC3B,IAAgB,CAAEb,SAAQyC,cAAc,IACnFD,GAAaE,SAAWC,GAEpBhC,GAAmBiC,EAAgB,+BAAgC,cAC3E,GACD,CAAC9C,EAAMC,EAAOC,EAAQC,IAEzBa,KAAK+B,eAAiB,KAClBhD,GAAAA,EAGJ,MAAMiD,iBAAEA,GAAqBvE,EAAMwE,QAC/B,CAACC,EAAMC,KACC1D,EAAe2D,SAASD,EAAKrE,KAAKoE,EAAKF,iBAAiBK,KAAK,IAAKF,IAC/DD,IAEX,CAAEF,iBAAkB,KAGxB,OACIM,EAACC,MAAAA,CAAIC,UAAU,iCACRR,EAAiB5D,QAChBkE,EAACG,OACGH,EAACI,EAAAA,CACGC,iBAAmE3D,IAAjDU,EAAiDV,EAAK,OAAY,KACpFvB,MAAOuE,EACPP,SAAUvB,EAAAA,KAEdoC,EAACM,SAITN,EAACO,EAAAA,CACGC,MAAOpF,EAAKM,IAAI,gCAChBK,cAnEY0E,EAmEkB7D,EAAO1B,OAnEfuF,GAASA,EAAM1E,aAAeX,EAAKM,IAAI+E,EAAM1E,gBAAkB0E,GAoErFC,mBAAoB,CAAC,eACrBjF,KAAM,SACNW,sBAAuBA,EACvBC,eAAgBA,GAEhB2D,EAACW,EAAAA,CACGxF,MAAOA,EACPyF,cAA6DlE,IAA9CU,EAA8CV,EAAK,OAAY,KAC9ER,YAAaA,EACbT,KAAM,SACNyE,UAAW,wCACXf,SAAUvB,EAAAA,GACViD,aAActC,EACduC,QAAShC,KAIhBxC,EAAMyE,oBACHf,EAACC,MAAAA,CAAIC,UAAU,mDACXF,EAACgB,EAAAA,CAAkBC,QAAS7F,EAAKM,IAAIY,EAAMyE,mBAAmBG,gBAAiBC,KAAM7E,EAAMyE,mBAAmBI,QAIrH7E,EAAM8E,eACH9E,EAAM+E,UAAU,CACZpE,SACAuD,MAAOvF,EAAe,CAAEC,OAAQwB,EAAc,OAAEvB,MAAO,IAAIA,KAAUuE,IAAqBtE,MA9FlFqF,IAAAA,CAkG5B,CAEAxE,EAAWqF,aAAe,CACtBnC,SAAU"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useState as e,useMemo as s,useEffect as
|
|
1
|
+
import{useState as e,useMemo as s,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{enhanceErrorObjectKeys as r}from"../../../core/Errors/utils.js";import{COMPANY_DETAILS_SCHEMA as t}from"../CompanyDetails/CompanyDetails.js";import{PERSONAL_DETAILS_SCHEMA as i}from"../PersonalDetails/PersonalDetails.js";import{ERROR_ACTION_BLUR_SCENARIO as l,ERROR_ACTION_FOCUS_FIELD as a}from"../../../core/Errors/constants.js";import c from"../../../core/Errors/useSRPanelContext.js";import n from"../Address/Specifications.js";import{setFocusOnField as d}from"../../../utils/setFocus.js";import{usePrevious as u}from"../../../utils/hookUtils.js";import{getArrayDifferences as p}from"../../../utils/arrayUtils.js";import{mapFieldKey as f}from"./utils.js";const m=({errors:m,data:y,props:b,isValidating:j})=>{const[F,g]=e(null),A=u(F),{setSRMessagesFromObjects:h,setSRMessagesFromStrings:S,clearSRPanel:k,shouldMoveFocusSR:C}=c(),v=h?.({fieldTypeMappingFn:f}),D=s((()=>new n),[]),T=s((()=>new n(b.deliveryAddressSpecification)),[]);o((()=>{try{const e="deliveryAddress:",s="billingAddress:",{companyDetails:o,personalDetails:c,bankAccount:n,billingAddress:u,deliveryAddress:f,...F}=m,h=r(u,s),E=r(f,e),M={..."object"==typeof o&&o,..."object"==typeof c&&c,..."object"==typeof n&&n,..."object"==typeof h&&h,..."object"==typeof E&&E,...F},R=t,$=b.personalDetailsRequiredFields??i,x=i.filter((e=>$?.includes(e))),L=["holder","iban"],P=D.getAddressSchemaForCountryFlat(y.billingAddress?.country).map((e=>`${s}${e}`)),_=T.getAddressSchemaForCountryFlat(y.deliveryAddress?.country).map((s=>`${e}${s}`)),w=R.concat(x,L,P,_,["consentCheckbox"]),U=D.getAddressLabelsForCountry(y.billingAddress?.country),V=T.getAddressLabelsForCountry(y.deliveryAddress?.country),q=v?.({errors:M,isValidating:j.current,layout:w,countrySpecificLabels:{...U,...V}}),B=q?.currentErrorsSortedByLayout;switch(g(B),q?.action){case a:{const e=q.fieldToFocus.includes(":")?q.fieldToFocus.split(":")[1]:q.fieldToFocus;let s="";const o=q.fieldToFocus.includes(":")?q.fieldToFocus.split(":")[0]:"";o.length&&(s=`.adyen-checkout__fieldset--${o} `),C&&d(".adyen-checkout__open-invoice",e,s),setTimeout((()=>{j.current=!1}),300);break}case l:{const e=p(B,A,"field"),s=e?.[0];if(s){const e="shopperEmail"===s.field&&"field.error.invalid"===s.errorCode?s.errorMessage:null;S(e)}else k();break}}}catch(e){}}),[m,y])};export{m as default};
|
|
2
2
|
//# sourceMappingURL=useSRPanelForOpenInvoiceErrors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSRPanelForOpenInvoiceErrors.js","sources":["../../../../../src/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.ts"],"sourcesContent":["import { useEffect, useState, useMemo, MutableRef } from 'preact/hooks';\nimport { enhanceErrorObjectKeys } from '../../../core/Errors/utils';\nimport { COMPANY_DETAILS_SCHEMA } from '../CompanyDetails/CompanyDetails';\nimport { PERSONAL_DETAILS_SCHEMA } from '../PersonalDetails/PersonalDetails';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport Specifications from '../Address/Specifications';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport { usePrevious } from '../../../utils/hookUtils';\nimport { getArrayDifferences } from '../../../utils/arrayUtils';\nimport { mapFieldKey } from './utils';\nimport { OpenInvoiceProps, OpenInvoiceStateData, OpenInvoiceStateError } from './types';\n\ninterface UseSRPanelForErrorsProps {\n errors: OpenInvoiceStateError;\n data: OpenInvoiceStateData;\n props: OpenInvoiceProps;\n isValidating: MutableRef<boolean>;\n}\n\nconst useSRPanelForOpenInvoiceErrors = ({ errors, data, props, isValidating }: UseSRPanelForErrorsProps) => {\n // Relates to onBlur errors\n const [sortedErrorList, setSortedErrorList] = useState(null);\n // Get the previous value (Relates to onBlur errors)\n const previousSortedErrors = usePrevious(sortedErrorList);\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const billingAddressSpecifications = useMemo(() => new Specifications(), []);\n const deliveryAddressSpecifications = useMemo(() => new Specifications(props.deliveryAddressSpecification), []);\n\n useEffect(() => {\n try {\n const DELIVERY_ADDRESS_PREFIX = 'deliveryAddress:';\n const BILLING_ADDRESS_PREFIX = 'billingAddress:';\n\n /** Create messages for SRPanel */\n // Extract nested errors from the various child components...\n const {\n companyDetails: extractedCompanyDetailsErrors,\n personalDetails: extractedPersonalDetailsErrors,\n bankAccount: extractedBankAccountErrors,\n billingAddress: extractedBillingAddressErrors,\n deliveryAddress: extractedDeliveryAddressErrors,\n ...remainingErrors\n } = errors;\n\n // Differentiate between billingAddress and deliveryAddress errors by adding a prefix.\n // This also allows overlapping errors e.g. now that addresses can contain first & last name fields\n const enhancedBillingAddressErrors = enhanceErrorObjectKeys(extractedBillingAddressErrors, BILLING_ADDRESS_PREFIX);\n const enhancedDeliveryAddressErrors = enhanceErrorObjectKeys(extractedDeliveryAddressErrors, DELIVERY_ADDRESS_PREFIX);\n\n // ...and then collate the errors into a new object so that they all sit at top level\n const errorsForPanel = {\n ...(typeof extractedCompanyDetailsErrors === 'object' && extractedCompanyDetailsErrors),\n ...(typeof extractedPersonalDetailsErrors === 'object' && extractedPersonalDetailsErrors),\n ...(typeof extractedBankAccountErrors === 'object' && extractedBankAccountErrors),\n ...(typeof enhancedBillingAddressErrors === 'object' && enhancedBillingAddressErrors),\n ...(typeof enhancedDeliveryAddressErrors === 'object' && enhancedDeliveryAddressErrors),\n ...remainingErrors\n };\n\n // Create layout\n const companyDetailsLayout: string[] = COMPANY_DETAILS_SCHEMA;\n\n const personalDetailsReqFields: string[] = props.personalDetailsRequiredFields ?? PERSONAL_DETAILS_SCHEMA;\n const personalDetailLayout: string[] = PERSONAL_DETAILS_SCHEMA.filter(x => personalDetailsReqFields?.includes(x));\n\n const bankAccountLayout = ['holder', 'iban'];\n\n const billingAddressLayout = billingAddressSpecifications.getAddressSchemaForCountryFlat(data.billingAddress?.country);\n // In order to sort the address errors the layout entries need to have the same (prefixed) identifier as the errors themselves\n const billingAddressLayoutEnhanced = billingAddressLayout.map(item => `${BILLING_ADDRESS_PREFIX}${item}`);\n\n const deliveryAddressLayout = deliveryAddressSpecifications.getAddressSchemaForCountryFlat(data.deliveryAddress?.country);\n const deliveryAddressLayoutEnhanced = deliveryAddressLayout.map(item => `${DELIVERY_ADDRESS_PREFIX}${item}`);\n\n const fullLayout = companyDetailsLayout.concat(\n personalDetailLayout,\n bankAccountLayout,\n billingAddressLayoutEnhanced,\n deliveryAddressLayoutEnhanced,\n ['consentCheckbox']\n );\n\n // Country specific address labels\n const countrySpecificLabels_billing = billingAddressSpecifications.getAddressLabelsForCountry(data.billingAddress?.country);\n const countrySpecificLabels_delivery = deliveryAddressSpecifications.getAddressLabelsForCountry(data.deliveryAddress?.country);\n\n // Set messages: Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: fullLayout,\n countrySpecificLabels: { ...countrySpecificLabels_billing, ...countrySpecificLabels_delivery }\n });\n\n // Relates to onBlur errors\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout); // Relates to onBlur errors\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n // Focus first field in error, if required\n if (shouldMoveFocusSR) setFocusOnField('.adyen-checkout__open-invoice', srPanelResp.fieldToFocus);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n\n /** On blur scenario: not validating, i.e. trying to submit form, but there might be an error, either to set or to clear */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Is error actually a blur based one - depends on the specific fields in a component as to whether they validate on blur\n const isBlurBasedError = latestErrorMsg.errorCode === 'shopperEmail.invalid';\n\n // Only add blur based errors to the error panel - doing this step prevents the non-blur based errors from being read out twice\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n clearSRPanel();\n }\n\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors, data]);\n};\n\nexport default useSRPanelForOpenInvoiceErrors;\n"],"names":["useSRPanelForOpenInvoiceErrors","errors","data","props","isValidating","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressSpecifications","useMemo","Specifications","deliveryAddressSpecifications","deliveryAddressSpecification","useEffect","DELIVERY_ADDRESS_PREFIX","BILLING_ADDRESS_PREFIX","companyDetails","extractedCompanyDetailsErrors","personalDetails","extractedPersonalDetailsErrors","bankAccount","extractedBankAccountErrors","billingAddress","extractedBillingAddressErrors","deliveryAddress","extractedDeliveryAddressErrors","remainingErrors","enhancedBillingAddressErrors","enhanceErrorObjectKeys","enhancedDeliveryAddressErrors","errorsForPanel","companyDetailsLayout","COMPANY_DETAILS_SCHEMA","personalDetailsReqFields","personalDetailsRequiredFields","PERSONAL_DETAILS_SCHEMA","personalDetailLayout","filter","x","includes","bankAccountLayout","billingAddressLayoutEnhanced","getAddressSchemaForCountryFlat","country","map","item","deliveryAddressLayoutEnhanced","fullLayout","concat","countrySpecificLabels_billing","getAddressLabelsForCountry","countrySpecificLabels_delivery","srPanelResp","current","layout","countrySpecificLabels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnField","fieldToFocus","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","errorCode","errorMessage","_"],"mappings":"6vBAsBMA,MAAAA,EAAiC,EAAGC,SAAQC,OAAMC,QAAOC,mBAE3D,MAAOC,EAAiBC,GAAsBC,EAAS,MAEjDC,EAAuBC,EAAYJ,IACnCK,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAE1FC,EAAuCL,IAA2B,CACpEM,mBAAoBC,IAGlBC,EAA+BC,GAAQ,IAAM,IAAIC,GAAkB,IACnEC,EAAgCF,GAAQ,IAAM,IAAIC,EAAejB,EAAMmB,+BAA+B,IAE5GC,GAAU,KACN,IACI,MAAMC,EAA0B,mBAC1BC,EAAyB,mBAK3BC,eAAgBC,EAChBC,gBAAiBC,EACjBC,YAAaC,EACbC,eAAgBC,EAChBC,gBAAiBC,KACdC,GACHnC,EAIEoC,EAA+BC,EAAuBL,EAA+BR,GACrFc,EAAgCD,EAAuBH,EAAgCX,GAGvFgB,EAAiB,IAC0B,iBAAlCb,GAA8CA,KACX,iBAAnCE,GAA+CA,KAChB,iBAA/BE,GAA2CA,KACV,iBAAjCM,GAA6CA,KACX,iBAAlCE,GAA8CA,KACtDH,GAIDK,EAAiCC,EAEjCC,EAAqCxC,EAAMyC,+BAAiCC,EAC5EC,EAAiCD,EAAwBE,QAAOC,GAAKL,GAA0BM,SAASD,KAExGE,EAAoB,CAAC,SAAU,QAI/BC,EAFuBjC,EAA6BkC,+BAA+BlD,EAAK8B,gBAAgBqB,SAEpDC,KAAIC,GAAQ,GAAG9B,IAAyB8B,MAG5FC,EADwBnC,EAA8B+B,+BAA+BlD,EAAKgC,iBAAiBmB,SACrDC,KAAIC,GAAQ,GAAG/B,IAA0B+B,MAE/FE,EAAahB,EAAqBiB,OACpCZ,EACAI,EACAC,EACAK,EACA,CAAC,oBAICG,EAAgCzC,EAA6B0C,2BAA2B1D,EAAK8B,gBAAgBqB,SAC7GQ,EAAiCxC,EAA8BuC,2BAA2B1D,EAAKgC,iBAAiBmB,SAGhHS,EAAyC/C,IAAgB,CAC3Dd,OAAQuC,EACRpC,aAAcA,EAAa2D,QAC3BC,OAAQP,EACRQ,sBAAuB,IAAKN,KAAkCE,KAI5DK,EAA8BJ,GAAaI,4BAQjD,OALA5D,EAAmB4D,GAKXJ,GAAaK,QAEjB,KAAKC,EAEGvD,GAAmBwD,EAAgB,gCAAiCP,EAAYQ,cAEpFC,YAAW,KACPnE,EAAa2D,SAAU,CAAA,GACxB,KACH,MAGJ,KAAKS,EAA4B,CAC7B,MAAMC,EAAaC,EAAoBR,EAA6B1D,EAAsB,SAEpFmE,EAAiBF,IAAa,GAEpC,GAAIE,EAAgB,CAEhB,MAGMC,EAHgD,yBAA7BD,EAAeE,UAGCF,EAAeG,aAAe,KACvEnE,EAAyBiE,QAGzBhE,IAGJ,KACJ,EAIR,CAAE,MAAOmE,GAET,IACD,CAAC9E,EAAQC,GAAK"}
|
|
1
|
+
{"version":3,"file":"useSRPanelForOpenInvoiceErrors.js","sources":["../../../../../src/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.ts"],"sourcesContent":["import { useEffect, useState, useMemo, MutableRef } from 'preact/hooks';\nimport { enhanceErrorObjectKeys } from '../../../core/Errors/utils';\nimport { COMPANY_DETAILS_SCHEMA } from '../CompanyDetails/CompanyDetails';\nimport { PERSONAL_DETAILS_SCHEMA } from '../PersonalDetails/PersonalDetails';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport Specifications from '../Address/Specifications';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport { usePrevious } from '../../../utils/hookUtils';\nimport { getArrayDifferences } from '../../../utils/arrayUtils';\nimport { mapFieldKey } from './utils';\nimport { OpenInvoiceProps, OpenInvoiceStateData, OpenInvoiceStateError } from './types';\n\ninterface UseSRPanelForErrorsProps {\n errors: OpenInvoiceStateError;\n data: OpenInvoiceStateData;\n props: OpenInvoiceProps;\n isValidating: MutableRef<boolean>;\n}\n\nconst useSRPanelForOpenInvoiceErrors = ({ errors, data, props, isValidating }: UseSRPanelForErrorsProps) => {\n // Relates to onBlur errors\n const [sortedErrorList, setSortedErrorList] = useState(null);\n // Get the previous value (Relates to onBlur errors)\n const previousSortedErrors = usePrevious(sortedErrorList);\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const billingAddressSpecifications = useMemo(() => new Specifications(), []);\n const deliveryAddressSpecifications = useMemo(() => new Specifications(props.deliveryAddressSpecification), []);\n\n useEffect(() => {\n try {\n const DELIVERY_ADDRESS_PREFIX = 'deliveryAddress:';\n const BILLING_ADDRESS_PREFIX = 'billingAddress:';\n\n /** Create messages for SRPanel */\n // Extract nested errors from the various child components...\n const {\n companyDetails: extractedCompanyDetailsErrors,\n personalDetails: extractedPersonalDetailsErrors,\n bankAccount: extractedBankAccountErrors,\n billingAddress: extractedBillingAddressErrors,\n deliveryAddress: extractedDeliveryAddressErrors,\n ...remainingErrors\n } = errors;\n\n // Differentiate between billingAddress and deliveryAddress errors by adding a prefix.\n // This also allows overlapping errors e.g. now that addresses can contain first & last name fields\n const enhancedBillingAddressErrors = enhanceErrorObjectKeys(extractedBillingAddressErrors, BILLING_ADDRESS_PREFIX);\n const enhancedDeliveryAddressErrors = enhanceErrorObjectKeys(extractedDeliveryAddressErrors, DELIVERY_ADDRESS_PREFIX);\n\n // ...and then collate the errors into a new object so that they all sit at top level\n const errorsForPanel = {\n ...(typeof extractedCompanyDetailsErrors === 'object' && extractedCompanyDetailsErrors),\n ...(typeof extractedPersonalDetailsErrors === 'object' && extractedPersonalDetailsErrors),\n ...(typeof extractedBankAccountErrors === 'object' && extractedBankAccountErrors),\n ...(typeof enhancedBillingAddressErrors === 'object' && enhancedBillingAddressErrors),\n ...(typeof enhancedDeliveryAddressErrors === 'object' && enhancedDeliveryAddressErrors),\n ...remainingErrors\n };\n\n // Create layout\n const companyDetailsLayout: string[] = COMPANY_DETAILS_SCHEMA;\n\n const personalDetailsReqFields: string[] = props.personalDetailsRequiredFields ?? PERSONAL_DETAILS_SCHEMA;\n const personalDetailLayout: string[] = PERSONAL_DETAILS_SCHEMA.filter(x => personalDetailsReqFields?.includes(x));\n\n const bankAccountLayout = ['holder', 'iban'];\n\n const billingAddressLayout = billingAddressSpecifications.getAddressSchemaForCountryFlat(data.billingAddress?.country);\n // In order to sort the address errors the layout entries need to have the same (prefixed) identifier as the errors themselves\n const billingAddressLayoutEnhanced = billingAddressLayout.map(item => `${BILLING_ADDRESS_PREFIX}${item}`);\n\n const deliveryAddressLayout = deliveryAddressSpecifications.getAddressSchemaForCountryFlat(data.deliveryAddress?.country);\n const deliveryAddressLayoutEnhanced = deliveryAddressLayout.map(item => `${DELIVERY_ADDRESS_PREFIX}${item}`);\n\n const fullLayout = companyDetailsLayout.concat(\n personalDetailLayout,\n bankAccountLayout,\n billingAddressLayoutEnhanced,\n deliveryAddressLayoutEnhanced,\n ['consentCheckbox']\n );\n\n // Country specific address labels\n const countrySpecificLabels_billing = billingAddressSpecifications.getAddressLabelsForCountry(data.billingAddress?.country);\n const countrySpecificLabels_delivery = deliveryAddressSpecifications.getAddressLabelsForCountry(data.deliveryAddress?.country);\n\n // Set messages: Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: fullLayout,\n countrySpecificLabels: { ...countrySpecificLabels_billing, ...countrySpecificLabels_delivery }\n });\n\n // Relates to onBlur errors\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout); // Relates to onBlur errors\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD: {\n /**\n * For prefixed fields (ones that can occur twice but in different contexts i.e. billingAddress & deliveryAddress) - consider the prefix...\n */\n // ...Firstly strip it to gain a \"clean\" reference to the field...\n const fieldToFocus = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[1] : srPanelResp.fieldToFocus; // country, street etc\n\n // ...Secondly use the prefix to add context for when we try to select it\n let focusContextSelector = '';\n const focusContext = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[0] : ''; // 'billingAddress' | 'deliveryAddress'\n if (focusContext.length) {\n focusContextSelector = `.adyen-checkout__fieldset--${focusContext} `;\n }\n\n // Focus first field in error, if required\n if (shouldMoveFocusSR) setFocusOnField('.adyen-checkout__open-invoice', fieldToFocus, focusContextSelector);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n }\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Is error actually a blur based one - depends on the specific fields in a component as to whether they validate on blur\n const isBlurBasedError = latestErrorMsg.field === 'shopperEmail' && latestErrorMsg.errorCode === 'field.error.invalid';\n\n // Only add blur based errors to the error panel - doing this step prevents the non-blur based errors from being read out twice\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n clearSRPanel();\n }\n\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors, data]);\n};\n\nexport default useSRPanelForOpenInvoiceErrors;\n"],"names":["useSRPanelForOpenInvoiceErrors","errors","data","props","isValidating","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressSpecifications","useMemo","Specifications","deliveryAddressSpecifications","deliveryAddressSpecification","useEffect","DELIVERY_ADDRESS_PREFIX","BILLING_ADDRESS_PREFIX","companyDetails","extractedCompanyDetailsErrors","personalDetails","extractedPersonalDetailsErrors","bankAccount","extractedBankAccountErrors","billingAddress","extractedBillingAddressErrors","deliveryAddress","extractedDeliveryAddressErrors","remainingErrors","enhancedBillingAddressErrors","enhanceErrorObjectKeys","enhancedDeliveryAddressErrors","errorsForPanel","companyDetailsLayout","COMPANY_DETAILS_SCHEMA","personalDetailsReqFields","personalDetailsRequiredFields","PERSONAL_DETAILS_SCHEMA","personalDetailLayout","filter","x","includes","bankAccountLayout","billingAddressLayoutEnhanced","getAddressSchemaForCountryFlat","country","map","item","deliveryAddressLayoutEnhanced","fullLayout","concat","countrySpecificLabels_billing","getAddressLabelsForCountry","countrySpecificLabels_delivery","srPanelResp","current","layout","countrySpecificLabels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","split","focusContextSelector","focusContext","length","setFocusOnField","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","field","errorCode","errorMessage","_"],"mappings":"6vBAsBMA,MAAAA,EAAiC,EAAGC,SAAQC,OAAMC,QAAOC,mBAE3D,MAAOC,EAAiBC,GAAsBC,EAAS,MAEjDC,EAAuBC,EAAYJ,IACnCK,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAE1FC,EAAuCL,IAA2B,CACpEM,mBAAoBC,IAGlBC,EAA+BC,GAAQ,IAAM,IAAIC,GAAkB,IACnEC,EAAgCF,GAAQ,IAAM,IAAIC,EAAejB,EAAMmB,+BAA+B,IAE5GC,GAAU,KACN,IACI,MAAMC,EAA0B,mBAC1BC,EAAyB,mBAK3BC,eAAgBC,EAChBC,gBAAiBC,EACjBC,YAAaC,EACbC,eAAgBC,EAChBC,gBAAiBC,KACdC,GACHnC,EAIEoC,EAA+BC,EAAuBL,EAA+BR,GACrFc,EAAgCD,EAAuBH,EAAgCX,GAGvFgB,EAAiB,IAC0B,iBAAlCb,GAA8CA,KACX,iBAAnCE,GAA+CA,KAChB,iBAA/BE,GAA2CA,KACV,iBAAjCM,GAA6CA,KACX,iBAAlCE,GAA8CA,KACtDH,GAIDK,EAAiCC,EAEjCC,EAAqCxC,EAAMyC,+BAAiCC,EAC5EC,EAAiCD,EAAwBE,QAAOC,GAAKL,GAA0BM,SAASD,KAExGE,EAAoB,CAAC,SAAU,QAI/BC,EAFuBjC,EAA6BkC,+BAA+BlD,EAAK8B,gBAAgBqB,SAEpDC,KAAIC,GAAQ,GAAG9B,IAAyB8B,MAG5FC,EADwBnC,EAA8B+B,+BAA+BlD,EAAKgC,iBAAiBmB,SACrDC,KAAIC,GAAQ,GAAG/B,IAA0B+B,MAE/FE,EAAahB,EAAqBiB,OACpCZ,EACAI,EACAC,EACAK,EACA,CAAC,oBAICG,EAAgCzC,EAA6B0C,2BAA2B1D,EAAK8B,gBAAgBqB,SAC7GQ,EAAiCxC,EAA8BuC,2BAA2B1D,EAAKgC,iBAAiBmB,SAGhHS,EAAyC/C,IAAgB,CAC3Dd,OAAQuC,EACRpC,aAAcA,EAAa2D,QAC3BC,OAAQP,EACRQ,sBAAuB,IAAKN,KAAkCE,KAI5DK,EAA8BJ,GAAaI,4BAQjD,OALA5D,EAAmB4D,GAKXJ,GAAaK,QAEjB,KAAKC,EAA0B,CAK3B,MAAMC,EAAeP,EAAYO,aAAapB,SAAS,KAAOa,EAAYO,aAAaC,MAAM,KAAK,GAAKR,EAAYO,aAGnH,IAAIE,EAAuB,GAC3B,MAAMC,EAAeV,EAAYO,aAAapB,SAAS,KAAOa,EAAYO,aAAaC,MAAM,KAAK,GAAK,GACnGE,EAAaC,SACbF,EAAuB,8BAA8BC,MAIrD3D,GAAmB6D,EAAgB,gCAAiCL,EAAcE,GAEtFI,YAAW,KACPvE,EAAa2D,SAAU,CAAA,GACxB,KACH,KACJ,CAKA,KAAKa,EAA4B,CAC7B,MAAMC,EAAaC,EAAoBZ,EAA6B1D,EAAsB,SAEpFuE,EAAiBF,IAAa,GAEpC,GAAIE,EAAgB,CAEhB,MAGMC,EAH4C,iBAAzBD,EAAeE,OAAyD,wBAA7BF,EAAeG,UAG1CH,EAAeI,aAAe,KACvExE,EAAyBqE,QAGzBpE,IAGJ,KACJ,EAIR,CAAE,MAAOwE,GAET,IACD,CAACnF,EAAQC,GAAK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as r,useRef as o,useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import s from"../../../utils/useForm/useForm.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import{phoneValidationRules as n,phoneFormatters as a}from"./validate.js";import l from"../FormFields/Fieldset/Fieldset.js";import m from"./PhoneInputFields.js";function u(u){const{i18n:p}=i(),d=u.requiredFields||[...u?.items?.length?["phonePrefix"]:[],"phoneNumber"],f=d.includes("phonePrefix")&&!!u?.items?.length,h=d.includes("phoneNumber"),c=s({
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as r,useRef as o,useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import s from"../../../utils/useForm/useForm.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import{phoneValidationRules as n,phoneFormatters as a}from"./validate.js";import l from"../FormFields/Fieldset/Fieldset.js";import m from"./PhoneInputFields.js";function u(u){const{i18n:p}=i(),d=u.requiredFields||[...u?.items?.length?["phonePrefix"]:[],"phoneNumber"],f=d.includes("phonePrefix")&&!!u?.items?.length,h=d.includes("phoneNumber"),c=s({...u,schema:d,defaultData:u.data,rules:n,formatters:a});r((()=>{c.setSchema(d)}),[d.toString()]);const{data:g,valid:b,errors:x,isValid:F,triggerValidation:j}=c;r((()=>{u.onChange({data:g,valid:b,errors:x,isValid:F})}),[g,b,x,F]);const N=o({showValidation:j});r((()=>{u.setComponentRef(N.current)}),[u.setComponentRef]);const P=t((e=>{if(x[e]){const r="phoneNumber"===e?"phoneNumberErrorKey":"phonePrefixErrorKey",o=u[r]?u[r]:x[e].errorMessage;return p.get(o)??null}return null}),[x]);return e(l,{classNameModifiers:["phone-input"]},e(m,{getError:P,showNumber:h,showPrefix:f,form:c,...u}))}u.defaultProps={phoneLabel:"telephoneNumber"};export{u as default};
|
|
2
2
|
//# sourceMappingURL=PhoneInputForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInputForm.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputForm.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useCallback, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport { phoneFormatters, phoneValidationRules } from './validate';\nimport { PhoneInputFormProps, PhoneInputSchema } from './types';\nimport Fieldset from '../FormFields/Fieldset';\nimport PhoneInputFields from './PhoneInputFields';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nfunction PhoneInputForm(props: PhoneInputFormProps) {\n const { i18n } = useCoreContext();\n\n const schema = props.requiredFields || [...(props?.items?.length ? ['phonePrefix'] : []), 'phoneNumber'];\n const showPrefix = schema.includes('phonePrefix') && !!props?.items?.length;\n const showNumber = schema.includes('phoneNumber');\n\n const form = useForm<PhoneInputSchema>({\n i18n,\n ...props,\n schema,\n defaultData: props.data,\n rules: phoneValidationRules,\n formatters: phoneFormatters\n });\n\n useEffect(() => {\n form.setSchema(schema);\n }, [schema.toString()]);\n\n const { data, valid, errors, isValid, triggerValidation } = form;\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const componentRef = useRef<ComponentMethodsRef>({\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n props.setComponentRef(componentRef.current);\n }, [props.setComponentRef]);\n\n // This is here for MBWay, prob should be moved up\n // MBWay has a weird way of loading its error messages\n // They come form the prop phoneNumberErrorKey: 'mobileNumber.invalid'\n // Strangely it's defined as invalidPhoneNumber in the validation rules\n const getPhoneFieldError = useCallback(\n (field: string) => {\n if (errors[field]) {\n const propsField = field === 'phoneNumber' ? 'phoneNumberErrorKey' : 'phonePrefixErrorKey';\n const key = props[propsField] ? props[propsField] : errors[field].errorMessage;\n return i18n.get(key) ?? null;\n }\n return null;\n },\n [errors]\n );\n\n return (\n <Fieldset classNameModifiers={['phone-input']}>\n <PhoneInputFields getError={getPhoneFieldError} showNumber={showNumber} showPrefix={showPrefix} form={form} {...props} />\n </Fieldset>\n );\n}\n\nPhoneInputForm.defaultProps = {\n phoneLabel: 'telephoneNumber'\n};\n\nexport default PhoneInputForm;\n"],"names":["PhoneInputForm","props","i18n","useCoreContext","schema","requiredFields","items","length","showPrefix","includes","showNumber","form","useForm","defaultData","data","rules","phoneValidationRules","formatters","phoneFormatters","useEffect","setSchema","toString","valid","errors","isValid","triggerValidation","onChange","componentRef","useRef","showValidation","setComponentRef","current","getPhoneFieldError","useCallback","field","propsField","key","errorMessage","get","h","Fieldset","classNameModifiers","PhoneInputFields","getError","defaultProps","phoneLabel"],"mappings":"ucAgBA,SAASA,EAAeC,GACpB,MAAMC,KAAEA,GAASC,IAEXC,EAASH,EAAMI,gBAAkB,IAAKJ,GAAOK,OAAOC,OAAS,CAAC,eAAiB,GAAK,eACpFC,EAAaJ,EAAOK,SAAS,kBAAoBR,GAAOK,OAAOC,OAC/DG,EAAaN,EAAOK,SAAS,eAE7BE,EAAOC,EAA0B,
|
|
1
|
+
{"version":3,"file":"PhoneInputForm.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputForm.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useCallback, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport { phoneFormatters, phoneValidationRules } from './validate';\nimport { PhoneInputFormProps, PhoneInputSchema } from './types';\nimport Fieldset from '../FormFields/Fieldset';\nimport PhoneInputFields from './PhoneInputFields';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nfunction PhoneInputForm(props: PhoneInputFormProps) {\n const { i18n } = useCoreContext();\n\n const schema = props.requiredFields || [...(props?.items?.length ? ['phonePrefix'] : []), 'phoneNumber'];\n const showPrefix = schema.includes('phonePrefix') && !!props?.items?.length;\n const showNumber = schema.includes('phoneNumber');\n\n const form = useForm<PhoneInputSchema>({\n i18n,\n ...props,\n schema,\n defaultData: props.data,\n rules: phoneValidationRules,\n formatters: phoneFormatters\n });\n\n useEffect(() => {\n form.setSchema(schema);\n }, [schema.toString()]);\n\n const { data, valid, errors, isValid, triggerValidation } = form;\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const componentRef = useRef<ComponentMethodsRef>({\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n props.setComponentRef(componentRef.current);\n }, [props.setComponentRef]);\n\n // This is here for MBWay, prob should be moved up\n // MBWay has a weird way of loading its error messages\n // They come form the prop phoneNumberErrorKey: 'mobileNumber.invalid'\n // Strangely it's defined as invalidPhoneNumber in the validation rules\n const getPhoneFieldError = useCallback(\n (field: string) => {\n if (errors[field]) {\n const propsField = field === 'phoneNumber' ? 'phoneNumberErrorKey' : 'phonePrefixErrorKey';\n const key = props[propsField] ? props[propsField] : errors[field].errorMessage;\n return i18n.get(key) ?? null;\n }\n return null;\n },\n [errors]\n );\n\n return (\n <Fieldset classNameModifiers={['phone-input']}>\n <PhoneInputFields getError={getPhoneFieldError} showNumber={showNumber} showPrefix={showPrefix} form={form} {...props} />\n </Fieldset>\n );\n}\n\nPhoneInputForm.defaultProps = {\n phoneLabel: 'telephoneNumber'\n};\n\nexport default PhoneInputForm;\n"],"names":["PhoneInputForm","props","i18n","useCoreContext","schema","requiredFields","items","length","showPrefix","includes","showNumber","form","useForm","defaultData","data","rules","phoneValidationRules","formatters","phoneFormatters","useEffect","setSchema","toString","valid","errors","isValid","triggerValidation","onChange","componentRef","useRef","showValidation","setComponentRef","current","getPhoneFieldError","useCallback","field","propsField","key","errorMessage","get","h","Fieldset","classNameModifiers","PhoneInputFields","getError","defaultProps","phoneLabel"],"mappings":"ucAgBA,SAASA,EAAeC,GACpB,MAAMC,KAAEA,GAASC,IAEXC,EAASH,EAAMI,gBAAkB,IAAKJ,GAAOK,OAAOC,OAAS,CAAC,eAAiB,GAAK,eACpFC,EAAaJ,EAAOK,SAAS,kBAAoBR,GAAOK,OAAOC,OAC/DG,EAAaN,EAAOK,SAAS,eAE7BE,EAAOC,EAA0B,IAEhCX,EACHG,SACAS,YAAaZ,EAAMa,KACnBC,MAAOC,EACPC,WAAYC,IAGhBC,GAAU,KACNR,EAAKS,UAAUhB,EAAAA,GAChB,CAACA,EAAOiB,aAEX,MAAMP,KAAEA,EAAIQ,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,kBAAEA,GAAsBd,EAE5DQ,GAAU,KACNlB,EAAMyB,SAAS,CAAEZ,OAAMQ,QAAOC,SAAQC,WAAQ,GAC/C,CAACV,EAAMQ,EAAOC,EAAQC,IAEzB,MAAMG,EAAeC,EAA4B,CAC7CC,eAAgBJ,IAGpBN,GAAU,KACNlB,EAAM6B,gBAAgBH,EAAaI,QAAO,GAC3C,CAAC9B,EAAM6B,kBAMV,MAAME,EAAqBC,GACtBC,IACG,GAAIX,EAAOW,GAAQ,CACf,MAAMC,EAAuB,gBAAVD,EAA0B,sBAAwB,sBAC/DE,EAAMnC,EAAMkC,GAAclC,EAAMkC,GAAcZ,EAAOW,GAAOG,aAClE,OAAOnC,EAAKoC,IAAIF,IAAQ,IAC5B,CACA,OAAO,IAAA,GAEX,CAACb,IAGL,OACIgB,EAACC,EAAAA,CAASC,mBAAoB,CAAC,gBAC3BF,EAACG,EAAAA,CAAiBC,SAAUX,EAAoBtB,WAAYA,EAAYF,WAAYA,EAAYG,KAAMA,KAAUV,IAG5H,CAEAD,EAAe4C,aAAe,CAC1BC,WAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isEmpty as e,getFormattingRegEx as r}from"../../../utils/validator-utils.js";const o=/\b(2\d{1}|(9(3|6|2|1)))\d{7}\b/,t=/^(\d){4,}$/,a={phoneNumber:{modes:["blur"],validate:(r,a)=>{const d="+351"===a.state.data.phonePrefix?o:t;return e(r)?null:d.test(r)},errorMessage:"invalidPhoneNumber"},phonePrefix:{modes:["blur"],validate:e=>!!e,errorMessage:"invalidCountryCode"}},d={phoneNumber:{formatterFn:e=>e.replace(r("^\\d","g"),"")}};export{d as phoneFormatters,a as phoneValidationRules};
|
|
2
2
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";import o from"../Countdown/index.js";import r from"../Button/Button.js";import s from"../Spinner/Spinner.js";import a from"../../../core/Services/payment-status.js";import{processResponse as i}from"../../../core/ProcessResponse/process-response.js";import{copyToClipboard as n}from"../../../utils/clipboard.js";import c from"../../../core/Errors/AdyenCheckoutError.js";import{useCoreContext as p}from"../../../core/Context/CoreProvider.js";import d from"../ContentSeparator/ContentSeparator.js";import l from"../../../core/Context/useImage.js";import{useA11yReporter as m}from"../../../core/Errors/useA11yReporter.js";import u from"../../../utils/useAutoFocus.js";import{
|
|
1
|
+
import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";import o from"../Countdown/index.js";import r from"../Button/Button.js";import s from"../Spinner/Spinner.js";import a from"../../../core/Services/payment-status.js";import{processResponse as i}from"../../../core/ProcessResponse/process-response.js";import{copyToClipboard as n}from"../../../utils/clipboard.js";import c from"../../../core/Errors/AdyenCheckoutError.js";import{useCoreContext as p}from"../../../core/Context/CoreProvider.js";import d from"../ContentSeparator/ContentSeparator.js";import l from"../../../core/Context/useImage.js";import{useA11yReporter as m}from"../../../core/Errors/useA11yReporter.js";import u from"../../../utils/useAutoFocus.js";import{ANALYTICS_QR_CODE_DOWNLOAD as h,ANALYTICS_DOWNLOAD_STR as _}from"../../../core/Analytics/constants.js";import{PREFIX as y}from"../Icon/constants.js";function g(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class f extends t{componentDidMount(){this.statusInterval()}componentWillUnmount(){clearTimeout(this.timeoutId)}pollStatus(t){clearTimeout(this.timeoutId),this.timeoutId=setTimeout((async()=>{const t=performance.now();await this.checkStatus();const e=performance.now();this.statusInterval(Math.round(e-t))}),t)}render({amount:t,url:a,brandLogo:i,brandName:c,countdownTime:g,type:f,onActionHandled:k},{expired:q,completed:b,loading:v}){const{i18n:C,loadingContext:N}=p(),w=l(),T=this.props.qrCodeData?`${N}utility/v1/barcode.png?type=qrCode&data=${this.props.qrCodeData}&clientKey=${this.props.clientKey}`:this.props.qrCodeImage,I=(t,o)=>{const r=C.get(o);return m(r),e("div",{className:"adyen-checkout__qr-loader adyen-checkout__qr-loader--result"},e("img",{className:"adyen-checkout__qr-loader__icon adyen-checkout__qr-loader__icon--result",src:w({imageFolder:"components/"})(t),alt:r}),e("div",{className:"adyen-checkout__qr-loader__subtitle"},r))};if(q)return I("error","error.subtitle.payment");if(b)return I("success","creditCard.success");if(v)return e("div",{className:"adyen-checkout__qr-loader"},i&&e("div",{className:"adyen-checkout__qr-loader__brand-logo-wrapper"},e("img",{alt:c,src:i,className:"adyen-checkout__qr-loader__brand-logo"})),e(s,null));const j=C.get(this.props.timeToPay).split("%@"),S=u(),x=this.props.classNameModifiers.map((t=>`adyen-checkout__qr-loader--${t}`));return e("div",{className:`adyen-checkout__qr-loader adyen-checkout__qr-loader--${f} ${x.join(" ")}`},i&&e("div",{className:"adyen-checkout__qr-loader__brand-logo-wrapper"},e("img",{src:i,alt:c,className:"adyen-checkout__qr-loader__brand-logo"})),t&&t.value&&t.currency&&e("div",{className:"adyen-checkout__qr-loader__payment_amount"},C.amount(t.value,t.currency)),a&&e("div",{className:"adyen-checkout__qr-loader__app-link"},this.props.redirectIntroduction&&e("div",{className:"adyen-checkout__qr-loader__subtitle"},C.get(this.props.redirectIntroduction)),e(r,{classNameModifiers:["qr-loader"],onClick:()=>this.redirectToApp(a),label:C.get(this.props.buttonLabel)}),e(d,null)),e("div",{ref:S,tabIndex:0,className:"adyen-checkout__qr-loader__subtitle"},"string"==typeof this.props.introduction?C.get(this.props.introduction):this.props.introduction?.()),e("img",{src:T,alt:C.get("wechatpay.scanqrcode"),onLoad:()=>{k?.({componentType:this.props.type,actionDescription:"qr-code-loaded"})}}),e("div",{className:"adyen-checkout__qr-loader__progress"},e("span",{className:"adyen-checkout__qr-loader__percentage",style:{width:`${this.state.percentage}%`}})),e("div",{className:"adyen-checkout__qr-loader__countdown"},j[0]," ",e(o,{minutesFromNow:g,onTick:this.onTick,onCompleted:this.onTimeUp})," ",j[1]),this.props.instructions&&e("div",{className:"adyen-checkout__qr-loader__instructions"},"string"==typeof this.props.instructions?C.get(this.props.instructions):this.props.instructions?.()),this.props.copyBtn&&e("div",{className:"adyen-checkout__qr-loader__actions"},e(r,{inline:!0,variant:"action",onClick:(t,{complete:e})=>{n(this.props.qrCodeData),this.props.onSubmitAnalytics({type:_,target:h}),e()},icon:w({imageFolder:"components/"})(`${y}copy`),label:C.get("button.copy")})))}constructor(t){super(t),g(this,"timeoutId",void 0),g(this,"redirectToApp",(t=>{window.location.assign(t)})),g(this,"statusInterval",((t=0)=>{if(this.state.expired||this.state.completed)return;this.setState((e=>({timePassed:e.timePassed+this.props.delay+t})));const e=this.state.timePassed>=this.props.throttleTime?this.props.throttledInterval:this.state.delay;this.pollStatus(e)})),g(this,"onTick",(t=>{this.setState({percentage:t.percentage})})),g(this,"onTimeUp",(()=>{this.setState({expired:!0}),clearTimeout(this.timeoutId),this.props.onError(new c("ERROR","Payment Expired"))})),g(this,"onComplete",(t=>{clearTimeout(this.timeoutId),this.setState({completed:!0,loading:!1});const e={data:{details:{payload:t.props.payload},paymentData:this.props.paymentData}};this.props.onComplete(e,this)})),g(this,"onError",(t=>{if(clearTimeout(this.timeoutId),this.setState({expired:!0,loading:!1}),t.props.payload){const e={data:{details:{payload:t.props.payload},paymentData:this.props.paymentData}};this.props.onComplete(e,this)}const e=new c("ERROR","error result with no payload in response");return this.props.onError(e)})),g(this,"checkStatus",(()=>{const{paymentData:t,clientKey:e,loadingContext:o,throttledInterval:r}=this.props;return a(t,e,o,r).then(i).catch((t=>({type:"network-error",props:t}))).then((t=>{switch(t.type){case"success":this.onComplete(t);break;case"error":this.onError(t);break;default:this.setState({loading:!1})}return t}))})),this.state={buttonStatus:"default",completed:!1,delay:t.delay,expired:!1,loading:!0,percentage:100,timePassed:0}}}g(f,"defaultProps",{delay:2e3,countdownTime:15,onError:()=>{},onComplete:()=>{},throttleTime:6e4,classNameModifiers:[],throttledInterval:1e4,introduction:"wechatpay.scanqrcode",timeToPay:"wechatpay.timetopay",buttonLabel:"openApp"});export{f as default};
|
|
2
2
|
//# sourceMappingURL=QRLoader.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as s}from"../../../../external/preact/dist/preact.js";import{getFields as t,validFieldsReducer as e,getErrorReducer as i,getErrorObject as o}from"./SFPUtils.js";import n from"../lib/CSF/initCSF.js";import r from"./SecuredFieldsProviderHandlers.js";import d from"./defaultProps.js";import{ENCRYPTED_PWD_FIELD as a,ENCRYPTED_CARD_NUMBER as h,DEDICATED_CARD_COMPONENTS as l,
|
|
1
|
+
import{Component as s}from"../../../../external/preact/dist/preact.js";import{getFields as t,validFieldsReducer as e,getErrorReducer as i,getErrorObject as o}from"./SFPUtils.js";import n from"../lib/CSF/initCSF.js";import r from"./SecuredFieldsProviderHandlers.js";import d from"./defaultProps.js";import{ENCRYPTED_PWD_FIELD as a,ENCRYPTED_CARD_NUMBER as h,DEDICATED_CARD_COMPONENTS as l,DATE_POLICY_REQUIRED as p,CVC_POLICY_REQUIRED as c}from"../lib/constants.js";import u from"../../../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as f}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as m}from"../../../../core/Errors/constants.js";function F(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}class C extends s{componentDidMount(){this.props.rootNode&&this.setRootNode(this.props.rootNode);const s=t(this.rootNode),i=s.reduce(e,{});this.setState({valid:i}),s.forEach((s=>{this.numCharsInField[s]=0})),this.numDateFields=s.filter((s=>s.match(/Expiry/))).length,s.length?(this.destroy(),this.initializeCSF(this.rootNode)):this.handleOnNoDataRequired()}componentDidUpdate(){this.checkForKCPFields()}componentWillUnmount(){this.csf=null,clearTimeout(this.csfLoadFailTimeout),clearTimeout(this.csfConfigFailTimeout)}initializeCSF(s){let t=this.props.loadingContext;const e={rootNode:s,type:this.props.type,clientKey:this.props.clientKey,cardGroupTypes:this.props.brands,autoFocus:this.props.autoFocus,trimTrailingSeparator:this.props.trimTrailingSeparator,loadingContext:t,keypadFix:this.props.keypadFix,showWarnings:this.props.showWarnings,iframeUIConfig:{sfStyles:this.props.styles},i18n:this.props.i18n,callbacks:{onLoad:this.handleOnLoad,onConfigSuccess:this.handleOnConfigSuccess,onFieldValid:this.handleOnFieldValid,onAllValid:this.handleOnAllValid,onBrand:this.handleOnBrand,onError:this.handleOnError,onFocus:this.handleFocus,onBinValue:this.props.onBinValue,onAutoComplete:this.handleOnAutoComplete,onAdditionalSFConfig:this.props.onAdditionalSFConfig,onAdditionalSFRemoved:this.props.onAdditionalSFRemoved,onTouchstartIOS:this.handleOnTouchstartIOS,onKeyPressed:this.handleKeyPressed},isKCP:this.state.hasKoreanFields,legacyInputMode:this.props.legacyInputMode,minimumExpiryDate:this.props.minimumExpiryDate,implementationType:this.props.implementationType||"components",forceCompat:this.props.forceCompat,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,shouldDisableIOSArrowKeys:!!this.props.disableIOSArrowKeys,placeholders:this.props.placeholders??{},showContextualElement:this.props.showContextualElement};this.csf=n(e),this.csfLoadFailTimeout=setTimeout((()=>{"ready"!==this.state.status&&(this.setState({status:"csfLoadFailure"}),this.props.onError(new u("ERROR","secured field iframes have failed to load")))}),this.csfLoadFailTimeoutMS)}checkForKCPFields(){let s=!1;if(this.props.koreanAuthenticationRequired&&(s=this.issuingCountryCode?"kr"===this.issuingCountryCode:"kr"===this.props.countryCode),this.state.hasKoreanFields&&!s){const s=s=>({data:{...s.data,[a]:void 0},valid:{...s.valid,[a]:!1},errors:{...s.errors,[a]:!1},hasKoreanFields:!1});this.setState(s,(()=>{this.props.onChange(this.state)})),this.csf.removeSecuredField(a),this.csf.setKCPStatus(!1)}if(!this.state.hasKoreanFields&&s){const s=s=>({valid:{...s.valid,[a]:!1},hasKoreanFields:!0,isSfpValid:!1});this.setState(s,(()=>{this.props.onChange(this.state)})),this.csf.addSecuredField(a),this.csf.setKCPStatus(!0)}}getChildContext(){return{i18n:this.props.i18n}}handleUnsupportedCard(s){const t=!!s.error;return t&&this.setState({detectedUnsupportedBrands:s.detectedBrands}),s.rootNode=this.rootNode,this.handleOnError(s,t),this.csf&&this.csf.hasUnsupportedCard(h,s.error),t}setFocusOn(s){this.csf&&this.csf.setFocusOnFrame(s)}updateStyles(s){this.csf&&this.csf.updateStyles(s)}sfIsOptionalOrHidden(s){return this.csf.sfIsOptionalOrHidden(s)}destroy(){this.csf&&this.csf.destroy()}showValidation(){const{numDateFields:s,state:t}=this;Object.keys(t.valid).reduce(i(s,t),[]).forEach((s=>{const e=o(s,this.rootNode,t);this.handleOnError(e,!!t.detectedUnsupportedBrands),this.csf&&this.csf.isValidated&&this.csf.isValidated(s,e.error)}))}mapErrorsToValidationRuleResult(){return Object.keys(this.state.errors).reduce(((s,t)=>{const e=this.state.errors[t];return s[t]=e?{isValid:!1,errorMessage:f(e,m),errorI18n:this.props.i18n.get(e),error:e,rootNode:this.rootNode,...this.state.detectedUnsupportedBrands&&{detectedBrands:this.state.detectedUnsupportedBrands}}:null,s}),{})}processBinLookupResponse(s,t){if(this.state.detectedUnsupportedBrands&&(this.setState((s=>({errors:{...s.errors,[h]:!1},detectedUnsupportedBrands:null}))),this.csf&&s)){const s={type:"card",fieldType:"encryptedCardNumber",error:""};this.handleUnsupportedCard(s)}this.issuingCountryCode=s?.issuingCountryCode?.toLowerCase();const e=t?.brand,i=e&&l.includes(t.brand);i&&this.setState(t,(()=>{this.props.onChange(this.state)})),this.csf&&this.csf.brandsFromBinLookup(s,i?t:null)}render(s,t){return s.render({setRootNode:this.setRootNode,setFocusOn:this.setFocusOn},t)}constructor(s){super(s),F(this,"csfLoadFailTimeout",void 0),F(this,"csfLoadFailTimeoutMS",void 0),F(this,"csfConfigFailTimeout",void 0),F(this,"csfConfigFailTimeoutMS",void 0),F(this,"numCharsInField",void 0),F(this,"rootNode",void 0),F(this,"numDateFields",void 0),F(this,"csf",void 0),F(this,"handleOnLoad",void 0),F(this,"handleOnConfigSuccess",void 0),F(this,"handleOnFieldValid",void 0),F(this,"handleOnAllValid",void 0),F(this,"handleOnBrand",void 0),F(this,"handleFocus",void 0),F(this,"handleOnError",void 0),F(this,"handleOnAutoComplete",void 0),F(this,"handleOnNoDataRequired",void 0),F(this,"handleOnTouchstartIOS",void 0),F(this,"handleKeyPressed",void 0),F(this,"state",void 0),F(this,"props",void 0),F(this,"issuingCountryCode",void 0),F(this,"setRootNode",(s=>{this.rootNode=s}));const t={status:"loading",brand:s.type,errors:{},valid:{},data:{},cvcPolicy:c,expiryDatePolicy:p,isSfpValid:!1,hasKoreanFields:s.hasKoreanFields};this.state=t,this.csfLoadFailTimeout=null,this.csfLoadFailTimeoutMS=3e4,this.csfConfigFailTimeout=null,this.csfConfigFailTimeoutMS=15e3,this.numCharsInField={},this.handleOnLoad=r.handleOnLoad.bind(this),this.handleOnConfigSuccess=r.handleOnConfigSuccess.bind(this),this.handleOnFieldValid=r.handleOnFieldValid.bind(this),this.handleOnAllValid=r.handleOnAllValid.bind(this),this.handleOnBrand=r.handleOnBrand.bind(this),this.handleFocus=r.handleFocus.bind(this),this.handleOnError=r.handleOnError.bind(this),this.handleOnNoDataRequired=r.handleOnNoDataRequired.bind(this),this.handleOnAutoComplete=r.handleOnAutoComplete.bind(this),this.handleOnTouchstartIOS=r.handleOnTouchstartIOS.bind(this),this.handleKeyPressed=r.handleKeyPressed.bind(this),this.processBinLookupResponse=this.processBinLookupResponse.bind(this),this.setFocusOn=this.setFocusOn.bind(this),this.updateStyles=this.updateStyles.bind(this),this.handleUnsupportedCard=this.handleUnsupportedCard.bind(this),this.showValidation=this.showValidation.bind(this),this.destroy=this.destroy.bind(this)}}F(C,"defaultProps",d);export{C as default};
|
|
2
2
|
//# sourceMappingURL=SecuredFieldsProvider.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getCardImageUrl as e}from"../utils.js";import{ENCRYPTED_CARD_NUMBER as t,ENCRYPTED_SECURITY_CODE as s,ENCRYPTED_EXPIRY_DATE as i,ENCRYPTED_EXPIRY_MONTH as n,ENCRYPTED_EXPIRY_YEAR as r,
|
|
1
|
+
import{getCardImageUrl as e}from"../utils.js";import{ENCRYPTED_CARD_NUMBER as t,ENCRYPTED_SECURITY_CODE as s,ENCRYPTED_EXPIRY_DATE as i,ENCRYPTED_EXPIRY_MONTH as n,ENCRYPTED_EXPIRY_YEAR as r,DATE_POLICY_REQUIRED as o,CVC_POLICY_REQUIRED as a,OPTIONAL as l,HIDDEN as d}from"../lib/constants.js";import{existy as h}from"../../../../utils/commonUtils.js";import u from"../../../../core/Errors/AdyenCheckoutError.js";function p(e,t,s,i){return(t!==l&&t!==d||0!==s[e])&&i[e]}var c={handleFocus:function(e){this.numCharsInField[e.fieldType]=e.numChars,this.props.onFocus(e)},handleOnAllValid:function(e){return!this.state.detectedUnsupportedBrands&&(this.setState({isSfpValid:e.allValid},(()=>{this.props.onChange(this.state,{event:"handleOnAllValid"}),this.props.onAllValid(e)})),!0)},handleOnAutoComplete:function(e){this.setState({autoCompleteName:e.value},(()=>{this.props.onChange(this.state,{event:"handleOnAutoComplete",fieldType:e.fieldType}),this.setState({autoCompleteName:null})})),this.props.onAutoComplete(e)},handleOnFieldValid:function(e){return(!this.state.detectedUnsupportedBrands||e.fieldType!==t)&&(this.setState((t=>({data:{...t.data,[e.encryptedFieldName]:e.blob},valid:{...t.valid,[e.encryptedFieldName]:e.valid},errors:{...t.errors,[e.fieldType]:t.errors[e.fieldType]??!1}})),(()=>{this.props.onChange(this.state,{event:"handleOnFieldValid",fieldType:e.fieldType}),this.props.onFieldValid(e)})),!0)},handleOnLoad:function(e){clearTimeout(this.csfLoadFailTimeout),this.csfLoadFailTimeout=null,this.props.onLoad(e),this.csfConfigFailTimeout=setTimeout((()=>{"ready"!==this.state.status&&(this.setState({status:"csfConfigFailure"}),this.props.onError(new u("ERROR","secured fields have failed to configure")))}),this.csfConfigFailTimeoutMS)},handleOnConfigSuccess:function(e){clearTimeout(this.csfConfigFailTimeout),this.csfConfigFailTimeout=null,this.setState({status:"ready"},(()=>{this.props.onConfigSuccess(e)}))},handleOnBrand:function(t){this.setState((e=>{const l=p(s,t.cvcPolicy,this.numCharsInField,e.errors),d=1===this.numDateFields?p(i,t.expiryDatePolicy,this.numCharsInField,e.errors):null,u=2===this.numDateFields?p(n,t.expiryDatePolicy,this.numCharsInField,e.errors):null,c=2===this.numDateFields?p(r,t.expiryDatePolicy,this.numCharsInField,e.errors):null;return{brand:t.brand,cvcPolicy:t.cvcPolicy??a,showSocialSecurityNumber:t.showSocialSecurityNumber,errors:{...e.errors,...h(l)&&{[s]:l},...h(d)&&{[i]:d},...h(u)&&{[n]:u},...h(c)&&{[r]:c}},expiryDatePolicy:t.expiryDatePolicy??o}}),(()=>{this.props.onChange(this.state,{event:"handleOnBrand"});const s=this.props.brandsConfiguration[t.brand]?.icon??e(t.brand,this.props.resources);this.props.onBrand({...t,brandImageUrl:s})}))},handleOnError:function(e,s=null){const i=e.error;return this.setState((n=>({errors:{...n.errors,[e.fieldType]:i||!1},...s&&{data:{...n.data,[t]:void 0}},...s&&{valid:{...n.valid,[t]:!1}},...s&&{isSfpValid:!1}})),(()=>{this.props.onChange(this.state,{event:"handleOnError",fieldType:e.fieldType})})),!0},handleOnNoDataRequired:function(){this.setState({status:"ready"},(()=>this.props.onChange({isSfpValid:!0})))},handleOnTouchstartIOS:function(e){this.props.disableIOSArrowKeys?.(e)},handleKeyPressed:function(e){if("enterKeyPressed"===e.action){const e=new KeyboardEvent("keypress",{bubbles:!0,cancelable:!0,key:"Enter",code:"Enter"});this.props.handleKeyPress?.(e)}}};export{c as default};
|
|
2
2
|
//# sourceMappingURL=SecuredFieldsProviderHandlers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{select as e,getAttribute as t}from"../../utilities/dom.js";import{DATA_ENCRYPTED_FIELD_ATTR as i,
|
|
1
|
+
import{select as e,getAttribute as t}from"../../utilities/dom.js";import{DATA_ENCRYPTED_FIELD_ATTR as i,ALL_SECURED_FIELDS as s,CVC_POLICY_REQUIRED as o,DATE_POLICY_REQUIRED as n,ENCRYPTED_EXPIRY_YEAR as r,SF_CONFIG_TIMEOUT as a,DATA_UID as d,DATA_INFO as l}from"../../constants.js";import{existy as c}from"../../../../../../utils/commonUtils.js";import h from"../utils/cardType.js";import u from"../../securedField/SecuredField.js";import p from"../../../../../../core/Errors/AdyenCheckoutError.js";function f(){this.encryptedAttrName=i;const r=e(this.props.rootNode,`[${this.encryptedAttrName}]`).filter((e=>{const i=t(e,this.encryptedAttrName),o=s.includes(i);return o||console.warn(`WARNING: '${i}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),o})),a=o,d=n;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(r,a,d),r.length):(this.createNonCardSecuredFields(r),r.length)}async function m(e){for(let t=0;t<e.length;t++){const i=e[t];await this.setupSecuredField(i).catch((e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)}))}}async function y(e,t,i){let s=this.state.type;if("card"===s&&1===this.config.cardGroupTypes.length&&(s=this.config.cardGroupTypes[0],this.state.type=s),this.isSingleBrandedCard="card"!==s,this.isSingleBrandedCard){const e=h.getCardByBrand(s);c(e)?(t=e.cvcPolicy||o,i=e.expiryDatePolicy||n,this.securityCode=e.securityCode):this.state.type="unrecognised-single-brand"}for(let s=0;s<e.length;s++){const o=e[s];window._b$dl&&console.log("\nAbout to set up securedField:",o),await this.setupSecuredField(o,t,i).catch((e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)})),window._b$dl&&console.log("Finished setting up securedField:",o)}if(window._b$dl&&console.log("Finished setting up all securedFields"),this.isSingleBrandedCard){const e={type:this.state.type,rootNode:this.props.rootNode,brand:s,cvcPolicy:t,expiryDatePolicy:i,cvcText:this.securityCode};setTimeout((()=>{this.callbacks.onBrand(e)}),0)}}function g(e,i,s){return new Promise(((o,n)=>{const c=t(e,this.encryptedAttrName);c===r&&(this.state.hasSeparateDateFields=!0);const h={fieldType:c,extraFieldData:t(e,l),uid:t(e,d),cvcPolicy:i,holderEl:e,expiryDatePolicy:s,txVariant:this.state.type,cardGroupTypes:this.config.cardGroupTypes,iframeUIConfig:this.config.iframeUIConfig,sfLogAtStart:this.config.sfLogAtStart,trimTrailingSeparator:this.config.trimTrailingSeparator,isCreditCardType:this.config.isCreditCardType,iframeSrc:this.config.iframeSrc,loadingContext:this.config.loadingContext,showWarnings:this.config.showWarnings,legacyInputMode:this.config.legacyInputMode,minimumExpiryDate:this.config.minimumExpiryDate,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,disableIOSArrowKeys:this.props.shouldDisableIOSArrowKeys,implementationType:this.props.implementationType,showContextualElement:this.props.showContextualElement,placeholders:this.props.placeholders},f=new u(h,this.props.i18n).onIframeLoaded((()=>{if(this.state.iframeCount+=1,window._b$dl&&console.log("### createSecuredFields::onIframeLoaded:: this.state.iframeCount=",this.state.iframeCount),this.state.iframeCount>this.state.numIframes)throw this.destroySecuredFields(),new p("ERROR",`One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`);if(f.loadToConfigTimeout=setTimeout((()=>{n({type:h.fieldType,failReason:"sf took too long to config"})}),a),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}})).onConfig((e=>{this.handleIframeConfigFeedback(e),clearTimeout(f.loadToConfigTimeout),f.loadToConfigTimeout=null,o(e)})).onFocus((e=>{this.handleFocus(e)})).onBinValue((e=>{this.handleBinValue(e)})).onTouchstart((e=>{this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents||e.hasGenuineTouchEvents)&&this.callbacks.onTouchstartIOS({fieldType:e.fieldType}),(e.hasGenuineTouchEvents||this.hasGenuineTouchEvents)&&this.postMessageToAllIframes({fieldType:e.fieldType,fieldClick:!0})})).onShiftTab((e=>{this.handleSFShiftTab(e.fieldType)})).onEncryption((e=>{this.handleEncryption(e)})).onValidation((e=>{this.handleValidation(e)})).onAutoComplete((e=>{this.processAutoComplete(e)})).onKeyPressed((e=>{const{numKey:t,...i}=e;this.callbacks.onKeyPressed(i)}));this.state.securedFields[c]=f}))}export{y as createCardSecuredFields,m as createNonCardSecuredFields,f as createSecuredFields,g as setupSecuredField};
|
|
2
2
|
//# sourceMappingURL=createSecuredFields.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getCardGroupTypes as i}from"../utils/getCardGroupTypes.js";import{NON_CREDIT_CARD_TYPE_SECURED_FIELDS as o,SF_VERSION as t}from"../../constants.js";import{warn as n}from"../../utilities/logger.js";function e(e){this.config.cardGroupTypes=i(e.cardGroupTypes);const r=e.loadingContext;if(!r)return void n("WARNING Config :: no loadingContext has been specified!");var
|
|
1
|
+
import{getCardGroupTypes as i}from"../utils/getCardGroupTypes.js";import{NON_CREDIT_CARD_TYPE_SECURED_FIELDS as o,SF_VERSION as t}from"../../constants.js";import{warn as n}from"../../utilities/logger.js";function e(e){this.config.cardGroupTypes=i(e.cardGroupTypes);const r=e.loadingContext;if(!r)return void n("WARNING Config :: no loadingContext has been specified!");var s;this.config.loadingContext="/"===(s=r).charAt(s.length-1)?r:`${r}/`,this.config.isCreditCardType=!1===o.includes(e.type),this.config.iframeUIConfig=e.iframeUIConfig??{},this.config.autoFocus=!(!1===e.autoFocus||"false"===e.autoFocus),this.config.showWarnings=!0===e.showWarnings||"true"===e.showWarnings,this.config.trimTrailingSeparator=!(!1===e.trimTrailingSeparator||"false"===e.trimTrailingSeparator),this.config.keypadFix=!(!1===e.keypadFix||"false"===e.keypadFix),this.config.legacyInputMode=e.legacyInputMode||null,this.config.minimumExpiryDate=e.minimumExpiryDate||null,this.config.sfLogAtStart=!0===window._b$dl;const a=this.config.isCreditCardType?"card":e.type,c=btoa(window.location.origin),g=`${a}${!!e.forceCompat||!("function"==typeof window.TextEncoder)?"Compat":""}`;this.config.iframeSrc=`${this.config.loadingContext}securedfields/${e.clientKey}/${t}/securedFields.html?type=${g}&d=${c}`}export{e as handleConfig};
|
|
2
2
|
//# sourceMappingURL=handleConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleConfig.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.ts"],"sourcesContent":["import { getCardGroupTypes } from '../utils/getCardGroupTypes';\nimport { NON_CREDIT_CARD_TYPE_SECURED_FIELDS, SF_VERSION } from '../../constants';\nimport * as logger from '../../utilities/logger';\nimport { CSFSetupObject } from '../types';\n\n/**\n * Parses this.props to set 'config' type vars on this (CSFComp)\n * - properties that just need to be set once, at startup, and then don't change\n *\n * See interface CSFConfigObject in types.ts\n */\nexport function handleConfig(props: CSFSetupObject): void {\n // --\n this.config.cardGroupTypes = getCardGroupTypes(props.cardGroupTypes);\n\n if (process.env.NODE_ENV === 'development' && window._b$dl) {\n logger.log('### StoreCls::init:: this.config.cardGroupTypes=', this.config.cardGroupTypes);\n }\n\n const loadingContext: string = props.loadingContext;\n\n if (!loadingContext) {\n logger.warn('WARNING Config :: no loadingContext has been specified!');\n return;\n }\n\n // Ensure passed loadingContext has trailing slash\n const lastChar = str => str.charAt(str.length - 1);\n this.config.loadingContext = lastChar(loadingContext) === '/' ? loadingContext : `${loadingContext}/`;\n\n // Is this for the regular creditCard or for another use-case for securedFields e.g. 'ach' or 'giftcard'\n this.config.isCreditCardType = NON_CREDIT_CARD_TYPE_SECURED_FIELDS.includes(props.type) === false;\n\n // Configuration object for individual txVariants - contains styling object values for securedFields inputs\n this.config.iframeUIConfig = props.iframeUIConfig ?? {};\n\n // By default CSF is allowed to automatically shift focus from the date to CVC fields - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.autoFocus = !(props.autoFocus === false || props.autoFocus === 'false');\n\n // By default CSF will NOT perform a console.warn when receiving postMessages with origin or numKey mismatches - user of CSF must explicitly 'opt-in' to get this\n this.config.showWarnings = props.showWarnings === true || props.showWarnings === 'true';\n\n // By default CSF will strip the trailing separator character from valid credit card numbers - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.trimTrailingSeparator = !(props.trimTrailingSeparator === false || props.trimTrailingSeparator === 'false');\n\n // By default CSF is allowed to add a fix for iOS to force the keypad to retract - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.keypadFix = !(props.keypadFix === false || props.keypadFix === 'false');\n\n // To set the type on the iframe input fields to 'tel' c.f. the default 'text' (with inputmode='numeric')\n this.config.legacyInputMode = props.legacyInputMode || null;\n\n // To configure the minimum expiry date to a merchant defined value - this means the card has to be valid until at least this date\n this.config.minimumExpiryDate = props.minimumExpiryDate || null;\n\n this.config.sfLogAtStart = window._b$dl === true;\n\n
|
|
1
|
+
{"version":3,"file":"handleConfig.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.ts"],"sourcesContent":["import { getCardGroupTypes } from '../utils/getCardGroupTypes';\nimport { NON_CREDIT_CARD_TYPE_SECURED_FIELDS, SF_VERSION } from '../../constants';\nimport * as logger from '../../utilities/logger';\nimport { CSFSetupObject } from '../types';\n\n/**\n * Parses this.props to set 'config' type vars on this (CSFComp)\n * - properties that just need to be set once, at startup, and then don't change\n *\n * See interface CSFConfigObject in types.ts\n */\nexport function handleConfig(props: CSFSetupObject): void {\n // --\n this.config.cardGroupTypes = getCardGroupTypes(props.cardGroupTypes);\n\n if (process.env.NODE_ENV === 'development' && window._b$dl) {\n logger.log('### StoreCls::init:: this.config.cardGroupTypes=', this.config.cardGroupTypes);\n }\n\n const loadingContext: string = props.loadingContext;\n\n if (!loadingContext) {\n logger.warn('WARNING Config :: no loadingContext has been specified!');\n return;\n }\n\n // Ensure passed loadingContext has trailing slash\n const lastChar = str => str.charAt(str.length - 1);\n this.config.loadingContext = lastChar(loadingContext) === '/' ? loadingContext : `${loadingContext}/`;\n\n // Is this for the regular creditCard or for another use-case for securedFields e.g. 'ach' or 'giftcard'\n this.config.isCreditCardType = NON_CREDIT_CARD_TYPE_SECURED_FIELDS.includes(props.type) === false;\n\n // Configuration object for individual txVariants - contains styling object values for securedFields inputs\n this.config.iframeUIConfig = props.iframeUIConfig ?? {};\n\n // By default CSF is allowed to automatically shift focus from the date to CVC fields - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.autoFocus = !(props.autoFocus === false || props.autoFocus === 'false');\n\n // By default CSF will NOT perform a console.warn when receiving postMessages with origin or numKey mismatches - user of CSF must explicitly 'opt-in' to get this\n this.config.showWarnings = props.showWarnings === true || props.showWarnings === 'true';\n\n // By default CSF will strip the trailing separator character from valid credit card numbers - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.trimTrailingSeparator = !(props.trimTrailingSeparator === false || props.trimTrailingSeparator === 'false');\n\n // By default CSF is allowed to add a fix for iOS to force the keypad to retract - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.keypadFix = !(props.keypadFix === false || props.keypadFix === 'false');\n\n // To set the type on the iframe input fields to 'tel' c.f. the default 'text' (with inputmode='numeric')\n this.config.legacyInputMode = props.legacyInputMode || null;\n\n // To configure the minimum expiry date to a merchant defined value - this means the card has to be valid until at least this date\n this.config.minimumExpiryDate = props.minimumExpiryDate || null;\n\n this.config.sfLogAtStart = window._b$dl === true;\n\n const sfBundleType: string = this.config.isCreditCardType ? 'card' : props.type;\n\n // Add a hash of the origin to ensure urls are different across domains\n const d = btoa(window.location.origin);\n\n /**\n * Unless we are forcing the use of the compat version via card config\n * - detect Edge vn \\<= 18 & IE11 - who don't support TextEncoder; and use this as an indicator to load a different, compatible, version of SF\n */\n const needsJWECompatVersion = props.forceCompat ? true : !(typeof window.TextEncoder === 'function');\n\n const bundleType = `${sfBundleType}${needsJWECompatVersion ? 'Compat' : ''}`; // e.g. 'card' or 'cardCompat'\n\n this.config.iframeSrc = `${this.config.loadingContext}securedfields/${props.clientKey}/${SF_VERSION}/securedFields.html?type=${bundleType}&d=${d}`;\n\n // TODO###### FOR QUICK LOCAL TESTING of sf\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n this.config.iframeSrc = `${process.env.__SF_ENV__}securedFields.${SF_VERSION}.html?type=${sfBundleType}`;\n }\n // TODO######\n}\n"],"names":["handleConfig","props","this","config","cardGroupTypes","getCardGroupTypes","loadingContext","logger","str","charAt","length","isCreditCardType","NON_CREDIT_CARD_TYPE_SECURED_FIELDS","includes","type","iframeUIConfig","autoFocus","showWarnings","trimTrailingSeparator","keypadFix","legacyInputMode","minimumExpiryDate","sfLogAtStart","window","_b$dl","sfBundleType","d","btoa","location","origin","bundleType","forceCompat","TextEncoder","iframeSrc","clientKey","SF_VERSION"],"mappings":"4MAWO,SAASA,EAAaC,GAEzBC,KAAKC,OAAOC,eAAiBC,EAAkBJ,EAAMG,gBAMrD,MAAME,EAAyBL,EAAMK,eAErC,IAAKA,EAED,YADAC,EAAY,2DAKCC,IAAAA,EACjBN,KAAKC,OAAOG,eAA8C,OADzCE,EACqBF,GADVG,OAAOD,EAAIE,OAAS,GACgBJ,EAAiB,GAAGA,KAGpFJ,KAAKC,OAAOQ,kBAAgF,IAA7DC,EAAoCC,SAASZ,EAAMa,MAGlFZ,KAAKC,OAAOY,eAAiBd,EAAMc,gBAAkB,CAAC,EAGtDb,KAAKC,OAAOa,aAAkC,IAApBf,EAAMe,WAA2C,UAApBf,EAAMe,WAG7Dd,KAAKC,OAAOc,cAAsC,IAAvBhB,EAAMgB,cAAgD,SAAvBhB,EAAMgB,aAGhEf,KAAKC,OAAOe,yBAA0D,IAAhCjB,EAAMiB,uBAAmE,UAAhCjB,EAAMiB,uBAGrFhB,KAAKC,OAAOgB,aAAkC,IAApBlB,EAAMkB,WAA2C,UAApBlB,EAAMkB,WAG7DjB,KAAKC,OAAOiB,gBAAkBnB,EAAMmB,iBAAmB,KAGvDlB,KAAKC,OAAOkB,kBAAoBpB,EAAMoB,mBAAqB,KAE3DnB,KAAKC,OAAOmB,cAAgC,IAAjBC,OAAOC,MAElC,MAAMC,EAAuBvB,KAAKC,OAAOQ,iBAAmB,OAASV,EAAMa,KAGrEY,EAAIC,KAAKJ,OAAOK,SAASC,QAQzBC,EAAa,GAAGL,MAFQxB,EAAM8B,eAAqD,mBAAvBR,OAAOS,aAEZ,SAAW,KAExE9B,KAAKC,OAAO8B,UAAY,GAAG/B,KAAKC,OAAOG,+BAA+BL,EAAMiC,aAAaC,6BAAsCL,OAAgBJ,GAOnJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"../utils/userAgent.js";import"../../utilities/logger.js";import{shiftTabCreditCard as i}from"../utils/tabbing/tabScenarioCreditCard.js";import{
|
|
1
|
+
import t from"../utils/userAgent.js";import"../../utilities/logger.js";import{shiftTabCreditCard as i}from"../utils/tabbing/tabScenarioCreditCard.js";import{shiftTabGiftCard as s}from"../utils/tabbing/tabScenarioGiftCard.js";import{shiftTabKCP as a}from"../utils/tabbing/tabScenarioKCP.js";import{focusExternalField as e}from"../utils/tabbing/utils.js";var o={handleShiftTab:function(t){let o;if("giftcard"===this.state.type)o=s(t,this.props.rootNode);else o=this.state.isKCP?a(t,this.props.rootNode,this.state.hasSeparateDateFields):i(t,this.props.rootNode,this.state.hasSeparateDateFields,this.state.numIframes);const r=o.fieldToFocus,l=o.additionalField;r?this.setFocusOnFrame(r,false):l&&e(l)},handleSFShiftTab:function(i){(t.__IS_FIREFOX||t.__IS_IE&&t.__IS_IE<=11)&&this.handleShiftTab(i)}};export{o as default};
|
|
2
2
|
//# sourceMappingURL=handleTab.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleTab.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleTab.ts"],"sourcesContent":["import ua from '../utils/userAgent';\nimport * as logger from '../../utilities/logger';\nimport { shiftTabCreditCard } from '../utils/tabbing/tabScenarioCreditCard';\nimport {
|
|
1
|
+
{"version":3,"file":"handleTab.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleTab.ts"],"sourcesContent":["import ua from '../utils/userAgent';\nimport * as logger from '../../utilities/logger';\nimport { shiftTabCreditCard } from '../utils/tabbing/tabScenarioCreditCard';\nimport { shiftTabGiftCard } from '../utils/tabbing/tabScenarioGiftCard';\nimport { shiftTabKCP } from '../utils/tabbing/tabScenarioKCP';\nimport { SFFieldType, ShiftTabObject } from '../../types';\nimport { focusExternalField } from '../utils/tabbing/utils';\n\nconst logTab = false;\n\nfunction handleShiftTab(fieldType: SFFieldType): void {\n if (logTab) logger.log('### handleTab::handleShiftTab:: fieldType', fieldType);\n\n let shiftTabObj: ShiftTabObject;\n\n switch (this.state.type) {\n // GIFT CARD scenario: SecurityCode preceded by CardNumber\n case 'giftcard':\n shiftTabObj = shiftTabGiftCard(fieldType, this.props.rootNode);\n break;\n\n // Credit Card scenarios\n default:\n // KCP scenario: Regular credit card but with additional fields\n // - an encrypted pin/password field preceded by a form field of a non-SF type (d.o.b/taxRefNum)\n if (this.state.isKCP) {\n shiftTabObj = shiftTabKCP(fieldType, this.props.rootNode, this.state.hasSeparateDateFields);\n } else {\n // Regular Credit Card\n shiftTabObj = shiftTabCreditCard(fieldType, this.props.rootNode, this.state.hasSeparateDateFields, this.state.numIframes);\n }\n break;\n }\n\n const fieldToFocus: string = shiftTabObj.fieldToFocus;\n const additionalField: HTMLElement = shiftTabObj.additionalField;\n\n if (fieldToFocus) {\n this.setFocusOnFrame(fieldToFocus, logTab);\n } else if (additionalField) {\n focusExternalField(additionalField);\n }\n}\n\nconst eligibleForTabFix = (): boolean => ua.__IS_FIREFOX || (ua.__IS_IE && ua.__IS_IE <= 11);\n\nfunction handleSFShiftTab(fieldType: SFFieldType): void {\n if (eligibleForTabFix()) {\n this.handleShiftTab(fieldType);\n }\n}\n\nexport default {\n handleShiftTab,\n handleSFShiftTab\n};\n"],"names":["handleTab","handleShiftTab","fieldType","shiftTabObj","this","state","type","shiftTabGiftCard","props","rootNode","isKCP","shiftTabKCP","hasSeparateDateFields","shiftTabCreditCard","numIframes","fieldToFocus","additionalField","setFocusOnFrame","focusExternalField","handleSFShiftTab","ua","__IS_FIREFOX","__IS_IE"],"mappings":"iWAoDA,IAAeA,EAAA,CACXC,eA3CJ,SAAwBC,GAGpB,IAAIC,EAEJ,GAES,aAFDC,KAAKC,MAAMC,KAGXH,EAAcI,EAAiBL,EAAWE,KAAKI,MAAMC,eAQjDN,EADAC,KAAKC,MAAMK,MACGC,EAAYT,EAAWE,KAAKI,MAAMC,SAAUL,KAAKC,MAAMO,uBAGvDC,EAAmBX,EAAWE,KAAKI,MAAMC,SAAUL,KAAKC,MAAMO,sBAAuBR,KAAKC,MAAMS,YAK1H,MAAMC,EAAuBZ,EAAYY,aACnCC,EAA+Bb,EAAYa,gBAE7CD,EACAX,KAAKa,gBAAgBF,EA9Bd,OA+BAC,GACPE,EAAmBF,EAE3B,EAYIG,iBARJ,SAA0BjB,IAFekB,EAAGC,cAAiBD,EAAGE,SAAWF,EAAGE,SAAW,KAIjFlB,KAAKH,eAAeC,EAE5B"}
|
package/dist/es/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processAutoComplete.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.ts"],"sourcesContent":["import postMessageToIframe from '../utils/iframes/postMessageToIframe';\nimport { ENCRYPTED_EXPIRY_DATE, ENCRYPTED_EXPIRY_MONTH, ENCRYPTED_EXPIRY_YEAR } from '../../constants';\nimport { SFFeedbackObj, CardAutoCompleteData } from '../../types';\nimport { hasOwnProperty } from '../../../../../../utils/hasOwnProperty';\nimport getIframeContentWin from '../utils/iframes/getIframeContentWin';\nimport { CSFThisObject } from '../types';\n\n/**\n *\n * @param csfState - comes from initial, partial, implementation\n * @param csfConfig - comes from initial, partial, implementation\n * @param csfCallbacks - comes from initial, partial, implementation\n *\n * @param pFeedbackObj -\n */\nexport function processAutoComplete({ csfState, csfConfig, csfCallbacks }: CSFThisObject, pFeedbackObj: SFFeedbackObj): boolean {\n /**\n * NOTE: It seems Chrome has started autofilling across cross-origin iframes. Have tested as far back as v104 but have no resources to test further back\n * So, in theory for Chrome \\>= v104 we don't need to do any of this, including having special listeners in the securedFields\n */\n\n // Specifically for cc-name (but no reason not to propagate all AC objects to the merchant)\n if (pFeedbackObj.name === 'cc-name') {\n const feedbackObj: SFFeedbackObj = { ...pFeedbackObj };\n delete feedbackObj.numKey;\n const ACFeedbackObj: CardAutoCompleteData = feedbackObj as CardAutoCompleteData;\n csfCallbacks.onAutoComplete(ACFeedbackObj);\n return true;\n }\n\n // Send date info to relevant secured fields (needed for Safari whose Security model won't allow direct population of fields in 3rd party iframes)\n if (pFeedbackObj.name === 'cc-exp') {\n const splittableDateVal = pFeedbackObj.value.replace(/[^0-9]/gi, '/'); // Replace any non-digits with a fwd-slash so we can always split it\n\n const dateValArr: string[] = splittableDateVal.split('/');\n\n if (dateValArr.length !== 2) {\n // To avoid bug in some versions of Safari where date doesn't come through as expected\n return false;\n }\n\n if (dateValArr[0].length === 1) dateValArr[0] = `0${dateValArr[0]}`; // pad, if required\n\n const acMonthVal: string = dateValArr[0];\n\n // Extra checks that passed year is a valid value\n const year = dateValArr[1];\n const isValidYear = (year?.length === 4 || year?.length === 2) && !isNaN(parseInt(year));\n if (!isValidYear) {\n return false;\n }\n\n const acYearVal: string = year.slice(-2); // take last 2 digits of year\n const acDateVal = `${acMonthVal}/${acYearVal}`;\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_DATE,\n autoComplete: acDateVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_DATE].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_DATE), csfConfig.loadingContext);\n return true;\n }\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_MONTH)) {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_MONTH,\n autoComplete: acMonthVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_MONTH].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_MONTH), csfConfig.loadingContext);\n }\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_YEAR)) {\n // Dirty! - Need to wait til next page draw if setting month and year at the same time, otherwise only year gets set\n setTimeout(() => {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_YEAR,\n autoComplete: acYearVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_YEAR].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_YEAR), csfConfig.loadingContext);\n }, 0);\n }\n return true;\n }\n\n return false;\n}\n"],"names":["processAutoComplete","csfState","csfConfig","csfCallbacks","pFeedbackObj","name","feedbackObj","numKey","ACFeedbackObj","onAutoComplete","dateValArr","value","replace","split","length","acMonthVal","year","isNaN","parseInt","acYearVal","slice","acDateVal","hasOwnProperty","securedFields","ENCRYPTED_EXPIRY_DATE","dataObj","txVariant","type","fieldType","autoComplete","postMessageToIframe","getIframeContentWin","loadingContext","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","setTimeout"],"mappings":"2SAeO,SAASA,GAAoBC,SAAEA,EAAQC,UAAEA,EAASC,aAAEA,GAA+BC,GAOtF,GAA0B,YAAtBA,EAAaC,KAAoB,CACjC,MAAMC,EAA6B,IAAKF,UACjCE,EAAYC,OACnB,MAAMC,EAAsCF,EAE5C,OADAH,EAAaM,eAAeD,IACrB,CACX,CAGA,GAA0B,WAAtBJ,EAAaC,KAAmB,CAChC,MAEMK,EAFoBN,EAAaO,MAAMC,QAAQ,WAAY,KAElBC,MAAM,KAErD,GAA0B,IAAtBH,EAAWI,OAEX,OAAO,EAGkB,IAAzBJ,EAAW,GAAGI,SAAcJ,EAAW,GAAK,IAAIA,EAAW,MAE/D,MAAMK,EAAqBL,EAAW,GAGhCM,EAAON,EAAW,GAExB,MADsC,IAAjBM,GAAMF,QAAiC,IAAjBE,GAAMF,UAAkBG,MAAMC,SAASF,KAE9E,OAAO,EAGX,MAAMG,EAAoBH,EAAKI,
|
|
1
|
+
{"version":3,"file":"processAutoComplete.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.ts"],"sourcesContent":["import postMessageToIframe from '../utils/iframes/postMessageToIframe';\nimport { ENCRYPTED_EXPIRY_DATE, ENCRYPTED_EXPIRY_MONTH, ENCRYPTED_EXPIRY_YEAR } from '../../constants';\nimport { SFFeedbackObj, CardAutoCompleteData } from '../../types';\nimport { hasOwnProperty } from '../../../../../../utils/hasOwnProperty';\nimport getIframeContentWin from '../utils/iframes/getIframeContentWin';\nimport { CSFThisObject } from '../types';\n\n/**\n *\n * @param csfState - comes from initial, partial, implementation\n * @param csfConfig - comes from initial, partial, implementation\n * @param csfCallbacks - comes from initial, partial, implementation\n *\n * @param pFeedbackObj -\n */\nexport function processAutoComplete({ csfState, csfConfig, csfCallbacks }: CSFThisObject, pFeedbackObj: SFFeedbackObj): boolean {\n /**\n * NOTE: It seems Chrome has started autofilling across cross-origin iframes. Have tested as far back as v104 but have no resources to test further back\n * So, in theory for Chrome \\>= v104 we don't need to do any of this, including having special listeners in the securedFields\n */\n\n // Specifically for cc-name (but no reason not to propagate all AC objects to the merchant)\n if (pFeedbackObj.name === 'cc-name') {\n const feedbackObj: SFFeedbackObj = { ...pFeedbackObj };\n delete feedbackObj.numKey;\n const ACFeedbackObj: CardAutoCompleteData = feedbackObj as CardAutoCompleteData;\n csfCallbacks.onAutoComplete(ACFeedbackObj);\n return true;\n }\n\n // Send date info to relevant secured fields (needed for Safari whose Security model won't allow direct population of fields in 3rd party iframes)\n if (pFeedbackObj.name === 'cc-exp') {\n const splittableDateVal = pFeedbackObj.value.replace(/[^0-9]/gi, '/'); // Replace any non-digits with a fwd-slash so we can always split it\n\n const dateValArr: string[] = splittableDateVal.split('/');\n\n if (dateValArr.length !== 2) {\n // To avoid bug in some versions of Safari where date doesn't come through as expected\n return false;\n }\n\n if (dateValArr[0].length === 1) dateValArr[0] = `0${dateValArr[0]}`; // pad, if required\n\n const acMonthVal: string = dateValArr[0];\n\n // Extra checks that passed year is a valid value\n const year = dateValArr[1];\n const isValidYear = (year?.length === 4 || year?.length === 2) && !isNaN(parseInt(year));\n if (!isValidYear) {\n return false;\n }\n\n const acYearVal: string = year.slice(-2); // take last 2 digits of year\n const acDateVal = `${acMonthVal}/${acYearVal}`;\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_DATE,\n autoComplete: acDateVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_DATE].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_DATE), csfConfig.loadingContext);\n return true;\n }\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_MONTH)) {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_MONTH,\n autoComplete: acMonthVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_MONTH].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_MONTH), csfConfig.loadingContext);\n }\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_YEAR)) {\n // Dirty! - Need to wait til next page draw if setting month and year at the same time, otherwise only year gets set\n setTimeout(() => {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_YEAR,\n autoComplete: acYearVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_YEAR].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_YEAR), csfConfig.loadingContext);\n }, 0);\n }\n return true;\n }\n\n return false;\n}\n"],"names":["processAutoComplete","csfState","csfConfig","csfCallbacks","pFeedbackObj","name","feedbackObj","numKey","ACFeedbackObj","onAutoComplete","dateValArr","value","replace","split","length","acMonthVal","year","isNaN","parseInt","acYearVal","slice","acDateVal","hasOwnProperty","securedFields","ENCRYPTED_EXPIRY_DATE","dataObj","txVariant","type","fieldType","autoComplete","postMessageToIframe","getIframeContentWin","loadingContext","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","setTimeout"],"mappings":"2SAeO,SAASA,GAAoBC,SAAEA,EAAQC,UAAEA,EAASC,aAAEA,GAA+BC,GAOtF,GAA0B,YAAtBA,EAAaC,KAAoB,CACjC,MAAMC,EAA6B,IAAKF,UACjCE,EAAYC,OACnB,MAAMC,EAAsCF,EAE5C,OADAH,EAAaM,eAAeD,IACrB,CACX,CAGA,GAA0B,WAAtBJ,EAAaC,KAAmB,CAChC,MAEMK,EAFoBN,EAAaO,MAAMC,QAAQ,WAAY,KAElBC,MAAM,KAErD,GAA0B,IAAtBH,EAAWI,OAEX,OAAO,EAGkB,IAAzBJ,EAAW,GAAGI,SAAcJ,EAAW,GAAK,IAAIA,EAAW,MAE/D,MAAMK,EAAqBL,EAAW,GAGhCM,EAAON,EAAW,GAExB,MADsC,IAAjBM,GAAMF,QAAiC,IAAjBE,GAAMF,UAAkBG,MAAMC,SAASF,KAE9E,OAAO,EAGX,MAAMG,EAAoBH,EAAKI,UACzBC,EAAY,GAAGN,KAAcI,IAEnC,GAAIG,EAAerB,EAASsB,cAAeC,GAAwB,CAC/D,MAAMC,EAAkB,CACpBC,UAAWzB,EAAS0B,KACpBC,UAAWJ,EACXK,aAAcR,EACdd,OAAQN,EAASsB,cAAcC,GAAuBjB,QAG1D,OADAuB,EAAoBL,EAASM,EAAoB9B,EAAUuB,GAAwBtB,EAAU8B,iBACtF,CACX,CAEA,GAAIV,EAAerB,EAASsB,cAAeU,GAAyB,CAChE,MAAMR,EAAkB,CACpBC,UAAWzB,EAAS0B,KACpBC,UAAWK,EACXJ,aAAcd,EACdR,OAAQN,EAASsB,cAAcU,GAAwB1B,QAE3DuB,EAAoBL,EAASM,EAAoB9B,EAAUgC,GAAyB/B,EAAU8B,eAClG,CAcA,OAZIV,EAAerB,EAASsB,cAAeW,IAEvCC,YAAW,KACP,MAAMV,EAAkB,CACpBC,UAAWzB,EAAS0B,KACpBC,UAAWM,EACXL,aAAcV,EACdZ,OAAQN,EAASsB,cAAcW,GAAuB3B,QAE1DuB,EAAoBL,EAASM,EAAoB9B,EAAUiC,GAAwBhC,EAAU8B,eAAc,GAC5G,IAEA,CACX,CAEA,OAAO,CACX"}
|
package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postMessageValidation.js","sources":["../../../../../../../../../src/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.ts"],"sourcesContent":["import * as logger from '../../../utilities/logger';\n\nexport const originCheckPassed = (event: MessageEvent, pLoadingContext: string, pShowWarnings: boolean): boolean => {\n const origin = event.origin; // || event.originalEvent.origin;\n\n const isCheckoutUrl: number = pLoadingContext.indexOf('/checkoutshopper/');\n let adyenDomain: string = isCheckoutUrl > -1 ? pLoadingContext.substring(0, isCheckoutUrl) : pLoadingContext;\n\n // Strip trailing /\n const lastCharIndex: number = adyenDomain.length - 1;\n if (adyenDomain.charAt(lastCharIndex) === '/') {\n adyenDomain = adyenDomain.substring(0, lastCharIndex);\n }\n\n if (origin !== adyenDomain) {\n if (pShowWarnings) {\n logger.warn(\n 'WARNING postMessageValidation: postMessage listener for iframe::origin mismatch!\\n Received message with origin:',\n origin,\n 'but the only allowed origin for messages to CSF is',\n adyenDomain,\n '### event.data=',\n event.data\n );\n }\n return false;\n }\n\n return true;\n};\n\n// Catch webpack postMessages responses\nexport const isWebpackPostMsg = (event: MessageEvent): boolean =>\n event.data && event.data.type && typeof event.data.type === 'string' && event.data.type.indexOf('webpack') > -1;\n\n// Catch ChromeVox postMessages responses\nexport const isChromeVoxPostMsg = (event: MessageEvent): boolean => event.data && typeof event.data === 'string' && event.data.indexOf('cvox') > -1;\n"],"names":["originCheckPassed","event","pLoadingContext","pShowWarnings","origin","isCheckoutUrl","indexOf","adyenDomain","substring","lastCharIndex","length","charAt","logger","data","isWebpackPostMsg","type","isChromeVoxPostMsg"],"mappings":"oDAEaA,MAAAA,EAAoB,CAACC,EAAqBC,EAAyBC,KAC5E,MAAMC,EAASH,EAAMG,OAEfC,EAAwBH,EAAgBI,QAAQ,qBACtD,IAAIC,EAAsBF,
|
|
1
|
+
{"version":3,"file":"postMessageValidation.js","sources":["../../../../../../../../../src/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.ts"],"sourcesContent":["import * as logger from '../../../utilities/logger';\n\nexport const originCheckPassed = (event: MessageEvent, pLoadingContext: string, pShowWarnings: boolean): boolean => {\n const origin = event.origin; // || event.originalEvent.origin;\n\n const isCheckoutUrl: number = pLoadingContext.indexOf('/checkoutshopper/');\n let adyenDomain: string = isCheckoutUrl > -1 ? pLoadingContext.substring(0, isCheckoutUrl) : pLoadingContext;\n\n // Strip trailing /\n const lastCharIndex: number = adyenDomain.length - 1;\n if (adyenDomain.charAt(lastCharIndex) === '/') {\n adyenDomain = adyenDomain.substring(0, lastCharIndex);\n }\n\n if (origin !== adyenDomain) {\n if (pShowWarnings) {\n logger.warn(\n 'WARNING postMessageValidation: postMessage listener for iframe::origin mismatch!\\n Received message with origin:',\n origin,\n 'but the only allowed origin for messages to CSF is',\n adyenDomain,\n '### event.data=',\n event.data\n );\n }\n return false;\n }\n\n return true;\n};\n\n// Catch webpack postMessages responses\nexport const isWebpackPostMsg = (event: MessageEvent): boolean =>\n event.data && event.data.type && typeof event.data.type === 'string' && event.data.type.indexOf('webpack') > -1;\n\n// Catch ChromeVox postMessages responses\nexport const isChromeVoxPostMsg = (event: MessageEvent): boolean => event.data && typeof event.data === 'string' && event.data.indexOf('cvox') > -1;\n"],"names":["originCheckPassed","event","pLoadingContext","pShowWarnings","origin","isCheckoutUrl","indexOf","adyenDomain","substring","lastCharIndex","length","charAt","logger","data","isWebpackPostMsg","type","isChromeVoxPostMsg"],"mappings":"oDAEaA,MAAAA,EAAoB,CAACC,EAAqBC,EAAyBC,KAC5E,MAAMC,EAASH,EAAMG,OAEfC,EAAwBH,EAAgBI,QAAQ,qBACtD,IAAIC,EAAsBF,KAAqBH,EAAgBM,UAAU,EAAGH,GAAiBH,EAG7F,MAAMO,EAAwBF,EAAYG,OAAS,EAKnD,MAJ0C,MAAtCH,EAAYI,OAAOF,KACnBF,EAAcA,EAAYC,UAAU,EAAGC,IAGvCL,IAAWG,IACPJ,GACAS,EACI,mHACAR,EACA,qDACAG,EACA,kBACAN,EAAMY,OAGP,EAGJ,EAIEC,EAAoBb,GAC7BA,EAAMY,MAAQZ,EAAMY,KAAKE,MAAmC,iBAApBd,EAAMY,KAAKE,MAAqBd,EAAMY,KAAKE,KAAKT,QAAQ,YAAa,EAGpGU,EAAsBf,GAAiCA,EAAMY,MAA8B,iBAAfZ,EAAMY,MAAqBZ,EAAMY,KAAKP,QAAQ,SAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../../../../../src/components/internal/SecuredFields/lib/CSF/utils/tabbing/utils.ts"],"sourcesContent":["import { selectOne, select } from '../../../utilities/dom';\n\nconst getPreviousTabbableEl = (matchEl, getPrevious = true) => {\n const selStr =\n '*[data-cse], a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), ' +\n 'button:not([disabled]), object, embed, *[tabindex], *[contenteditable]';\n const allPotentialTabEls = Array.prototype.slice.call(select(document, selStr));\n const actualTabEls = [];\n\n allPotentialTabEls.forEach(potentialTabEl => {\n const tabIndex = potentialTabEl.getAttribute('tabindex');\n const isValidTabEl = !tabIndex || parseInt(tabIndex, 10) >= 0; // If tabindex hasn't been set, or is set and is >= 0\n const bounds = potentialTabEl.getBoundingClientRect();\n const hasDimensions = bounds.width > 0 && bounds.height > 0;\n\n if (isValidTabEl && hasDimensions) {\n actualTabEls.push(potentialTabEl);\n }\n });\n\n // Loop through an array until it finds an element based on a test fn, and then return the elements index\n const getIndexThruTest = (arr, testFn) => {\n for (let n = 0; n < arr.length; n += 1) {\n if (testFn(arr[n])) {\n return n;\n }\n }\n return -1;\n };\n\n // Test function\n const isElOrContainsEl = tabEl => tabEl === matchEl || matchEl.contains(tabEl);\n\n // Loop through the actualTabEls array until it finds the matchEl, returning its index\n const matchElIndex = getIndexThruTest(actualTabEls, isElOrContainsEl);\n\n // Are we actually getting the previous element OR the next?\n const indexModifier = getPrevious ? -1 : 1;\n\n return actualTabEls[matchElIndex + indexModifier];\n};\n\nexport const getPreviousTabbableNonSFElement = (passedFieldType, rootNode, getPrevious?) => {\n // --\n const sfEl = selectOne(rootNode, `[data-cse=${passedFieldType}]`);\n return getPreviousTabbableEl(sfEl, getPrevious);\n};\n\nexport const focusExternalField = (pAdditionalField: HTMLElement): void => {\n if (pAdditionalField) {\n pAdditionalField.focus();\n\n // Quirky! - Needed to work in the Components scenario\n pAdditionalField.blur();\n pAdditionalField.focus();\n }\n};\n"],"names":["getPreviousTabbableNonSFElement","passedFieldType","rootNode","getPrevious","matchEl","allPotentialTabEls","Array","prototype","slice","call","select","document","actualTabEls","forEach","potentialTabEl","tabIndex","getAttribute","isValidTabEl","parseInt","bounds","getBoundingClientRect","hasDimensions","width","height","push","matchElIndex","arr","testFn","n","length","getIndexThruTest","tabEl","contains","getPreviousTabbableEl","selectOne","focusExternalField","pAdditionalField","focus","blur"],"mappings":"kEAEA,MAwCaA,EAAkC,CAACC,EAAiBC,EAAUC,IAxC7C,EAACC,EAASD,GAAc,KAClD,MAGME,EAAqBC,MAAMC,UAAUC,MAAMC,KAAKC,EAAOC,SAFzD,sLAGEC,EAAe,GAErBP,EAAmBQ,SAAQC,IACvB,MAAMC,EAAWD,EAAeE,aAAa,YACvCC,GAAgBF,GAAYG,SAASH,EAAU,KAAO,EACtDI,EAASL,EAAeM,wBACxBC,EAAgBF,EAAOG,MAAQ,GAAKH,EAAOI,OAAS,EAEtDN,GAAgBI,GAChBT,EAAaY,KAAKV,EACtB,IAIJ,MAaMW,EAbmB,EAACC,EAAKC,KAC3B,IAAK,IAAIC,EAAI,EAAGA,EAAIF,EAAIG,OAAQD,GAAK,EACjC,GAAID,EAAOD,EAAIE,IACX,OAAOA,EAGf,OAAQ,CAAA,EAOSE,CAAiBlB,GAHbmB,GAASA,IAAU3B,GAAWA,EAAQ4B,SAASD,KAQxE,OAAOnB,EAAaa,GAFEtB,
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../../../../src/components/internal/SecuredFields/lib/CSF/utils/tabbing/utils.ts"],"sourcesContent":["import { selectOne, select } from '../../../utilities/dom';\n\nconst getPreviousTabbableEl = (matchEl, getPrevious = true) => {\n const selStr =\n '*[data-cse], a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), ' +\n 'button:not([disabled]), object, embed, *[tabindex], *[contenteditable]';\n const allPotentialTabEls = Array.prototype.slice.call(select(document, selStr));\n const actualTabEls = [];\n\n allPotentialTabEls.forEach(potentialTabEl => {\n const tabIndex = potentialTabEl.getAttribute('tabindex');\n const isValidTabEl = !tabIndex || parseInt(tabIndex, 10) >= 0; // If tabindex hasn't been set, or is set and is >= 0\n const bounds = potentialTabEl.getBoundingClientRect();\n const hasDimensions = bounds.width > 0 && bounds.height > 0;\n\n if (isValidTabEl && hasDimensions) {\n actualTabEls.push(potentialTabEl);\n }\n });\n\n // Loop through an array until it finds an element based on a test fn, and then return the elements index\n const getIndexThruTest = (arr, testFn) => {\n for (let n = 0; n < arr.length; n += 1) {\n if (testFn(arr[n])) {\n return n;\n }\n }\n return -1;\n };\n\n // Test function\n const isElOrContainsEl = tabEl => tabEl === matchEl || matchEl.contains(tabEl);\n\n // Loop through the actualTabEls array until it finds the matchEl, returning its index\n const matchElIndex = getIndexThruTest(actualTabEls, isElOrContainsEl);\n\n // Are we actually getting the previous element OR the next?\n const indexModifier = getPrevious ? -1 : 1;\n\n return actualTabEls[matchElIndex + indexModifier];\n};\n\nexport const getPreviousTabbableNonSFElement = (passedFieldType, rootNode, getPrevious?) => {\n // --\n const sfEl = selectOne(rootNode, `[data-cse=${passedFieldType}]`);\n return getPreviousTabbableEl(sfEl, getPrevious);\n};\n\nexport const focusExternalField = (pAdditionalField: HTMLElement): void => {\n if (pAdditionalField) {\n pAdditionalField.focus();\n\n // Quirky! - Needed to work in the Components scenario\n pAdditionalField.blur();\n pAdditionalField.focus();\n }\n};\n"],"names":["getPreviousTabbableNonSFElement","passedFieldType","rootNode","getPrevious","matchEl","allPotentialTabEls","Array","prototype","slice","call","select","document","actualTabEls","forEach","potentialTabEl","tabIndex","getAttribute","isValidTabEl","parseInt","bounds","getBoundingClientRect","hasDimensions","width","height","push","matchElIndex","arr","testFn","n","length","getIndexThruTest","tabEl","contains","getPreviousTabbableEl","selectOne","focusExternalField","pAdditionalField","focus","blur"],"mappings":"kEAEA,MAwCaA,EAAkC,CAACC,EAAiBC,EAAUC,IAxC7C,EAACC,EAASD,GAAc,KAClD,MAGME,EAAqBC,MAAMC,UAAUC,MAAMC,KAAKC,EAAOC,SAFzD,sLAGEC,EAAe,GAErBP,EAAmBQ,SAAQC,IACvB,MAAMC,EAAWD,EAAeE,aAAa,YACvCC,GAAgBF,GAAYG,SAASH,EAAU,KAAO,EACtDI,EAASL,EAAeM,wBACxBC,EAAgBF,EAAOG,MAAQ,GAAKH,EAAOI,OAAS,EAEtDN,GAAgBI,GAChBT,EAAaY,KAAKV,EACtB,IAIJ,MAaMW,EAbmB,EAACC,EAAKC,KAC3B,IAAK,IAAIC,EAAI,EAAGA,EAAIF,EAAIG,OAAQD,GAAK,EACjC,GAAID,EAAOD,EAAIE,IACX,OAAOA,EAGf,OAAQ,CAAA,EAOSE,CAAiBlB,GAHbmB,GAASA,IAAU3B,GAAWA,EAAQ4B,SAASD,KAQxE,OAAOnB,EAAaa,GAFEtB,GAAc,EAAK,GAEQ,EAM1C8B,CADMC,EAAUhC,EAAU,aAAaD,MACXE,GAG1BgC,EAAsBC,IAC3BA,IACAA,EAAiBC,QAGjBD,EAAiBE,OACjBF,EAAiBC,QACrB"}
|