@adyen/adyen-web 6.28.0 → 6.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adyen.css +15 -14
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2688 -2566
- package/dist/es/adyen.css +15 -14
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
- package/dist/es/components/Econtext/Econtext.js +1 -1
- package/dist/es/components/Econtext/Econtext.js.map +1 -1
- package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
- package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
- package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js +1 -1
- package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js.map +1 -1
- package/dist/es/components/Giftcard/Giftcard.js +1 -1
- package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es/components/Iris/Iris.js +2 -0
- package/dist/es/components/Iris/Iris.js.map +1 -0
- package/dist/es/components/Iris/components/IrisComponent.js +2 -0
- package/dist/es/components/Iris/components/IrisComponent.js.map +1 -0
- package/dist/es/components/Iris/components/IrisComponent.module.scss.js +2 -0
- package/dist/es/components/Iris/components/IrisComponent.module.scss.js.map +1 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.js +2 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.js.map +1 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.module.scss.js +2 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.module.scss.js.map +1 -0
- package/dist/es/components/Iris/components/IrisQrCodeInstructions.js +2 -0
- package/dist/es/components/Iris/components/IrisQrCodeInstructions.js.map +1 -0
- package/dist/es/components/Iris/constants.js +2 -0
- package/dist/es/components/Iris/constants.js.map +1 -0
- package/dist/es/components/Iris/types.js +2 -0
- package/dist/es/components/Iris/types.js.map +1 -0
- package/dist/es/components/Iris/utils.js +2 -0
- package/dist/es/components/Iris/utils.js.map +1 -0
- package/dist/es/components/PayTo/components/PayToComponent.js +1 -1
- package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es/components/Pix/components/PixQRDetails.js +1 -1
- package/dist/es/components/Pix/components/PixQRDetails.js.map +1 -1
- package/dist/es/components/UPI/UPI.js +1 -1
- package/dist/es/components/UPI/UPI.js.map +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es/components/UPI/constants.js +1 -1
- package/dist/es/components/UPI/constants.js.map +1 -1
- package/dist/es/components/components-name-map.js +1 -1
- package/dist/es/components/components-name-map.js.map +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es/components/index.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/Countdown/index.js +1 -1
- package/dist/es/components/internal/Countdown/index.js.map +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
- package/dist/es/components/internal/QRLoader/components/QRDetails.js +1 -1
- package/dist/es/components/internal/QRLoader/components/QRDetails.js.map +1 -1
- package/dist/es/components/internal/QRLoader/components/QRImage.js +1 -1
- package/dist/es/components/internal/QRLoader/components/QRImage.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js +2 -0
- package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -0
- package/dist/es/components/internal/Voucher/Voucher.js +1 -1
- package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
- package/dist/es/components/internal/Voucher/utils.js.map +1 -1
- package/dist/es/components/tx-variants.js +1 -1
- package/dist/es/components/tx-variants.js.map +1 -1
- package/dist/es/core/Analytics/Analytics.js +1 -1
- package/dist/es/core/Analytics/Analytics.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/utils.js +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/index.d.ts +2688 -2566
- package/dist/es/index.js +1 -1
- package/dist/es/language/Language.js.map +1 -1
- package/dist/es/utils/createSdkData.js +2 -0
- package/dist/es/utils/createSdkData.js.map +1 -0
- package/dist/es-legacy/adyen.css +15 -14
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/utils/payment-request.js +1 -1
- package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js.map +1 -1
- package/dist/es-legacy/components/Card/Card.js +1 -1
- package/dist/es-legacy/components/Card/Card.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
- package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
- package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/requests.js +1 -1
- package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
- package/dist/es-legacy/components/Iris/Iris.js +2 -0
- package/dist/es-legacy/components/Iris/Iris.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.module.scss.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.module.scss.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.module.scss.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.module.scss.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisQrCodeInstructions.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisQrCodeInstructions.js.map +1 -0
- package/dist/es-legacy/components/Iris/constants.js +2 -0
- package/dist/es-legacy/components/Iris/constants.js.map +1 -0
- package/dist/es-legacy/components/Iris/types.js +2 -0
- package/dist/es-legacy/components/Iris/types.js.map +1 -0
- package/dist/es-legacy/components/Iris/utils.js +2 -0
- package/dist/es-legacy/components/Iris/utils.js.map +1 -0
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es-legacy/components/Pix/components/PixQRDetails.js +1 -1
- package/dist/es-legacy/components/Pix/components/PixQRDetails.js.map +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
- package/dist/es-legacy/components/UPI/UPI.js +1 -1
- package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es-legacy/components/UPI/constants.js +1 -1
- package/dist/es-legacy/components/UPI/constants.js.map +1 -1
- package/dist/es-legacy/components/components-name-map.js +1 -1
- package/dist/es-legacy/components/components-name-map.js.map +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/index.js +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
- package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
- package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
- package/dist/es-legacy/components/internal/Countdown/index.js +1 -1
- package/dist/es-legacy/components/internal/Countdown/index.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
- package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
- package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRDetails.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRImage.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRImage.js.map +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js +2 -0
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -0
- package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js +1 -1
- package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
- package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
- package/dist/es-legacy/components/internal/Voucher/utils.js.map +1 -1
- package/dist/es-legacy/components/tx-variants.js +1 -1
- package/dist/es-legacy/components/tx-variants.js.map +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js +1 -1
- package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
- package/dist/es-legacy/core/Context/Resources.js +1 -1
- package/dist/es-legacy/core/Context/Resources.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
- package/dist/es-legacy/index.js +1 -1
- package/dist/es-legacy/language/Language.js.map +1 -1
- package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
- package/dist/es-legacy/utils/commonUtils.js.map +1 -1
- package/dist/es-legacy/utils/createSdkData.js +2 -0
- package/dist/es-legacy/utils/createSdkData.js.map +1 -0
- package/dist/es-legacy/utils/useForm/reducer.js +1 -1
- package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
- package/package.json +12 -12
- package/styles/adyen.css +15 -14
- package/dist/es/components/UPI/components/VpaInput/VpaInput.js +0 -2
- package/dist/es/components/UPI/components/VpaInput/VpaInput.js.map +0 -1
- package/dist/es/components/UPI/components/VpaInput/validate.js +0 -2
- package/dist/es/components/UPI/components/VpaInput/validate.js.map +0 -1
- package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js +0 -2
- package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js.map +0 -1
- package/dist/es-legacy/components/UPI/components/VpaInput/validate.js +0 -2
- package/dist/es-legacy/components/UPI/components/VpaInput/validate.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import{usePaymentStatusTimer as o}from"../../../hooks/usePaymentStatusTimer/usePaymentStatusTimer.js";import{DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS as r,DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS as a,DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS as n,DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN as i}from"../../../hooks/usePaymentStatusTimer/constants.js";import c from"../../../utils/useAutoFocus.js";import
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import{usePaymentStatusTimer as o}from"../../../hooks/usePaymentStatusTimer/usePaymentStatusTimer.js";import{DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS as r,DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS as a,DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS as n,DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN as i}from"../../../hooks/usePaymentStatusTimer/constants.js";import c from"../../../utils/useAutoFocus.js";import d from"../Button/Button.js";import l from"../ContentSeparator/ContentSeparator.js";import{AnalyticsInfoEvent as s,UiTarget as m,InfoEventType as p}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";import u from"../Spinner/Spinner.js";import{QRDetails as y}from"./components/QRDetails.js";import{QRFinalState as _}from"./components/QRFinalState.js";import{QRLoaderDetailsProvider as h}from"./QRLoaderDetailsProvider.js";import{redirectToApp as g}from"../../../utils/urls.js";function f(r){const{i18n:a,loadingContext:n}=t(),{state:i,actions:f}=o({loadingContext:n,paymentData:r.paymentData,clientKey:r.clientKey,delay:r.delay,throttleTime:r.throttleTime,throttleInterval:r.throttledInterval,type:r.type,onError:r.onError,onComplete:r.onComplete,onActionHandled:r.onActionHandled}),{completed:q,expired:C,loading:k,percentage:b}=i,{onTick:T,onTimeUp:v}=f,{amount:j,showAmount:N,url:w,brandLogo:A,brandName:D,countdownTime:I,type:P,onActionHandled:S}=r,x=r.qrCodeData?`${n}utility/v1/barcode.png?type=qrCode&data=${r.qrCodeData}&clientKey=${r.clientKey}`:r.qrCodeImage,$=c();if(C)return e(_,{image:"error",message:a.get("error.subtitle.payment")});if(q)return e(_,{image:"success",message:a.get("creditCard.success")});if(k)return e("div",{className:"adyen-checkout__qr-loader"},A&&e("div",{className:"adyen-checkout__qr-loader__brand-logo-wrapper"},e("img",{alt:D,src:A,className:"adyen-checkout__qr-loader__brand-logo"})),e(u,null));const B=r.classNameModifiers.map(e=>`adyen-checkout__qr-loader--${e}`);return e("div",{className:`adyen-checkout__qr-loader adyen-checkout__qr-loader--${P} ${B.join(" ")}`,"data-testid":`${P}-qr-loader`},A&&e("div",{className:"adyen-checkout__qr-loader__brand-logo-wrapper"},e("img",{src:A,alt:D,className:"adyen-checkout__qr-loader__brand-logo"})),N&&j&&null!==j.value&&!!j.currency&&e("h1",{className:"adyen-checkout__qr-loader__payment_amount"},a.amount(j.value,j.currency)),w&&e("div",{className:"adyen-checkout__qr-loader__app-link"},r.redirectIntroduction&&e("p",{className:"adyen-checkout__qr-loader__subtitle"},a.get(r.redirectIntroduction)),e(d,{classNameModifiers:["qr-loader"],onClick:()=>g(w),label:a.get(r.buttonLabel)}),e(l,null)),e("p",{ref:$,tabIndex:0,className:"adyen-checkout__qr-loader__subtitle"},"string"==typeof r.introduction?a.get(r.introduction):r.introduction?.()),e(h,{type:P,qrCodeImage:x,qrCodeData:r.qrCodeData,percentage:b,timeToPay:r.timeToPay,copyBtn:r.copyBtn,instructions:r.instructions,countdownTime:I,onTick:e=>T(e),onQRCodeLoad:()=>{S?.({componentType:r.type,actionDescription:"qr-code-loaded"})},onTimeUp:()=>v(),handleCopy:()=>{const e=new s({component:r.type,type:p.download,target:m.qrDownloadButton});r.onSubmitAnalytics(e)}},r.children?r.children:e(y,null)))}f.defaultProps={countdownTime:i,delay:n,throttleTime:a,throttledInterval:r,onError:()=>{},onComplete:()=>{},classNameModifiers:[],introduction:"wechatpay.scanqrcode",timeToPay:"wechatpay.timetopay",buttonLabel:"openApp",showAmount:!0};export{f as QRLoader};
|
|
2
2
|
//# sourceMappingURL=QRLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRLoader.js","sources":["../../../../../src/components/internal/QRLoader/QRLoader.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport {\n usePaymentStatusTimer,\n DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from '../../../hooks/usePaymentStatusTimer';\nimport useAutoFocus from '../../../utils/useAutoFocus';\nimport Button from '../Button';\nimport ContentSeparator from '../ContentSeparator';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { CountdownTime } from '../Countdown/types';\nimport Spinner from '../Spinner';\nimport { QRDetails } from './components/QRDetails';\nimport { QRFinalState } from './components/QRFinalState';\nimport { QRLoaderDetailsProvider } from './QRLoaderDetailsProvider';\nimport { QRLoaderProps } from './types';\nimport { redirectToApp } from '../../../utils/urls';\nimport './QRLoader.scss';\n\nconst QRCODE_URL = 'utility/v1/barcode.png?type=qrCode&data=';\n\nexport function QRLoader(props: QRLoaderProps) {\n const { i18n, loadingContext } = useCoreContext();\n\n const { state: timerState, actions: timerActions } = usePaymentStatusTimer({\n loadingContext,\n paymentData: props.paymentData,\n clientKey: props.clientKey,\n delay: props.delay,\n throttleTime: props.throttleTime,\n throttleInterval: props.throttledInterval,\n type: props.type,\n onError: props.onError,\n onComplete: props.onComplete,\n onActionHandled: props.onActionHandled\n });\n\n const { completed, expired, loading, percentage } = timerState;\n const { onTick, onTimeUp } = timerActions;\n\n const { amount, showAmount, url, brandLogo, brandName, countdownTime, type, onActionHandled } = props;\n\n const qrCodeImage = props.qrCodeData ? `${loadingContext}${QRCODE_URL}${props.qrCodeData}&clientKey=${props.clientKey}` : props.qrCodeImage;\n\n const handleCopy = () => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.download,\n target: UiTarget.qrDownloadButton\n });\n props.onSubmitAnalytics(event);\n };\n\n const onQrCodeLoad = () => {\n onActionHandled?.({\n componentType: props.type,\n actionDescription: 'qr-code-loaded'\n });\n };\n\n const qrSubtitleRef = useAutoFocus();\n\n if (expired) {\n return <QRFinalState image=\"error\" message={i18n.get('error.subtitle.payment')} />;\n }\n\n if (completed) {\n return <QRFinalState image=\"success\" message={i18n.get('creditCard.success')} />;\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__qr-loader\">\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img alt={brandName} src={brandLogo} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n <Spinner />\n </div>\n );\n }\n\n const classnames = props.classNameModifiers.map(m => `adyen-checkout__qr-loader--${m}`);\n\n return (\n <div className={`adyen-checkout__qr-loader adyen-checkout__qr-loader--${type} ${classnames.join(' ')}`}>\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img src={brandLogo} alt={brandName} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n\n {showAmount && amount && amount.value !== null && !!amount.currency && (\n <h1 className=\"adyen-checkout__qr-loader__payment_amount\">{i18n.amount(amount.value, amount.currency)}</h1>\n )}\n\n {url && (\n <div className=\"adyen-checkout__qr-loader__app-link\">\n {props.redirectIntroduction && <p className=\"adyen-checkout__qr-loader__subtitle\">{i18n.get(props.redirectIntroduction)}</p>}\n <Button classNameModifiers={['qr-loader']} onClick={() => redirectToApp(url)} label={i18n.get(props.buttonLabel)} />\n <ContentSeparator />\n </div>\n )}\n\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <p ref={qrSubtitleRef} tabIndex={0} className=\"adyen-checkout__qr-loader__subtitle\">\n {typeof props.introduction === 'string' ? i18n.get(props.introduction) : props.introduction?.()}\n </p>\n\n <QRLoaderDetailsProvider\n qrCodeImage={qrCodeImage}\n qrCodeData={props.qrCodeData}\n percentage={percentage}\n timeToPay={props.timeToPay}\n copyBtn={props.copyBtn}\n instructions={props.instructions}\n countdownTime={countdownTime}\n onTick={(time: CountdownTime) => onTick(time)}\n onQRCodeLoad={onQrCodeLoad}\n onTimeUp={() => onTimeUp()}\n handleCopy={handleCopy}\n >\n {props.children ? props.children : <QRDetails />}\n </QRLoaderDetailsProvider>\n </div>\n );\n}\n\nQRLoader.defaultProps = {\n countdownTime: DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n delay: DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n throttleTime: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS,\n throttledInterval: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n onError: () => {},\n onComplete: () => {},\n classNameModifiers: [],\n introduction: 'wechatpay.scanqrcode',\n timeToPay: 'wechatpay.timetopay',\n buttonLabel: 'openApp',\n showAmount: true\n};\n"],"names":["QRLoader","props","i18n","loadingContext","useCoreContext","state","timerState","actions","timerActions","usePaymentStatusTimer","paymentData","clientKey","delay","throttleTime","throttleInterval","throttledInterval","type","onError","onComplete","onActionHandled","completed","expired","loading","percentage","onTick","onTimeUp","amount","showAmount","url","brandLogo","brandName","countdownTime","qrCodeImage","qrCodeData","qrSubtitleRef","useAutoFocus","h","QRFinalState","image","message","get","div","className","img","alt","src","Spinner","classnames","classNameModifiers","map","m","join","value","currency","h1","redirectIntroduction","p","Button","onClick","redirectToApp","label","buttonLabel","ContentSeparator","ref","tabIndex","introduction","QRLoaderDetailsProvider","timeToPay","copyBtn","instructions","time","onQRCodeLoad","componentType","actionDescription","handleCopy","event","AnalyticsInfoEvent","component","InfoEventType","download","target","UiTarget","qrDownloadButton","onSubmitAnalytics","children","QRDetails","defaultProps","DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS"],"mappings":"shCAwBO,SAASA,EAASC,GACrB,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,KAEzBC,MAAOC,EAAYC,QAASC,GAAiBC,EAAsB,CACvEN,iBACAO,YAAaT,EAAMS,YACnBC,UAAWV,EAAMU,UACjBC,MAAOX,EAAMW,MACbC,aAAcZ,EAAMY,aACpBC,iBAAkBb,EAAMc,kBACxBC,KAAMf,EAAMe,KACZC,QAAShB,EAAMgB,QACfC,WAAYjB,EAAMiB,WAClBC,gBAAiBlB,EAAMkB,mBAGrBC,UAAEA,EAASC,QAAEA,EAAOC,QAAEA,EAAOC,WAAEA,GAAejB,GAC9CkB,OAAEA,EAAMC,SAAEA,GAAajB,GAEvBkB,OAAEA,EAAMC,WAAEA,EAAUC,IAAEA,EAAGC,UAAEA,EAASC,UAAEA,EAASC,cAAEA,EAAaf,KAAEA,EAAIG,gBAAEA,GAAoBlB,EAE1F+B,EAAc/B,EAAMgC,WAAa,GAAG9B,4CAA8BF,EAAMgC,wBAAwBhC,EAAMU,YAAcV,EAAM+B,YAkB1HE,EAAgBC,IAEtB,GAAId,EACA,OAAOe,EAACC,EAAAA,CAAaC,MAAM,QAAQC,QAASrC,EAAKsC,IAAI,4BAGzD,GAAIpB,EACA,OAAOgB,EAACC,EAAAA,CAAaC,MAAM,UAAUC,QAASrC,EAAKsC,IAAI,wBAG3D,GAAIlB,EACA,OACIc,EAACK,MAAAA,CAAIC,UAAU,6BACVb,GACGO,EAACK,MAAAA,CAAIC,UAAU,iDACXN,EAACO,MAAAA,CAAIC,IAAKd,EAAWe,IAAKhB,EAAWa,UAAU,2CAGvDN,EAACU,EAAAA,OAKb,MAAMC,EAAa9C,EAAM+C,mBAAmBC,IAAIC,GAAK,8BAA8BA,KAEnF,OACId,EAACK,MAAAA,CAAIC,UAAW,wDAAwD1B,KAAQ+B,EAAWI,KAAK,
|
|
1
|
+
{"version":3,"file":"QRLoader.js","sources":["../../../../../src/components/internal/QRLoader/QRLoader.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport {\n usePaymentStatusTimer,\n DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from '../../../hooks/usePaymentStatusTimer';\nimport useAutoFocus from '../../../utils/useAutoFocus';\nimport Button from '../Button';\nimport ContentSeparator from '../ContentSeparator';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { CountdownTime } from '../Countdown/types';\nimport Spinner from '../Spinner';\nimport { QRDetails } from './components/QRDetails';\nimport { QRFinalState } from './components/QRFinalState';\nimport { QRLoaderDetailsProvider } from './QRLoaderDetailsProvider';\nimport { QRLoaderProps } from './types';\nimport { redirectToApp } from '../../../utils/urls';\nimport './QRLoader.scss';\n\nconst QRCODE_URL = 'utility/v1/barcode.png?type=qrCode&data=';\n\nexport function QRLoader(props: Readonly<QRLoaderProps>) {\n const { i18n, loadingContext } = useCoreContext();\n\n const { state: timerState, actions: timerActions } = usePaymentStatusTimer({\n loadingContext,\n paymentData: props.paymentData,\n clientKey: props.clientKey,\n delay: props.delay,\n throttleTime: props.throttleTime,\n throttleInterval: props.throttledInterval,\n type: props.type,\n onError: props.onError,\n onComplete: props.onComplete,\n onActionHandled: props.onActionHandled\n });\n\n const { completed, expired, loading, percentage } = timerState;\n const { onTick, onTimeUp } = timerActions;\n\n const { amount, showAmount, url, brandLogo, brandName, countdownTime, type, onActionHandled } = props;\n\n const qrCodeImage = props.qrCodeData ? `${loadingContext}${QRCODE_URL}${props.qrCodeData}&clientKey=${props.clientKey}` : props.qrCodeImage;\n\n const handleCopy = () => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.download,\n target: UiTarget.qrDownloadButton\n });\n props.onSubmitAnalytics(event);\n };\n\n const onQrCodeLoad = () => {\n onActionHandled?.({\n componentType: props.type,\n actionDescription: 'qr-code-loaded'\n });\n };\n\n const qrSubtitleRef = useAutoFocus();\n\n if (expired) {\n return <QRFinalState image=\"error\" message={i18n.get('error.subtitle.payment')} />;\n }\n\n if (completed) {\n return <QRFinalState image=\"success\" message={i18n.get('creditCard.success')} />;\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__qr-loader\">\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img alt={brandName} src={brandLogo} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n <Spinner />\n </div>\n );\n }\n\n const classnames = props.classNameModifiers.map(m => `adyen-checkout__qr-loader--${m}`);\n\n return (\n <div className={`adyen-checkout__qr-loader adyen-checkout__qr-loader--${type} ${classnames.join(' ')}`} data-testid={`${type}-qr-loader`}>\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img src={brandLogo} alt={brandName} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n\n {showAmount && amount && amount.value !== null && !!amount.currency && (\n <h1 className=\"adyen-checkout__qr-loader__payment_amount\">{i18n.amount(amount.value, amount.currency)}</h1>\n )}\n\n {url && (\n <div className=\"adyen-checkout__qr-loader__app-link\">\n {props.redirectIntroduction && <p className=\"adyen-checkout__qr-loader__subtitle\">{i18n.get(props.redirectIntroduction)}</p>}\n <Button classNameModifiers={['qr-loader']} onClick={() => redirectToApp(url)} label={i18n.get(props.buttonLabel)} />\n <ContentSeparator />\n </div>\n )}\n\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <p ref={qrSubtitleRef} tabIndex={0} className=\"adyen-checkout__qr-loader__subtitle\">\n {typeof props.introduction === 'string' ? i18n.get(props.introduction) : props.introduction?.()}\n </p>\n\n <QRLoaderDetailsProvider\n type={type}\n qrCodeImage={qrCodeImage}\n qrCodeData={props.qrCodeData}\n percentage={percentage}\n timeToPay={props.timeToPay}\n copyBtn={props.copyBtn}\n instructions={props.instructions}\n countdownTime={countdownTime}\n onTick={(time: CountdownTime) => onTick(time)}\n onQRCodeLoad={onQrCodeLoad}\n onTimeUp={() => onTimeUp()}\n handleCopy={handleCopy}\n >\n {props.children ? props.children : <QRDetails />}\n </QRLoaderDetailsProvider>\n </div>\n );\n}\n\nQRLoader.defaultProps = {\n countdownTime: DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n delay: DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n throttleTime: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS,\n throttledInterval: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n onError: () => {},\n onComplete: () => {},\n classNameModifiers: [],\n introduction: 'wechatpay.scanqrcode',\n timeToPay: 'wechatpay.timetopay',\n buttonLabel: 'openApp',\n showAmount: true\n};\n"],"names":["QRLoader","props","i18n","loadingContext","useCoreContext","state","timerState","actions","timerActions","usePaymentStatusTimer","paymentData","clientKey","delay","throttleTime","throttleInterval","throttledInterval","type","onError","onComplete","onActionHandled","completed","expired","loading","percentage","onTick","onTimeUp","amount","showAmount","url","brandLogo","brandName","countdownTime","qrCodeImage","qrCodeData","qrSubtitleRef","useAutoFocus","h","QRFinalState","image","message","get","div","className","img","alt","src","Spinner","classnames","classNameModifiers","map","m","join","data-testid","value","currency","h1","redirectIntroduction","p","Button","onClick","redirectToApp","label","buttonLabel","ContentSeparator","ref","tabIndex","introduction","QRLoaderDetailsProvider","timeToPay","copyBtn","instructions","time","onQRCodeLoad","componentType","actionDescription","handleCopy","event","AnalyticsInfoEvent","component","InfoEventType","download","target","UiTarget","qrDownloadButton","onSubmitAnalytics","children","QRDetails","defaultProps","DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS"],"mappings":"shCAwBO,SAASA,EAASC,GACrB,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,KAEzBC,MAAOC,EAAYC,QAASC,GAAiBC,EAAsB,CACvEN,iBACAO,YAAaT,EAAMS,YACnBC,UAAWV,EAAMU,UACjBC,MAAOX,EAAMW,MACbC,aAAcZ,EAAMY,aACpBC,iBAAkBb,EAAMc,kBACxBC,KAAMf,EAAMe,KACZC,QAAShB,EAAMgB,QACfC,WAAYjB,EAAMiB,WAClBC,gBAAiBlB,EAAMkB,mBAGrBC,UAAEA,EAASC,QAAEA,EAAOC,QAAEA,EAAOC,WAAEA,GAAejB,GAC9CkB,OAAE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AO3D,EAAKsC,IAAIvC,EAAM6D,eACpG1B,EAAC2B,SAKT3B,EAACqB,IAAAA,CAAEO,IAAK9B,EAAe+B,SAAU,EAAGvB,UAAU,uCACX,iBAAvBzC,EAAMiE,aAA4BhE,EAAKsC,IAAIvC,EAAMiE,cAAgBjE,EAAMiE,kBAGnF9B,EAAC+B,EAAAA,CACGnD,KAAMA,EACNgB,YAAaA,EACbC,WAAYhC,EAAMgC,WAClBV,WAAYA,EACZ6C,UAAWnE,EAAMmE,UACjBC,QAASpE,EAAMoE,QACfC,aAAcrE,EAAMqE,aACpBvC,cAAeA,EACfP,OAAS+C,GAAwB/C,EAAO+C,GACxCC,aAnES,KACjBrD,IAAkB,CACdsD,cAAexE,EAAMe,KACrB0D,kBAAmB,oBAiEfjD,SAAU,IAAMA,IAChBkD,WA9EO,KACf,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,UAAW7E,EAAMe,KACjBA,KAAM+D,EAAcC,SACpBC,OAAQC,EAASC,mBAErBlF,EAAMmF,kBAAkBR,KA0Ef3E,EAAMoF,SAAWpF,EAAMoF,SAAWjD,EAACkD,EAAAA,OAIpD,CAEAtF,EAASuF,aAAe,CACpBxD,cAAeyD,EACf5E,MAAO6E,EACP5E,aAAc6E,EACd3E,kBAAmB4E,EACnB1E,QAAS,OACTC,WAAY,OACZ8B,mBAAoB,GACpBkB,aAAc,uBACdE,UAAW,sBACXN,YAAa,UACbnC,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRLoaderDetailsProvider.js","sources":["../../../../../src/components/internal/QRLoader/QRLoaderDetailsProvider.tsx"],"sourcesContent":["import { h, createContext } from 'preact';\nimport type { ComponentChildren } from 'preact';\nimport { useContext } from 'preact/hooks';\nimport { CountdownTime } from '../Countdown/types';\n\ninterface QRLoaderDetailsProviderProps {\n qrCodeImage: string;\n qrCodeData: string;\n countdownTime: number;\n percentage: number;\n timeToPay: string;\n instructions?: string | (() => h.JSX.Element);\n copyBtn: boolean;\n onTick: (time: CountdownTime) => void;\n onQRCodeLoad: () => void;\n onTimeUp: () => void;\n handleCopy?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n children: ComponentChildren;\n}\n\ntype QRLoaderDetailsContextValue = Omit<QRLoaderDetailsProviderProps, 'children'>;\n\nconst QRLoaderDetailsContext = createContext<QRLoaderDetailsContextValue | undefined>(undefined);\n\nconst QRLoaderDetailsProvider = ({ children, ...props }: QRLoaderDetailsProviderProps) => {\n return <QRLoaderDetailsContext.Provider value={{ ...props }}>{children}</QRLoaderDetailsContext.Provider>;\n};\n\nconst useQRLoaderDetails = (): QRLoaderDetailsContextValue => {\n const context = useContext(QRLoaderDetailsContext);\n\n if (context === undefined) {\n throw new Error('\"useQRLoaderDetails\" must be used within a QRLoaderDetailsContext');\n }\n\n return context;\n};\n\nexport { QRLoaderDetailsProvider, useQRLoaderDetails };\n"],"names":["QRLoaderDetailsContext","createContext","undefined","QRLoaderDetailsProvider","children","props","h","Provider","value","useQRLoaderDetails","context","useContext","Error"],"mappings":"
|
|
1
|
+
{"version":3,"file":"QRLoaderDetailsProvider.js","sources":["../../../../../src/components/internal/QRLoader/QRLoaderDetailsProvider.tsx"],"sourcesContent":["import { h, createContext } from 'preact';\nimport type { ComponentChildren } from 'preact';\nimport { useContext } from 'preact/hooks';\nimport { CountdownTime } from '../Countdown/types';\n\ninterface QRLoaderDetailsProviderProps {\n type: string;\n qrCodeImage: string;\n qrCodeData: string;\n countdownTime: number;\n percentage: number;\n timeToPay: string;\n instructions?: string | (() => h.JSX.Element);\n copyBtn: boolean;\n onTick: (time: CountdownTime) => void;\n onQRCodeLoad: () => void;\n onTimeUp: () => void;\n handleCopy?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n children: ComponentChildren;\n}\n\ntype QRLoaderDetailsContextValue = Omit<QRLoaderDetailsProviderProps, 'children'>;\n\nconst QRLoaderDetailsContext = createContext<QRLoaderDetailsContextValue | undefined>(undefined);\n\nconst QRLoaderDetailsProvider = ({ children, ...props }: QRLoaderDetailsProviderProps) => {\n return <QRLoaderDetailsContext.Provider value={{ ...props }}>{children}</QRLoaderDetailsContext.Provider>;\n};\n\nconst useQRLoaderDetails = (): QRLoaderDetailsContextValue => {\n const context = useContext(QRLoaderDetailsContext);\n\n if (context === undefined) {\n throw new Error('\"useQRLoaderDetails\" must be used within a QRLoaderDetailsContext');\n }\n\n return context;\n};\n\nexport { QRLoaderDetailsProvider, useQRLoaderDetails };\n"],"names":["QRLoaderDetailsContext","createContext","undefined","QRLoaderDetailsProvider","children","props","h","Provider","value","useQRLoaderDetails","context","useContext","Error"],"mappings":"qKAuBA,MAAMA,EAAyBC,OAAuDC,GAEhFC,EAA0B,EAAGC,cAAaC,KACrCC,EAACN,EAAuBO,SAAQ,CAACC,MAAO,IAAKH,IAAUD,GAG5DK,EAAqB,KACvB,MAAMC,EAAUC,EAAWX,GAE3B,QAAgBE,IAAZQ,EACA,MAAM,IAAIE,MAAM,qEAGpB,OAAOF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as o,Fragment as e}from"../../../../external/preact/dist/preact.js";import{QRImage as t}from"./QRImage.js";import{QRProgressbar as r}from"./QRProgressbar.js";import{QRCountdown as n}from"./QRCountdown.js";import{QRInstructions as a}from"./QRIntructions.js";import{QRCodeCopyButton as m}from"./QRCodeCopyButton.js";import{useQRLoaderDetails as i}from"../QRLoaderDetailsProvider.js";const s=()=>{const{
|
|
1
|
+
import{createElement as o,Fragment as e}from"../../../../external/preact/dist/preact.js";import{QRImage as t}from"./QRImage.js";import{QRProgressbar as r}from"./QRProgressbar.js";import{QRCountdown as n}from"./QRCountdown.js";import{QRInstructions as a}from"./QRIntructions.js";import{QRCodeCopyButton as m}from"./QRCodeCopyButton.js";import{useQRLoaderDetails as i}from"../QRLoaderDetailsProvider.js";const s=()=>{const{type:s,qrCodeData:c,qrCodeImage:p,percentage:d,timeToPay:l,copyBtn:u,instructions:y,onTick:C,countdownTime:f,onQRCodeLoad:j,onTimeUp:Q,handleCopy:R}=i();return o(e,null,o(t,{type:s,src:p,onLoad:j}),o(r,{percentage:d}),o(n,{countdownTime:f,timeToPay:l,onTick:C,onCompleted:Q}),y&&o(a,{instructions:y}),u&&o("div",{className:"adyen-checkout__qr-loader__actions"},o(m,{text:c,handleCopy:R})))};export{s as QRDetails};
|
|
2
2
|
//# sourceMappingURL=QRDetails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRDetails.js","sources":["../../../../../../src/components/internal/QRLoader/components/QRDetails.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { QRImage } from './QRImage';\nimport { QRProgressbar } from './QRProgressbar';\nimport { QRCountdown } from './QRCountdown';\nimport { QRInstructions } from './QRIntructions';\nimport { QRCodeCopyButton } from './QRCodeCopyButton';\nimport { useQRLoaderDetails } from '../QRLoaderDetailsProvider';\n\nexport const QRDetails = () => {\n const { qrCodeData, qrCodeImage, percentage, timeToPay, copyBtn, instructions, onTick, countdownTime, onQRCodeLoad, onTimeUp, handleCopy } =\n useQRLoaderDetails();\n\n return (\n <Fragment>\n <QRImage src={qrCodeImage} onLoad={onQRCodeLoad} />\n\n <QRProgressbar percentage={percentage} />\n\n <QRCountdown countdownTime={countdownTime} timeToPay={timeToPay} onTick={onTick} onCompleted={onTimeUp} />\n\n {instructions && <QRInstructions instructions={instructions} />}\n\n {copyBtn && (\n <div className=\"adyen-checkout__qr-loader__actions\">\n <QRCodeCopyButton text={qrCodeData} handleCopy={handleCopy} />\n </div>\n )}\n </Fragment>\n );\n};\n"],"names":["QRDetails","qrCodeData","qrCodeImage","percentage","timeToPay","copyBtn","instructions","onTick","countdownTime","onQRCodeLoad","onTimeUp","handleCopy","useQRLoaderDetails","h","Fragment","QRImage","src","onLoad","QRProgressbar","QRCountdown","onCompleted","QRInstructions","div","className","QRCodeCopyButton","text"],"mappings":"wZAQaA,EAAY,KACrB,MAAMC,WAAEA,EAAUC,YAAEA,EAAWC,WAAEA,EAAUC,UAAEA,EAASC,QAAEA,EAAOC,aAAEA,EAAYC,OAAEA,EAAMC,cAAEA,EAAaC,aAAEA,EAAYC,SAAEA,EAAQC,WAAEA,
|
|
1
|
+
{"version":3,"file":"QRDetails.js","sources":["../../../../../../src/components/internal/QRLoader/components/QRDetails.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { QRImage } from './QRImage';\nimport { QRProgressbar } from './QRProgressbar';\nimport { QRCountdown } from './QRCountdown';\nimport { QRInstructions } from './QRIntructions';\nimport { QRCodeCopyButton } from './QRCodeCopyButton';\nimport { useQRLoaderDetails } from '../QRLoaderDetailsProvider';\n\nexport const QRDetails = () => {\n const { type, qrCodeData, qrCodeImage, percentage, timeToPay, copyBtn, instructions, onTick, countdownTime, onQRCodeLoad, onTimeUp, handleCopy } =\n useQRLoaderDetails();\n\n return (\n <Fragment>\n <QRImage type={type} src={qrCodeImage} onLoad={onQRCodeLoad} />\n\n <QRProgressbar percentage={percentage} />\n\n <QRCountdown countdownTime={countdownTime} timeToPay={timeToPay} onTick={onTick} onCompleted={onTimeUp} />\n\n {instructions && <QRInstructions instructions={instructions} />}\n\n {copyBtn && (\n <div className=\"adyen-checkout__qr-loader__actions\">\n <QRCodeCopyButton text={qrCodeData} handleCopy={handleCopy} />\n </div>\n )}\n </Fragment>\n );\n};\n"],"names":["QRDetails","type","qrCodeData","qrCodeImage","percentage","timeToPay","copyBtn","instructions","onTick","countdownTime","onQRCodeLoad","onTimeUp","handleCopy","useQRLoaderDetails","h","Fragment","QRImage","src","onLoad","QRProgressbar","QRCountdown","onCompleted","QRInstructions","div","className","QRCodeCopyButton","text"],"mappings":"wZAQaA,EAAY,KACrB,MAAMC,KAAEA,EAAIC,WAAEA,EAAUC,YAAEA,EAAWC,WAAEA,EAAUC,UAAEA,EAASC,QAAEA,EAAOC,aAAEA,EAAYC,OAAEA,EAAMC,cAAEA,EAAaC,aAAEA,EAAYC,SAAEA,EAAQC,WAAEA,GAChIC,IAEJ,OACIC,EAACC,OACGD,EAACE,EAAAA,CAAQf,KAAMA,EAAMgB,IAAKd,EAAae,OAAQR,IAE/CI,EAACK,EAAAA,CAAcf,WAAYA,IAE3BU,EAACM,EAAAA,CAAYX,cAAeA,EAAeJ,UAAWA,EAAWG,OAAQA,EAAQa,YAAaV,IAE7FJ,GAAgBO,EAACQ,EAAAA,CAAef,aAAcA,IAE9CD,GACGQ,EAACS,MAAAA,CAAIC,UAAU,sCACXV,EAACW,EAAAA,CAAiBC,KAAMxB,EAAYU,WAAYA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as
|
|
1
|
+
import{createElement as t}from"../../../../external/preact/dist/preact.js";import{useCoreContext as e}from"../../../../core/Context/CoreProvider.js";const r=({type:r,onLoad:o,src:a})=>{const{i18n:c}=e();return t("img",{src:a,alt:c.get("wechatpay.scanqrcode"),onLoad:o,"data-testid":`${r}-qr-image`})};export{r as QRImage};
|
|
2
2
|
//# sourceMappingURL=QRImage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRImage.js","sources":["../../../../../../src/components/internal/QRLoader/components/QRImage.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { QRImageProps } from '../types';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\n\nexport const QRImage = ({ onLoad, src }: QRImageProps) => {\n const { i18n } = useCoreContext();\n\n return <img src={src} alt={i18n.get('wechatpay.scanqrcode')} onLoad={onLoad} />;\n};\n"],"names":["QRImage","onLoad","src","i18n","useCoreContext","h","img","alt","get"],"mappings":"
|
|
1
|
+
{"version":3,"file":"QRImage.js","sources":["../../../../../../src/components/internal/QRLoader/components/QRImage.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { QRImageProps } from '../types';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\n\nexport const QRImage = ({ type, onLoad, src }: QRImageProps) => {\n const { i18n } = useCoreContext();\n\n return <img src={src} alt={i18n.get('wechatpay.scanqrcode')} onLoad={onLoad} data-testid={`${type}-qr-image`} />;\n};\n"],"names":["QRImage","type","onLoad","src","i18n","useCoreContext","h","img","alt","get","data-testid"],"mappings":"qJAIO,MAAMA,EAAU,EAAGC,OAAMC,SAAQC,UACpC,MAAMC,KAAEA,GAASC,IAEjB,OAAOC,EAACC,MAAAA,CAAIJ,IAAKA,EAAKK,IAAKJ,EAAKK,IAAI,wBAAyBP,OAAQA,EAAQQ,cAAa,GAAGT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as
|
|
1
|
+
import{Component as t}from"../../../../external/preact/dist/preact.js";import{getFields as s,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 m}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as f}from"../../../../core/Errors/constants.js";import{TxVariants as C}from"../../../tx-variants.js";function y(t,s,e){return s in t?Object.defineProperty(t,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[s]=e,t}class F extends t{componentDidMount(){this.props.rootNode&&this.setRootNode(this.props.rootNode);const t=s(this.rootNode),i=t.reduce(e,{});this.setState({valid:i}),t.forEach(t=>{this.numCharsInField[t]=0}),this.numDateFields=t.filter(t=>t.match(/Expiry/)).length,t.length?(this.destroy(),this.initializeCSF(this.rootNode)):(this.props.componentType===C.customCard&&console.debug('You are trying to create a CustomCard component but the element into which you are trying to mount the CustomCard component does not contain any elements with a "data-cse" attribute e.g. <div data-cse="encryptedCardNumber"></div>'),this.handleOnNoDataRequired())}componentDidUpdate(){this.checkForKCPFields(),this.props.onStateUpdate?.(this.state)}componentWillUnmount(){this.csf=null,clearTimeout(this.csfLoadFailTimeout),clearTimeout(this.csfConfigFailTimeout)}initializeCSF(t){let s=this.props.loadingContext;const e={rootNode:t,type:this.props.type,componentType:this.props.componentType,clientKey:this.props.clientKey,cardGroupTypes:this.props.brands,autoFocus:this.props.autoFocus,trimTrailingSeparator:this.props.trimTrailingSeparator,loadingContext:s,keypadFix:this.props.keypadFix,showWarnings:this.props.showWarnings,iframeUIConfig:{sfStyles:this.props.styles},i18n:this.props.i18n,onSubmitAnalytics:this.props.onSubmitAnalytics,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 t=!1;if(this.props.koreanAuthenticationRequired&&(t=this.issuingCountryCode?"kr"===this.issuingCountryCode:"kr"===this.props.countryCode),this.state.hasKoreanFields&&!t){const t=t=>({data:{...t.data,[a]:void 0},valid:{...t.valid,[a]:!1},errors:{...t.errors,[a]:!1},hasKoreanFields:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.removeSecuredField(a),this.csf.setKCPStatus(!1)}if(!this.state.hasKoreanFields&&t){const t=t=>({valid:{...t.valid,[a]:!1},hasKoreanFields:!0,isSfpValid:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.addSecuredField(a),this.csf.setKCPStatus(!0)}}getChildContext(){return{i18n:this.props.i18n}}handleUnsupportedCard(t){const s=!!t.error;return s&&this.setState({detectedUnsupportedBrands:t.detectedBrands}),t.rootNode=this.rootNode,this.handleOnError(t,s),this.csf&&this.csf.hasUnsupportedCard(h,t.error),s}setFocusOn(t){this.csf&&this.csf.setFocusOnFrame(t)}updateStyles(t){this.csf&&this.csf.updateStyles(t)}sfIsOptionalOrHidden(t){return this.csf.sfIsOptionalOrHidden(t)}destroy(){this.csf&&this.csf.destroy()}showValidation(){const{numDateFields:t,state:s}=this;Object.keys(s.valid).reduce(i(t,s),[]).forEach(t=>{const e=o(t,this.rootNode,s);this.handleOnError(e,!!s.detectedUnsupportedBrands),this.csf&&this.csf.isValidated&&this.csf.isValidated(t,e.error)})}mapErrorsToValidationRuleResult(){return Object.keys(this.state.errors).reduce((t,s)=>{const e=this.state.errors[s];return t[s]=e?{isValid:!1,errorMessage:m(e,f),errorI18n:this.props.i18n.get(e),error:e,rootNode:this.rootNode,...this.state.detectedUnsupportedBrands&&{detectedBrands:this.state.detectedUnsupportedBrands}}:null,t},{})}processBinLookupResponse(t,s){if(this.state.detectedUnsupportedBrands&&(this.setState(t=>({errors:{...t.errors,[h]:!1},detectedUnsupportedBrands:null})),this.csf&&t)){const t={type:"card",fieldType:"encryptedCardNumber",error:""};this.handleUnsupportedCard(t)}this.issuingCountryCode=t?.issuingCountryCode?.toLowerCase();const e=s?.brand,i=e&&l.includes(s.brand);i&&this.setState(s,()=>{this.props.onChange(this.state)}),this.csf&&this.csf.brandsFromBinLookup(t,i?s:null)}render(t,s){return t.render({setRootNode:this.setRootNode,setFocusOn:this.setFocusOn},s)}constructor(t){super(t),y(this,"csfLoadFailTimeout",void 0),y(this,"csfLoadFailTimeoutMS",void 0),y(this,"csfConfigFailTimeout",void 0),y(this,"csfConfigFailTimeoutMS",void 0),y(this,"numCharsInField",void 0),y(this,"rootNode",void 0),y(this,"numDateFields",void 0),y(this,"csf",void 0),y(this,"handleOnLoad",void 0),y(this,"handleOnConfigSuccess",void 0),y(this,"handleOnFieldValid",void 0),y(this,"handleOnAllValid",void 0),y(this,"handleOnBrand",void 0),y(this,"handleFocus",void 0),y(this,"handleOnError",void 0),y(this,"handleOnAutoComplete",void 0),y(this,"handleOnNoDataRequired",void 0),y(this,"handleOnTouchstartIOS",void 0),y(this,"handleKeyPressed",void 0),y(this,"state",void 0),y(this,"props",void 0),y(this,"issuingCountryCode",void 0),y(this,"setRootNode",t=>{this.rootNode=t});const s={status:"loading",brand:t.type,errors:{},valid:{},data:{},cvcPolicy:c,expiryDatePolicy:p,isSfpValid:!1,hasKoreanFields:t.hasKoreanFields};this.state=s,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)}}y(F,"defaultProps",d);export{F as default};
|
|
2
2
|
//# sourceMappingURL=SecuredFieldsProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecuredFieldsProvider.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProvider.ts"],"sourcesContent":["import { Component } from 'preact';\nimport { getErrorObject, getFields, getErrorReducer, validFieldsReducer } from './SFPUtils';\nimport initCSF from '../lib/CSF';\nimport handlers from './SecuredFieldsProviderHandlers';\nimport defaultProps from './defaultProps';\nimport { SFPProps, SFPState, SingleBrandResetObject } from './types';\nimport {\n StylesObject,\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj\n} from '../lib/types';\nimport { CSFReturnObject, CSFSetupObject } from '../lib/CSF/types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, DEDICATED_CARD_COMPONENTS, ENCRYPTED_CARD_NUMBER, ENCRYPTED_PWD_FIELD } from '../lib/constants';\nimport { BinLookupResponse } from '../../../Card/types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { SFStateErrorObj } from '../../../Card/components/CardInput/types';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\n\n/**\n * SecuredFieldsProvider:\n * Initialises & handles the client-side part of SecuredFields\n */\nclass SecuredFieldsProvider extends Component<SFPProps, SFPState> {\n private csfLoadFailTimeout: number;\n private csfLoadFailTimeoutMS: number;\n private csfConfigFailTimeout: number;\n private csfConfigFailTimeoutMS: number;\n private numCharsInField: object;\n private rootNode;\n private numDateFields: number;\n private csf: CSFReturnObject;\n private handleOnLoad: (obj: CardLoadData) => void;\n private handleOnConfigSuccess: (obj: CardConfigSuccessData) => void;\n private handleOnFieldValid: (obj: CardFieldValidData) => void;\n private handleOnAllValid: (obj: CardAllValidData) => void;\n private handleOnBrand: (obj: CardBrandData) => void;\n private handleFocus: (obj: CardFocusData) => void;\n private handleOnError: (obj: CardErrorData, hasUnsupportedCard?: boolean) => void;\n private handleOnAutoComplete: (obj: CardAutoCompleteData) => void;\n private handleOnNoDataRequired: () => void;\n private handleOnTouchstartIOS: (obj) => void;\n private handleKeyPressed: (obj: SFKeyPressObj) => void;\n public state: SFPState;\n public props;\n private issuingCountryCode;\n\n constructor(props: SFPProps) {\n super(props);\n\n const stateObj: SFPState = {\n status: 'loading',\n brand: props.type,\n errors: {},\n valid: {},\n data: {},\n cvcPolicy: CVC_POLICY_REQUIRED,\n expiryDatePolicy: DATE_POLICY_REQUIRED,\n isSfpValid: false,\n hasKoreanFields: props.hasKoreanFields\n };\n this.state = stateObj;\n\n this.csfLoadFailTimeout = null;\n this.csfLoadFailTimeoutMS = 30000;\n\n this.csfConfigFailTimeout = null;\n this.csfConfigFailTimeoutMS = 15000;\n\n this.numCharsInField = {};\n\n // Handlers\n this.handleOnLoad = handlers.handleOnLoad.bind(this);\n this.handleOnConfigSuccess = handlers.handleOnConfigSuccess.bind(this);\n this.handleOnFieldValid = handlers.handleOnFieldValid.bind(this);\n this.handleOnAllValid = handlers.handleOnAllValid.bind(this);\n this.handleOnBrand = handlers.handleOnBrand.bind(this);\n this.handleFocus = handlers.handleFocus.bind(this);\n this.handleOnError = handlers.handleOnError.bind(this);\n this.handleOnNoDataRequired = handlers.handleOnNoDataRequired.bind(this);\n this.handleOnAutoComplete = handlers.handleOnAutoComplete.bind(this);\n this.handleOnTouchstartIOS = handlers.handleOnTouchstartIOS.bind(this); // Only called when iOS detected\n this.handleKeyPressed = handlers.handleKeyPressed.bind(this);\n\n this.processBinLookupResponse = this.processBinLookupResponse.bind(this);\n\n // Bindings for functions exposed to users of this component: SecuredFields & CardInput\n this.setFocusOn = this.setFocusOn.bind(this);\n this.updateStyles = this.updateStyles.bind(this);\n this.handleUnsupportedCard = this.handleUnsupportedCard.bind(this);\n this.showValidation = this.showValidation.bind(this);\n this.destroy = this.destroy.bind(this);\n }\n\n public static defaultProps = defaultProps;\n\n public componentDidMount(): void {\n // When SFP instantiated through SecuredFieldsInput c.f. CardInput\n if (this.props.rootNode) {\n this.setRootNode(this.props.rootNode);\n }\n\n // Find encryptedFields and map them to the values we use to store valid states\n const fields = getFields(this.rootNode);\n const valid = fields.reduce(validFieldsReducer, {});\n\n this.setState({ valid });\n\n // Populate numCharsInField object\n fields.forEach(field => {\n this.numCharsInField[field] = 0;\n });\n\n // Store how many dateFields we are dealing with visually\n this.numDateFields = fields.filter(f => f.match(/Expiry/)).length;\n\n if (fields.length) {\n this.destroy(); // TODO test if this solves the React double render problem.\n this.initializeCSF(this.rootNode);\n } else {\n this.handleOnNoDataRequired();\n }\n }\n\n public componentDidUpdate() {\n this.checkForKCPFields();\n // Pass all the state data up - Used right now for loading status\n this.props.onStateUpdate?.(this.state);\n }\n\n public componentWillUnmount(): void {\n this.csf = null;\n clearTimeout(this.csfLoadFailTimeout);\n clearTimeout(this.csfConfigFailTimeout);\n }\n\n private initializeCSF(root: HTMLElement): void {\n let loadingContext = this.props.loadingContext;\n\n // For loading securedFields from local server during development\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n loadingContext = process.env.__SF_ENV__;\n }\n\n const csfSetupObj: CSFSetupObject = {\n rootNode: root,\n type: this.props.type,\n clientKey: this.props.clientKey,\n cardGroupTypes: this.props.brands,\n autoFocus: this.props.autoFocus,\n trimTrailingSeparator: this.props.trimTrailingSeparator,\n loadingContext,\n keypadFix: this.props.keypadFix,\n showWarnings: this.props.showWarnings,\n iframeUIConfig: {\n sfStyles: this.props.styles\n },\n i18n: this.props.i18n,\n callbacks: {\n onLoad: this.handleOnLoad,\n onConfigSuccess: this.handleOnConfigSuccess,\n onFieldValid: this.handleOnFieldValid,\n onAllValid: this.handleOnAllValid,\n onBrand: this.handleOnBrand,\n onError: this.handleOnError,\n onFocus: this.handleFocus,\n onBinValue: this.props.onBinValue,\n onAutoComplete: this.handleOnAutoComplete,\n onAdditionalSFConfig: this.props.onAdditionalSFConfig,\n onAdditionalSFRemoved: this.props.onAdditionalSFRemoved,\n onTouchstartIOS: this.handleOnTouchstartIOS,\n onKeyPressed: this.handleKeyPressed\n },\n isKCP: this.state.hasKoreanFields,\n legacyInputMode: this.props.legacyInputMode,\n minimumExpiryDate: this.props.minimumExpiryDate,\n implementationType: this.props.implementationType || 'components', // to distinguish between 'regular' and 'custom' card component\n forceCompat: this.props.forceCompat,\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n shouldDisableIOSArrowKeys: !!this.props.disableIOSArrowKeys, // convert whether function has been defined into a boolean\n placeholders: this.props.placeholders ?? {},\n showContextualElement: this.props.showContextualElement\n };\n\n this.csf = initCSF(csfSetupObj);\n\n /**\n * Expect to at least have had the handleOnLoad callback called within this time\n * - if this hasn't happened then something has happened to interrupt the loading of the securedFields\n * So we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n // @ts-ignore - timout 'type' is a number\n this.csfLoadFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfLoadFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured field iframes have failed to load'));\n }\n }, this.csfLoadFailTimeoutMS);\n }\n\n private checkForKCPFields() {\n let needsKoreanFields = false;\n if (this.props.koreanAuthenticationRequired) {\n needsKoreanFields = this.issuingCountryCode ? this.issuingCountryCode === 'kr' : this.props.countryCode === 'kr';\n }\n\n // Was korean, now isn't - hide password field\n if (this.state.hasKoreanFields && !needsKoreanFields) {\n // Clear any stored data\n const setRemovedFieldState = prevState => ({\n data: { ...prevState.data, [ENCRYPTED_PWD_FIELD]: undefined },\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n errors: { ...prevState.errors, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: false\n });\n\n this.setState(setRemovedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.removeSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(false);\n }\n\n // Wasn't korean, now is - show password field\n if (!this.state.hasKoreanFields && needsKoreanFields) {\n const setAddedFieldState = prevState => ({\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: true,\n isSfpValid: false\n });\n\n this.setState(setAddedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.addSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(true);\n }\n }\n\n public getChildContext(): object {\n return { i18n: this.props.i18n };\n }\n\n public handleUnsupportedCard(errObj: CardErrorData): boolean {\n const hasUnsupportedCard = !!errObj.error;\n\n // Store the brand(s) we detected and which we don't support\n if (hasUnsupportedCard) {\n this.setState({ detectedUnsupportedBrands: errObj.detectedBrands });\n }\n\n errObj.rootNode = this.rootNode; // Needed for CustomCard\n this.handleOnError(errObj, hasUnsupportedCard);\n // Inform CSF that the number field has an unsupportedCard error (or that it has been cleared)\n if (this.csf) {\n this.csf.hasUnsupportedCard(ENCRYPTED_CARD_NUMBER, errObj.error);\n }\n return hasUnsupportedCard;\n }\n\n public setFocusOn(frame: string): void {\n if (this.csf) this.csf.setFocusOnFrame(frame);\n }\n\n public updateStyles(stylesObj: StylesObject): void {\n if (this.csf) this.csf.updateStyles(stylesObj);\n }\n\n public sfIsOptionalOrHidden(fieldType: string): boolean {\n return this.csf.sfIsOptionalOrHidden(fieldType);\n }\n\n public destroy(): void {\n if (this.csf) this.csf.destroy();\n }\n\n public showValidation(): void {\n const { numDateFields, state }: SecuredFieldsProvider = this;\n\n Object.keys(state.valid)\n .reduce(getErrorReducer(numDateFields, state), [])\n .forEach(field => {\n // For each detected error pass an error object to the handler (calls error callback & sets state)\n const errorObj: CardErrorData = getErrorObject(field, this.rootNode, state);\n this.handleOnError(errorObj, !!state.detectedUnsupportedBrands);\n // Inform the secured-fields instance of which fields have been found to have errors\n if (this.csf && this.csf.isValidated) {\n this.csf.isValidated(field, errorObj.error);\n }\n });\n }\n\n /**\n * Map SF errors to ValidationRuleResult-like objects, for CardInput component\n */\n public mapErrorsToValidationRuleResult(): SFStateErrorObj {\n const fieldNames: string[] = Object.keys(this.state.errors);\n\n const sfStateErrorsObj = fieldNames.reduce((acc, fieldName) => {\n const errorCode = this.state.errors[fieldName];\n if (errorCode) {\n acc[fieldName] = {\n isValid: false,\n errorMessage: getErrorMessageFromCode(errorCode, SF_ErrorCodes), // this is the human-readable, untranslated, explanation of the error that will exist on the error object in card.state.errors\n // For v5 the object found in state.errors should also contain the additional properties that used to be sent to the onError callback\n // namely: translation, errorCode, a ref to rootNode &, in the case of failed binLookup, an array of the detectedBrands\n errorI18n: this.props.i18n.get(errorCode),\n error: errorCode,\n rootNode: this.rootNode,\n ...(this.state.detectedUnsupportedBrands && { detectedBrands: this.state.detectedUnsupportedBrands })\n };\n } else {\n acc[fieldName] = null;\n }\n return acc;\n }, {});\n return sfStateErrorsObj;\n }\n\n public processBinLookupResponse(binLookupResponse: BinLookupResponse, resetObject: SingleBrandResetObject): void {\n // If we were dealing with an unsupported card & now we have a valid /binLookup response (or a response triggering a reset of the UI),\n // - reset state to clear the error & the stored unsupportedBrands and, in the case of a valid /binLookup response, inform CSF (via handleUnsupportedCard)\n // (Scenario: from an unsupportedCard state the shopper has pasted another number long enough to trigger a /binLookup)\n if (this.state.detectedUnsupportedBrands) {\n this.setState(prevState => ({\n errors: { ...prevState.errors, [ENCRYPTED_CARD_NUMBER]: false },\n detectedUnsupportedBrands: null\n }));\n\n // If we have some sort of binLookupResponse object then this isn't the reset caused by digits dropping below a threshold\n // - so call handleUnsupportedCard to clear the error\n if (this.csf && binLookupResponse) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n this.handleUnsupportedCard(errObj);\n }\n }\n\n this.issuingCountryCode = binLookupResponse?.issuingCountryCode?.toLowerCase();\n\n const hasBrandedResetObj = resetObject?.brand;\n\n /**\n * Are we dealing with a \"dedicated\" card scenario i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands\n * - in which case we will need to reset brand and pass on the resetObj to CSF\n */\n const mustResetDedicatedBrand = hasBrandedResetObj && DEDICATED_CARD_COMPONENTS.includes(resetObject.brand);\n\n if (mustResetDedicatedBrand) {\n // resetObject.brand will be the value of the brand whose logo we want to reshow in the UI\n this.setState(resetObject, () => {\n this.props.onChange(this.state);\n });\n }\n\n /**\n * Scenarios:\n *\n * - RESET (binLookupResponse === null): The number of digits in number field has dropped below threshold for BIN lookup\n * - RESULT (binLookupResponse.supportedBrands.length === 1): binLookup has found a result so inform CSF\n *\n * In the RESET scenario, for \"dedicated\" card components we also need to pass on the resetObject since this contains information about\n * the brand that CSF needs to reset to, internally.\n */\n if (this.csf) this.csf.brandsFromBinLookup(binLookupResponse, mustResetDedicatedBrand ? resetObject : null);\n }\n\n private setRootNode = (input: HTMLElement): void => {\n this.rootNode = input;\n };\n\n public render(props, state) {\n return props.render({ setRootNode: this.setRootNode, setFocusOn: this.setFocusOn }, state);\n }\n}\n\nexport default SecuredFieldsProvider;\n"],"names":["SecuredFieldsProvider","Component","componentDidMount","this","props","rootNode","setRootNode","fields","getFields","valid","reduce","validFieldsReducer","setState","forEach","field","numCharsInField","numDateFields","filter","f","match","length","destroy","initializeCSF","handleOnNoDataRequired","componentDidUpdate","checkForKCPFields","onStateUpdate","state","componentWillUnmount","csf","clearTimeout","csfLoadFailTimeout","csfConfigFailTimeout","root","loadingContext","csfSetupObj","type","clientKey","cardGroupTypes","brands","autoFocus","trimTrailingSeparator","keypadFix","showWarnings","iframeUIConfig","sfStyles","styles","i18n","callbacks","onLoad","handleOnLoad","onConfigSuccess","handleOnConfigSuccess","onFieldValid","handleOnFieldValid","onAllValid","handleOnAllValid","onBrand","handleOnBrand","onError","handleOnError","onFocus","handleFocus","onBinValue","onAutoComplete","handleOnAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","handleOnTouchstartIOS","onKeyPressed","handleKeyPressed","isKCP","hasKoreanFields","legacyInputMode","minimumExpiryDate","implementationType","forceCompat","maskSecurityCode","exposeExpiryDate","shouldDisableIOSArrowKeys","disableIOSArrowKeys","placeholders","showContextualElement","initCSF","setTimeout","status","AdyenCheckoutError","csfLoadFailTimeoutMS","needsKoreanFields","koreanAuthenticationRequired","issuingCountryCode","countryCode","setRemovedFieldState","prevState","data","ENCRYPTED_PWD_FIELD","undefined","errors","onChange","removeSecuredField","setKCPStatus","setAddedFieldState","isSfpValid","addSecuredField","getChildContext","handleUnsupportedCard","errObj","hasUnsupportedCard","error","detectedUnsupportedBrands","detectedBrands","ENCRYPTED_CARD_NUMBER","setFocusOn","frame","setFocusOnFrame","updateStyles","stylesObj","sfIsOptionalOrHidden","fieldType","showValidation","Object","keys","getErrorReducer","errorObj","getErrorObject","isValidated","mapErrorsToValidationRuleResult","acc","fieldName","errorCode","isValid","errorMessage","getErrorMessageFromCode","SF_ErrorCodes","errorI18n","get","processBinLookupResponse","binLookupResponse","resetObject","toLowerCase","hasBrandedResetObj","brand","mustResetDedicatedBrand","DEDICATED_CARD_COMPONENTS","includes","brandsFromBinLookup","render","constructor","super","_define_property","csfConfigFailTimeoutMS","input","stateObj","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","handlers","bind","defaultProps"],"mappings":"sxBA8BA,MAAMA,UAA8BC,EAyEzBC,iBAAAA,GAECC,KAAKC,MAAMC,UACXF,KAAKG,YAAYH,KAAKC,MAAMC,UAIhC,MAAME,EAASC,EAAUL,KAAKE,UACxBI,EAAQF,EAAOG,OAAOC,EAAoB,CAAA,GAEhDR,KAAKS,SAAS,CAAEH,UAGhBF,EAAOM,QAAQC,IACXX,KAAKY,gBAAgBD,GAAS,IAIlCX,KAAKa,cAAgBT,EAAOU,OAAOC,GAAKA,EAAEC,MAAM,WAAWC,OAEvDb,EAAOa,QAC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,iBAAmBuF,EAASvF,iBAAiBwF,KAAK5J,MAEvDA,KAAKsI,yBAA2BtI,KAAKsI,yBAAyBsB,KAAK5J,MAGnEA,KAAK8G,WAAa9G,KAAK8G,WAAW8C,KAAK5J,MACvCA,KAAKiH,aAAejH,KAAKiH,aAAa2C,KAAK5J,MAC3CA,KAAKuG,sBAAwBvG,KAAKuG,sBAAsBqD,KAAK5J,MAC7DA,KAAKqH,eAAiBrH,KAAKqH,eAAeuC,KAAK5J,MAC/CA,KAAKkB,QAAUlB,KAAKkB,QAAQ0I,KAAK5J,KACrC,EAEAmJ,EAvEEtJ,EAuEYgK,eAAeA"}
|
|
1
|
+
{"version":3,"file":"SecuredFieldsProvider.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProvider.ts"],"sourcesContent":["import { Component } from 'preact';\nimport { getErrorObject, getFields, getErrorReducer, validFieldsReducer } from './SFPUtils';\nimport initCSF from '../lib/CSF';\nimport handlers from './SecuredFieldsProviderHandlers';\nimport defaultProps from './defaultProps';\nimport { SFPProps, SFPState, SingleBrandResetObject } from './types';\nimport {\n StylesObject,\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj\n} from '../lib/types';\nimport { CSFReturnObject, CSFSetupObject } from '../lib/CSF/types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, DEDICATED_CARD_COMPONENTS, ENCRYPTED_CARD_NUMBER, ENCRYPTED_PWD_FIELD } from '../lib/constants';\nimport { BinLookupResponse } from '../../../Card/types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { SFStateErrorObj } from '../../../Card/components/CardInput/types';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { TxVariants } from '../../../tx-variants';\n\n/**\n * SecuredFieldsProvider:\n * Initialises & handles the client-side part of SecuredFields\n */\nclass SecuredFieldsProvider extends Component<SFPProps, SFPState> {\n private csfLoadFailTimeout: number;\n private csfLoadFailTimeoutMS: number;\n private csfConfigFailTimeout: number;\n private csfConfigFailTimeoutMS: number;\n private numCharsInField: object;\n private rootNode;\n private numDateFields: number;\n private csf: CSFReturnObject;\n private handleOnLoad: (obj: CardLoadData) => void;\n private handleOnConfigSuccess: (obj: CardConfigSuccessData) => void;\n private handleOnFieldValid: (obj: CardFieldValidData) => void;\n private handleOnAllValid: (obj: CardAllValidData) => void;\n private handleOnBrand: (obj: CardBrandData) => void;\n private handleFocus: (obj: CardFocusData) => void;\n private handleOnError: (obj: CardErrorData, hasUnsupportedCard?: boolean) => void;\n private handleOnAutoComplete: (obj: CardAutoCompleteData) => void;\n private handleOnNoDataRequired: () => void;\n private handleOnTouchstartIOS: (obj) => void;\n private handleKeyPressed: (obj: SFKeyPressObj) => void;\n public state: SFPState;\n public props;\n private issuingCountryCode;\n\n constructor(props: SFPProps) {\n super(props);\n\n const stateObj: SFPState = {\n status: 'loading',\n brand: props.type,\n errors: {},\n valid: {},\n data: {},\n cvcPolicy: CVC_POLICY_REQUIRED,\n expiryDatePolicy: DATE_POLICY_REQUIRED,\n isSfpValid: false,\n hasKoreanFields: props.hasKoreanFields\n };\n this.state = stateObj;\n\n this.csfLoadFailTimeout = null;\n this.csfLoadFailTimeoutMS = 30000;\n\n this.csfConfigFailTimeout = null;\n this.csfConfigFailTimeoutMS = 15000;\n\n this.numCharsInField = {};\n\n // Handlers\n this.handleOnLoad = handlers.handleOnLoad.bind(this);\n this.handleOnConfigSuccess = handlers.handleOnConfigSuccess.bind(this);\n this.handleOnFieldValid = handlers.handleOnFieldValid.bind(this);\n this.handleOnAllValid = handlers.handleOnAllValid.bind(this);\n this.handleOnBrand = handlers.handleOnBrand.bind(this);\n this.handleFocus = handlers.handleFocus.bind(this);\n this.handleOnError = handlers.handleOnError.bind(this);\n this.handleOnNoDataRequired = handlers.handleOnNoDataRequired.bind(this);\n this.handleOnAutoComplete = handlers.handleOnAutoComplete.bind(this);\n this.handleOnTouchstartIOS = handlers.handleOnTouchstartIOS.bind(this); // Only called when iOS detected\n this.handleKeyPressed = handlers.handleKeyPressed.bind(this);\n\n this.processBinLookupResponse = this.processBinLookupResponse.bind(this);\n\n // Bindings for functions exposed to users of this component: SecuredFields & CardInput\n this.setFocusOn = this.setFocusOn.bind(this);\n this.updateStyles = this.updateStyles.bind(this);\n this.handleUnsupportedCard = this.handleUnsupportedCard.bind(this);\n this.showValidation = this.showValidation.bind(this);\n this.destroy = this.destroy.bind(this);\n }\n\n public static defaultProps = defaultProps;\n\n public componentDidMount(): void {\n // When SFP instantiated through SecuredFieldsInput c.f. CardInput\n if (this.props.rootNode) {\n this.setRootNode(this.props.rootNode);\n }\n\n // Find encryptedFields and map them to the values we use to store valid states\n const fields = getFields(this.rootNode);\n const valid = fields.reduce(validFieldsReducer, {});\n\n this.setState({ valid });\n\n // Populate numCharsInField object\n fields.forEach(field => {\n this.numCharsInField[field] = 0;\n });\n\n // Store how many dateFields we are dealing with visually\n this.numDateFields = fields.filter(f => f.match(/Expiry/)).length;\n\n if (fields.length) {\n this.destroy();\n this.initializeCSF(this.rootNode);\n } else {\n if (this.props.componentType === TxVariants.customCard) {\n console.debug(\n 'You are trying to create a CustomCard component but the element into which you are trying to mount the CustomCard component does not contain any elements with a \"data-cse\" attribute e.g. <div data-cse=\"encryptedCardNumber\"></div>'\n );\n }\n this.handleOnNoDataRequired();\n }\n }\n\n public componentDidUpdate() {\n this.checkForKCPFields();\n // Pass all the state data up - Used right now for loading status\n this.props.onStateUpdate?.(this.state);\n }\n\n public componentWillUnmount(): void {\n this.csf = null;\n clearTimeout(this.csfLoadFailTimeout);\n clearTimeout(this.csfConfigFailTimeout);\n }\n\n private initializeCSF(root: HTMLElement): void {\n let loadingContext = this.props.loadingContext;\n\n // For loading securedFields from local server during development\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n loadingContext = process.env.__SF_ENV__;\n }\n\n const csfSetupObj: CSFSetupObject = {\n rootNode: root,\n type: this.props.type,\n componentType: this.props.componentType,\n clientKey: this.props.clientKey,\n cardGroupTypes: this.props.brands,\n autoFocus: this.props.autoFocus,\n trimTrailingSeparator: this.props.trimTrailingSeparator,\n loadingContext,\n keypadFix: this.props.keypadFix,\n showWarnings: this.props.showWarnings,\n iframeUIConfig: {\n sfStyles: this.props.styles\n },\n i18n: this.props.i18n,\n onSubmitAnalytics: this.props.onSubmitAnalytics,\n callbacks: {\n onLoad: this.handleOnLoad,\n onConfigSuccess: this.handleOnConfigSuccess,\n onFieldValid: this.handleOnFieldValid,\n onAllValid: this.handleOnAllValid,\n onBrand: this.handleOnBrand,\n onError: this.handleOnError,\n onFocus: this.handleFocus,\n onBinValue: this.props.onBinValue,\n onAutoComplete: this.handleOnAutoComplete,\n onAdditionalSFConfig: this.props.onAdditionalSFConfig,\n onAdditionalSFRemoved: this.props.onAdditionalSFRemoved,\n onTouchstartIOS: this.handleOnTouchstartIOS,\n onKeyPressed: this.handleKeyPressed\n },\n isKCP: this.state.hasKoreanFields,\n legacyInputMode: this.props.legacyInputMode,\n minimumExpiryDate: this.props.minimumExpiryDate,\n implementationType: this.props.implementationType || 'components', // to distinguish between 'regular' and 'custom' card component\n forceCompat: this.props.forceCompat,\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n shouldDisableIOSArrowKeys: !!this.props.disableIOSArrowKeys, // convert whether function has been defined into a boolean\n placeholders: this.props.placeholders ?? {},\n showContextualElement: this.props.showContextualElement\n };\n\n this.csf = initCSF(csfSetupObj);\n\n /**\n * Expect to at least have had the handleOnLoad callback called within this time\n * - if this hasn't happened then something has happened to interrupt the loading of the securedFields\n * So we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n // @ts-ignore - timout 'type' is a number\n this.csfLoadFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfLoadFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured field iframes have failed to load'));\n }\n }, this.csfLoadFailTimeoutMS);\n }\n\n private checkForKCPFields() {\n let needsKoreanFields = false;\n if (this.props.koreanAuthenticationRequired) {\n needsKoreanFields = this.issuingCountryCode ? this.issuingCountryCode === 'kr' : this.props.countryCode === 'kr';\n }\n\n // Was korean, now isn't - hide password field\n if (this.state.hasKoreanFields && !needsKoreanFields) {\n // Clear any stored data\n const setRemovedFieldState = prevState => ({\n data: { ...prevState.data, [ENCRYPTED_PWD_FIELD]: undefined },\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n errors: { ...prevState.errors, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: false\n });\n\n this.setState(setRemovedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.removeSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(false);\n }\n\n // Wasn't korean, now is - show password field\n if (!this.state.hasKoreanFields && needsKoreanFields) {\n const setAddedFieldState = prevState => ({\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: true,\n isSfpValid: false\n });\n\n this.setState(setAddedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.addSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(true);\n }\n }\n\n public getChildContext(): object {\n return { i18n: this.props.i18n };\n }\n\n public handleUnsupportedCard(errObj: CardErrorData): boolean {\n const hasUnsupportedCard = !!errObj.error;\n\n // Store the brand(s) we detected and which we don't support\n if (hasUnsupportedCard) {\n this.setState({ detectedUnsupportedBrands: errObj.detectedBrands });\n }\n\n errObj.rootNode = this.rootNode; // Needed for CustomCard\n this.handleOnError(errObj, hasUnsupportedCard);\n // Inform CSF that the number field has an unsupportedCard error (or that it has been cleared)\n if (this.csf) {\n this.csf.hasUnsupportedCard(ENCRYPTED_CARD_NUMBER, errObj.error);\n }\n return hasUnsupportedCard;\n }\n\n public setFocusOn(frame: string): void {\n if (this.csf) this.csf.setFocusOnFrame(frame);\n }\n\n public updateStyles(stylesObj: StylesObject): void {\n if (this.csf) this.csf.updateStyles(stylesObj);\n }\n\n public sfIsOptionalOrHidden(fieldType: string): boolean {\n return this.csf.sfIsOptionalOrHidden(fieldType);\n }\n\n public destroy(): void {\n if (this.csf) this.csf.destroy();\n }\n\n public showValidation(): void {\n const { numDateFields, state }: SecuredFieldsProvider = this;\n\n Object.keys(state.valid)\n .reduce(getErrorReducer(numDateFields, state), [])\n .forEach(field => {\n // For each detected error pass an error object to the handler (calls error callback & sets state)\n const errorObj: CardErrorData = getErrorObject(field, this.rootNode, state);\n this.handleOnError(errorObj, !!state.detectedUnsupportedBrands);\n // Inform the secured-fields instance of which fields have been found to have errors\n if (this.csf && this.csf.isValidated) {\n this.csf.isValidated(field, errorObj.error);\n }\n });\n }\n\n /**\n * Map SF errors to ValidationRuleResult-like objects, for CardInput component\n */\n public mapErrorsToValidationRuleResult(): SFStateErrorObj {\n const fieldNames: string[] = Object.keys(this.state.errors);\n\n const sfStateErrorsObj = fieldNames.reduce((acc, fieldName) => {\n const errorCode = this.state.errors[fieldName];\n if (errorCode) {\n acc[fieldName] = {\n isValid: false,\n errorMessage: getErrorMessageFromCode(errorCode, SF_ErrorCodes), // this is the human-readable, untranslated, explanation of the error that will exist on the error object in card.state.errors\n // For v5 the object found in state.errors should also contain the additional properties that used to be sent to the onError callback\n // namely: translation, errorCode, a ref to rootNode &, in the case of failed binLookup, an array of the detectedBrands\n errorI18n: this.props.i18n.get(errorCode),\n error: errorCode,\n rootNode: this.rootNode,\n ...(this.state.detectedUnsupportedBrands && { detectedBrands: this.state.detectedUnsupportedBrands })\n };\n } else {\n acc[fieldName] = null;\n }\n return acc;\n }, {});\n return sfStateErrorsObj;\n }\n\n public processBinLookupResponse(binLookupResponse: BinLookupResponse, resetObject: SingleBrandResetObject): void {\n // If we were dealing with an unsupported card & now we have a valid /binLookup response (or a response triggering a reset of the UI),\n // - reset state to clear the error & the stored unsupportedBrands and, in the case of a valid /binLookup response, inform CSF (via handleUnsupportedCard)\n // (Scenario: from an unsupportedCard state the shopper has pasted another number long enough to trigger a /binLookup)\n if (this.state.detectedUnsupportedBrands) {\n this.setState(prevState => ({\n errors: { ...prevState.errors, [ENCRYPTED_CARD_NUMBER]: false },\n detectedUnsupportedBrands: null\n }));\n\n // If we have some sort of binLookupResponse object then this isn't the reset caused by digits dropping below a threshold\n // - so call handleUnsupportedCard to clear the error\n if (this.csf && binLookupResponse) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n this.handleUnsupportedCard(errObj);\n }\n }\n\n this.issuingCountryCode = binLookupResponse?.issuingCountryCode?.toLowerCase();\n\n const hasBrandedResetObj = resetObject?.brand;\n\n /**\n * Are we dealing with a \"dedicated\" card scenario i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands\n * - in which case we will need to reset brand and pass on the resetObj to CSF\n */\n const mustResetDedicatedBrand = hasBrandedResetObj && DEDICATED_CARD_COMPONENTS.includes(resetObject.brand);\n\n if (mustResetDedicatedBrand) {\n // resetObject.brand will be the value of the brand whose logo we want to reshow in the UI\n this.setState(resetObject, () => {\n this.props.onChange(this.state);\n });\n }\n\n /**\n * Scenarios:\n *\n * - RESET (binLookupResponse === null): The number of digits in number field has dropped below threshold for BIN lookup\n * - RESULT (binLookupResponse.supportedBrands.length === 1): binLookup has found a result so inform CSF\n *\n * In the RESET scenario, for \"dedicated\" card components we also need to pass on the resetObject since this contains information about\n * the brand that CSF needs to reset to, internally.\n */\n if (this.csf) this.csf.brandsFromBinLookup(binLookupResponse, mustResetDedicatedBrand ? resetObject : null);\n }\n\n private setRootNode = (input: HTMLElement): void => {\n this.rootNode = input;\n };\n\n public render(props, state) {\n return props.render({ setRootNode: this.setRootNode, setFocusOn: this.setFocusOn }, state);\n }\n}\n\nexport default SecuredFieldsProvider;\n"],"names":["SecuredFieldsProvider","Component","componentDidMount","this","props","rootNode","setRootNode","fields","getFields","valid","reduce","validFieldsReducer","setState","forEach","field","numCharsInField","numDateFields","filter","f","match","length","destroy","initializeCSF","componentType","TxVariants","customCard","console","debug","handleOnNoDataRequired","componentDidUpdate","checkForKCPFields","onStateUpdate","state","componentWillUnmount","csf","clearTimeout","csfLoadFailTimeout","csfConfigFailTimeout","root","loadingContext","csfSetupObj","type","clientKey","cardGroupTypes","brands","autoFocus","trimTrailingSeparator","keypadFix","showWarnings","iframeUIConfig","sfStyles","styles","i18n","onSubmitAnalytics","callbacks","onLoad","handleOnLoad","onConfigSuccess","handleOnConfigSuccess","onFieldValid","handleOnFieldValid","onAllValid","handleOnAllValid","onBrand","handleOnBrand","onError","handleOnError","onFocus","handleFocus","onBinValue","onAutoComplete","handleOnAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","handleOnTouchstartIOS","onKeyPressed","handleKeyPressed","isKCP","hasKoreanFields","legacyInputMode","minimumExpiryDate","implementationType","forceCompat","maskSecurityCode","exposeExpiryDate","shouldDisableIOSArrowKeys","disableIOSArrowKeys","placeholders","showContextualElement","initCSF","setTimeout","status","AdyenCheckoutError","csfLoadFailTimeoutMS","needsKoreanFields","koreanAuthenticationRequired","issuingCountryCode","countryCode","setRemovedFieldState","prevState","data","ENCRYPTED_PWD_FIELD","undefined","errors","onChange","removeSecuredField","setKCPStatus","setAddedFieldState","isSfpValid","addSecuredField","getChildContext","handleUnsupportedCard","errObj","hasUnsupportedCard","error","detectedUnsupportedBrands","detectedBrands","ENCRYPTED_CARD_NUMBER","setFocusOn","frame","setFocusOnFrame","updateStyles","stylesObj","sfIsOptionalOrHidden","fieldType","showValidation","Object","keys","getErrorReducer","errorObj","getErrorObject","isValidated","mapErrorsToValidationRuleResult","acc","fieldName","errorCode","isValid","errorMessage","getErrorMessageFromCode","SF_ErrorCodes","errorI18n","get","processBinLookupResponse","binLookupResponse","resetObject","toLowerCase","hasBrandedResetObj","brand","mustResetDedicatedBrand","DEDICATED_CARD_COMPONENTS","includes","brandsFromBinLookup","render","constructor","super","_define_property","csfConfigFailTimeoutMS","input","stateObj","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","handlers","bind","defaultProps"],"mappings":"20BA+BA,MAAMA,UAA8BC,EAyEzBC,iBAAAA,GAECC,KAAKC,MAAMC,UACXF,KAAKG,YAAYH,KAAKC,MAAMC,UAIhC,MAAME,EAASC,EAAUL,KAAKE,UACxBI,EAAQF,EAAOG,OAAOC,EAAoB,CAAA,GAEhDR,KAAKS,SAAS,CAAEH,UAGhBF,EAAOM,QAAQC,IACXX,KAAKY,gBAAgBD,GAAS,IAIlCX,KAAKa,cAAgBT,EAAOU,OAAOC,GAAKA,EAAEC,MAAM,WAAWC,OAEvDb,EAAOa,QACPjB,KAAKkB,UACLlB,KAAKmB,cAAcnB,KAAKE,YAEpBF,KAAKC,MAAMmB,gBAAkBC,EAAWC,YACxCC,QAAQC,MACJ,yOAGRxB,KAAKyB,yBAEb,CAEOC,kBAAAA,GACH1B,KAAK2B,oBAEL3B,KAAKC,MAAM2B,gBAAgB5B,KAAK6B,MACpC,CAEOC,oBAAAA,GACH9B,KAAK+B,IAAM,KACXC,aAAahC,KAAKiC,oBAClBD,aAAahC,KAAKkC,qBACtB,CAEQf,aAAAA,CAAcgB,GAClB,IAAIC,EAAiBpC,KAAKC,MAAMmC,eAOhC,MAAMC,EAA8B,CAChCnC,SAAUiC,EACVG,KAAMtC,KAAKC,MAAMqC,KACjBlB,cAAepB,KAAKC,MAAMmB,cAC1BmB,UAAWvC,KAAKC,MAAMsC,UACtBC,eAAgBxC,KAAKC,MAAMwC,OAC3BC,UAAW1C,KAAKC,MAAMyC,UACtBC,sBAAuB3C,KAAKC,MAAM0C,sBAClCP,iBACAQ,UAAW5C,KAAKC,MAAM2C,UACtBC,aAAc7C,KAAKC,MAAM4C,aACzBC,eAAgB,CACZC,SAAU/C,KAAKC,MAAM+C,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Y_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
|
|
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 p from"../../securedField/SecuredField.js";import u 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,submitAnalytics:this.props.onSubmitAnalytics,componentType:this.props.componentType},f=new p(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 u("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
|
package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSecuredFields.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.ts"],"sourcesContent":["import { select, getAttribute } from '../../utilities/dom';\nimport {\n ENCRYPTED_EXPIRY_YEAR,\n DATE_POLICY_REQUIRED,\n CVC_POLICY_REQUIRED,\n DATA_ENCRYPTED_FIELD_ATTR,\n DATA_INFO,\n DATA_UID,\n SF_CONFIG_TIMEOUT,\n ALL_SECURED_FIELDS,\n ENCRYPTED_EXPIRY_MONTH\n} from '../../constants';\nimport { existy } from '../../../../../../utils/commonUtils';\nimport cardType from '../utils/cardType';\nimport { SecuredFieldSetupObject } from '../../types';\nimport SecuredField from '../../securedField/SecuredField';\nimport { CardObject, CardBrandData, SFFeedbackObj, CardLoadData, CVCPolicyType, DatePolicyType } from '../../types';\nimport AdyenCheckoutError from '../../../../../../core/Errors/AdyenCheckoutError';\nimport type { SFKeyPressObj } from '../../types';\n\n/**\n * Bound to the instance of CSF\n * Handles specific functionality related to configuring & creating SecuredFields\n */\nexport function createSecuredFields(): number {\n this.encryptedAttrName = DATA_ENCRYPTED_FIELD_ATTR;\n\n // Detect DOM elements that qualify as securedField holders & filter them for valid types\n const securedFields: HTMLElement[] = select(this.props.rootNode, `[${this.encryptedAttrName}]`).filter(field => {\n const fieldType: string = getAttribute(field, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_MONTH) {\n // TODO send analytics about separate date fields\n }\n\n const isValidType = ALL_SECURED_FIELDS.includes(fieldType);\n if (!isValidType) {\n console.warn(\n `WARNING: '${fieldType}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`\n );\n }\n return isValidType;\n });\n\n /**\n * cvcPolicy - 'required' | 'optional' | 'hidden'\n * - Always 'required' for GiftCards\n * - Usually 'required' for single branded Credit Cards but with exceptions e.g. maestro ('optional'), bcmc ('hidden').\n * - Always 'required' for generic Credit Cards at start up - in this case, subsequent, supporting information about whether cvc stops being required\n * comes from the SF in the brand information (as the shopper inputs the cc number)\n */\n const cvcPolicy: CVCPolicyType = CVC_POLICY_REQUIRED;\n\n /** Usually 'required' for single branded Credit Cards but with exceptions e.g. ticket ('hidden', *technically* a meal voucher) */\n const expiryDatePolicy: DatePolicyType = DATE_POLICY_REQUIRED;\n\n // CHECK IF THIS SECURED FIELD IS NOT OF A CREDIT CARD TYPE\n if (!this.config.isCreditCardType) {\n this.createNonCardSecuredFields(securedFields);\n return securedFields.length;\n }\n\n // CONTINUE AS CREDIT-CARD TYPE...\n this.isSingleBrandedCard = false;\n\n this.securityCode = '';\n\n this.createCardSecuredFields(securedFields, cvcPolicy, expiryDatePolicy);\n\n // Return the number of iframes we're going to create\n return securedFields.length;\n}\n\n/**\n * i.e. giftcard and ach fields\n *\n * Create a new SecuredField for each detected holding element\n */\nexport async function createNonCardSecuredFields(securedFields: HTMLElement[]): Promise<any> {\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n await this.setupSecuredField(securedField).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n }\n}\n\nexport async function createCardSecuredFields(\n securedFields: HTMLElement[],\n cvcPolicy: CVCPolicyType,\n expiryDatePolicy: DatePolicyType\n): Promise<any> {\n // Declared card type from the initialisation of CSF\n let type: string = this.state.type;\n\n // Maybe it's a single branded card defined by setting type: 'card' & a single item in cardGroupTypes\n // In which case update the type var both locally AND in State\n if (type === 'card' && this.config.cardGroupTypes.length === 1) {\n type = this.config.cardGroupTypes[0];\n this.state.type = type;\n }\n\n // So, is it a single branded card?\n this.isSingleBrandedCard = type !== 'card';\n\n // If single branded card field...\n if (this.isSingleBrandedCard) {\n // Check that type exists\n const card: CardObject = cardType.getCardByBrand(type);\n\n // It's possible we don't recognise the card type -\n // scenario: frontend initially recognises card as e.g. Visa - but then backend tokenises it as a sub-brand which we currently don't recognise\n if (!existy(card)) {\n this.state.type = 'unrecognised-single-brand'; // Will let CVC field accept 4 digits in the input\n } else {\n // Assess whether cvc field is required based on the card type & whether the cvc field should even be visible\n cvcPolicy = card.cvcPolicy || CVC_POLICY_REQUIRED;\n expiryDatePolicy = card.expiryDatePolicy || DATE_POLICY_REQUIRED;\n\n this.securityCode = card.securityCode;\n }\n }\n\n /**\n * Create a new SecuredField for each detected holding element\n *\n * - we do this in sequence, waiting until one has configured before creating the next.\n * We do it this way to avoid the 'bug' whereby if something interrupts the loading of an iframe the listener we have for its load event\n * never fires; which means the iframe never configures.\n * (NB - you can recreate this 'bug' by creating the securedFields in a synchronous loop:\n * securedFields.forEach(this.setupSecuredField.bind(this));\n * and putting a breakpoint on the line where we declare the setupSecuredField function)\n *\n * Also note we tried the Array.map/Promise.all way of asynchronously looping through an array - but it didn't fix the issue,\n * - so we fall back to a good old for-loop\n */\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n if (window._b$dl) console.log('\\nAbout to set up securedField:', securedField);\n await this.setupSecuredField(securedField, cvcPolicy, expiryDatePolicy).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n if (window._b$dl) console.log('Finished setting up securedField:', securedField);\n }\n if (window._b$dl) console.log('Finished setting up all securedFields');\n\n /**\n * Now the securedFields have all been created and configured...\n *\n * For a single branded card we call to onBrand callback once.\n * This allows the UI to set the correct logo if they haven't already,\n * and we also pass the cvcPolicy & expiryDatePolicy so the UI can hide the iframe holders if necessary\n */\n if (this.isSingleBrandedCard) {\n const callbackObj: CardBrandData = {\n type: this.state.type,\n rootNode: this.props.rootNode,\n brand: type,\n cvcPolicy,\n expiryDatePolicy,\n cvcText: this.securityCode\n };\n\n // Allow a tick for the securedField to finish rendering\n setTimeout(() => {\n this.callbacks.onBrand(callbackObj);\n }, 0);\n }\n}\n\n// Run for each detected holder of a securedField...\nexport function setupSecuredField(pItem: HTMLElement, cvcPolicy?: CVCPolicyType, expiryDatePolicy?: DatePolicyType): Promise<any> {\n return new Promise((resolve, reject) => {\n /**\n * possible values:\n * encryptedCardNumber\n * encryptedExpiryDate\n * encryptedExpiryMonth\n * encryptedExpiryYear\n * encryptedSecurityCode\n * encryptedPassword\n * encryptedPin???\n * encryptedBankAccountNumber\n * encryptedBankLocationId\n * encryptedIBAN\n */\n const fieldType: string = getAttribute(pItem, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_YEAR) {\n this.state.hasSeparateDateFields = true;\n }\n\n const extraFieldData: string = getAttribute(pItem, DATA_INFO);\n const uid = getAttribute(pItem, DATA_UID);\n\n // CREATE SecuredField passing config object\n const sfInitObj: SecuredFieldSetupObject = {\n fieldType,\n extraFieldData,\n uid,\n cvcPolicy,\n holderEl: pItem,\n expiryDatePolicy,\n txVariant: this.state.type,\n // from this.config (calculated)\n cardGroupTypes: this.config.cardGroupTypes,\n iframeUIConfig: this.config.iframeUIConfig,\n sfLogAtStart: this.config.sfLogAtStart,\n trimTrailingSeparator: this.config.trimTrailingSeparator,\n isCreditCardType: this.config.isCreditCardType,\n iframeSrc: this.config.iframeSrc,\n loadingContext: this.config.loadingContext,\n showWarnings: this.config.showWarnings,\n legacyInputMode: this.config.legacyInputMode,\n minimumExpiryDate: this.config.minimumExpiryDate,\n // from this.props (passed straight thru)\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n disableIOSArrowKeys: this.props.shouldDisableIOSArrowKeys,\n implementationType: this.props.implementationType,\n showContextualElement: this.props.showContextualElement,\n placeholders: this.props.placeholders\n };\n\n const sf: SecuredField = new SecuredField(sfInitObj, this.props.i18n)\n .onIframeLoaded((): void => {\n // Count\n this.state.iframeCount += 1;\n\n if (window._b$dl) console.log('### createSecuredFields::onIframeLoaded:: this.state.iframeCount=', this.state.iframeCount);\n\n // One of our existing securedFields has just loaded new content!\n if (this.state.iframeCount > this.state.numIframes) {\n this.destroySecuredFields();\n // TODO send analytics about this error\n throw new AdyenCheckoutError(\n 'ERROR',\n `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}`\n );\n }\n\n /** Create timeout within which time we expect the securedField to configure */\n // @ts-ignore - timeout 'type' *is* a number\n sf.loadToConfigTimeout = setTimeout(() => {\n reject({ type: sfInitObj.fieldType, failReason: 'sf took too long to config' });\n }, SF_CONFIG_TIMEOUT);\n\n // If all iframes are loaded - call onLoad callback\n if (this.state.iframeCount === this.state.originalNumIframes) {\n const callbackObj: CardLoadData = { iframesLoaded: true };\n this.callbacks.onLoad(callbackObj);\n }\n })\n .onConfig((pFeedbackObj: SFFeedbackObj): void => {\n this.handleIframeConfigFeedback(pFeedbackObj);\n\n // Clear timeout since the securedField has configured\n clearTimeout(sf.loadToConfigTimeout);\n sf.loadToConfigTimeout = null;\n\n resolve(pFeedbackObj);\n })\n .onFocus((pFeedbackObj: SFFeedbackObj): void => {\n this.handleFocus(pFeedbackObj);\n })\n .onBinValue((pFeedbackObj: SFFeedbackObj): void => {\n this.handleBinValue(pFeedbackObj);\n })\n .onTouchstart((pFeedbackObj: SFFeedbackObj): void => {\n // re. Disabling arrow keys in iOS - need to disable all other fields in the form\n if (this.props.shouldDisableIOSArrowKeys) {\n /**\n * re. this.hasGenuineTouchEvents...\n * There seems to be an issue with Responsive Design mode in Safari that means it allows setting focus on cross-origin iframes,\n * without enabling the touch events that allow the \"disableIOSArrowKeys\" workaround to fully function.\n * This results in a click on an securedFields *label* leading to, for example, the holderName field being disabled, but w/o access\n * to the touch events that would let it re-enable itself.\n *\n * So we prevent the \"disableIOSArrowKeys\" workaround unless we genuinely have touch events available.\n */\n if (this.hasGenuineTouchEvents || pFeedbackObj.hasGenuineTouchEvents) {\n this.callbacks.onTouchstartIOS({ fieldType: pFeedbackObj.fieldType });\n }\n }\n\n // Only perform this step if we genuinely have touch events available\n if (pFeedbackObj.hasGenuineTouchEvents || this.hasGenuineTouchEvents) {\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n // - pass information about which field has just been clicked (gained focus) to the other iframes\n this.postMessageToAllIframes({ fieldType: pFeedbackObj.fieldType, fieldClick: true });\n }\n })\n .onShiftTab((pFeedbackObj: SFFeedbackObj): void => {\n // Only happens for Firefox & IE <= 11\n this.handleSFShiftTab(pFeedbackObj.fieldType);\n })\n .onEncryption((pFeedbackObj: SFFeedbackObj): void => {\n this.handleEncryption(pFeedbackObj);\n })\n .onValidation((pFeedbackObj: SFFeedbackObj): void => {\n this.handleValidation(pFeedbackObj);\n })\n .onAutoComplete((pFeedbackObj: SFFeedbackObj): void => {\n this.processAutoComplete(pFeedbackObj);\n })\n .onKeyPressed((pFeedbackObj: SFFeedbackObj): void => {\n const { numKey, ...rest } = pFeedbackObj;\n this.callbacks.onKeyPressed(rest as SFKeyPressObj);\n });\n\n // Store reference to securedField in this.state (under fieldType)\n this.state.securedFields[fieldType] = sf;\n });\n}\n"],"names":["createSecuredFields","this","encryptedAttrName","DATA_ENCRYPTED_FIELD_ATTR","securedFields","select","props","rootNode","filter","field","fieldType","getAttribute","isValidType","ALL_SECURED_FIELDS","includes","console","warn","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","config","isCreditCardType","isSingleBrandedCard","securityCode","createCardSecuredFields","length","createNonCardSecuredFields","async","i","securedField","setupSecuredField","catch","e","window","_b$dl","log","type","state","cardGroupTypes","card","cardType","getCardByBrand","existy","callbackObj","brand","cvcText","setTimeout","callbacks","onBrand","pItem","Promise","resolve","reject","ENCRYPTED_EXPIRY_YEAR","hasSeparateDateFields","sfInitObj","extraFieldData","DATA_INFO","uid","DATA_UID","holderEl","txVariant","iframeUIConfig","sfLogAtStart","trimTrailingSeparator","iframeSrc","loadingContext","showWarnings","legacyInputMode","minimumExpiryDate","maskSecurityCode","exposeExpiryDate","disableIOSArrowKeys","shouldDisableIOSArrowKeys","implementationType","showContextualElement","placeholders","sf","SecuredField","i18n","onIframeLoaded","iframeCount","numIframes","destroySecuredFields","AdyenCheckoutError","loadToConfigTimeout","failReason","SF_CONFIG_TIMEOUT","originalNumIframes","iframesLoaded","onLoad","onConfig","pFeedbackObj","handleIframeConfigFeedback","clearTimeout","onFocus","handleFocus","onBinValue","handleBinValue","onTouchstart","hasGenuineTouchEvents","onTouchstartIOS","postMessageToAllIframes","fieldClick","onShiftTab","handleSFShiftTab","onEncryption","handleEncryption","onValidation","handleValidation","onAutoComplete","processAutoComplete","onKeyPressed","numKey","rest"],"mappings":"ofAwBO,SAASA,IACZC,KAAKC,kBAAoBC,EAGzB,MAAMC,EAA+BC,EAAOJ,KAAKK,MAAMC,SAAU,IAAIN,KAAKC,sBAAsBM,OAAOC,IACnG,MAAMC,EAAoBC,EAAaF,EAAOR,KAAKC,mBAM7CU,EAAcC,EAAmBC,SAASJ,GAMhD,OALKE,GACDG,QAAQC,KACJ,aAAaN,mCAA2CT,KAAKC,sFAG9DU,IAULK,EAA2BC,EAG3BC,EAAmCC,EAGzC,OAAKnB,KAAKoB,OAAOC,kBAMjBrB,KAAKsB,qBAAsB,EAE3BtB,KAAKuB,aAAe,GAEpBvB,KAAKwB,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,WAGpC,MAFAlF,KAAKmF,uBAEC,IAAIC,EACN,QACA,gKACoBpF,KAAKqC,MAAM4C,+BAA+BjF,KAAKqC,MAAM6C,cAWjF,GALAL,EAAGQ,oBAAsBvC,WAAW,KAChCM,EAAO,CAAEhB,KAAMmB,EAAU9C,UAAW6E,WAAY,gCACjDC,GAGCvF,KAAKqC,MAAM4C,cAAgBjF,KAAKqC,MAAMmD,mBAAoB,CAC1D,MAAM7C,EAA4B,CAAE8C,eAAe,GACnDzF,KAAK+C,UAAU2C,OAAO/C,EAC1B,IAEHgD,SAAUC,IACP5F,KAAK6F,2BAA2BD,GAGhCE,aAAajB,EAAGQ,qBAChBR,EAAGQ,oBAAsB,KAEzBlC,EAAQyC,KAEXG,QAASH,IACN5F,KAAKgG,YAAYJ,KAEpBK,WAAYL,IACT5F,KAAKkG,eAAeN,KAEvBO,aAAcP,IAEP5F,KAAKK,MAAMoE,4BAUPzE,KAAKoG,uBAAyBR,EAAaQ,wBAC3CpG,KAAK+C,UAAUsD,gBAAgB,CAAE5F,UAAWmF,EAAanF,aAK7DmF,EAAaQ,uBAAyBpG,KAAKoG,wBAG3CpG,KAAKsG,wBAAwB,CAAE7F,UAAWmF,EAAanF,UAAW8F,YAAY,MAGrFC,WAAYZ,IAET5F,KAAKyG,iBAAiBb,EAAanF,aAEtCiG,aAAcd,IACX5F,KAAK2G,iBAAiBf,KAEzBgB,aAAchB,IACX5F,KAAK6G,iBAAiBjB,KAEzBkB,eAAgBlB,IACb5F,KAAK+G,oBAAoBnB,KAE5BoB,aAAcpB,IACX,MAAMqB,OAAEA,KAAWC,GAAStB,EAC5B5F,KAAK+C,UAAUiE,aAAaE,KAIpClH,KAAKqC,MAAMlC,cAAcM,GAAaoE,GAE9C"}
|
|
1
|
+
{"version":3,"file":"createSecuredFields.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.ts"],"sourcesContent":["import { select, getAttribute } from '../../utilities/dom';\nimport {\n ENCRYPTED_EXPIRY_YEAR,\n DATE_POLICY_REQUIRED,\n CVC_POLICY_REQUIRED,\n DATA_ENCRYPTED_FIELD_ATTR,\n DATA_INFO,\n DATA_UID,\n SF_CONFIG_TIMEOUT,\n ALL_SECURED_FIELDS,\n ENCRYPTED_EXPIRY_MONTH\n} from '../../constants';\nimport { existy } from '../../../../../../utils/commonUtils';\nimport cardType from '../utils/cardType';\nimport { SecuredFieldSetupObject } from '../../types';\nimport SecuredField from '../../securedField/SecuredField';\nimport { CardObject, CardBrandData, SFFeedbackObj, CardLoadData, CVCPolicyType, DatePolicyType } from '../../types';\nimport AdyenCheckoutError from '../../../../../../core/Errors/AdyenCheckoutError';\nimport type { SFKeyPressObj } from '../../types';\n\n/**\n * Bound to the instance of CSF\n * Handles specific functionality related to configuring & creating SecuredFields\n */\nexport function createSecuredFields(): number {\n this.encryptedAttrName = DATA_ENCRYPTED_FIELD_ATTR;\n\n // Detect DOM elements that qualify as securedField holders & filter them for valid types\n const securedFields: HTMLElement[] = select(this.props.rootNode, `[${this.encryptedAttrName}]`).filter(field => {\n const fieldType: string = getAttribute(field, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_MONTH) {\n // TODO send analytics about separate date fields\n }\n\n const isValidType = ALL_SECURED_FIELDS.includes(fieldType);\n if (!isValidType) {\n console.warn(\n `WARNING: '${fieldType}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`\n );\n }\n return isValidType;\n });\n\n /**\n * cvcPolicy - 'required' | 'optional' | 'hidden'\n * - Always 'required' for GiftCards\n * - Usually 'required' for single branded Credit Cards but with exceptions e.g. maestro ('optional'), bcmc ('hidden').\n * - Always 'required' for generic Credit Cards at start up - in this case, subsequent, supporting information about whether cvc stops being required\n * comes from the SF in the brand information (as the shopper inputs the cc number)\n */\n const cvcPolicy: CVCPolicyType = CVC_POLICY_REQUIRED;\n\n /** Usually 'required' for single branded Credit Cards but with exceptions e.g. ticket ('hidden', *technically* a meal voucher) */\n const expiryDatePolicy: DatePolicyType = DATE_POLICY_REQUIRED;\n\n // CHECK IF THIS SECURED FIELD IS NOT OF A CREDIT CARD TYPE\n if (!this.config.isCreditCardType) {\n this.createNonCardSecuredFields(securedFields);\n return securedFields.length;\n }\n\n // CONTINUE AS CREDIT-CARD TYPE...\n this.isSingleBrandedCard = false;\n\n this.securityCode = '';\n\n this.createCardSecuredFields(securedFields, cvcPolicy, expiryDatePolicy);\n\n // Return the number of iframes we're going to create\n return securedFields.length;\n}\n\n/**\n * i.e. giftcard and ach fields\n *\n * Create a new SecuredField for each detected holding element\n */\nexport async function createNonCardSecuredFields(securedFields: HTMLElement[]): Promise<any> {\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n await this.setupSecuredField(securedField).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n }\n}\n\nexport async function createCardSecuredFields(\n securedFields: HTMLElement[],\n cvcPolicy: CVCPolicyType,\n expiryDatePolicy: DatePolicyType\n): Promise<any> {\n // Declared card type from the initialisation of CSF\n let type: string = this.state.type;\n\n // Maybe it's a single branded card defined by setting type: 'card' & a single item in cardGroupTypes\n // In which case update the type var both locally AND in State\n if (type === 'card' && this.config.cardGroupTypes.length === 1) {\n type = this.config.cardGroupTypes[0];\n this.state.type = type;\n }\n\n // So, is it a single branded card?\n this.isSingleBrandedCard = type !== 'card';\n\n // If single branded card field...\n if (this.isSingleBrandedCard) {\n // Check that type exists\n const card: CardObject = cardType.getCardByBrand(type);\n\n // It's possible we don't recognise the card type -\n // scenario: frontend initially recognises card as e.g. Visa - but then backend tokenises it as a sub-brand which we currently don't recognise\n if (!existy(card)) {\n this.state.type = 'unrecognised-single-brand'; // Will let CVC field accept 4 digits in the input\n } else {\n // Assess whether cvc field is required based on the card type & whether the cvc field should even be visible\n cvcPolicy = card.cvcPolicy || CVC_POLICY_REQUIRED;\n expiryDatePolicy = card.expiryDatePolicy || DATE_POLICY_REQUIRED;\n\n this.securityCode = card.securityCode;\n }\n }\n\n /**\n * Create a new SecuredField for each detected holding element\n *\n * - we do this in sequence, waiting until one has configured before creating the next.\n * We do it this way to avoid the 'bug' whereby if something interrupts the loading of an iframe the listener we have for its load event\n * never fires; which means the iframe never configures.\n * (NB - you can recreate this 'bug' by creating the securedFields in a synchronous loop:\n * securedFields.forEach(this.setupSecuredField.bind(this));\n * and putting a breakpoint on the line where we declare the setupSecuredField function)\n *\n * Also note we tried the Array.map/Promise.all way of asynchronously looping through an array - but it didn't fix the issue,\n * - so we fall back to a good old for-loop\n */\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n if (window._b$dl) console.log('\\nAbout to set up securedField:', securedField);\n await this.setupSecuredField(securedField, cvcPolicy, expiryDatePolicy).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n if (window._b$dl) console.log('Finished setting up securedField:', securedField);\n }\n if (window._b$dl) console.log('Finished setting up all securedFields');\n\n /**\n * Now the securedFields have all been created and configured...\n *\n * For a single branded card we call to onBrand callback once.\n * This allows the UI to set the correct logo if they haven't already,\n * and we also pass the cvcPolicy & expiryDatePolicy so the UI can hide the iframe holders if necessary\n */\n if (this.isSingleBrandedCard) {\n const callbackObj: CardBrandData = {\n type: this.state.type,\n rootNode: this.props.rootNode,\n brand: type,\n cvcPolicy,\n expiryDatePolicy,\n cvcText: this.securityCode\n };\n\n // Allow a tick for the securedField to finish rendering\n setTimeout(() => {\n this.callbacks.onBrand(callbackObj);\n }, 0);\n }\n}\n\n// Run for each detected holder of a securedField...\nexport function setupSecuredField(pItem: HTMLElement, cvcPolicy?: CVCPolicyType, expiryDatePolicy?: DatePolicyType): Promise<any> {\n return new Promise((resolve, reject) => {\n /**\n * possible values:\n * encryptedCardNumber\n * encryptedExpiryDate\n * encryptedExpiryMonth\n * encryptedExpiryYear\n * encryptedSecurityCode\n * encryptedPassword\n * encryptedPin???\n * encryptedBankAccountNumber\n * encryptedBankLocationId\n * encryptedIBAN\n */\n const fieldType: string = getAttribute(pItem, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_YEAR) {\n this.state.hasSeparateDateFields = true;\n }\n\n const extraFieldData: string = getAttribute(pItem, DATA_INFO);\n const uid = getAttribute(pItem, DATA_UID);\n\n // CREATE SecuredField passing config object\n const sfInitObj: SecuredFieldSetupObject = {\n fieldType,\n extraFieldData,\n uid,\n cvcPolicy,\n holderEl: pItem,\n expiryDatePolicy,\n txVariant: this.state.type,\n // from this.config (calculated)\n cardGroupTypes: this.config.cardGroupTypes,\n iframeUIConfig: this.config.iframeUIConfig,\n sfLogAtStart: this.config.sfLogAtStart,\n trimTrailingSeparator: this.config.trimTrailingSeparator,\n isCreditCardType: this.config.isCreditCardType,\n iframeSrc: this.config.iframeSrc,\n loadingContext: this.config.loadingContext,\n showWarnings: this.config.showWarnings,\n legacyInputMode: this.config.legacyInputMode,\n minimumExpiryDate: this.config.minimumExpiryDate,\n // from this.props (passed straight thru)\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n disableIOSArrowKeys: this.props.shouldDisableIOSArrowKeys,\n implementationType: this.props.implementationType,\n showContextualElement: this.props.showContextualElement,\n placeholders: this.props.placeholders,\n submitAnalytics: this.props.onSubmitAnalytics,\n componentType: this.props.componentType\n };\n\n const sf: SecuredField = new SecuredField(sfInitObj, this.props.i18n)\n .onIframeLoaded((): void => {\n // Count\n this.state.iframeCount += 1;\n\n if (window._b$dl) console.log('### createSecuredFields::onIframeLoaded:: this.state.iframeCount=', this.state.iframeCount);\n\n // One of our existing securedFields has just loaded new content!\n if (this.state.iframeCount > this.state.numIframes) {\n this.destroySecuredFields();\n // TODO send analytics about this error\n throw new AdyenCheckoutError(\n 'ERROR',\n `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}`\n );\n }\n\n /** Create timeout within which time we expect the securedField to configure */\n // @ts-ignore - timeout 'type' *is* a number\n sf.loadToConfigTimeout = setTimeout(() => {\n reject({ type: sfInitObj.fieldType, failReason: 'sf took too long to config' });\n }, SF_CONFIG_TIMEOUT);\n\n // If all iframes are loaded - call onLoad callback\n if (this.state.iframeCount === this.state.originalNumIframes) {\n const callbackObj: CardLoadData = { iframesLoaded: true };\n this.callbacks.onLoad(callbackObj);\n }\n })\n .onConfig((pFeedbackObj: SFFeedbackObj): void => {\n this.handleIframeConfigFeedback(pFeedbackObj);\n\n // Clear timeout since the securedField has configured\n clearTimeout(sf.loadToConfigTimeout);\n sf.loadToConfigTimeout = null;\n\n resolve(pFeedbackObj);\n })\n .onFocus((pFeedbackObj: SFFeedbackObj): void => {\n this.handleFocus(pFeedbackObj);\n })\n .onBinValue((pFeedbackObj: SFFeedbackObj): void => {\n this.handleBinValue(pFeedbackObj);\n })\n .onTouchstart((pFeedbackObj: SFFeedbackObj): void => {\n // re. Disabling arrow keys in iOS - need to disable all other fields in the form\n if (this.props.shouldDisableIOSArrowKeys) {\n /**\n * re. this.hasGenuineTouchEvents...\n * There seems to be an issue with Responsive Design mode in Safari that means it allows setting focus on cross-origin iframes,\n * without enabling the touch events that allow the \"disableIOSArrowKeys\" workaround to fully function.\n * This results in a click on an securedFields *label* leading to, for example, the holderName field being disabled, but w/o access\n * to the touch events that would let it re-enable itself.\n *\n * So we prevent the \"disableIOSArrowKeys\" workaround unless we genuinely have touch events available.\n */\n if (this.hasGenuineTouchEvents || pFeedbackObj.hasGenuineTouchEvents) {\n this.callbacks.onTouchstartIOS({ fieldType: pFeedbackObj.fieldType });\n }\n }\n\n // Only perform this step if we genuinely have touch events available\n if (pFeedbackObj.hasGenuineTouchEvents || this.hasGenuineTouchEvents) {\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n // - pass information about which field has just been clicked (gained focus) to the other iframes\n this.postMessageToAllIframes({ fieldType: pFeedbackObj.fieldType, fieldClick: true });\n }\n })\n .onShiftTab((pFeedbackObj: SFFeedbackObj): void => {\n // Only happens for Firefox & IE <= 11\n this.handleSFShiftTab(pFeedbackObj.fieldType);\n })\n .onEncryption((pFeedbackObj: SFFeedbackObj): void => {\n this.handleEncryption(pFeedbackObj);\n })\n .onValidation((pFeedbackObj: SFFeedbackObj): void => {\n this.handleValidation(pFeedbackObj);\n })\n .onAutoComplete((pFeedbackObj: SFFeedbackObj): void => {\n this.processAutoComplete(pFeedbackObj);\n })\n .onKeyPressed((pFeedbackObj: SFFeedbackObj): void => {\n const { numKey, ...rest } = pFeedbackObj;\n this.callbacks.onKeyPressed(rest as SFKeyPressObj);\n });\n\n // Store reference to securedField in this.state (under fieldType)\n this.state.securedFields[fieldType] = sf;\n });\n}\n"],"names":["createSecuredFields","this","encryptedAttrName","DATA_ENCRYPTED_FIELD_ATTR","securedFields","select","props","rootNode","filter","field","fieldType","getAttribute","isValidType","ALL_SECURED_FIELDS","includes","console","warn","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","config","isCreditCardType","isSingleBrandedCard","securityCode","createCardSecuredFields","length","createNonCardSecuredFields","async","i","securedField","setupSecuredField","catch","e","window","_b$dl","log","type","state","cardGroupTypes","card","cardType","getCardByBrand","existy","callbackObj","brand","cvcText","setTimeout","callbacks","onBrand","pItem","Promise","resolve","reject","ENCRYPTED_EXPIRY_YEAR","hasSeparateDateFields","sfInitObj","extraFieldData","DATA_INFO","uid","DATA_UID","holderEl","txVariant","iframeUIConfig","sfLogAtStart","trimTrailingSeparator","iframeSrc","loadingContext","showWarnings","legacyInputMode","minimumExpiryDate","maskSecurityCode","exposeExpiryDate","disableIOSArrowKeys","shouldDisableIOSArrowKeys","implementationType","showContextualElement","placeholders","submitAnalytics","onSubmitAnalytics","componentType","sf","SecuredField","i18n","onIframeLoaded","iframeCount","numIframes","destroySecuredFields","AdyenCheckoutError","loadToConfigTimeout","failReason","SF_CONFIG_TIMEOUT","originalNumIframes","iframesLoaded","onLoad","onConfig","pFeedbackObj","handleIframeConfigFeedback","clearTimeout","onFocus","handleFocus","onBinValue","handleBinValue","onTouchstart","hasGenuineTouchEvents","onTouchstartIOS","postMessageToAllIframes","fieldClick","onShiftTab","handleSFShiftTab","onEncryption","handleEncryption","onValidation","handleValidation","onAutoComplete","processAutoComplete","onKeyPressed","numKey","rest"],"mappings":"ofAwBO,SAASA,IACZC,KAAKC,kBAAoBC,EAGzB,MAAMC,EAA+BC,EAAOJ,KAAKK,MAAMC,SAAU,IAAIN,KAAKC,sBAAsBM,OAAOC,IACnG,MAAMC,EAAoBC,EAAaF,EAAOR,KAAKC,mBAM7CU,EAAcC,EAAmBC,SAASJ,GAMhD,OALKE,GACDG,QAAQC,KACJ,aAAaN,mCAA2CT,KAAKC,sFAG9DU,IAULK,EAA2BC,EAG3BC,EAAmCC,EAGzC,OAAKnB,KAAKoB,OAAOC,kBAMjBrB,KAAKsB,qBAAsB,EAE3BtB,KAAKuB,aAAe,GAEpBvB,KAAKwB,wBAAwBrB,EAAea,EAAWE,GAGhDf,EAAcsB,SAZjBzB,KAAK0B,2BAA2BvB,GACzBA,EAAcsB,OAY7B,CAOOE,eAAeD,EAA2BvB,GAC7C,IAAK,IAAIyB,EAAI,EAAGA,EAAIzB,EAAcsB,OAAQG,IAAK,CAC3C,MAAMC,EAAe1B,EAAcyB,SAC7B5B,KAAK8B,kBAAkBD,GAAcE,MAAMC,IACzCC,OAAOC,OAAOpB,QAAQqB,IAAI,mCAAoCH,IAE1E,CACJ,CAEOL,eAAeH,EAClBrB,EACAa,EACAE,GAGA,IAAIkB,EAAepC,KAAKqC,MAAMD,KAa9B,GATa,SAATA,GAAyD,IAAtCpC,KAAKoB,OAAOkB,eAAeb,SAC9CW,EAAOpC,KAAKoB,OAAOkB,eAAe,GAClCtC,KAAKqC,MAAMD,KAAOA,GAItBpC,KAAKsB,oBAA+B,SAATc,EAGvBpC,KAAKsB,oBAAqB,CAE1B,MAAMiB,EAAmBC,EAASC,eAAeL,GAI5CM,EAAOH,IAIRvB,EAAYuB,EAAKvB,W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AAyBR,EAAaQ,wBAC3CvG,KAAK+C,UAAUyD,gBAAgB,CAAE/F,UAAWsF,EAAatF,aAK7DsF,EAAaQ,uBAAyBvG,KAAKuG,wBAG3CvG,KAAKyG,wBAAwB,CAAEhG,UAAWsF,EAAatF,UAAWiG,YAAY,MAGrFC,WAAYZ,IAET/F,KAAK4G,iBAAiBb,EAAatF,aAEtCoG,aAAcd,IACX/F,KAAK8G,iBAAiBf,KAEzBgB,aAAchB,IACX/F,KAAKgH,iBAAiBjB,KAEzBkB,eAAgBlB,IACb/F,KAAKkH,oBAAoBnB,KAE5BoB,aAAcpB,IACX,MAAMqB,OAAEA,KAAWC,GAAStB,EAC5B/F,KAAK+C,UAAUoE,aAAaE,KAIpCrH,KAAKqC,MAAMlC,cAAcM,GAAauE,GAE9C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function i(i,o,t){return o in i?Object.defineProperty(i,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[o]=t,i}class o{constructor(){i(this,"sfConfig",void 0),i(this,"loadingContext",void 0),i(this,"holderEl",void 0),i(this,"iframeRef",void 0),i(this,"loadToConfigTimeout",void 0),i(this,"_isValid",void 0),i(this,"_iframeContentWindow",void 0),i(this,"_numKey",void 0),i(this,"_isEncrypted",void 0),i(this,"_hasError",void 0),i(this,"_errorType",void 0),i(this,"_cvcPolicy",void 0),i(this,"_expiryDatePolicy",void 0),i(this,"_iframeOnLoadListener",void 0),i(this,"_postMessageListener",void 0),i(this,"onIframeLoadedCallback",void 0),i(this,"onConfigCallback",void 0),i(this,"onEncryptionCallback",void 0),i(this,"onValidationCallback",void 0),i(this,"onFocusCallback",void 0),i(this,"onBinValueCallback",void 0),i(this,"onTouchstartCallback",void 0),i(this,"onShiftTabCallback",void 0),i(this,"onAutoCompleteCallback",void 0),i(this,"onKeyPressedCallback",void 0),this.sfConfig={}}}export{o as default};
|
|
1
|
+
function i(i,o,t){return o in i?Object.defineProperty(i,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[o]=t,i}class o{constructor(){i(this,"sfConfig",void 0),i(this,"componentType",void 0),i(this,"loadingContext",void 0),i(this,"holderEl",void 0),i(this,"iframeRef",void 0),i(this,"loadToConfigTimeout",void 0),i(this,"_isValid",void 0),i(this,"_iframeContentWindow",void 0),i(this,"_numKey",void 0),i(this,"_isEncrypted",void 0),i(this,"_hasError",void 0),i(this,"_errorType",void 0),i(this,"_cvcPolicy",void 0),i(this,"_expiryDatePolicy",void 0),i(this,"_iframeOnLoadListener",void 0),i(this,"_postMessageListener",void 0),i(this,"submitAnalytics",void 0),i(this,"onIframeLoadedCallback",void 0),i(this,"onConfigCallback",void 0),i(this,"onEncryptionCallback",void 0),i(this,"onValidationCallback",void 0),i(this,"onFocusCallback",void 0),i(this,"onBinValueCallback",void 0),i(this,"onTouchstartCallback",void 0),i(this,"onShiftTabCallback",void 0),i(this,"onAutoCompleteCallback",void 0),i(this,"onKeyPressedCallback",void 0),this.sfConfig={}}}export{o as default};
|
|
2
2
|
//# sourceMappingURL=AbstractSecuredField.js.map
|
package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractSecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.ts"],"sourcesContent":["import {\n CVCPolicyType,\n DatePolicyType,\n RtnType_callbackFn,\n RtnType_noParamVoidFn,\n RtnType_postMessageListener,\n SecuredFieldCommonProps\n} from '../types';\n\nabstract class AbstractSecuredField {\n public sfConfig: SecuredFieldCommonProps; // could be protected but needs to be public for tests to run\n protected loadingContext: string;\n protected holderEl: HTMLElement;\n protected iframeRef: HTMLElement;\n public loadToConfigTimeout: number;\n // From getters/setters with the same name\n protected _isValid: boolean;\n protected _iframeContentWindow: Window;\n protected _numKey: number;\n protected _isEncrypted: boolean;\n protected _hasError: boolean;\n protected _errorType: string;\n protected _cvcPolicy: CVCPolicyType;\n protected _expiryDatePolicy: DatePolicyType;\n protected _iframeOnLoadListener: RtnType_noParamVoidFn;\n protected _postMessageListener: RtnType_postMessageListener;\n // Callback fns assigned via public functions\n protected onIframeLoadedCallback: RtnType_noParamVoidFn;\n protected onConfigCallback: RtnType_callbackFn;\n protected onEncryptionCallback: RtnType_callbackFn;\n protected onValidationCallback: RtnType_callbackFn;\n protected onFocusCallback: RtnType_callbackFn;\n protected onBinValueCallback: RtnType_callbackFn;\n protected onTouchstartCallback: RtnType_callbackFn;\n protected onShiftTabCallback: RtnType_callbackFn;\n protected onAutoCompleteCallback: RtnType_callbackFn;\n protected onKeyPressedCallback: RtnType_callbackFn;\n\n protected constructor() {\n this.sfConfig = {} as any as SecuredFieldCommonProps;\n }\n}\n\nexport default AbstractSecuredField;\n"],"names":["AbstractSecuredField","constructor","_define_property","this","sfConfig","loadingContext","holderEl","iframeRef","loadToConfigTimeout","_isValid","_iframeContentWindow","_numKey","_isEncrypted","_hasError","_errorType","_cvcPolicy","_expiryDatePolicy","_iframeOnLoadListener","_postMessageListener","onIframeLoadedCallback","onConfigCallback","onEncryptionCallback","onValidationCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onKeyPressedCallback"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AbstractSecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.ts"],"sourcesContent":["import {\n CVCPolicyType,\n DatePolicyType,\n RtnType_callbackFn,\n RtnType_noParamVoidFn,\n RtnType_postMessageListener,\n SecuredFieldCommonProps,\n SecuredFieldSetupObject\n} from '../types';\n\nabstract class AbstractSecuredField {\n public sfConfig: SecuredFieldCommonProps; // could be protected but needs to be public for tests to run\n protected componentType: string;\n protected loadingContext: string;\n protected holderEl: HTMLElement;\n protected iframeRef: HTMLElement;\n public loadToConfigTimeout: number;\n // From getters/setters with the same name\n protected _isValid: boolean;\n protected _iframeContentWindow: Window;\n protected _numKey: number;\n protected _isEncrypted: boolean;\n protected _hasError: boolean;\n protected _errorType: string;\n protected _cvcPolicy: CVCPolicyType;\n protected _expiryDatePolicy: DatePolicyType;\n protected _iframeOnLoadListener: RtnType_noParamVoidFn;\n protected _postMessageListener: RtnType_postMessageListener;\n protected submitAnalytics: SecuredFieldSetupObject['submitAnalytics'];\n // Callback fns assigned via public functions\n protected onIframeLoadedCallback: RtnType_noParamVoidFn;\n protected onConfigCallback: RtnType_callbackFn;\n protected onEncryptionCallback: RtnType_callbackFn;\n protected onValidationCallback: RtnType_callbackFn;\n protected onFocusCallback: RtnType_callbackFn;\n protected onBinValueCallback: RtnType_callbackFn;\n protected onTouchstartCallback: RtnType_callbackFn;\n protected onShiftTabCallback: RtnType_callbackFn;\n protected onAutoCompleteCallback: RtnType_callbackFn;\n protected onKeyPressedCallback: RtnType_callbackFn;\n\n protected constructor() {\n this.sfConfig = {} as any as SecuredFieldCommonProps;\n }\n}\n\nexport default AbstractSecuredField;\n"],"names":["AbstractSecuredField","constructor","_define_property","this","sfConfig","componentType","loadingContext","holderEl","iframeRef","loadToConfigTimeout","_isValid","_iframeContentWindow","_numKey","_isEncrypted","_hasError","_errorType","_cvcPolicy","_expiryDatePolicy","_iframeOnLoadListener","_postMessageListener","submitAnalytics","onIframeLoadedCallback","onConfigCallback","onEncryptionCallback","onValidationCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onKeyPressedCallback"],"mappings":"wHAUA,MAAeA,EA+BX,WAAAC,GA9BAC,EAAAC,KAAOC,gBAAP,GACAF,EAAAC,KAAUE,qBAAV,GACAH,EAAAC,KAAUG,sBAAV,GACAJ,EAAAC,KAAUI,gBAAV,GACAL,EAAAC,KAAUK,iBAAV,GACAN,EAAAC,KAAOM,2BAAP,GAEAP,EAAAC,KAAUO,gBAAV,GACAR,EAAAC,KAAUQ,4BAAV,GACAT,EAAAC,KAAUS,eAAV,GACAV,EAAAC,KAAUU,oBAAV,GACAX,EAAAC,KAAUW,iBAAV,GACAZ,EAAAC,KAAUY,kBAAV,GACAb,EAAAC,KAAUa,kBAAV,GACAd,EAAAC,KAAUc,yBAAV,GACAf,EAAAC,KAAUe,6BAAV,GACAhB,EAAAC,KAAUgB,4BAAV,GACAjB,EAAAC,KAAUiB,uBAAV,GAEAlB,EAAAC,KAAUkB,8BAAV,GACAnB,EAAAC,KAAUmB,wBAAV,GACApB,EAAAC,KAAUoB,4BAAV,GACArB,EAAAC,KAAUqB,4BAAV,GACAtB,EAAAC,KAAUsB,uBAAV,GACAvB,EAAAC,KAAUuB,0BAAV,GACAxB,EAAAC,KAAUwB,4BAAV,GACAzB,EAAAC,KAAUyB,0BAAV,GACA1B,EAAAC,KAAU0B,8BAAV,GACA3B,EAAAC,KAAU2B,4BAAV,GAGI3B,KAAKC,SAAW,CAAA,CACpB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{log as e,warn as i}from"../utilities/logger.js";import
|
|
1
|
+
import{log as e,warn as i}from"../utilities/logger.js";import t from"./utils/createIframe.js";import{selectOne as s,removeAllChildren as r}from"../utilities/dom.js";import{on as n,off as o}from"../../../../../utils/listenerUtils.js";import a from"../CSF/utils/iframes/postMessageToIframe.js";import{originCheckPassed as l,isWebpackPostMsg as h,isChromeVoxPostMsg as f}from"../CSF/utils/iframes/postMessageValidation.js";import{ENCRYPTED_EXPIRY_DATE as c,ENCRYPTED_EXPIRY_MONTH as d,ENCRYPTED_EXPIRY_YEAR as m,DATE_POLICY_OPTIONAL as u,DATE_POLICY_HIDDEN as p,ENCRYPTED_SECURITY_CODE as g,CVC_POLICY_OPTIONAL as y,CVC_POLICY_HIDDEN as C}from"../constants.js";import{generateRandomNumber as b}from"../utilities/commonUtils.js";import E from"./AbstractSecuredField.js";import{reject as T}from"../../../../../utils/commonUtils.js";import{processAriaConfig as L}from"./utils/processAriaConfig.js";import{processPlaceholders as w}from"./utils/processPlaceholders.js";import{hasOwnProperty as _}from"../../../../../utils/hasOwnProperty.js";import{AnalyticsErrorEvent as k,ErrorEventType as F,ErrorEventCode as P}from"../../../../../core/Analytics/events/AnalyticsErrorEvent.js";class O extends E{init(e,i,r,o){const a=L(this.sfConfig.txVariant,this.sfConfig.fieldType,e,o);this.sfConfig.iframeUIConfig.ariaConfig=a,this.sfConfig.iframeUIConfig.placeholders=w(this.sfConfig.txVariant,this.sfConfig.fieldType,r);const l={src:i,title:a[this.sfConfig.fieldType].iframeTitle,policy:"origin"},h=t(l);this.holderEl.appendChild(h);const f=s(this.holderEl,".js-iframe");if(f){if(!f.contentWindow){console.error("ERROR: Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined. Are you sure the element into which the Card component is being mounted already exists in the DOM *before* the Card component is mounted?");const e=new k({component:this.componentType,code:P.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,errorType:F.implementation,message:`Trying to initialise an iframe for ${this.sfConfig.fieldType}, but the iframe.contentWindow is undefined`});this.submitAnalytics?.(e)}this.iframeContentWindow=f.contentWindow,this.iframeOnLoadListener=this.iframeOnLoadListenerFn,n(f,"load",this.iframeOnLoadListener,!1)}return this.iframeRef=f,this}iframeOnLoadListenerFn(){this.postMessageListener=this.postMessageListenerFn,n(window,"message",this.postMessageListener,!1);const e={...this.sfConfig,numKey:this.numKey};window._b$dl&&console.log("### SecuredField:::: onIframeLoaded:: created configObj=",e),a(e,this.iframeContentWindow,this.loadingContext),this.onIframeLoadedCallback()}postMessageListenerFn(t){if(!l(t,this.loadingContext,this.sfConfig.showWarnings))return;let s;try{s=JSON.parse(t.data)}catch(i){return h(t)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK")):f(t)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX")):void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=",t.data))}if(_(s,"action")&&_(s,"numKey"))if(this.numKey===s.numKey)switch(s.action){case"encryption":this.isValid=!0,this.onEncryptionCallback(s);break;case"config":window._b$dl&&console.log("### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback",s.fieldType),this.onConfigCallback(s);break;case"focus":this.onFocusCallback(s);break;case"binValue":this.onBinValueCallback(s);break;case"touch":this.onTouchstartCallback(s);break;case"shifttab":this.onShiftTabCallback(s);break;case"autoComplete":this.onAutoCompleteCallback(s);break;case"enterKeyPressed":this.onKeyPressedCallback(s);break;default:this.isValid=!1,this.onValidationCallback(s)}else this.sfConfig.showWarnings&&i("WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)");else this.sfConfig.showWarnings&&i("WARNING SecuredField :: postMessage listener for iframe :: data mismatch!")}destroy(){o(window,"message",this.postMessageListener,!1),o(this.iframeRef,"load",this.iframeOnLoadListener,!1),this.iframeContentWindow=null,r(this.holderEl)}isOptionalOrHidden(){if(this.sfConfig.fieldType===c||this.sfConfig.fieldType===d||this.sfConfig.fieldType===m)switch(this.expiryDatePolicy){case p:return!0;case u:return!this.hasError;default:return!1}if(this.sfConfig.fieldType===g)switch(this.cvcPolicy){case C:return!0;case y:return!this.hasError;default:return!1}return!1}onIframeLoaded(e){return this.onIframeLoadedCallback=e,this}onEncryption(e){return this.onEncryptionCallback=e,this}onValidation(e){return this.onValidationCallback=e,this}onConfig(e){return this.onConfigCallback=e,this}onFocus(e){return this.onFocusCallback=e,this}onBinValue(e){return this.onBinValueCallback=e,this}onTouchstart(e){return this.onTouchstartCallback=e,this}onShiftTab(e){return this.onShiftTabCallback=e,this}onAutoComplete(e){return this.onAutoCompleteCallback=e,this}onKeyPressed(e){return this.onKeyPressedCallback=e,this}get errorType(){return this._errorType}set errorType(e){this._errorType=e}get hasError(){return this._hasError}set hasError(e){this._hasError=e}get isValid(){if(this.sfConfig.fieldType===g)switch(this.cvcPolicy){case C:return!0;case y:return!this.hasError;default:return this._isValid}if(this.sfConfig.fieldType===c||this.sfConfig.fieldType===d||this.sfConfig.fieldType===m)switch(this.expiryDatePolicy){case p:return!0;case u:return!this.hasError;default:return this._isValid}return this._isValid}set isValid(e){this._isValid=e}get cvcPolicy(){return this._cvcPolicy}set cvcPolicy(e){this.sfConfig.fieldType===g&&e!==this.cvcPolicy&&(this._cvcPolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get expiryDatePolicy(){return this._expiryDatePolicy}set expiryDatePolicy(e){this.sfConfig.fieldType!==c&&this.sfConfig.fieldType!==d&&this.sfConfig.fieldType!==m||e!==this.expiryDatePolicy&&(this._expiryDatePolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get iframeContentWindow(){return this._iframeContentWindow}set iframeContentWindow(e){this._iframeContentWindow=e}get isEncrypted(){return this._isEncrypted}set isEncrypted(e){this._isEncrypted=e}get numKey(){return this._numKey}set numKey(e){this._numKey=e}get iframeOnLoadListener(){return this._iframeOnLoadListener}set iframeOnLoadListener(e){this._iframeOnLoadListener=e.bind(this)}get postMessageListener(){return this._postMessageListener}set postMessageListener(e){this._postMessageListener=e.bind(this)}constructor(e,i){super();const t=T(["loadingContext","holderEl","iframeSrc","showContextualElement","placeholders"]).from(e);this.sfConfig={...t,iframeUIConfig:{...t.iframeUIConfig}};const{iframeSrc:s,placeholders:r,showContextualElement:n}=e;return this.loadingContext=e.loadingContext,this.holderEl=e.holderEl,this.submitAnalytics=e.submitAnalytics,this.componentType=e.componentType,this.isValid=!1,this.iframeContentWindow=null,this.numKey=b(),this.isEncrypted=!1,this.hasError=!1,this.errorType="",this.cvcPolicy=e.cvcPolicy,this.expiryDatePolicy=e.expiryDatePolicy,this.init(i,s,r,n)}}export{O as default};
|
|
2
2
|
//# sourceMappingURL=SecuredField.js.map
|