@adyen/adyen-web 6.28.0 → 6.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adyen.css +15 -14
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2688 -2566
- package/dist/es/adyen.css +15 -14
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
- package/dist/es/components/Econtext/Econtext.js +1 -1
- package/dist/es/components/Econtext/Econtext.js.map +1 -1
- package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
- package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
- package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js +1 -1
- package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js.map +1 -1
- package/dist/es/components/Giftcard/Giftcard.js +1 -1
- package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es/components/Iris/Iris.js +2 -0
- package/dist/es/components/Iris/Iris.js.map +1 -0
- package/dist/es/components/Iris/components/IrisComponent.js +2 -0
- package/dist/es/components/Iris/components/IrisComponent.js.map +1 -0
- package/dist/es/components/Iris/components/IrisComponent.module.scss.js +2 -0
- package/dist/es/components/Iris/components/IrisComponent.module.scss.js.map +1 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.js +2 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.js.map +1 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.module.scss.js +2 -0
- package/dist/es/components/Iris/components/IrisGenerateQRCode.module.scss.js.map +1 -0
- package/dist/es/components/Iris/components/IrisQrCodeInstructions.js +2 -0
- package/dist/es/components/Iris/components/IrisQrCodeInstructions.js.map +1 -0
- package/dist/es/components/Iris/constants.js +2 -0
- package/dist/es/components/Iris/constants.js.map +1 -0
- package/dist/es/components/Iris/types.js +2 -0
- package/dist/es/components/Iris/types.js.map +1 -0
- package/dist/es/components/Iris/utils.js +2 -0
- package/dist/es/components/Iris/utils.js.map +1 -0
- package/dist/es/components/PayTo/components/PayToComponent.js +1 -1
- package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es/components/Pix/components/PixQRDetails.js +1 -1
- package/dist/es/components/Pix/components/PixQRDetails.js.map +1 -1
- package/dist/es/components/UPI/UPI.js +1 -1
- package/dist/es/components/UPI/UPI.js.map +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es/components/UPI/constants.js +1 -1
- package/dist/es/components/UPI/constants.js.map +1 -1
- package/dist/es/components/components-name-map.js +1 -1
- package/dist/es/components/components-name-map.js.map +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es/components/index.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/Countdown/index.js +1 -1
- package/dist/es/components/internal/Countdown/index.js.map +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
- package/dist/es/components/internal/QRLoader/components/QRDetails.js +1 -1
- package/dist/es/components/internal/QRLoader/components/QRDetails.js.map +1 -1
- package/dist/es/components/internal/QRLoader/components/QRImage.js +1 -1
- package/dist/es/components/internal/QRLoader/components/QRImage.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js +2 -0
- package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -0
- package/dist/es/components/internal/Voucher/Voucher.js +1 -1
- package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
- package/dist/es/components/internal/Voucher/utils.js.map +1 -1
- package/dist/es/components/tx-variants.js +1 -1
- package/dist/es/components/tx-variants.js.map +1 -1
- package/dist/es/core/Analytics/Analytics.js +1 -1
- package/dist/es/core/Analytics/Analytics.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/utils.js +1 -1
- package/dist/es/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/index.d.ts +2688 -2566
- package/dist/es/index.js +1 -1
- package/dist/es/language/Language.js.map +1 -1
- package/dist/es/utils/createSdkData.js +2 -0
- package/dist/es/utils/createSdkData.js.map +1 -0
- package/dist/es-legacy/adyen.css +15 -14
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/utils/payment-request.js +1 -1
- package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js.map +1 -1
- package/dist/es-legacy/components/Card/Card.js +1 -1
- package/dist/es-legacy/components/Card/Card.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
- package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
- package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/requests.js +1 -1
- package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
- package/dist/es-legacy/components/Iris/Iris.js +2 -0
- package/dist/es-legacy/components/Iris/Iris.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.module.scss.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisComponent.module.scss.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.module.scss.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.module.scss.js.map +1 -0
- package/dist/es-legacy/components/Iris/components/IrisQrCodeInstructions.js +2 -0
- package/dist/es-legacy/components/Iris/components/IrisQrCodeInstructions.js.map +1 -0
- package/dist/es-legacy/components/Iris/constants.js +2 -0
- package/dist/es-legacy/components/Iris/constants.js.map +1 -0
- package/dist/es-legacy/components/Iris/types.js +2 -0
- package/dist/es-legacy/components/Iris/types.js.map +1 -0
- package/dist/es-legacy/components/Iris/utils.js +2 -0
- package/dist/es-legacy/components/Iris/utils.js.map +1 -0
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
- package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es-legacy/components/Pix/components/PixQRDetails.js +1 -1
- package/dist/es-legacy/components/Pix/components/PixQRDetails.js.map +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
- package/dist/es-legacy/components/UPI/UPI.js +1 -1
- package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es-legacy/components/UPI/constants.js +1 -1
- package/dist/es-legacy/components/UPI/constants.js.map +1 -1
- package/dist/es-legacy/components/components-name-map.js +1 -1
- package/dist/es-legacy/components/components-name-map.js.map +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/index.js +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
- package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
- package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
- package/dist/es-legacy/components/internal/Countdown/index.js +1 -1
- package/dist/es-legacy/components/internal/Countdown/index.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
- package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
- package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
- package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRDetails.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRImage.js +1 -1
- package/dist/es-legacy/components/internal/QRLoader/components/QRImage.js.map +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
- package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js +2 -0
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -0
- package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js +1 -1
- package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
- package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
- package/dist/es-legacy/components/internal/Voucher/utils.js.map +1 -1
- package/dist/es-legacy/components/tx-variants.js +1 -1
- package/dist/es-legacy/components/tx-variants.js.map +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js +1 -1
- package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
- package/dist/es-legacy/core/Context/Resources.js +1 -1
- package/dist/es-legacy/core/Context/Resources.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
- package/dist/es-legacy/index.js +1 -1
- package/dist/es-legacy/language/Language.js.map +1 -1
- package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
- package/dist/es-legacy/utils/commonUtils.js.map +1 -1
- package/dist/es-legacy/utils/createSdkData.js +2 -0
- package/dist/es-legacy/utils/createSdkData.js.map +1 -0
- package/dist/es-legacy/utils/useForm/reducer.js +1 -1
- package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
- package/package.json +12 -12
- package/styles/adyen.css +15 -14
- package/dist/es/components/UPI/components/VpaInput/VpaInput.js +0 -2
- package/dist/es/components/UPI/components/VpaInput/VpaInput.js.map +0 -1
- package/dist/es/components/UPI/components/VpaInput/validate.js +0 -2
- package/dist/es/components/UPI/components/VpaInput/validate.js.map +0 -1
- package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js +0 -2
- package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js.map +0 -1
- package/dist/es-legacy/components/UPI/components/VpaInput/validate.js +0 -2
- package/dist/es-legacy/components/UPI/components/VpaInput/validate.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleBrandFromBinLookup.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.ts"],"sourcesContent":["import {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_CARD_NUMBER,\n DATE_POLICY_REQUIRED,\n DATE_POLICY_HIDDEN,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR\n} from '../../constants';\nimport postMessageToIframe from '../utils/iframes/postMessageToIframe';\nimport { SFFeedbackObj, SendBrandObject, SendExpiryDateObject } from '../../types';\nimport { BinLookupResponse, BrandObject } from '../../../../../Card/types';\nimport { hasOwnProperty } from '../../../../../../utils/hasOwnProperty';\nimport getIframeContentWin from '../utils/iframes/getIframeContentWin';\nimport { SingleBrandResetObject } from '../../../SFP/types';\n\nexport function sendBrandToCardSF(brandObj: SendBrandObject): void {\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_CARD_NUMBER)) {\n const dataObj: object = {\n txVariant: this.state.type,\n ...brandObj,\n fieldType: ENCRYPTED_CARD_NUMBER,\n numKey: this.state.securedFields[ENCRYPTED_CARD_NUMBER].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, ENCRYPTED_CARD_NUMBER), this.config.loadingContext);\n }\n}\n\nexport function sendExpiryDatePolicyToSF(expiryDateObj: SendExpiryDateObject): void {\n const separateDateFields =\n hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_MONTH) && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_YEAR);\n\n const dateIframesArr = separateDateFields ? [ENCRYPTED_EXPIRY_MONTH, ENCRYPTED_EXPIRY_YEAR] : [ENCRYPTED_EXPIRY_DATE];\n\n dateIframesArr.forEach((key: string) => {\n const dataObj: object = {\n txVariant: this.state.type,\n ...expiryDateObj,\n fieldType: key,\n numKey: this.state.securedFields[key].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, key), this.config.loadingContext);\n });\n}\n\nexport default function handleBrandFromBinLookup(binLookupResponse: BinLookupResponse, resetObj: SingleBrandResetObject): void {\n const isGenericCard: boolean = this.state.type === 'card';\n\n /**\n * The number of digits in number field has dropped below threshold for BIN lookup (or the bin wasn't found in the DB)\n * - so tell SF to reset & republish the brand it detects\n */\n if (!binLookupResponse || !Object.keys(binLookupResponse).length) {\n if (isGenericCard) {\n // This will be sent to CardNumber SF which will trigger the brand to be re-evaluated and broadcast\n // (which will reset cvcPolicy & expiryDatePolicy in state, here in Checkout)\n this.sendBrandToCardSF({ brand: 'reset' });\n // Also pass the reset expiryDatePolicy to the date related SFs so they can reset visibility & aria-required attrs\n this.sendExpiryDatePolicyToSF({ expiryDatePolicy: DATE_POLICY_REQUIRED });\n } else {\n /**\n * For \"dedicated\" card components, i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands,\n * there will be no to-and-fro with the securedField iframe to reset brand.\n * The presence of a resetObj indicates we are in this \"dedicated\"\" scenario, so we need to use the information contained within this object\n * to internally reset the brand\n */\n if (resetObj) {\n this.processBrand({ ...resetObj, fieldType: ENCRYPTED_CARD_NUMBER } as SFFeedbackObj);\n }\n }\n\n // Reset expiryDatePolicy - which never comes from SF // TODO find out under which circumstances this clause is still required\n if (this.state.type === 'card' && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_DATE].expiryDatePolicy = DATE_POLICY_REQUIRED;\n }\n\n return;\n }\n\n const binBrandObj: BrandObject = binLookupResponse.supportedBrands[0];\n\n const passedBrand: string = binBrandObj.brand;\n\n // Look first for expiryDatePolicy string otherwise use showExpiryDate boolean\n const expiryDatePolicy = binBrandObj.expiryDatePolicy ?? (binBrandObj.showExpiryDate === true ? DATE_POLICY_REQUIRED : DATE_POLICY_HIDDEN);\n\n const brandObj: object = {\n brand: passedBrand,\n cvcPolicy: binBrandObj.cvcPolicy,\n expiryDatePolicy,\n cvcText: 'Security code',\n showSocialSecurityNumber: binBrandObj.showSocialSecurityNumber ?? false,\n fieldType: ENCRYPTED_CARD_NUMBER\n };\n\n // Take advantage of function used to handle brand messages from SF in order to process this new brand information\n this.processBrand(brandObj as SFFeedbackObj);\n\n if (isGenericCard) {\n // Pass brand to CardNumber SF\n const cardObj: SendBrandObject = {\n brand: passedBrand,\n enableLuhnCheck: binLookupResponse.supportedBrands[0].enableLuhnCheck !== false,\n // Only pass the panLength if a) we have one & b) we're not in a switching-between-dual-brands scenario\n // (because it causes unnecessary callbacks from SF which uses panLength to trigger moving focus to the expiryDate field)\n ...(binBrandObj?.panLength && !binLookupResponse.isDualBrandSelection && { panLength: binBrandObj?.panLength })\n };\n this.sendBrandToCardSF(cardObj);\n\n // Inform the date related securedFields\n // - if expiryDatePolicy is 'optional' or 'hidden' they need to set the aria-required attribute / hide themselves\n this.sendExpiryDatePolicyToSF({ expiryDatePolicy });\n }\n\n /**\n * CHECK IF BRAND CHANGE MEANS FORM IS NOW VALID e.g maestro/bcmc (which don't require cvc) OR bcmc/visa (one of which doesn't require cvc, one of which does)\n */\n\n /**\n * First set the cvcPolicy value on the relevant SecuredFields instance (which will reflect in the cvc field being considered valid,\n * as long as it is not in error)...\n */\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_SECURITY_CODE)) {\n this.state.securedFields[ENCRYPTED_SECURITY_CODE].cvcPolicy = binBrandObj.cvcPolicy;\n }\n\n /**\n * ...then set the expiryDatePolicy...\n */\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_DATE].expiryDatePolicy = expiryDatePolicy;\n } else if (hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_MONTH) && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_YEAR)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_MONTH].expiryDatePolicy = expiryDatePolicy;\n this.state.securedFields[ENCRYPTED_EXPIRY_YEAR].expiryDatePolicy = expiryDatePolicy;\n }\n\n /**\n * ...and now re-check if form i.e all the SecuredFields, are valid\n */\n this.validateForm();\n}\n"],"names":["sendBrandToCardSF","brandObj","hasOwnProperty","this","state","securedFields","ENCRYPTED_CARD_NUMBER","dataObj","_object_spread_props","_object_spread","txVariant","type","fieldType","numKey","postMessageToIframe","getIframeContentWin","config","loadingContext","sendExpiryDatePolicyToSF","expiryDateObj","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_EXPIRY_DATE","forEach","key","handleBrandFromBinLookup","binLookupResponse","resetObj","isGenericCard","Object","keys","length","brand","expiryDatePolicy","DATE_POLICY_REQUIRED","processBrand","
|
|
1
|
+
{"version":3,"file":"handleBrandFromBinLookup.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.ts"],"sourcesContent":["import {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_CARD_NUMBER,\n DATE_POLICY_REQUIRED,\n DATE_POLICY_HIDDEN,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR\n} from '../../constants';\nimport postMessageToIframe from '../utils/iframes/postMessageToIframe';\nimport { SFFeedbackObj, SendBrandObject, SendExpiryDateObject } from '../../types';\nimport { BinLookupResponse, BrandObject } from '../../../../../Card/types';\nimport { hasOwnProperty } from '../../../../../../utils/hasOwnProperty';\nimport getIframeContentWin from '../utils/iframes/getIframeContentWin';\nimport { SingleBrandResetObject } from '../../../SFP/types';\n\nexport function sendBrandToCardSF(brandObj: SendBrandObject): void {\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_CARD_NUMBER)) {\n const dataObj: object = {\n txVariant: this.state.type,\n ...brandObj,\n fieldType: ENCRYPTED_CARD_NUMBER,\n numKey: this.state.securedFields[ENCRYPTED_CARD_NUMBER].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, ENCRYPTED_CARD_NUMBER), this.config.loadingContext);\n }\n}\n\nexport function sendExpiryDatePolicyToSF(expiryDateObj: SendExpiryDateObject): void {\n const separateDateFields =\n hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_MONTH) && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_YEAR);\n\n const dateIframesArr = separateDateFields ? [ENCRYPTED_EXPIRY_MONTH, ENCRYPTED_EXPIRY_YEAR] : [ENCRYPTED_EXPIRY_DATE];\n\n dateIframesArr.forEach((key: string) => {\n const dataObj: object = {\n txVariant: this.state.type,\n ...expiryDateObj,\n fieldType: key,\n numKey: this.state.securedFields[key].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, key), this.config.loadingContext);\n });\n}\n\nexport default function handleBrandFromBinLookup(binLookupResponse: BinLookupResponse, resetObj: SingleBrandResetObject): void {\n const isGenericCard: boolean = this.state.type === 'card';\n\n /**\n * The number of digits in number field has dropped below threshold for BIN lookup (or the bin wasn't found in the DB)\n * - so tell SF to reset & republish the brand it detects\n */\n if (!binLookupResponse || !Object.keys(binLookupResponse).length) {\n if (isGenericCard) {\n // This will be sent to CardNumber SF which will trigger the brand to be re-evaluated and broadcast\n // (which will reset cvcPolicy & expiryDatePolicy in state, here in Checkout)\n this.sendBrandToCardSF({ brand: 'reset' });\n // Also pass the reset expiryDatePolicy to the date related SFs so they can reset visibility & aria-required attrs\n this.sendExpiryDatePolicyToSF({ expiryDatePolicy: DATE_POLICY_REQUIRED });\n } else {\n /**\n * For \"dedicated\" card components, i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands,\n * there will be no to-and-fro with the securedField iframe to reset brand.\n * The presence of a resetObj indicates we are in this \"dedicated\"\" scenario, so we need to use the information contained within this object\n * to internally reset the brand\n */\n if (resetObj) {\n this.processBrand({ ...resetObj, fieldType: ENCRYPTED_CARD_NUMBER } as SFFeedbackObj);\n }\n }\n\n // Reset expiryDatePolicy - which never comes from SF // TODO find out under which circumstances this clause is still required\n if (this.state.type === 'card' && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_DATE].expiryDatePolicy = DATE_POLICY_REQUIRED;\n }\n\n return;\n }\n\n const binBrandObj: BrandObject = binLookupResponse.supportedBrands[0];\n\n const passedBrand: string = binBrandObj.brand;\n\n // Look first for expiryDatePolicy string otherwise use showExpiryDate boolean\n const expiryDatePolicy = binBrandObj.expiryDatePolicy ?? (binBrandObj.showExpiryDate === true ? DATE_POLICY_REQUIRED : DATE_POLICY_HIDDEN);\n\n const brandObj: object = {\n brand: passedBrand,\n cvcPolicy: binBrandObj.cvcPolicy,\n expiryDatePolicy,\n cvcText: 'Security code',\n showSocialSecurityNumber: binBrandObj.showSocialSecurityNumber ?? false,\n fieldType: ENCRYPTED_CARD_NUMBER\n };\n\n // Take advantage of function used to handle brand messages from SF in order to process this new brand information\n this.processBrand(brandObj as SFFeedbackObj);\n\n if (isGenericCard) {\n // Pass brand to CardNumber SF\n const cardObj: SendBrandObject = {\n brand: passedBrand,\n enableLuhnCheck: binLookupResponse.supportedBrands[0].enableLuhnCheck !== false,\n // Only pass the panLength if a) we have one & b) we're not in a switching-between-dual-brands scenario\n // (because it causes unnecessary callbacks from SF which uses panLength to trigger moving focus to the expiryDate field)\n ...(binBrandObj?.panLength && !binLookupResponse.isDualBrandSelection && { panLength: binBrandObj?.panLength })\n };\n this.sendBrandToCardSF(cardObj);\n\n // Inform the date related securedFields\n // - if expiryDatePolicy is 'optional' or 'hidden' they need to set the aria-required attribute / hide themselves\n this.sendExpiryDatePolicyToSF({ expiryDatePolicy });\n }\n\n /**\n * CHECK IF BRAND CHANGE MEANS FORM IS NOW VALID e.g maestro/bcmc (which don't require cvc) OR bcmc/visa (one of which doesn't require cvc, one of which does)\n */\n\n /**\n * First set the cvcPolicy value on the relevant SecuredFields instance (which will reflect in the cvc field being considered valid,\n * as long as it is not in error)...\n */\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_SECURITY_CODE)) {\n this.state.securedFields[ENCRYPTED_SECURITY_CODE].cvcPolicy = binBrandObj.cvcPolicy;\n }\n\n /**\n * ...then set the expiryDatePolicy...\n */\n if (hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_DATE].expiryDatePolicy = expiryDatePolicy;\n } else if (hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_MONTH) && hasOwnProperty(this.state.securedFields, ENCRYPTED_EXPIRY_YEAR)) {\n this.state.securedFields[ENCRYPTED_EXPIRY_MONTH].expiryDatePolicy = expiryDatePolicy;\n this.state.securedFields[ENCRYPTED_EXPIRY_YEAR].expiryDatePolicy = expiryDatePolicy;\n }\n\n /**\n * ...and now re-check if form i.e all the SecuredFields, are valid\n */\n this.validateForm();\n}\n"],"names":["sendBrandToCardSF","brandObj","hasOwnProperty","this","state","securedFields","ENCRYPTED_CARD_NUMBER","dataObj","_object_spread_props","_object_spread","txVariant","type","fieldType","numKey","postMessageToIframe","getIframeContentWin","config","loadingContext","sendExpiryDatePolicyToSF","expiryDateObj","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_EXPIRY_DATE","forEach","key","handleBrandFromBinLookup","binLookupResponse","resetObj","binBrandObj","isGenericCard","Object","keys","length","brand","expiryDatePolicy","DATE_POLICY_REQUIRED","processBrand","supportedBrands","passedBrand","showExpiryDate","DATE_POLICY_HIDDEN","cvcPolicy","cvcText","showSocialSecurityNumber","cardObj","enableLuhnCheck","panLength","isDualBrandSelection","ENCRYPTED_SECURITY_CODE","validateForm"],"mappings":"8rCAgBO,SAASA,EAAkBC,GAC9B,GAAIC,EAAeC,KAAKC,MAAMC,cAAeC,GAAwB,CACjE,MAAMC,EAAkBC,EAAAC,EAAA,CACpBC,UAAWP,KAAKC,MAAMO,MACnBV,GAAAA,CACHW,UAAWN,EACXO,OAAQV,KAAKC,MAAMC,cAAcC,GAAuBO,SAE5DC,EAAoBP,EAASQ,EAAoBZ,KAAKC,MAAOE,GAAwBH,KAAKa,OAAOC,eACrG,CACJ,CAEO,SAASC,EAAyBC,IAEjCjB,EAAeC,KAAKC,MAAMC,cAAee,IAA2BlB,EAAeC,KAAKC,MAAMC,cAAegB,GAErE,CAACD,EAAwBC,GAAyB,CAACC,IAEhFC,QAASC,IACpB,MAAMjB,EAAkBC,EAAAC,EAAA,CACpBC,UAAWP,KAAKC,MAAMO,MACnBQ,GAAAA,CACHP,UAAWY,EACXX,OAAQV,KAAKC,MAAMC,cAAcmB,GAAKX,SAE1CC,EAAoBP,EAASQ,EAAoBZ,KAAKC,MAAOoB,GAAMrB,KAAKa,OAAOC,iBAEvF,CAEe,SAASQ,EAAyBC,EAAsCC,OAuC1DC,EAOKA,EA7C9B,MAAMC,EAA6C,SAApB1B,KAAKC,MAAMO,KAM1C,IAAKe,IAAsBI,OAAOC,KAAKL,GAAmBM,OAwBtD,OAvBIH,GAGA1B,KAAKH,kBAAkB,CAAEiC,MAAO,UAEhC9B,KAAKe,yBAAyB,CAAEgB,iBAAkBC,KAQ9CR,GACAxB,KAAKiC,aAAa5B,EAAAC,EAAA,CAAA,EAAKkB,GAAAA,CAAUf,UAAWN,UAK5B,SAApBH,KAAKC,MAAMO,MAAmBT,EAAeC,KAAKC,MAAMC,cAAeiB,KACvEnB,KAAKC,MAAMC,cAAciB,GAAuBY,iBAAmBC,IAM3E,MAAMP,EAA2BF,EAAkBW,gBAAgB,GAE7DC,EAAsBV,EAAYK,MAGlCC,EAA+C,QAA5BN,EAAAA,EAAYM,wBAAZN,IAAAA,EAAAA,GAAgE,IAA/BA,EAAYW,eAA0BJ,EAAuBK,EAEjHvC,EAAmB,CACrBgC,MAAOK,EACPG,UAAWb,EAAYa,UACvBP,mBACAQ,QAAS,gBACTC,yBAA8D,QAApCf,EAAAA,EAAYe,oCAAZf,GAAAA,EAC1BhB,UAAWN,GAMf,GAFAH,KAAKiC,aAAanC,GAEd4B,EAAe,CAEf,MAAMe,EAA2BnC,EAAA,CAC7BwB,MAAOK,EACPO,iBAA0E,IAAzDnB,EAAkBW,gBAAgB,GAAGQ,kBAGlDjB,eAAAA,EAAakB,aAAcpB,EAAkBqB,sBAAwB,CAAED,UAAWlB,aAAAA,EAAAA,EAAakB,YAEvG3C,KAAKH,kBAAkB4C,GAIvBzC,KAAKe,yBAAyB,CAAEgB,oBACpC,CAUIhC,EAAeC,KAAKC,MAAMC,cAAe2C,KACzC7C,KAAKC,MAAMC,cAAc2C,GAAyBP,UAAYb,EAAYa,WAM1EvC,EAAeC,KAAKC,MAAMC,cAAeiB,GACzCnB,KAAKC,MAAMC,cAAciB,GAAuBY,iBAAmBA,EAC5DhC,EAAeC,KAAKC,MAAMC,cAAee,IAA2BlB,EAAeC,KAAKC,MAAMC,cAAegB,KACpHlB,KAAKC,MAAMC,cAAce,GAAwBc,iBAAmBA,EACpE/B,KAAKC,MAAMC,cAAcgB,GAAuBa,iBAAmBA,GAMvE/B,KAAK8C,cACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getCardGroupTypes as i}from"../utils/getCardGroupTypes.js";import{NON_CREDIT_CARD_TYPE_SECURED_FIELDS as o,SF_VERSION as t}from"../../constants.js";import{warn as n}from"../../utilities/logger.js";function e(e){this.config.cardGroupTypes=i(e.cardGroupTypes);const
|
|
1
|
+
import{getCardGroupTypes as i}from"../utils/getCardGroupTypes.js";import{NON_CREDIT_CARD_TYPE_SECURED_FIELDS as o,SF_VERSION as t}from"../../constants.js";import{warn as n}from"../../utilities/logger.js";function e(e){var r;this.config.cardGroupTypes=i(e.cardGroupTypes);const s=e.loadingContext;if(!s)return void n("WARNING Config :: no loadingContext has been specified!");var a;this.config.loadingContext="/"===(a=s).charAt(a.length-1)?s:`${s}/`,this.config.isCreditCardType=!1===o.includes(e.type),this.config.iframeUIConfig=null!==(r=e.iframeUIConfig)&&void 0!==r?r:{},this.config.autoFocus=!(!1===e.autoFocus||"false"===e.autoFocus),this.config.showWarnings=!0===e.showWarnings||"true"===e.showWarnings,this.config.trimTrailingSeparator=!(!1===e.trimTrailingSeparator||"false"===e.trimTrailingSeparator),this.config.keypadFix=!(!1===e.keypadFix||"false"===e.keypadFix),this.config.legacyInputMode=e.legacyInputMode||null,this.config.minimumExpiryDate=e.minimumExpiryDate||null,this.config.sfLogAtStart=!0===window._b$dl;const c=this.config.isCreditCardType?"card":e.type,g=btoa(window.location.origin),f=`${c}${!this.config.loadingContext.includes("live")&&e.forceCompat?"Compat":""}`;this.config.iframeSrc=`${this.config.loadingContext}securedfields/${e.clientKey}/${t}/securedFields.html?type=${f}&d=${g}`}export{e as handleConfig};
|
|
2
2
|
//# sourceMappingURL=handleConfig.js.map
|
package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleConfig.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.ts"],"sourcesContent":["import { getCardGroupTypes } from '../utils/getCardGroupTypes';\nimport { NON_CREDIT_CARD_TYPE_SECURED_FIELDS, SF_VERSION } from '../../constants';\nimport * as logger from '../../utilities/logger';\nimport { CSFSetupObject } from '../types';\n\n/**\n * Parses this.props to set 'config' type vars on this (CSFComp)\n * - properties that just need to be set once, at startup, and then don't change\n *\n * See interface CSFConfigObject in types.ts\n */\nexport function handleConfig(props: CSFSetupObject): void {\n // --\n this.config.cardGroupTypes = getCardGroupTypes(props.cardGroupTypes);\n\n if (process.env.NODE_ENV === 'development' && window._b$dl) {\n logger.log('### StoreCls::init:: this.config.cardGroupTypes=', this.config.cardGroupTypes);\n }\n\n const loadingContext: string = props.loadingContext;\n\n if (!loadingContext) {\n logger.warn('WARNING Config :: no loadingContext has been specified!');\n return;\n }\n\n // Ensure passed loadingContext has trailing slash\n const lastChar = str => str.charAt(str.length - 1);\n this.config.loadingContext = lastChar(loadingContext) === '/' ? loadingContext : `${loadingContext}/`;\n\n // Is this for the regular creditCard or for another use-case for securedFields e.g. 'ach' or 'giftcard'\n this.config.isCreditCardType = NON_CREDIT_CARD_TYPE_SECURED_FIELDS.includes(props.type) === false;\n\n // Configuration object for individual txVariants - contains styling object values for securedFields inputs\n this.config.iframeUIConfig = props.iframeUIConfig ?? {};\n\n // By default CSF is allowed to automatically shift focus from the date to CVC fields - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.autoFocus = !(props.autoFocus === false || props.autoFocus === 'false');\n\n // By default CSF will NOT perform a console.warn when receiving postMessages with origin or numKey mismatches - user of CSF must explicitly 'opt-in' to get this\n this.config.showWarnings = props.showWarnings === true || props.showWarnings === 'true';\n\n // By default CSF will strip the trailing separator character from valid credit card numbers - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.trimTrailingSeparator = !(props.trimTrailingSeparator === false || props.trimTrailingSeparator === 'false');\n\n // By default CSF is allowed to add a fix for iOS to force the keypad to retract - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.keypadFix = !(props.keypadFix === false || props.keypadFix === 'false');\n\n // To set the type on the iframe input fields to 'tel' c.f. the default 'text' (with inputmode='numeric')\n this.config.legacyInputMode = props.legacyInputMode || null;\n\n // To configure the minimum expiry date to a merchant defined value - this means the card has to be valid until at least this date\n this.config.minimumExpiryDate = props.minimumExpiryDate || null;\n\n this.config.sfLogAtStart = window._b$dl === true;\n\n const sfBundleType: string = this.config.isCreditCardType ? 'card' : props.type;\n\n // Add a hash of the origin to ensure urls are different across domains\n const d = btoa(window.location.origin);\n\n /**\n * Don't allow compat version on Live - it is only for if the merchant wants to *test* with a custom http url.\n * Otherwise, set it passed on the config prop\n */\n const needsJWECompatVersion = this.config.loadingContext.includes('live') ? false : props.forceCompat;\n\n const bundleModifier = !needsJWECompatVersion ? '' : 'Compat';\n\n const bundleType = `${sfBundleType}${bundleModifier}`; // e.g. 'card' or 'cardCompat'\n\n this.config.iframeSrc = `${this.config.loadingContext}securedfields/${props.clientKey}/${SF_VERSION}/securedFields.html?type=${bundleType}&d=${d}`;\n\n // TODO###### FOR QUICK LOCAL TESTING of sf\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n this.config.iframeSrc = `${process.env.__SF_ENV__}securedFields.${SF_VERSION}.html?type=${sfBundleType}`;\n }\n // TODO######\n}\n"],"names":["handleConfig","props","this","config","cardGroupTypes","getCardGroupTypes","loadingContext","logger","str","charAt","length","isCreditCardType","NON_CREDIT_CARD_TYPE_SECURED_FIELDS","includes","type","iframeUIConfig","autoFocus","showWarnings","trimTrailingSeparator","keypadFix","legacyInputMode","minimumExpiryDate","sfLogAtStart","window","_b$dl","sfBundleType","d","btoa","location","origin","bundleType","forceCompat","iframeSrc","clientKey","SF_VERSION"],"mappings":"4MAWO,SAASA,EAAaC,
|
|
1
|
+
{"version":3,"file":"handleConfig.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.ts"],"sourcesContent":["import { getCardGroupTypes } from '../utils/getCardGroupTypes';\nimport { NON_CREDIT_CARD_TYPE_SECURED_FIELDS, SF_VERSION } from '../../constants';\nimport * as logger from '../../utilities/logger';\nimport { CSFSetupObject } from '../types';\n\n/**\n * Parses this.props to set 'config' type vars on this (CSFComp)\n * - properties that just need to be set once, at startup, and then don't change\n *\n * See interface CSFConfigObject in types.ts\n */\nexport function handleConfig(props: CSFSetupObject): void {\n // --\n this.config.cardGroupTypes = getCardGroupTypes(props.cardGroupTypes);\n\n if (process.env.NODE_ENV === 'development' && window._b$dl) {\n logger.log('### StoreCls::init:: this.config.cardGroupTypes=', this.config.cardGroupTypes);\n }\n\n const loadingContext: string = props.loadingContext;\n\n if (!loadingContext) {\n logger.warn('WARNING Config :: no loadingContext has been specified!');\n return;\n }\n\n // Ensure passed loadingContext has trailing slash\n const lastChar = str => str.charAt(str.length - 1);\n this.config.loadingContext = lastChar(loadingContext) === '/' ? loadingContext : `${loadingContext}/`;\n\n // Is this for the regular creditCard or for another use-case for securedFields e.g. 'ach' or 'giftcard'\n this.config.isCreditCardType = NON_CREDIT_CARD_TYPE_SECURED_FIELDS.includes(props.type) === false;\n\n // Configuration object for individual txVariants - contains styling object values for securedFields inputs\n this.config.iframeUIConfig = props.iframeUIConfig ?? {};\n\n // By default CSF is allowed to automatically shift focus from the date to CVC fields - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.autoFocus = !(props.autoFocus === false || props.autoFocus === 'false');\n\n // By default CSF will NOT perform a console.warn when receiving postMessages with origin or numKey mismatches - user of CSF must explicitly 'opt-in' to get this\n this.config.showWarnings = props.showWarnings === true || props.showWarnings === 'true';\n\n // By default CSF will strip the trailing separator character from valid credit card numbers - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.trimTrailingSeparator = !(props.trimTrailingSeparator === false || props.trimTrailingSeparator === 'false');\n\n // By default CSF is allowed to add a fix for iOS to force the keypad to retract - user of CSF must explicitly 'opt-out' to prevent this happening\n this.config.keypadFix = !(props.keypadFix === false || props.keypadFix === 'false');\n\n // To set the type on the iframe input fields to 'tel' c.f. the default 'text' (with inputmode='numeric')\n this.config.legacyInputMode = props.legacyInputMode || null;\n\n // To configure the minimum expiry date to a merchant defined value - this means the card has to be valid until at least this date\n this.config.minimumExpiryDate = props.minimumExpiryDate || null;\n\n this.config.sfLogAtStart = window._b$dl === true;\n\n const sfBundleType: string = this.config.isCreditCardType ? 'card' : props.type;\n\n // Add a hash of the origin to ensure urls are different across domains\n const d = btoa(window.location.origin);\n\n /**\n * Don't allow compat version on Live - it is only for if the merchant wants to *test* with a custom http url.\n * Otherwise, set it passed on the config prop\n */\n const needsJWECompatVersion = this.config.loadingContext.includes('live') ? false : props.forceCompat;\n\n const bundleModifier = !needsJWECompatVersion ? '' : 'Compat';\n\n const bundleType = `${sfBundleType}${bundleModifier}`; // e.g. 'card' or 'cardCompat'\n\n this.config.iframeSrc = `${this.config.loadingContext}securedfields/${props.clientKey}/${SF_VERSION}/securedFields.html?type=${bundleType}&d=${d}`;\n\n // TODO###### FOR QUICK LOCAL TESTING of sf\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n this.config.iframeSrc = `${process.env.__SF_ENV__}securedFields.${SF_VERSION}.html?type=${sfBundleType}`;\n }\n // TODO######\n}\n"],"names":["handleConfig","props","this","config","cardGroupTypes","getCardGroupTypes","loadingContext","logger","str","charAt","length","isCreditCardType","NON_CREDIT_CARD_TYPE_SECURED_FIELDS","includes","type","iframeUIConfig","autoFocus","showWarnings","trimTrailingSeparator","keypadFix","legacyInputMode","minimumExpiryDate","sfLogAtStart","window","_b$dl","sfBundleType","d","btoa","location","origin","bundleType","forceCompat","iframeSrc","clientKey","SF_VERSION"],"mappings":"4MAWO,SAASA,EAAaC,GAuBIA,IAAAA,EArB7BC,KAAKC,OAAOC,eAAiBC,EAAkBJ,EAAMG,gBAMrD,MAAME,EAAyBL,EAAMK,eAErC,IAAKA,EAED,YADAC,EAAY,2DAKCC,IAAAA,EACjBN,KAAKC,OAAOG,eAA8C,OADzCE,EACqBF,GADVG,OAAOD,EAAIE,OAAS,GACgBJ,EAAiB,GAAGA,KAGpFJ,KAAKC,OAAOQ,kBAAgF,IAA7DC,EAAoCC,SAASZ,EAAMa,MAGlFZ,KAAKC,OAAOY,eAAqC,QAApBd,EAAAA,EAAMc,sBAANd,IAAAA,EAAAA,EAAwB,CAAA,EAGrDC,KAAKC,OAAOa,aAAkC,IAApBf,EAAMe,WAA2C,UAApBf,EAAMe,WAG7Dd,KAAKC,OAAOc,cAAsC,IAAvBhB,EAAMgB,cAAgD,SAAvBhB,EAAMgB,aAGhEf,KAAKC,OAAOe,yBAA0D,IAAhCjB,EAAMiB,uBAAmE,UAAhCjB,EAAMiB,uBAGrFhB,KAAKC,OAAOgB,aAAkC,IAApBlB,EAAMkB,WAA2C,UAApBlB,EAAMkB,WAG7DjB,KAAKC,OAAOiB,gBAAkBnB,EAAMmB,iBAAmB,KAGvDlB,KAAKC,OAAOkB,kBAAoBpB,EAAMoB,mBAAqB,KAE3DnB,KAAKC,OAAOmB,cAAgC,IAAjBC,OAAOC,MAElC,MAAMC,EAAuBvB,KAAKC,OAAOQ,iBAAmB,OAASV,EAAMa,KAGrEY,EAAIC,KAAKJ,OAAOK,SAASC,QAUzBC,EAAa,GAAGL,KAJQvB,KAAKC,OAAOG,eAAeO,SAAS,SAAkBZ,EAAM8B,YAErC,SAAL,KAIhD7B,KAAKC,OAAO6B,UAAY,GAAG9B,KAAKC,OAAOG,+BAA+BL,EAAMgC,aAAaC,6BAAsCJ,OAAgBJ,GAOnJ"}
|
package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{selectOne as t}from"../../utilities/dom.js";import e from"../utils/userAgent.js";import{on as n,off as s}from"../../../../../../utils/listenerUtils.js";var o={touchendListener:function(t){const e=t.target;if(e instanceof HTMLInputElement||HTMLTextAreaElement&&e instanceof HTMLTextAreaElement){const s=e.value;let o="selectionStart"in(n=e)?n.selectionStart:0,i=!1;o===s.length&&(o-=1,i=!0),e.value=s;try{e.setSelectionRange&&(e.focus(),e.setSelectionRange(o,o),i&&(o+=1,setTimeout(()=>{e.setSelectionRange(o,o)},0)))}catch(t){}}else{if(this.config.keypadFix){const t=this.props.rootNode,e=document.createElement("input");e.style.width="1px",e.style.height="1px",e.style.opacity="0",e.style.fontSize="18px",t.appendChild(e),e.focus(),t.removeChild(e)}}var n;this.destroyTouchendListener(),this.state.registerFieldForIos=!1,this.postMessageToAllIframes({fieldType:"webInternalElement",fieldClick:!0})},touchstartListener:function(t){this.hasGenuineTouchEvents=!0;const e=t.target;if(e instanceof HTMLInputElement||e instanceof HTMLSpanElement){var n,s,o;this.postMessageToAllIframes({fieldType:"webInternalElement",checkoutTouchEvent:!0});const t=null!==(
|
|
1
|
+
import{selectOne as t}from"../../utilities/dom.js";import e from"../utils/userAgent.js";import{on as n,off as s}from"../../../../../../utils/listenerUtils.js";var o={touchendListener:function(t){const e=t.target;if(e instanceof HTMLInputElement||HTMLTextAreaElement&&e instanceof HTMLTextAreaElement){const s=e.value;let o="selectionStart"in(n=e)?n.selectionStart:0,i=!1;o===s.length&&(o-=1,i=!0),e.value=s;try{e.setSelectionRange&&(e.focus(),e.setSelectionRange(o,o),i&&(o+=1,setTimeout(()=>{e.setSelectionRange(o,o)},0)))}catch(t){}}else{if(this.config.keypadFix){const t=this.props.rootNode,e=document.createElement("input");e.style.width="1px",e.style.height="1px",e.style.opacity="0",e.style.fontSize="18px",t.appendChild(e),e.focus(),t.removeChild(e)}}var n;this.destroyTouchendListener(),this.state.registerFieldForIos=!1,this.postMessageToAllIframes({fieldType:"webInternalElement",fieldClick:!0})},touchstartListener:function(t){this.hasGenuineTouchEvents=!0;const e=t.target;if(e instanceof HTMLInputElement||e instanceof HTMLSpanElement){var n,s,o;this.postMessageToAllIframes({fieldType:"webInternalElement",checkoutTouchEvent:!0});const t=null!==(n=e.getAttribute("name"))&&void 0!==n?n:e.getAttribute("data-id");null===(s=(o=this.callbacks).onTouchstartIOS)||void 0===s||s.call(o,{fieldType:"webInternalElement",name:t})}},handleTouchend:function(){const e=t(document,"body");e.style.cursor="pointer",n(e,"touchend",this.touchendListener),this.state.registerFieldForIos=!0},destroyTouchendListener:function(){if(!e.__IS_IOS)return!1;const n=t(document,"body");return n.style.cursor="auto",s(n,"touchend",this.touchendListener),!0},destroyTouchstartListener:function(){return!!e.__IS_IOS&&(s(document,"touchstart",this.touchstartListener),!0)}};export{o as default};
|
|
2
2
|
//# sourceMappingURL=handleIOSTouchEvents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleIOSTouchEvents.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.ts"],"sourcesContent":["import { selectOne } from '../../utilities/dom';\nimport ua from '../utils/userAgent';\nimport { on, off } from '../../../../../../utils/listenerUtils';\n\nconst getCaretPos = (pNode: HTMLInputElement | HTMLTextAreaElement): number => {\n if ('selectionStart' in pNode) {\n return pNode.selectionStart;\n }\n return 0;\n};\n\n/**\n * Detect if touched element is an input or textArea.\n * - If it is do some quirky shit to set focus and caret position on this element\n * - Else do some quirky shit to make the iOS keyboard retract\n *\n * Always then remove this listener and set var saying we have done so (read in CSF...handleFocus)\n * Tell all securedFields some other element now has focus so they can blur themselves\n *\n * @param e -\n */\nfunction touchendListener(e: Event): void {\n const targetEl: EventTarget = e.target;\n\n // If other element is Input or TextArea\n if (targetEl instanceof HTMLInputElement || (HTMLTextAreaElement && targetEl instanceof HTMLTextAreaElement)) {\n // Force caret to show - 'requires' resetting field's value\n const val: string = targetEl.value;\n\n let caretPos: number = getCaretPos(targetEl);\n\n let adjFlag = false;\n\n // For some annoying, iOS Safari, reason if caretPos is at the end of the string then it won't show up\n // - so first decrease it; then set it again, asynchronously\n if (caretPos === val.length) {\n caretPos -= 1;\n adjFlag = true;\n }\n\n targetEl.value = val;\n\n /**\n * If the input element is of an unexpected type (perhaps the merchant is using a custom button that is an input element, type=\"button\", or,\n * it is something presented in the 3DS2 flow - both, TBC) then this next line will not work.\n * However, the input element still has a setSelectionRange property of type \"function\", but trying to call it will throw an error...\n * so, try, to see if setSelectionRange can be called\n */\n try {\n if (targetEl.setSelectionRange) {\n targetEl.focus();\n targetEl.setSelectionRange(caretPos, caretPos);\n\n // Quirky! (see comment about iOS Safari, above)\n if (adjFlag) {\n caretPos += 1;\n setTimeout(() => {\n targetEl.setSelectionRange(caretPos, caretPos);\n }, 0);\n }\n }\n /* eslint-disable-next-line */\n } catch (e) {}\n } else {\n /**\n * Workaround for iOS/Safari bug where keypad doesn't retract when SF paymentMethod is no longer active\n */\n const hasKeypadFix: boolean = this.config.keypadFix; // to avoid linting no-lonely-if\n if (hasKeypadFix) {\n // Create an input we can add focus to.\n // Otherwise 2nd & sub times the caret gets left in the SF even though it has lost focus and cannot be typed into\n const rootNode: HTMLElement = this.props.rootNode;\n const nuInput: HTMLInputElement = document.createElement('input');\n nuInput.style.width = '1px';\n nuInput.style.height = '1px';\n nuInput.style.opacity = '0';\n nuInput.style.fontSize = '18px'; // prevents zoom\n rootNode.appendChild(nuInput);\n nuInput.focus(); // Takes caret from SF\n rootNode.removeChild(nuInput); // Without this numpad will be replaced with text pad\n }\n }\n\n // Remove listener - it gets reset by next call to handleAdditionalFields from handleFocus\n this.destroyTouchendListener();\n\n // Store the fact we have unset the listener\n this.state.registerFieldForIos = false;\n\n // Clear focus on secured field inputs now this checkout element has gained focus\n this.postMessageToAllIframes({ fieldType: 'webInternalElement', fieldClick: true });\n}\n\n/**\n * re. Disabling arrow keys in iOS - need to enable all fields in the form and tell SFs to disable\n *\n * NOTE: Only called when iOS detected & this.props.shouldDisableIOSArrowKeys = true\n */\nfunction touchstartListener(e: Event): void {\n this.hasGenuineTouchEvents = true;\n const targetEl: EventTarget = e.target;\n // If other element is Input or Span (i.e. label text) TODO apply to other types of el?\n if (targetEl instanceof HTMLInputElement || targetEl instanceof HTMLSpanElement) {\n this.postMessageToAllIframes({ fieldType: 'webInternalElement', checkoutTouchEvent: true });\n\n const name = targetEl.getAttribute('name') ?? targetEl.getAttribute('data-id'); // if targetEl is a label's span it will only have a data-id\n this.callbacks.onTouchstartIOS?.({ fieldType: 'webInternalElement', name });\n }\n}\n\n/**\n * This works with the touchend handler to allow us to catch (click) events on non-securedFields elements\n * (re. http://gravitydept.com/blog/js-click-event-bubbling-on-ios - events don't bubble unless the click takes place on a link or input)\n *\n * We can use this event to:\n * 1. Set focus on these other elements, and\n * 2. Tell SecuredFields that this has happened so they can blur themselves\n * (see note in adyen-secured-fields...inputBase.js - \"Blur event never fires on input field\")\n *\n * NOTE: Only called when iOS detected\n */\nfunction handleTouchend(): void {\n const bodyEl: HTMLBodyElement = selectOne(document, 'body');\n bodyEl.style.cursor = 'pointer';\n\n on(bodyEl, 'touchend', this.touchendListener);\n\n // Store the fact we have set the listener\n this.state.registerFieldForIos = true;\n}\n\nfunction destroyTouchendListener(): boolean {\n if (!ua.__IS_IOS) return false; // For when fn is called as result of destroy being called on main csf instance\n\n const bodyEl: HTMLBodyElement = selectOne(document, 'body');\n bodyEl.style.cursor = 'auto';\n off(bodyEl, 'touchend', this.touchendListener);\n return true;\n}\n\nfunction destroyTouchstartListener(): boolean {\n if (!ua.__IS_IOS) return false; // For when fn is called as result of destroy being called on main csf instance\n\n off(document, 'touchstart', this.touchstartListener);\n return true;\n}\n\nexport default {\n touchendListener,\n touchstartListener,\n handleTouchend,\n destroyTouchendListener,\n destroyTouchstartListener\n};\n"],"names":["handleIOSTouchEvents","touchendListener","e","targetEl","target","HTMLInputElement","HTMLTextAreaElement","val","value","caretPos","pNode","selectionStart","adjFlag","length","setSelectionRange","focus","setTimeout","this","config","keypadFix","rootNode","props","nuInput","document","createElement","style","width","height","opacity","fontSize","appendChild","removeChild","destroyTouchendListener","state","registerFieldForIos","postMessageToAllIframes","fieldType","fieldClick","touchstartListener","hasGenuineTouchEvents","HTMLSpanElement","_this_callbacks_onTouchstartIOS","_this_callbacks","checkoutTouchEvent","name","getAttribute","callbacks","onTouchstartIOS","call","handleTouchend","bodyEl","selectOne","cursor","on","ua","__IS_IOS","off","destroyTouchstartListener"],"mappings":"+JAmJA,IAAAA,EAAe,CACXC,iBA/HJ,SAA0BC,GACtB,MAAMC,EAAwBD,EAAEE,OAGhC,GAAID,aAAoBE,kBAAqBC,qBAAuBH,aAAoBG,oBAAsB,CAE1G,MAAMC,EAAcJ,EAASK,MAE7B,IAAIC,EAxBJ,mBADaC,EAyBsBP,GAvB5BO,EAAMC,eAEV,EAuBCC,GAAU,EAIVH,IAAaF,EAAIM,SACjBJ,GAAY,EACZG,GAAU,GAGdT,EAASK,MAAQD,EAQjB,IACQJ,EAASW,oBACTX,EAASY,QACTZ,EAASW,kBAAkBL,EAAUA,GAGjCG,IACAH,GAAY,EACZO,WAAW,KACPb,EAASW,kBAAkBL,EAAUA,IACtC,IAIf,CAAE,MAAOP,GAAI,CACjB,KAAO,CAKH,GAD8Be,KAAKC,OAAOC,UACxB,CAGd,MAAMC,EAAwBH,KAAKI,MAAMD,SACnCE,EAA4BC,SAASC,cAAc,SACzDF,EAAQG,MAAMC,MAAQ,MACtBJ,EAAQG,MAAME,OAAS,MACvBL,EAAQG,MAAMG,QAAU,IACxBN,EAAQG,MAAMI,SAAW,OACzBT,EAASU,YAAYR,GACrBA,EAAQP,QACRK,EAASW,YAAYT,EACzB,CACJ,CA7EgB,IAACZ,EAgFjBO,KAAKe,0BAGLf,KAAKgB,MAAMC,qBAAsB,EAGjCjB,KAAKkB,wBAAwB,CAAEC,UAAW,qBAAsBC,YAAY,GAChF,EA0DIC,mBAnDJ,SAA4BpC,GACxBe,KAAKsB,uBAAwB,EAC7B,MAAMpC,EAAwBD,EAAEE,OAEhC,GAAID,aAAoBE,kBAAoBF,aAAoBqC,gBAAiB,
|
|
1
|
+
{"version":3,"file":"handleIOSTouchEvents.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.ts"],"sourcesContent":["import { selectOne } from '../../utilities/dom';\nimport ua from '../utils/userAgent';\nimport { on, off } from '../../../../../../utils/listenerUtils';\n\nconst getCaretPos = (pNode: HTMLInputElement | HTMLTextAreaElement): number => {\n if ('selectionStart' in pNode) {\n return pNode.selectionStart;\n }\n return 0;\n};\n\n/**\n * Detect if touched element is an input or textArea.\n * - If it is do some quirky shit to set focus and caret position on this element\n * - Else do some quirky shit to make the iOS keyboard retract\n *\n * Always then remove this listener and set var saying we have done so (read in CSF...handleFocus)\n * Tell all securedFields some other element now has focus so they can blur themselves\n *\n * @param e -\n */\nfunction touchendListener(e: Event): void {\n const targetEl: EventTarget = e.target;\n\n // If other element is Input or TextArea\n if (targetEl instanceof HTMLInputElement || (HTMLTextAreaElement && targetEl instanceof HTMLTextAreaElement)) {\n // Force caret to show - 'requires' resetting field's value\n const val: string = targetEl.value;\n\n let caretPos: number = getCaretPos(targetEl);\n\n let adjFlag = false;\n\n // For some annoying, iOS Safari, reason if caretPos is at the end of the string then it won't show up\n // - so first decrease it; then set it again, asynchronously\n if (caretPos === val.length) {\n caretPos -= 1;\n adjFlag = true;\n }\n\n targetEl.value = val;\n\n /**\n * If the input element is of an unexpected type (perhaps the merchant is using a custom button that is an input element, type=\"button\", or,\n * it is something presented in the 3DS2 flow - both, TBC) then this next line will not work.\n * However, the input element still has a setSelectionRange property of type \"function\", but trying to call it will throw an error...\n * so, try, to see if setSelectionRange can be called\n */\n try {\n if (targetEl.setSelectionRange) {\n targetEl.focus();\n targetEl.setSelectionRange(caretPos, caretPos);\n\n // Quirky! (see comment about iOS Safari, above)\n if (adjFlag) {\n caretPos += 1;\n setTimeout(() => {\n targetEl.setSelectionRange(caretPos, caretPos);\n }, 0);\n }\n }\n /* eslint-disable-next-line */\n } catch (e) {}\n } else {\n /**\n * Workaround for iOS/Safari bug where keypad doesn't retract when SF paymentMethod is no longer active\n */\n const hasKeypadFix: boolean = this.config.keypadFix; // to avoid linting no-lonely-if\n if (hasKeypadFix) {\n // Create an input we can add focus to.\n // Otherwise 2nd & sub times the caret gets left in the SF even though it has lost focus and cannot be typed into\n const rootNode: HTMLElement = this.props.rootNode;\n const nuInput: HTMLInputElement = document.createElement('input');\n nuInput.style.width = '1px';\n nuInput.style.height = '1px';\n nuInput.style.opacity = '0';\n nuInput.style.fontSize = '18px'; // prevents zoom\n rootNode.appendChild(nuInput);\n nuInput.focus(); // Takes caret from SF\n rootNode.removeChild(nuInput); // Without this numpad will be replaced with text pad\n }\n }\n\n // Remove listener - it gets reset by next call to handleAdditionalFields from handleFocus\n this.destroyTouchendListener();\n\n // Store the fact we have unset the listener\n this.state.registerFieldForIos = false;\n\n // Clear focus on secured field inputs now this checkout element has gained focus\n this.postMessageToAllIframes({ fieldType: 'webInternalElement', fieldClick: true });\n}\n\n/**\n * re. Disabling arrow keys in iOS - need to enable all fields in the form and tell SFs to disable\n *\n * NOTE: Only called when iOS detected & this.props.shouldDisableIOSArrowKeys = true\n */\nfunction touchstartListener(e: Event): void {\n this.hasGenuineTouchEvents = true;\n const targetEl: EventTarget = e.target;\n // If other element is Input or Span (i.e. label text) TODO apply to other types of el?\n if (targetEl instanceof HTMLInputElement || targetEl instanceof HTMLSpanElement) {\n this.postMessageToAllIframes({ fieldType: 'webInternalElement', checkoutTouchEvent: true });\n\n const name = targetEl.getAttribute('name') ?? targetEl.getAttribute('data-id'); // if targetEl is a label's span it will only have a data-id\n this.callbacks.onTouchstartIOS?.({ fieldType: 'webInternalElement', name });\n }\n}\n\n/**\n * This works with the touchend handler to allow us to catch (click) events on non-securedFields elements\n * (re. http://gravitydept.com/blog/js-click-event-bubbling-on-ios - events don't bubble unless the click takes place on a link or input)\n *\n * We can use this event to:\n * 1. Set focus on these other elements, and\n * 2. Tell SecuredFields that this has happened so they can blur themselves\n * (see note in adyen-secured-fields...inputBase.js - \"Blur event never fires on input field\")\n *\n * NOTE: Only called when iOS detected\n */\nfunction handleTouchend(): void {\n const bodyEl: HTMLBodyElement = selectOne(document, 'body');\n bodyEl.style.cursor = 'pointer';\n\n on(bodyEl, 'touchend', this.touchendListener);\n\n // Store the fact we have set the listener\n this.state.registerFieldForIos = true;\n}\n\nfunction destroyTouchendListener(): boolean {\n if (!ua.__IS_IOS) return false; // For when fn is called as result of destroy being called on main csf instance\n\n const bodyEl: HTMLBodyElement = selectOne(document, 'body');\n bodyEl.style.cursor = 'auto';\n off(bodyEl, 'touchend', this.touchendListener);\n return true;\n}\n\nfunction destroyTouchstartListener(): boolean {\n if (!ua.__IS_IOS) return false; // For when fn is called as result of destroy being called on main csf instance\n\n off(document, 'touchstart', this.touchstartListener);\n return true;\n}\n\nexport default {\n touchendListener,\n touchstartListener,\n handleTouchend,\n destroyTouchendListener,\n destroyTouchstartListener\n};\n"],"names":["handleIOSTouchEvents","touchendListener","e","targetEl","target","HTMLInputElement","HTMLTextAreaElement","val","value","caretPos","pNode","selectionStart","adjFlag","length","setSelectionRange","focus","setTimeout","this","config","keypadFix","rootNode","props","nuInput","document","createElement","style","width","height","opacity","fontSize","appendChild","removeChild","destroyTouchendListener","state","registerFieldForIos","postMessageToAllIframes","fieldType","fieldClick","touchstartListener","hasGenuineTouchEvents","HTMLSpanElement","_this_callbacks_onTouchstartIOS","_this_callbacks","checkoutTouchEvent","name","getAttribute","callbacks","onTouchstartIOS","call","handleTouchend","bodyEl","selectOne","cursor","on","ua","__IS_IOS","off","destroyTouchstartListener"],"mappings":"+JAmJA,IAAAA,EAAe,CACXC,iBA/HJ,SAA0BC,GACtB,MAAMC,EAAwBD,EAAEE,OAGhC,GAAID,aAAoBE,kBAAqBC,qBAAuBH,aAAoBG,oBAAsB,CAE1G,MAAMC,EAAcJ,EAASK,MAE7B,IAAIC,EAxBJ,mBADaC,EAyBsBP,GAvB5BO,EAAMC,eAEV,EAuBCC,GAAU,EAIVH,IAAaF,EAAIM,SACjBJ,GAAY,EACZG,GAAU,GAGdT,EAASK,MAAQD,EAQjB,IACQJ,EAASW,oBACTX,EAASY,QACTZ,EAASW,kBAAkBL,EAAUA,GAGjCG,IACAH,GAAY,EACZO,WAAW,KACPb,EAASW,kBAAkBL,EAAUA,IACtC,IAIf,CAAE,MAAOP,GAAI,CACjB,KAAO,CAKH,GAD8Be,KAAKC,OAAOC,UACxB,CAGd,MAAMC,EAAwBH,KAAKI,MAAMD,SACnCE,EAA4BC,SAASC,cAAc,SACzDF,EAAQG,MAAMC,MAAQ,MACtBJ,EAAQG,MAAME,OAAS,MACvBL,EAAQG,MAAMG,QAAU,IACxBN,EAAQG,MAAMI,SAAW,OACzBT,EAASU,YAAYR,GACrBA,EAAQP,QACRK,EAASW,YAAYT,EACzB,CACJ,CA7EgB,IAACZ,EAgFjBO,KAAKe,0BAGLf,KAAKgB,MAAMC,qBAAsB,EAGjCjB,KAAKkB,wBAAwB,CAAEC,UAAW,qBAAsBC,YAAY,GAChF,EA0DIC,mBAnDJ,SAA4BpC,GACxBe,KAAKsB,uBAAwB,EAC7B,MAAMpC,EAAwBD,EAAEE,OAEhC,GAAID,aAAoBE,kBAAoBF,aAAoBqC,gBAAiB,CAGhErC,IAAAA,EACbsC,EAAAC,EAHAzB,KAAKkB,wBAAwB,CAAEC,UAAW,qBAAsBO,oBAAoB,IAEpF,MAAMC,EAA6B,QAAtBzC,EAAAA,EAAS0C,aAAa,eAAtB1C,IAAAA,EAAAA,EAAiCA,EAAS0C,aAAa,WACtC,QAA9BJ,GAAAC,EAAAzB,KAAK6B,WAAUC,uBAAf,IAAAN,GAAAA,EAAAO,KAAAN,EAAiC,CAAEN,UAAW,qBAAsBQ,QACxE,CACJ,EA0CIK,eA7BJ,WACI,MAAMC,EAA0BC,EAAU5B,SAAU,QACpD2B,EAAOzB,MAAM2B,OAAS,UAEtBC,EAAGH,EAAQ,WAAYjC,KAAKhB,kBAG5BgB,KAAKgB,MAAMC,qBAAsB,CACrC,EAsBIF,wBApBJ,WACI,IAAKsB,EAAGC,SAAU,OAAO,EAEzB,MAAML,EAA0BC,EAAU5B,SAAU,QAGpD,OAFA2B,EAAOzB,MAAM2B,OAAS,OACtBI,EAAIN,EAAQ,WAAYjC,KAAKhB,mBACtB,CACX,EAcIwD,0BAZJ,WACI,QAAKH,EAAGC,WAERC,EAAIjC,SAAU,aAAcN,KAAKqB,qBAC1B,EACX"}
|
package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js
CHANGED
|
@@ -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
|
|
@@ -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 t}from"../utilities/logger.js";import i from"./utils/createIframe.js";import{selectOne as s,removeAllChildren as r}from"../utilities/dom.js";import{on as
|
|
1
|
+
import{log as e,warn as t}from"../utilities/logger.js";import i 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 c}from"../CSF/utils/iframes/postMessageValidation.js";import{ENCRYPTED_EXPIRY_DATE as f,ENCRYPTED_EXPIRY_MONTH as d,ENCRYPTED_EXPIRY_YEAR as u,DATE_POLICY_OPTIONAL as m,DATE_POLICY_HIDDEN as p,ENCRYPTED_SECURITY_CODE as y,CVC_POLICY_OPTIONAL as g,CVC_POLICY_HIDDEN as C}from"../constants.js";import{generateRandomNumber as b}from"../utilities/commonUtils.js";import O from"./AbstractSecuredField.js";import{reject as w}from"../../../../../utils/commonUtils.js";import{processAriaConfig as E}from"./utils/processAriaConfig.js";import{processPlaceholders as T}from"./utils/processPlaceholders.js";import{hasOwnProperty as P}from"../../../../../utils/hasOwnProperty.js";import{AnalyticsErrorEvent as L,ErrorEventType as k,ErrorEventCode as j}from"../../../../../core/Analytics/events/AnalyticsErrorEvent.js";function _(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function F(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},s=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),s.forEach(function(t){_(e,t,i[t])})}return e}function S(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}class W extends O{init(e,t,r,o){const a=E(this.sfConfig.txVariant,this.sfConfig.fieldType,e,o);this.sfConfig.iframeUIConfig.ariaConfig=a,this.sfConfig.iframeUIConfig.placeholders=T(this.sfConfig.txVariant,this.sfConfig.fieldType,r);const l={src:t,title:a[this.sfConfig.fieldType].iframeTitle,policy:"origin"},h=i(l);this.holderEl.appendChild(h);const c=s(this.holderEl,".js-iframe");if(c){if(!c.contentWindow){var f;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 L({component:this.componentType,code:j.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,errorType:k.implementation,message:`Trying to initialise an iframe for ${this.sfConfig.fieldType}, but the iframe.contentWindow is undefined`});null===(f=this.submitAnalytics)||void 0===f||f.call(this,e)}this.iframeContentWindow=c.contentWindow,this.iframeOnLoadListener=this.iframeOnLoadListenerFn,n(c,"load",this.iframeOnLoadListener,!1)}return this.iframeRef=c,this}iframeOnLoadListenerFn(){this.postMessageListener=this.postMessageListenerFn,n(window,"message",this.postMessageListener,!1);const e=S(F({},this.sfConfig),{numKey:this.numKey});window._b$dl&&console.log("### SecuredField:::: onIframeLoaded:: created configObj=",e),a(e,this.iframeContentWindow,this.loadingContext),this.onIframeLoadedCallback()}postMessageListenerFn(i){if(!l(i,this.loadingContext,this.sfConfig.showWarnings))return;let s;try{s=JSON.parse(i.data)}catch(t){return h(i)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK")):c(i)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX")):void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=",i.data))}if(P(s,"action")&&P(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&&t("WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)");else this.sfConfig.showWarnings&&t("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===f||this.sfConfig.fieldType===d||this.sfConfig.fieldType===u)switch(this.expiryDatePolicy){case p:return!0;case m:return!this.hasError;default:return!1}if(this.sfConfig.fieldType===y)switch(this.cvcPolicy){case C:return!0;case g: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===y)switch(this.cvcPolicy){case C:return!0;case g:return!this.hasError;default:return this._isValid}if(this.sfConfig.fieldType===f||this.sfConfig.fieldType===d||this.sfConfig.fieldType===u)switch(this.expiryDatePolicy){case p:return!0;case m: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===y&&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!==f&&this.sfConfig.fieldType!==d&&this.sfConfig.fieldType!==u||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,t){super();const i=w(["loadingContext","holderEl","iframeSrc","showContextualElement","placeholders"]).from(e);this.sfConfig=S(F({},i),{iframeUIConfig:F({},i.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(t,s,r,n)}}export{W as default};
|
|
2
2
|
//# sourceMappingURL=SecuredField.js.map
|
package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/SecuredField.ts"],"sourcesContent":["import * as logger from '../utilities/logger';\nimport createIframe from './utils/createIframe';\nimport { removeAllChildren, selectOne } from '../utilities/dom';\nimport { off, on } from '../../../../../utils/listenerUtils';\nimport postMessageToIframe from '../CSF/utils/iframes/postMessageToIframe';\nimport { isChromeVoxPostMsg, isWebpackPostMsg, originCheckPassed } from '../CSF/utils/iframes/postMessageValidation';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n DATE_POLICY_HIDDEN,\n DATE_POLICY_OPTIONAL,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE\n} from '../constants';\nimport { generateRandomNumber } from '../utilities/commonUtils';\nimport { CVCPolicyType, DatePolicyType, RtnType_callbackFn, RtnType_noParamVoidFn, RtnType_postMessageListener, SFFeedbackObj } from '../types';\nimport AbstractSecuredField from './AbstractSecuredField';\nimport { AriaConfig, IframeConfigObject, SecuredFieldSetupObject, SecuredFieldCommonProps } from '../types';\nimport { reject } from '../../../../../utils/commonUtils';\nimport { processAriaConfig } from './utils/processAriaConfig';\nimport { processPlaceholders } from './utils/processPlaceholders';\nimport Language from '../../../../../language/Language';\nimport { hasOwnProperty } from '../../../../../utils/hasOwnProperty';\nimport { Placeholders } from '../../SFP/types';\nimport './SecuredField.scss';\n\nconst logPostMsg = false;\nconst doLog = false;\n\nclass SecuredField extends AbstractSecuredField {\n constructor(pSetupObj: SecuredFieldSetupObject, i18n: Language) {\n super();\n\n /**\n * List of props to exclude from being set on this.sfConfig.\n * These props are only required for internal purposes. They do not get sent to the iframe\n */\n const deltaPropsArr: string[] = ['loadingContext', 'holderEl', 'iframeSrc', 'showContextualElement', 'placeholders'];\n\n /**\n * List of props from setup object that will be set on this.sfConfig\n * These props will all end up being sent to the iframe\n */\n const configVarsFromSetUpObj = reject(deltaPropsArr).from(pSetupObj);\n\n // Copy passed setup object values to this.sfConfig\n this.sfConfig = {\n // ...this.sfConfig, // Do we need to do this? Pretty sure we don't\n ...configVarsFromSetUpObj,\n // Break references on iframeUIConfig object so we can overwrite its properties in each securedField instance\n iframeUIConfig: { ...configVarsFromSetUpObj.iframeUIConfig }\n } as SecuredFieldCommonProps;\n\n /**\n * Extract values only needed for init\n */\n const { iframeSrc, placeholders, showContextualElement } = pSetupObj;\n\n /**\n * Store those passed setup object values that are needed in multiple functions\n */\n this.loadingContext = pSetupObj.loadingContext;\n this.holderEl = pSetupObj.holderEl;\n\n /**\n * Initiate other values on 'this' through setters\n */\n this.isValid = false;\n this.iframeContentWindow = null;\n this.numKey = generateRandomNumber();\n this.isEncrypted = false;\n this.hasError = false;\n this.errorType = '';\n this.cvcPolicy = pSetupObj.cvcPolicy;\n this.expiryDatePolicy = pSetupObj.expiryDatePolicy;\n\n if (process.env.NODE_ENV === 'development' && doLog) {\n logger.log(\n '### SecuredField::constructor:: this.sfConfig.fieldType=',\n this.sfConfig.fieldType,\n 'isValid=',\n this._isValid,\n 'numKey=',\n this.numKey\n );\n logger.log('\\n');\n }\n\n return this.init(i18n, iframeSrc, placeholders, showContextualElement);\n }\n\n init(i18n: Language, iframeSrc: string, placeholders: Placeholders, showContextualElement: boolean): SecuredField {\n /**\n * Ensure all fields have a related ariaConfig object containing, at minimum, an iframeTitle property and a (translated) errors object\n */\n const processedAriaConfig: AriaConfig = processAriaConfig(this.sfConfig.txVariant, this.sfConfig.fieldType, i18n, showContextualElement);\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.ariaConfig = processedAriaConfig;\n\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.placeholders = processPlaceholders(this.sfConfig.txVariant, this.sfConfig.fieldType, placeholders);\n\n /**\n * Configure, create & reference iframe and add load listener\n */\n const iframeConfig = {\n src: iframeSrc,\n title: processedAriaConfig[this.sfConfig.fieldType].iframeTitle,\n policy: 'origin'\n };\n\n const iframeEl: HTMLIFrameElement = createIframe(iframeConfig);\n\n // Place the iframe into the holder\n this.holderEl.appendChild(iframeEl);\n\n // Now examine the holder to get an actual DOM node\n const iframe: HTMLIFrameElement = selectOne(this.holderEl, '.js-iframe');\n\n if (iframe) {\n this.iframeContentWindow = iframe.contentWindow;\n\n // Create reference to bound fn (see getters/setters for binding)\n this.iframeOnLoadListener = this.iframeOnLoadListenerFn;\n\n on(iframe, 'load', this.iframeOnLoadListener, false);\n }\n\n this.iframeRef = iframe;\n\n return this;\n }\n\n iframeOnLoadListenerFn(): void {\n // Create reference to bound fn (see getters/setters for binding)\n this.postMessageListener = this.postMessageListenerFn;\n\n // Add general listener for 'message' EVENT - the event that 'powers' postMessage\n on(window, 'message', this.postMessageListener, false);\n\n // Create and send config object to iframe\n const configObj: IframeConfigObject = {\n ...this.sfConfig,\n numKey: this.numKey\n };\n\n if (window._b$dl) console.log('### SecuredField:::: onIframeLoaded:: created configObj=', configObj);\n\n postMessageToIframe(configObj, this.iframeContentWindow, this.loadingContext);\n //--\n\n // Callback to say iframe loaded\n this.onIframeLoadedCallback();\n }\n\n postMessageListenerFn(event: MessageEvent): void {\n // Check message is from expected domain\n if (!originCheckPassed(event, this.loadingContext, this.sfConfig.showWarnings)) {\n return;\n }\n\n // TODO - for debugging purposes this would always be useful to see\n // logger.log('\\n',this.sfConfig.fieldType,'### CSF SecuredField::postMessageListener:: event.data=',event.data);\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '\\n###CSF SecuredField::postMessageListener:: DOMAIN & ORIGIN MATCH, NO WEBPACK WEIRDNESS fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant,\n 'this.numKey=',\n this.numKey\n );\n }\n\n // PARSE DATA OBJECT (thus testing if it is a JSON string) - OR TRY & WORK OUT WHY THE PARSING FAILED\n let feedbackObj: SFFeedbackObj;\n\n try {\n feedbackObj = JSON.parse(event.data);\n } catch (e) {\n // Was the message generated by webpack?\n if (isWebpackPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK');\n return;\n }\n\n // Was the message generated by ChromeVox?\n if (isChromeVoxPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX');\n return;\n }\n\n if (this.sfConfig.showWarnings)\n logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=', event.data);\n return;\n }\n\n // CHECK FOR EXPECTED PROPS\n const hasMainProps: boolean = hasOwnProperty(feedbackObj, 'action') && hasOwnProperty(feedbackObj, 'numKey');\n\n if (!hasMainProps) {\n if (this.sfConfig.showWarnings) logger.warn('WARNING SecuredField :: postMessage listener for iframe :: data mismatch!');\n return;\n }\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log('### SecuredField::postMessageListener:: feedbackObj.numKey=', feedbackObj.numKey);\n }\n\n if (this.numKey !== feedbackObj.numKey) {\n if (this.sfConfig.showWarnings) {\n logger.warn(\n 'WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)'\n );\n }\n return;\n }\n\n // VALIDATION CHECKS PASSED - DECIDE ON COURSE OF ACTION\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '### SecuredField::postMessageListener:: numkeys match PROCEED WITH POST MESSAGE PROCESSING fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant\n );\n }\n\n switch (feedbackObj.action) {\n case 'encryption':\n this.isValid = true;\n this.onEncryptionCallback(feedbackObj);\n break;\n\n case 'config':\n if (window._b$dl)\n console.log('### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback', feedbackObj.fieldType);\n this.onConfigCallback(feedbackObj);\n break;\n\n case 'focus':\n this.onFocusCallback(feedbackObj);\n break;\n\n case 'binValue':\n this.onBinValueCallback(feedbackObj);\n break;\n\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n case 'touch':\n this.onTouchstartCallback(feedbackObj);\n break;\n\n // Only happens for Firefox & IE <= 11\n case 'shifttab':\n this.onShiftTabCallback(feedbackObj);\n break;\n\n case 'autoComplete':\n this.onAutoCompleteCallback(feedbackObj);\n break;\n\n case 'enterKeyPressed':\n this.onKeyPressedCallback(feedbackObj);\n break;\n\n /**\n * Validate, because action =\n *\n * 'brand'\n * 'delete'\n * 'luhnCheck'\n * //'incomplete field' (an error that follows from a focus (blur) event)\n * 'incorrectly filled field' (an error that follows from a focus (blur) event) // NEW\n * 'numberKeyPressed' (or date-, month-, year-, cvc-, pin-, or iban- KeyPressed)\n * - since we have no \"error\" action \"...KeyPressed\" is the action type on most error events (other than \"incomplete field\" or \"luhnCheck\")\n * and often these error events representing the clearing of an existing error\n */\n default:\n // If we're validation handling (& not encryption handling) field must be invalid\n this.isValid = false;\n this.onValidationCallback(feedbackObj);\n }\n }\n\n destroy(): void {\n off(window, 'message', this.postMessageListener, false);\n off(this.iframeRef, 'load', this.iframeOnLoadListener, false);\n this.iframeContentWindow = null;\n removeAllChildren(this.holderEl);\n }\n\n /**\n * Returns whether the securedField is hidden OR whether it is optional and not in error\n */\n isOptionalOrHidden(): boolean {\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n return true;\n case DATE_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n return true;\n case CVC_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n // Any other type of securedField is not optional & can't be hidden\n return false;\n }\n\n // /////// ALLOCATE CALLBACKS /////////\n onIframeLoaded(callbackFn: RtnType_noParamVoidFn): SecuredField {\n this.onIframeLoadedCallback = callbackFn;\n return this;\n }\n\n onEncryption(callbackFn: RtnType_callbackFn): SecuredField {\n this.onEncryptionCallback = callbackFn;\n return this;\n }\n\n onValidation(callbackFn: RtnType_callbackFn): SecuredField {\n this.onValidationCallback = callbackFn;\n return this;\n }\n\n onConfig(callbackFn: RtnType_callbackFn): SecuredField {\n this.onConfigCallback = callbackFn;\n return this;\n }\n\n onFocus(callbackFn: RtnType_callbackFn): SecuredField {\n this.onFocusCallback = callbackFn;\n return this;\n }\n\n onBinValue(callbackFn: RtnType_callbackFn): SecuredField {\n this.onBinValueCallback = callbackFn;\n return this;\n }\n\n onTouchstart(callbackFn: RtnType_callbackFn): SecuredField {\n this.onTouchstartCallback = callbackFn;\n return this;\n }\n\n onShiftTab(callbackFn: RtnType_callbackFn): SecuredField {\n this.onShiftTabCallback = callbackFn;\n return this;\n }\n\n onAutoComplete(callbackFn: RtnType_callbackFn): SecuredField {\n this.onAutoCompleteCallback = callbackFn;\n return this;\n }\n\n onKeyPressed(callbackFn: RtnType_callbackFn): SecuredField {\n this.onKeyPressedCallback = callbackFn;\n return this;\n }\n //------------------------------------\n\n // ///////////// GETTERS/SETTERS //////////////\n\n get errorType(): string {\n return this._errorType;\n }\n set errorType(value: string) {\n this._errorType = value;\n }\n\n get hasError(): boolean {\n return this._hasError;\n }\n set hasError(value: boolean) {\n this._hasError = value;\n }\n\n get isValid(): boolean {\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n // If cvc is hidden then the field is always valid\n return true;\n case CVC_POLICY_OPTIONAL:\n // If cvc is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n // If date is hidden then the field is always valid\n return true;\n case DATE_POLICY_OPTIONAL:\n // If date is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n return this._isValid;\n }\n set isValid(value: boolean) {\n this._isValid = value;\n }\n\n get cvcPolicy(): CVCPolicyType {\n return this._cvcPolicy;\n }\n\n set cvcPolicy(value: CVCPolicyType) {\n // Only set if this is a CVC field\n if (this.sfConfig.fieldType !== ENCRYPTED_SECURITY_CODE) return;\n\n // Only set if value has changed\n if (value === this.cvcPolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField::cvcPolicy:: value=', value);\n\n this._cvcPolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n // NOTE: fixes issue in Components where you first validate and then start typing a maestro number\n // - w/o this and the fix in CSF the maestro PM will never register as valid\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get expiryDatePolicy(): DatePolicyType {\n return this._expiryDatePolicy;\n }\n\n set expiryDatePolicy(value: DatePolicyType) {\n // Only set if this is a date field type of securedField\n if (\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_DATE &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_MONTH &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_YEAR\n )\n return;\n\n // Only set if value has changed\n if (value === this.expiryDatePolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField:expiryDatePolicy:: value=', value);\n\n this._expiryDatePolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get iframeContentWindow(): Window {\n return this._iframeContentWindow;\n }\n set iframeContentWindow(value: Window) {\n this._iframeContentWindow = value;\n }\n\n get isEncrypted(): boolean {\n return this._isEncrypted;\n }\n set isEncrypted(value: boolean) {\n this._isEncrypted = value;\n }\n\n get numKey(): number {\n return this._numKey;\n }\n set numKey(value: number) {\n this._numKey = value;\n }\n\n // Internal use - way to create listener refs that we can add/remove\n get iframeOnLoadListener(): RtnType_noParamVoidFn {\n return this._iframeOnLoadListener;\n }\n set iframeOnLoadListener(value: RtnType_noParamVoidFn) {\n this._iframeOnLoadListener = value.bind(this);\n }\n\n get postMessageListener(): RtnType_postMessageListener {\n return this._postMessageListener;\n }\n set postMessageListener(value: RtnType_postMessageListener) {\n this._postMessageListener = value.bind(this);\n }\n}\n\nexport default SecuredField;\n"],"names":["SecuredField","AbstractSecuredField","init","i18n","iframeSrc","placeholders","showContextualElement","processedAriaConfig","processAriaConfig","this","sfConfig","txVariant","fieldType","iframeUIConfig","ariaConfig","processPlaceholders","iframeConfig","src","title","iframeTitle","policy","iframeEl","createIframe","holderEl","appendChild","iframe","selectOne","iframeContentWindow","contentWindow","iframeOnLoadListener","iframeOnLoadListenerFn","on","iframeRef","postMessageListener","postMessageListenerFn","window","configObj","_object_spread_props","_object_spread","numKey","_b$dl","console","log","postMessageToIframe","loadingContext","onIframeLoadedCallback","event","originCheckPassed","showWarnings","feedbackObj","JSON","parse","data","e","isWebpackPostMsg","logger","isChromeVoxPostMsg","hasOwnProperty","action","isValid","onEncryptionCallback","onConfigCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onKeyPressedCallback","onValidationCallback","destroy","off","removeAllChildren","isOptionalOrHidden","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","expiryDatePolicy","DATE_POLICY_HIDDEN","DATE_POLICY_OPTIONAL","hasError","ENCRYPTED_SECURITY_CODE","cvcPolicy","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","onIframeLoaded","callbackFn","onEncryption","onValidation","onConfig","onFocus","onBinValue","onTouchstart","onShiftTab","onAutoComplete","onKeyPressed","errorType","_errorType","value","_hasError","_isValid","_cvcPolicy","_expiryDatePolicy","_iframeContentWindow","isEncrypted","_isEncrypted","_numKey","_iframeOnLoadListener","bind","_postMessageListener","constructor","pSetupObj","super","configVarsFromSetUpObj","reject","from","generateRandomNumber"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"SecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/SecuredField.ts"],"sourcesContent":["import * as logger from '../utilities/logger';\nimport createIframe from './utils/createIframe';\nimport { removeAllChildren, selectOne } from '../utilities/dom';\nimport { off, on } from '../../../../../utils/listenerUtils';\nimport postMessageToIframe from '../CSF/utils/iframes/postMessageToIframe';\nimport { isChromeVoxPostMsg, isWebpackPostMsg, originCheckPassed } from '../CSF/utils/iframes/postMessageValidation';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n DATE_POLICY_HIDDEN,\n DATE_POLICY_OPTIONAL,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE\n} from '../constants';\nimport { generateRandomNumber } from '../utilities/commonUtils';\nimport { CVCPolicyType, DatePolicyType, RtnType_callbackFn, RtnType_noParamVoidFn, RtnType_postMessageListener, SFFeedbackObj } from '../types';\nimport AbstractSecuredField from './AbstractSecuredField';\nimport { AriaConfig, IframeConfigObject, SecuredFieldSetupObject, SecuredFieldCommonProps } from '../types';\nimport { reject } from '../../../../../utils/commonUtils';\nimport { processAriaConfig } from './utils/processAriaConfig';\nimport { processPlaceholders } from './utils/processPlaceholders';\nimport Language from '../../../../../language/Language';\nimport { hasOwnProperty } from '../../../../../utils/hasOwnProperty';\nimport { Placeholders } from '../../SFP/types';\nimport './SecuredField.scss';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../../../../core/Analytics/events/AnalyticsErrorEvent';\n\nconst logPostMsg = false;\nconst doLog = false;\n\nclass SecuredField extends AbstractSecuredField {\n constructor(pSetupObj: SecuredFieldSetupObject, i18n: Language) {\n super();\n\n /**\n * List of props to exclude from being set on this.sfConfig.\n * These props are only required for internal purposes. They do not get sent to the iframe\n */\n const deltaPropsArr: string[] = ['loadingContext', 'holderEl', 'iframeSrc', 'showContextualElement', 'placeholders'];\n\n /**\n * List of props from setup object that will be set on this.sfConfig\n * These props will all end up being sent to the iframe\n */\n const configVarsFromSetUpObj = reject(deltaPropsArr).from(pSetupObj);\n\n // Copy passed setup object values to this.sfConfig\n this.sfConfig = {\n // ...this.sfConfig, // Do we need to do this? Pretty sure we don't\n ...configVarsFromSetUpObj,\n // Break references on iframeUIConfig object so we can overwrite its properties in each securedField instance\n iframeUIConfig: { ...configVarsFromSetUpObj.iframeUIConfig }\n } as SecuredFieldCommonProps;\n\n /**\n * Extract values only needed for init\n */\n const { iframeSrc, placeholders, showContextualElement } = pSetupObj;\n\n /**\n * Store those passed setup object values that are needed in multiple functions\n */\n this.loadingContext = pSetupObj.loadingContext;\n this.holderEl = pSetupObj.holderEl;\n this.submitAnalytics = pSetupObj.submitAnalytics;\n this.componentType = pSetupObj.componentType;\n\n /**\n * Initiate other values on 'this' through setters\n */\n this.isValid = false;\n this.iframeContentWindow = null;\n this.numKey = generateRandomNumber();\n this.isEncrypted = false;\n this.hasError = false;\n this.errorType = '';\n this.cvcPolicy = pSetupObj.cvcPolicy;\n this.expiryDatePolicy = pSetupObj.expiryDatePolicy;\n\n if (process.env.NODE_ENV === 'development' && doLog) {\n logger.log(\n '### SecuredField::constructor:: this.sfConfig.fieldType=',\n this.sfConfig.fieldType,\n 'isValid=',\n this._isValid,\n 'numKey=',\n this.numKey\n );\n logger.log('\\n');\n }\n\n return this.init(i18n, iframeSrc, placeholders, showContextualElement);\n }\n\n init(i18n: Language, iframeSrc: string, placeholders: Placeholders, showContextualElement: boolean): SecuredField {\n /**\n * Ensure all fields have a related ariaConfig object containing, at minimum, an iframeTitle property and a (translated) errors object\n */\n const processedAriaConfig: AriaConfig = processAriaConfig(this.sfConfig.txVariant, this.sfConfig.fieldType, i18n, showContextualElement);\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.ariaConfig = processedAriaConfig;\n\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.placeholders = processPlaceholders(this.sfConfig.txVariant, this.sfConfig.fieldType, placeholders);\n\n /**\n * Configure, create & reference iframe and add load listener\n */\n const iframeConfig = {\n src: iframeSrc,\n title: processedAriaConfig[this.sfConfig.fieldType].iframeTitle,\n policy: 'origin'\n };\n\n const iframeEl: HTMLIFrameElement = createIframe(iframeConfig);\n\n // Place the iframe into the holder\n this.holderEl.appendChild(iframeEl);\n\n // Now examine the holder to get an actual DOM node\n const iframe: HTMLIFrameElement = selectOne(this.holderEl, '.js-iframe');\n\n if (iframe) {\n if (!iframe.contentWindow) {\n // Warn the dev\n console.error(\n '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?'\n );\n // Log the error\n const event = new AnalyticsErrorEvent({\n component: this.componentType,\n code: ErrorEventCode.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,\n errorType: ErrorEventType.implementation,\n message: `Trying to initialise an iframe for ${this.sfConfig.fieldType}, but the iframe.contentWindow is undefined`\n });\n\n this.submitAnalytics?.(event);\n }\n\n this.iframeContentWindow = iframe.contentWindow;\n\n // Create reference to bound fn (see getters/setters for binding)\n this.iframeOnLoadListener = this.iframeOnLoadListenerFn;\n\n on(iframe, 'load', this.iframeOnLoadListener, false);\n }\n\n this.iframeRef = iframe;\n\n return this;\n }\n\n iframeOnLoadListenerFn(): void {\n // Create reference to bound fn (see getters/setters for binding)\n this.postMessageListener = this.postMessageListenerFn;\n\n // Add general listener for 'message' EVENT - the event that 'powers' postMessage\n on(window, 'message', this.postMessageListener, false);\n\n // Create and send config object to iframe\n const configObj: IframeConfigObject = {\n ...this.sfConfig,\n numKey: this.numKey\n };\n\n if (window._b$dl) console.log('### SecuredField:::: onIframeLoaded:: created configObj=', configObj);\n\n postMessageToIframe(configObj, this.iframeContentWindow, this.loadingContext);\n //--\n\n // Callback to say iframe loaded\n this.onIframeLoadedCallback();\n }\n\n postMessageListenerFn(event: MessageEvent): void {\n // Check message is from expected domain\n if (!originCheckPassed(event, this.loadingContext, this.sfConfig.showWarnings)) {\n return;\n }\n\n // TODO - for debugging purposes this would always be useful to see\n // logger.log('\\n',this.sfConfig.fieldType,'### CSF SecuredField::postMessageListener:: event.data=',event.data);\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '\\n###CSF SecuredField::postMessageListener:: DOMAIN & ORIGIN MATCH, NO WEBPACK WEIRDNESS fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant,\n 'this.numKey=',\n this.numKey\n );\n }\n\n // PARSE DATA OBJECT (thus testing if it is a JSON string) - OR TRY & WORK OUT WHY THE PARSING FAILED\n let feedbackObj: SFFeedbackObj;\n\n try {\n feedbackObj = JSON.parse(event.data);\n } catch (e) {\n // Was the message generated by webpack?\n if (isWebpackPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK');\n return;\n }\n\n // Was the message generated by ChromeVox?\n if (isChromeVoxPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX');\n return;\n }\n\n if (this.sfConfig.showWarnings)\n logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=', event.data);\n return;\n }\n\n // CHECK FOR EXPECTED PROPS\n const hasMainProps: boolean = hasOwnProperty(feedbackObj, 'action') && hasOwnProperty(feedbackObj, 'numKey');\n\n if (!hasMainProps) {\n if (this.sfConfig.showWarnings) logger.warn('WARNING SecuredField :: postMessage listener for iframe :: data mismatch!');\n return;\n }\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log('### SecuredField::postMessageListener:: feedbackObj.numKey=', feedbackObj.numKey);\n }\n\n if (this.numKey !== feedbackObj.numKey) {\n if (this.sfConfig.showWarnings) {\n logger.warn(\n 'WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)'\n );\n }\n return;\n }\n\n // VALIDATION CHECKS PASSED - DECIDE ON COURSE OF ACTION\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '### SecuredField::postMessageListener:: numkeys match PROCEED WITH POST MESSAGE PROCESSING fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant\n );\n }\n\n switch (feedbackObj.action) {\n case 'encryption':\n this.isValid = true;\n this.onEncryptionCallback(feedbackObj);\n break;\n\n case 'config':\n if (window._b$dl)\n console.log('### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback', feedbackObj.fieldType);\n this.onConfigCallback(feedbackObj);\n break;\n\n case 'focus':\n this.onFocusCallback(feedbackObj);\n break;\n\n case 'binValue':\n this.onBinValueCallback(feedbackObj);\n break;\n\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n case 'touch':\n this.onTouchstartCallback(feedbackObj);\n break;\n\n // Only happens for Firefox & IE <= 11\n case 'shifttab':\n this.onShiftTabCallback(feedbackObj);\n break;\n\n case 'autoComplete':\n this.onAutoCompleteCallback(feedbackObj);\n break;\n\n case 'enterKeyPressed':\n this.onKeyPressedCallback(feedbackObj);\n break;\n\n /**\n * Validate, because action =\n *\n * 'brand'\n * 'delete'\n * 'luhnCheck'\n * //'incomplete field' (an error that follows from a focus (blur) event)\n * 'incorrectly filled field' (an error that follows from a focus (blur) event) // NEW\n * 'numberKeyPressed' (or date-, month-, year-, cvc-, pin-, or iban- KeyPressed)\n * - since we have no \"error\" action \"...KeyPressed\" is the action type on most error events (other than \"incomplete field\" or \"luhnCheck\")\n * and often these error events representing the clearing of an existing error\n */\n default:\n // If we're validation handling (& not encryption handling) field must be invalid\n this.isValid = false;\n this.onValidationCallback(feedbackObj);\n }\n }\n\n destroy(): void {\n off(window, 'message', this.postMessageListener, false);\n off(this.iframeRef, 'load', this.iframeOnLoadListener, false);\n this.iframeContentWindow = null;\n removeAllChildren(this.holderEl);\n }\n\n /**\n * Returns whether the securedField is hidden OR whether it is optional and not in error\n */\n isOptionalOrHidden(): boolean {\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n return true;\n case DATE_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n return true;\n case CVC_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n // Any other type of securedField is not optional & can't be hidden\n return false;\n }\n\n // /////// ALLOCATE CALLBACKS /////////\n onIframeLoaded(callbackFn: RtnType_noParamVoidFn): SecuredField {\n this.onIframeLoadedCallback = callbackFn;\n return this;\n }\n\n onEncryption(callbackFn: RtnType_callbackFn): SecuredField {\n this.onEncryptionCallback = callbackFn;\n return this;\n }\n\n onValidation(callbackFn: RtnType_callbackFn): SecuredField {\n this.onValidationCallback = callbackFn;\n return this;\n }\n\n onConfig(callbackFn: RtnType_callbackFn): SecuredField {\n this.onConfigCallback = callbackFn;\n return this;\n }\n\n onFocus(callbackFn: RtnType_callbackFn): SecuredField {\n this.onFocusCallback = callbackFn;\n return this;\n }\n\n onBinValue(callbackFn: RtnType_callbackFn): SecuredField {\n this.onBinValueCallback = callbackFn;\n return this;\n }\n\n onTouchstart(callbackFn: RtnType_callbackFn): SecuredField {\n this.onTouchstartCallback = callbackFn;\n return this;\n }\n\n onShiftTab(callbackFn: RtnType_callbackFn): SecuredField {\n this.onShiftTabCallback = callbackFn;\n return this;\n }\n\n onAutoComplete(callbackFn: RtnType_callbackFn): SecuredField {\n this.onAutoCompleteCallback = callbackFn;\n return this;\n }\n\n onKeyPressed(callbackFn: RtnType_callbackFn): SecuredField {\n this.onKeyPressedCallback = callbackFn;\n return this;\n }\n //------------------------------------\n\n // ///////////// GETTERS/SETTERS //////////////\n\n get errorType(): string {\n return this._errorType;\n }\n set errorType(value: string) {\n this._errorType = value;\n }\n\n get hasError(): boolean {\n return this._hasError;\n }\n set hasError(value: boolean) {\n this._hasError = value;\n }\n\n get isValid(): boolean {\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n // If cvc is hidden then the field is always valid\n return true;\n case CVC_POLICY_OPTIONAL:\n // If cvc is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n // If date is hidden then the field is always valid\n return true;\n case DATE_POLICY_OPTIONAL:\n // If date is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n return this._isValid;\n }\n set isValid(value: boolean) {\n this._isValid = value;\n }\n\n get cvcPolicy(): CVCPolicyType {\n return this._cvcPolicy;\n }\n\n set cvcPolicy(value: CVCPolicyType) {\n // Only set if this is a CVC field\n if (this.sfConfig.fieldType !== ENCRYPTED_SECURITY_CODE) return;\n\n // Only set if value has changed\n if (value === this.cvcPolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField::cvcPolicy:: value=', value);\n\n this._cvcPolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n // NOTE: fixes issue in Components where you first validate and then start typing a maestro number\n // - w/o this and the fix in CSF the maestro PM will never register as valid\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get expiryDatePolicy(): DatePolicyType {\n return this._expiryDatePolicy;\n }\n\n set expiryDatePolicy(value: DatePolicyType) {\n // Only set if this is a date field type of securedField\n if (\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_DATE &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_MONTH &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_YEAR\n )\n return;\n\n // Only set if value has changed\n if (value === this.expiryDatePolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField:expiryDatePolicy:: value=', value);\n\n this._expiryDatePolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get iframeContentWindow(): Window {\n return this._iframeContentWindow;\n }\n set iframeContentWindow(value: Window) {\n this._iframeContentWindow = value;\n }\n\n get isEncrypted(): boolean {\n return this._isEncrypted;\n }\n set isEncrypted(value: boolean) {\n this._isEncrypted = value;\n }\n\n get numKey(): number {\n return this._numKey;\n }\n set numKey(value: number) {\n this._numKey = value;\n }\n\n // Internal use - way to create listener refs that we can add/remove\n get iframeOnLoadListener(): RtnType_noParamVoidFn {\n return this._iframeOnLoadListener;\n }\n set iframeOnLoadListener(value: RtnType_noParamVoidFn) {\n this._iframeOnLoadListener = value.bind(this);\n }\n\n get postMessageListener(): RtnType_postMessageListener {\n return this._postMessageListener;\n }\n set postMessageListener(value: RtnType_postMessageListener) {\n this._postMessageListener = value.bind(this);\n }\n}\n\nexport default SecuredField;\n"],"names":["SecuredField","AbstractSecuredField","init","i18n","iframeSrc","placeholders","showContextualElement","processedAriaConfig","processAriaConfig","this","sfConfig","txVariant","fieldType","iframeUIConfig","ariaConfig","processPlaceholders","iframeConfig","src","title","iframeTitle","policy","iframeEl","createIframe","holderEl","appendChild","iframe","selectOne","contentWindow","_this_submitAnalytics","console","error","event","AnalyticsErrorEvent","component","componentType","code","ErrorEventCode","SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND","errorType","ErrorEventType","implementation","message","submitAnalytics","iframeContentWindow","iframeOnLoadListener","iframeOnLoadListenerFn","on","iframeRef","postMessageListener","postMessageListenerFn","window","configObj","_object_spread_props","_object_spread","numKey","_b$dl","log","postMessageToIframe","loadingContext","onIframeLoadedCallback","originCheckPassed","showWarnings","feedbackObj","JSON","parse","data","e","isWebpackPostMsg","logger","isChromeVoxPostMsg","hasOwnProperty","action","isValid","onEncryptionCallback","onConfigCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onKeyPressedCallback","onValidationCallback","destroy","off","removeAllChildren","isOptionalOrHidden","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","expiryDatePolicy","DATE_POLICY_HIDDEN","DATE_POLICY_OPTIONAL","hasError","ENCRYPTED_SECURITY_CODE","cvcPolicy","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","onIframeLoaded","callbackFn","onEncryption","onValidation","onConfig","onFocus","onBinValue","onTouchstart","onShiftTab","onAutoComplete","onKeyPressed","_errorType","value","_hasError","_isValid","_cvcPolicy","_expiryDatePolicy","_iframeContentWindow","isEncrypted","_isEncrypted","_numKey","_iframeOnLoadListener","bind","_postMessageListener","constructor","pSetupObj","super","configVarsFromSetUpObj","reject","from","generateRandomNumber"],"mappings":"47DAgCA,MAAMA,UAAqBC,EAgEvBC,IAAAA,CAAKC,EAAgBC,EAAmBC,EAA4BC,GAIhE,MAAMC,EAAkCC,EAAkBC,KAAKC,SAASC,UAAWF,KAAKC,SAASE,UAAWT,EAAMG,GAElHG,KAAKC,SAASG,eAAeC,WAAaP,EAG1CE,KAAKC,SAASG,eAAeR,aAAeU,EAAoBN,KAAKC,SAASC,UAAWF,KAAKC,SAASE,UAAWP,GAKlH,MAAMW,EAAe,CACjBC,IAAKb,EACLc,MAAOX,EAAoBE,KAAKC,SAASE,WAAWO,YACpDC,OAAQ,UAGNC,EAA8BC,EAAaN,GAGjDP,KAAKc,SAASC,YAAYH,GAG1B,MAAMI,EAA4BC,EAAUjB,KAAKc,SAAU,cAE3D,GAAIE,EAAQ,CACR,IAAKA,EAAOE,cAAe,KAavBC,EAXAC,QAAQC,MACJ,2OAGJ,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWxB,KAAKyB,cAChBC,KAAMC,EAAeC,+CACrBC,UAAWC,EAAeC,eAC1BC,QAAS,sCAAsChC,KAAKC,SAASE,yDAG7C,QAApBgB,EAAAnB,KAAKiC,uBAAL,IAAAd,GAAAA,OAAAnB,KAAuBsB,EAC3B,CAEAtB,KAAKkC,oBAAsBlB,EAAOE,cAGlClB,KAAKmC,qBAAuBnC,KAAKoC,uBAEjCC,EAAGrB,EAAQ,OAAQhB,KAAKmC,sBAAsB,EAClD,CAIA,OAFAnC,KAAKsC,UAAYtB,EAEVhB,IACX,CAEAoC,sBAAAA,GAEIpC,KAAKuC,oBAAsBvC,KAAKwC,sBAGhCH,EAAGI,OAAQ,UAAWzC,KAAKuC,qBAAqB,GAGhD,MAAMG,EAAgCC,EAAAC,EAAA,CAAA,EAC/B5C,KAAKC,UAAQ,CAChB4C,OAAQ7C,KAAK6C,SAGbJ,OAAOK,OAAO1B,QAAQ2B,IAAI,2DAA4DL,GAE1FM,EAAoBN,EAAW1C,KAAKkC,oBAAqBlC,KAAKiD,gBAI9DjD,KAAKkD,wBACT,CAEAV,qBAAAA,CAAsBlB,GAElB,IAAK6B,EAAkB7B,EAAOtB,KAAKiD,eAAgBjD,KAAKC,SAASmD,cAC7D,OAkBJ,IAAIC,EAEJ,IACIA,EAAcC,KAAKC,MAAMjC,EAAMkC,KACnC,CAAE,MAAOC,GAEL,OAAIC,EAAiBpC,QACbtB,KAAKC,SAASmD,cAAcO,EAAW,mEAK3CC,EAAmBtC,QACftB,KAAKC,SAASmD,cAAcO,EAAW,0EAI3C3D,KAAKC,SAASmD,cACdO,EAAW,qFAAsFrC,EAAMkC,MAE/G,CAKA,GAF8BK,EAAeR,EAAa,WAAaQ,EAAeR,EAAa,UAWnG,GAAIrD,KAAK6C,SAAWQ,EAAYR,OAmBhC,OAAQQ,EAAYS,QAChB,IAAK,aACD9D,KAAK+D,SAAU,EACf/D,KAAKgE,qBAAqBX,GAC1B,MAEJ,IAAK,SACGZ,OAAOK,OACP1B,QAAQ2B,IAAI,kFAAmFM,EAAYlD,WAC/GH,KAAKiE,iBAAiBZ,GACtB,MAEJ,IAAK,QACDrD,KAAKkE,gBAAgBb,GACrB,MAEJ,IAAK,WACDrD,KAAKmE,mBAAmBd,GACxB,MAGJ,IAAK,QACDrD,KAAKoE,qBAAqBf,GAC1B,MAGJ,IAAK,WACDrD,KAAKqE,mBAAmBhB,GACxB,MAEJ,IAAK,eACDrD,KAAKsE,uBAAuBjB,GAC5B,MAEJ,IAAK,kBACDrD,KAAKuE,qBAAqBlB,GAC1B,MAcJ,QAEIrD,KAAK+D,SAAU,EACf/D,KAAKwE,qBAAqBnB,QAvE1BrD,KAAKC,SAASmD,cACdO,EACI,sIAXJ3D,KAAKC,SAASmD,cAAcO,EAAY,4EAkFpD,CAEAc,OAAAA,GACIC,EAAIjC,OAAQ,UAAWzC,KAAKuC,qBAAqB,GACjDmC,EAAI1E,KAAKsC,UAAW,OAAQtC,KAAKmC,sBAAsB,GACvDnC,KAAKkC,oBAAsB,KAC3ByC,EAAkB3E,KAAKc,SAC3B,CAKA8D,kBAAAA,GACI,GACI5E,KAAKC,SAASE,YAAc0E,GAC5B7E,KAAKC,SAASE,YAAc2E,GAC5B9E,KAAKC,SAASE,YAAc4E,EAE5B,OAAQ/E,KAAKgF,kBACT,KAAKC,EACD,OAAO,EACX,KAAKC,EACD,OAAQlF,KAAKmF,SACjB,QACI,OAAO,EAInB,GAAInF,KAAKC,SAASE,YAAciF,EAC5B,OAAQpF,KAAKqF,WACT,KAAKC,EACD,OAAO,EACX,KAAKC,EACD,OAAQvF,KAAKmF,SACjB,QACI,OAAO,EAKnB,OAAO,CACX,CAGAK,cAAAA,CAAeC,GAEX,OADAzF,KAAKkD,uBAAyBuC,EACvBzF,IACX,CAEA0F,YAAAA,CAAaD,GAET,OADAzF,KAAKgE,qBAAuByB,EACrBzF,IACX,CAEA2F,YAAAA,CAAaF,GAET,OADAzF,KAAKwE,qBAAuBiB,EACrBzF,IACX,CAEA4F,QAAAA,CAASH,GAEL,OADAzF,KAAKiE,iBAAmBwB,EACjBzF,IACX,CAEA6F,OAAAA,CAAQJ,GAEJ,OADAzF,KAAKkE,gBAAkBuB,EAChBzF,IACX,CAEA8F,UAAAA,CAAWL,GAEP,OADAzF,KAAKmE,mBAAqBsB,EACnBzF,IACX,CAEA+F,YAAAA,CAAaN,GAET,OADAzF,KAAKoE,qBAAuBqB,EACrBzF,IACX,CAEAgG,UAAAA,CAAWP,GAEP,OADAzF,KAAKqE,mBAAqBoB,EACnBzF,IACX,CAEAiG,cAAAA,CAAeR,GAEX,OADAzF,KAAKsE,uBAAyBmB,EACvBzF,IACX,CAEAkG,YAAAA,CAAaT,GAET,OADAzF,KAAKuE,qBAAuBkB,EACrBzF,IACX,CAKA,aAAI6B,GACA,OAAO7B,KAAKmG,UAChB,CACA,aAAItE,CAAUuE,GACVpG,KAAKmG,WAAaC,CACtB,CAEA,YAAIjB,GACA,OAAOnF,KAAKqG,SAChB,CACA,YAAIlB,CAASiB,GACTpG,KAAKqG,UAAYD,CACrB,CAEA,WAAIrC,GACA,GAAI/D,KAAKC,SAASE,YAAciF,EAC5B,OAAQpF,KAAKqF,WACT,KAAKC,EAED,OAAO,EACX,KAAKC,EAED,OAAQvF,KAAKmF,SACjB,QACI,OAAOnF,KAAKsG,SAIxB,GACItG,KAAKC,SAASE,YAAc0E,GAC5B7E,KAAKC,SAASE,YAAc2E,GAC5B9E,KAAKC,SAASE,YAAc4E,EAE5B,OAAQ/E,KAAKgF,kBACT,KAAKC,EAED,OAAO,EACX,KAAKC,EAED,OAAQlF,KAAKmF,SACjB,QACI,OAAOnF,KAAKsG,SAIxB,OAAOtG,KAAKsG,QAChB,CACA,WAAIvC,CAAQqC,GACRpG,KAAKsG,SAAWF,CACpB,CAEA,aAAIf,GACA,OAAOrF,KAAKuG,UAChB,CAEA,aAAIlB,CAAUe,GAENpG,KAAKC,SAASE,YAAciF,GAG5BgB,IAAUpG,KAAKqF,YAInBrF,KAAKuG,WAAaH,EAKdpG,KAAKmF,UAA+B,gBAAnBnF,KAAK6B,YACtB7B,KAAKmF,UAAW,GAExB,CAEA,oBAAIH,GACA,OAAOhF,KAAKwG,iBAChB,CAEA,oBAAIxB,CAAiBoB,GAGbpG,KAAKC,SAASE,YAAc0E,GAC5B7E,KAAKC,SAASE,YAAc2E,GAC5B9E,KAAKC,SAASE,YAAc4E,GAK5BqB,IAAUpG,KAAKgF,mBAInBhF,KAAKwG,kBAAoBJ,EAGrBpG,KAAKmF,UAA+B,gBAAnBnF,KAAK6B,YACtB7B,KAAKmF,UAAW,GAExB,CAEA,uBAAIjD,GACA,OAAOlC,KAAKyG,oBAChB,CACA,uBAAIvE,CAAoBkE,GACpBpG,KAAKyG,qBAAuBL,CAChC,CAEA,eAAIM,GACA,OAAO1G,KAAK2G,YAChB,CACA,eAAID,CAAYN,GACZpG,KAAK2G,aAAeP,CACxB,CAEA,UAAIvD,GACA,OAAO7C,KAAK4G,OAChB,CACA,UAAI/D,CAAOuD,GACPpG,KAAK4G,QAAUR,CACnB,CAGA,wBAAIjE,GACA,OAAOnC,KAAK6G,qBAChB,CACA,wBAAI1E,CAAqBiE,GACrBpG,KAAK6G,sBAAwBT,EAAMU,KAAK9G,KAC5C,CAEA,uBAAIuC,GACA,OAAOvC,KAAK+G,oBAChB,CACA,uBAAIxE,CAAoB6D,GACpBpG,KAAK+G,qBAAuBX,EAAMU,KAAK9G,KAC3C,CAvfA,WAAAgH,CAAYC,EAAoCvH,GAC5CwH,QAMA,MAMMC,EAAyBC,EANC,CAAC,iBAAkB,WAAY,YAAa,wBAAyB,iBAMhDC,KAAKJ,GAG1DjH,KAAKC,SAAW0C,EAAAC,EAAA,CAAA,EAETuE,GAAAA,CAEH/G,eAAgBwC,EAAA,GAAKuE,EAAuB/G,kBAMhD,MAAMT,UAAEA,EAASC,aAAEA,EAAYC,sBAAEA,GAA0BoH,EAkC3D,OA7BAjH,KAAKiD,eAAiBgE,EAAUhE,eAChCjD,KAAKc,SAAWmG,EAAUnG,SAC1Bd,KAAKiC,gBAAkBgF,EAAUhF,gBACjCjC,KAAKyB,cAAgBwF,EAAUxF,cAK/BzB,KAAK+D,SAAU,EACf/D,KAAKkC,oBAAsB,KAC3BlC,KAAK6C,OAASyE,IACdtH,KAAK0G,aAAc,EACnB1G,KAAKmF,UAAW,EAChBnF,KAAK6B,UAAY,GACjB7B,KAAKqF,UAAY4B,EAAU5B,UAC3BrF,KAAKgF,iBAAmBiC,EAAUjC,iBAc3BhF,KAAKP,KAAKC,EAAMC,EAAWC,EAAcC,EACpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processPlaceholders.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.ts"],"sourcesContent":["import { SFPlaceholdersObject } from '../../types';\nimport { Placeholders } from '../../../SFP/types';\nimport {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_SECURITY_CODE_3_DIGITS,\n ENCRYPTED_SECURITY_CODE_4_DIGITS,\n GIFT_CARD,\n SF_FIELDS_MAP\n} from '../../constants';\nimport { Placeholders as GiftcardPlaceholders } from '../../../../../Giftcard/components/types';\nimport { CardPlaceholders } from '../../../../../Card/types';\n\n/**\n * Create placeholders with a value from merchant's configuration\n *\n * Based on txVariant & fieldType, maps the entries in the passed placeholders object to create a field specific placeholder object\n */\nexport function processPlaceholders(txVariant: string, fieldType: string, placeholders: Placeholders): SFPlaceholdersObject {\n switch (txVariant) {\n case GIFT_CARD:\n return { [fieldType]: (placeholders as GiftcardPlaceholders)[SF_FIELDS_MAP[fieldType]] ?? '' };\n\n default:\n switch (fieldType) {\n case ENCRYPTED_SECURITY_CODE:\n return {\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]: (placeholders as CardPlaceholders).securityCodeThreeDigits ?? '',\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]: (placeholders as CardPlaceholders).securityCodeFourDigits ?? ''\n };\n\n default:\n return { [fieldType]: (placeholders as CardPlaceholders)[SF_FIELDS_MAP[fieldType]] ?? '' };\n }\n }\n}\n"],"names":["processPlaceholders","txVariant","fieldType","placeholders","_placeholders_SF_FIELDS_MAP_fieldType","_placeholders_securityCodeThreeDigits","_placeholders_securityCodeFourDigits","_placeholders_SF_FIELDS_MAP_fieldType1","GIFT_CARD","SF_FIELDS_MAP","ENCRYPTED_SECURITY_CODE","ENCRYPTED_SECURITY_CODE_3_DIGITS","securityCodeThreeDigits","ENCRYPTED_SECURITY_CODE_4_DIGITS","securityCodeFourDigits"],"mappings":"2KAiBO,SAASA,EAAoBC,EAAmBC,EAAmBC,GAGxC,IAAAC,EAM0BC,EACAC,EAIlBC,EAbtC,OAAQN,IACCO,EACM,CAAEN,CAACA,GAA4E,QAAhEE,
|
|
1
|
+
{"version":3,"file":"processPlaceholders.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.ts"],"sourcesContent":["import { SFPlaceholdersObject } from '../../types';\nimport { Placeholders } from '../../../SFP/types';\nimport {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_SECURITY_CODE_3_DIGITS,\n ENCRYPTED_SECURITY_CODE_4_DIGITS,\n GIFT_CARD,\n SF_FIELDS_MAP\n} from '../../constants';\nimport { Placeholders as GiftcardPlaceholders } from '../../../../../Giftcard/components/types';\nimport { CardPlaceholders } from '../../../../../Card/types';\n\n/**\n * Create placeholders with a value from merchant's configuration\n *\n * Based on txVariant & fieldType, maps the entries in the passed placeholders object to create a field specific placeholder object\n */\nexport function processPlaceholders(txVariant: string, fieldType: string, placeholders: Placeholders): SFPlaceholdersObject {\n switch (txVariant) {\n case GIFT_CARD:\n return { [fieldType]: (placeholders as GiftcardPlaceholders)[SF_FIELDS_MAP[fieldType]] ?? '' };\n\n default:\n switch (fieldType) {\n case ENCRYPTED_SECURITY_CODE:\n return {\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]: (placeholders as CardPlaceholders).securityCodeThreeDigits ?? '',\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]: (placeholders as CardPlaceholders).securityCodeFourDigits ?? ''\n };\n\n default:\n return { [fieldType]: (placeholders as CardPlaceholders)[SF_FIELDS_MAP[fieldType]] ?? '' };\n }\n }\n}\n"],"names":["processPlaceholders","txVariant","fieldType","placeholders","_placeholders_SF_FIELDS_MAP_fieldType","_placeholders_securityCodeThreeDigits","_placeholders_securityCodeFourDigits","_placeholders_SF_FIELDS_MAP_fieldType1","GIFT_CARD","SF_FIELDS_MAP","ENCRYPTED_SECURITY_CODE","ENCRYPTED_SECURITY_CODE_3_DIGITS","securityCodeThreeDigits","ENCRYPTED_SECURITY_CODE_4_DIGITS","securityCodeFourDigits"],"mappings":"2KAiBO,SAASA,EAAoBC,EAAmBC,EAAmBC,GAGxC,IAAAC,EAM0BC,EACAC,EAIlBC,EAbtC,OAAQN,IACCO,EACM,CAAEN,CAACA,GAA4E,QAAhEE,EAACD,EAAsCM,EAAcP,WAArD,IAAAE,EAAAA,EAAoE,IAGlFF,IACCQ,EACM,CACHC,CAACA,GAA6F,QAA1DN,EAACF,EAAkCS,mCAAnCP,EAAAA,EAA8D,GAClGQ,CAACA,GAA4F,QAAzDP,EAACH,EAAkCW,kCAAnCR,EAAAA,EAA6D,IAI9F,CAAEJ,CAACA,GAAwE,QAA5DK,EAACJ,EAAkCM,EAAcP,WAAjD,IAAAK,EAAAA,EAAgE,GAG1G"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../../../_virtual/index.js";import{stopPropagationForActionKeys as
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../../../_virtual/index.js";import{stopPropagationForActionKeys as o}from"../Button/stopPropagationForActionKeys.js";function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const r=({classNameModifiers:r=[],selectedValue:c,disabled:a=!1,options:l,onChange:s})=>l&&0!==l.length?e("div",{className:t("adyen-checkout__segmented-control",{"adyen-checkout__segmented-control--disabled":a},...r.map(e=>`adyen-checkout__segmented-control--${e}`)),role:"group"},l.map(({label:r,value:l,controls:i,htmlProps:u})=>e("button",function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){n(e,t,o[t])})}return e}({disabled:a,key:l,onClick:e=>s(l,e),onKeyPress:o,onKeyDown:o,className:t("adyen-checkout__segmented-control-segment",{"adyen-checkout__segmented-control-segment--selected":c===l}),"aria-controls":i,"aria-expanded":c===l,type:"button"},u),r))):null;export{r as SegmentedControl};
|
|
2
2
|
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.js","sources":["../../../../../src/components/internal/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport './SegmentedControl.scss';\nimport { stopPropagationForActionKeys } from '../Button/stopPropagationForActionKeys';\n\nexport interface SegmentedControlOption<T> {\n label: string;\n value: T;\n id: string;\n controls: string;\n htmlProps?: {};\n}\n\nexport type SegmentedControlOptions<T> = Array<SegmentedControlOption<T>>;\n\nexport interface SegmentedControlProps<T> {\n classNameModifiers?: string[];\n selectedValue: T;\n disabled?: boolean;\n options: SegmentedControlOptions<T>;\n onChange(value: T, event: MouseEvent): void;\n}\n\n/**\n *\n * example:\n * <SegmentedControl\n * onChange={(value) = setMode(value)}\n * selectedValue={mode}\n * disabled={status === 'loading'}\n * classNameModifiers={['css-class']}\n * options={segmentedControlOptions}\n * />\n *\n * @param classNameModifiers\n * @param selectedValue\n * @param disabled\n * @param options\n * @param onChange\n * @constructor\n */\
|
|
1
|
+
{"version":3,"file":"SegmentedControl.js","sources":["../../../../../src/components/internal/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport './SegmentedControl.scss';\nimport { stopPropagationForActionKeys } from '../Button/stopPropagationForActionKeys';\n\nexport interface SegmentedControlOption<T> {\n label: string;\n value: T;\n id: string;\n controls: string;\n htmlProps?: {};\n}\n\nexport type SegmentedControlOptions<T> = Array<SegmentedControlOption<T>>;\n\nexport interface SegmentedControlProps<T> {\n classNameModifiers?: string[];\n selectedValue: T;\n disabled?: boolean;\n options: SegmentedControlOptions<T>;\n onChange(value: T, event: MouseEvent): void;\n}\n\n/**\n *\n * example:\n * <SegmentedControl\n * onChange={(value) = setMode(value)}\n * selectedValue={mode}\n * disabled={status === 'loading'}\n * classNameModifiers={['css-class']}\n * options={segmentedControlOptions}\n * />\n *\n * @param classNameModifiers\n * @param selectedValue\n * @param disabled\n * @param options\n * @param onChange\n * @constructor\n */\nexport const SegmentedControl = <T,>({ classNameModifiers = [], selectedValue, disabled = false, options, onChange }: SegmentedControlProps<T>) => {\n if (!options || options.length === 0) {\n return null;\n }\n\n return (\n <div\n className={cx(\n 'adyen-checkout__segmented-control',\n { 'adyen-checkout__segmented-control--disabled': disabled },\n ...classNameModifiers.map(modifier => `adyen-checkout__segmented-control--${modifier}`)\n )}\n role=\"group\"\n >\n {options.map(({ label, value, controls, htmlProps }: SegmentedControlOption<T>) => (\n <button\n disabled={disabled}\n key={value}\n onClick={(event: MouseEvent) => onChange(value, event)}\n // Workaround: See ADR-0001-uielement-keyboard-event-propagation-workaround\n onKeyPress={stopPropagationForActionKeys}\n onKeyDown={stopPropagationForActionKeys}\n className={cx('adyen-checkout__segmented-control-segment', {\n 'adyen-checkout__segmented-control-segment--selected': selectedValue === value\n })}\n aria-controls={controls}\n aria-expanded={selectedValue === value}\n type=\"button\"\n {...htmlProps}\n >\n {label}\n </button>\n ))}\n </div>\n );\n};\n"],"names":["SegmentedControl","classNameModifiers","selectedValue","disabled","options","onChange","length","h","div","className","cx","map","modifier","role","label","value","controls","htmlProps","button","key","onClick","event","onKeyPress","stopPropagationForActionKeys","onKeyDown","aria-controls","aria-expanded","type"],"mappings":"mUAyCO,MAAMA,EAAmB,EAAOC,qBAAqB,GAAIC,gBAAeC,YAAW,EAAOC,UAASC,cACjGD,GAA8B,IAAnBA,EAAQE,OAKpBC,EAACC,MAAAA,CACGC,UAAWC,EACP,oCACA,CAAE,8CAA+CP,MAC9CF,EAAmBU,IAAIC,GAAY,sCAAsCA,MAEhFC,KAAK,SAEJT,EAAQO,IAAI,EAAGG,QAAOC,QAAOC,WAAUC,eACpCV,EAACW,2UAAAA,CAAAA,CACGf,SAAUA,EACVgB,IAAKJ,EACLK,QAAUC,GAAsBhB,EAASU,EAAOM,GAEhDC,WAAYC,EACZC,UAAWD,EACXd,UAAWC,EAAG,4CAA6C,CACvD,sDAAuDR,IAAkBa,IAE7EU,gBAAeT,EACfU,gBAAexB,IAAkBa,EACjCY,KAAK,UACDV,GAEHH,KA5BN"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";const a=({id:a,ariaLabelledBy:r,className:l,children:i})=>e("div",{id:a,"aria-labelledby":r,className:l,role:"region"},i);export{a as SegmentedControlRegion};
|
|
2
|
+
//# sourceMappingURL=SegmentedControlRegion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControlRegion.js","sources":["../../../../../src/components/internal/SegmentedControl/SegmentedControlRegion.tsx"],"sourcesContent":["import { h } from 'preact';\n\nexport interface SegmentedControlRegionProps {\n id: string;\n ariaLabelledBy: string;\n className?: string;\n children: h.JSX.Element | h.JSX.Element[];\n}\n\nexport const SegmentedControlRegion = ({ id, ariaLabelledBy, className, children }: SegmentedControlRegionProps) => {\n return (\n <div id={id} aria-labelledby={ariaLabelledBy} className={className} role=\"region\">\n {children}\n </div>\n );\n};\n"],"names":["SegmentedControlRegion","id","ariaLabelledBy","className","children","h","div","aria-labelledby","role"],"mappings":"wEASO,MAAMA,EAAyB,EAAGC,KAAIC,iBAAgBC,YAAWC,cAEhEC,EAACC,MAAAA,CAAIL,GAAIA,EAAIM,kBAAiBL,EAAgBC,UAAWA,EAAWK,KAAK,UACpEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useState as e,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import{createElement as r}from"../../../external/preact/dist/preact.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import s from"../FormFields/Checkbox/Checkbox.js";import
|
|
1
|
+
import{useState as e,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import{createElement as r}from"../../../external/preact/dist/preact.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import s from"../FormFields/Checkbox/Checkbox.js";import n from"../../../_virtual/index.js";function a(e,t){if(null==e)return{};var r,o,s,n={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),s=0;s<r.length;s++)o=r[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o]);return n}if(n=function(e,t){if(null==e)return{};var r,o,s={},n=Object.getOwnPropertyNames(e);for(o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r]);return s}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),s=0;s<r.length;s++)o=r[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o]);return n}function l(l){let{storeDetails:i=!1,disabled:c=!1,className:f=""}=l,p=a(l,["storeDetails","disabled","className"]);const{i18n:m}=o(),[d,u]=e(i);return t(()=>{p.onChange(d)},[d]),r("div",{className:n("adyen-checkout__store-details",f)},r(s,{onChange:e=>{u(e.target.checked)},disabled:c,label:m.get("storeDetails"),name:"storeDetails"}))}export{l as default};
|
|
2
2
|
//# sourceMappingURL=StoreDetails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoreDetails.js","sources":["../../../../../src/components/internal/StoreDetails/StoreDetails.tsx"],"sourcesContent":["import { useState, useEffect } from 'preact/hooks';\nimport { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Checkbox from '../FormFields/Checkbox';\nimport cx from 'classnames';\n\nimport './StoreDetails.scss';\n\ninterface StoreDetailsProps {\n storeDetails?: boolean;\n onChange: (value: boolean) => void;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * \"Store details\" generic checkbox\n */\nfunction StoreDetails({ storeDetails = false, disabled = false, className = '', ...props }: StoreDetailsProps) {\n const { i18n } = useCoreContext();\n const [value, setValue] = useState(storeDetails);\n\n const onChange = e => {\n setValue(e.target.checked);\n };\n\n useEffect(() => {\n props.onChange(value);\n }, [value]);\n\n return (\n <div className={cx('adyen-checkout__store-details', className)}>\n <Checkbox onChange={onChange} disabled={disabled} label={i18n.get('storeDetails')} name={'storeDetails'} />\n </div>\n );\n}\n\nexport default StoreDetails;\n"],"names":["StoreDetails","
|
|
1
|
+
{"version":3,"file":"StoreDetails.js","sources":["../../../../../src/components/internal/StoreDetails/StoreDetails.tsx"],"sourcesContent":["import { useState, useEffect } from 'preact/hooks';\nimport { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Checkbox from '../FormFields/Checkbox';\nimport cx from 'classnames';\n\nimport './StoreDetails.scss';\n\ninterface StoreDetailsProps {\n storeDetails?: boolean;\n onChange: (value: boolean) => void;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * \"Store details\" generic checkbox\n */\nfunction StoreDetails({ storeDetails = false, disabled = false, className = '', ...props }: StoreDetailsProps) {\n const { i18n } = useCoreContext();\n const [value, setValue] = useState(storeDetails);\n\n const onChange = e => {\n setValue(e.target.checked);\n };\n\n useEffect(() => {\n props.onChange(value);\n }, [value]);\n\n return (\n <div className={cx('adyen-checkout__store-details', className)}>\n <Checkbox onChange={onChange} disabled={disabled} label={i18n.get('storeDetails')} name={'storeDetails'} />\n </div>\n );\n}\n\nexport default StoreDetails;\n"],"names":["StoreDetails","_0","storeDetails","disabled","className","props","i18n","useCoreContext","value","setValue","useState","useEffect","onChange","h","div","cx","Checkbox","e","target","checked","label","get","name"],"mappings":"m7BAkBA,SAASA,EAAaC,OAAAC,aAAEA,GAAe,EAAKC,SAAEA,GAAW,EAAKC,UAAEA,EAAY,IAAiCH,EAA1BI,EAAAA,EAAAA,EAAAA,yCAC/E,MAAMC,KAAEA,GAASC,KACVC,EAAOC,GAAYC,EAASR,GAUnC,OAJAS,EAAU,KACNN,EAAMO,SAASJ,IAChB,CAACA,IAGAK,EAACC,MAAAA,CAAIV,UAAWW,EAAG,gCAAiCX,IAChDS,EAACG,EAAAA,CAASJ,SAVDK,IACbR,EAASQ,EAAEC,OAAOC,UASgBhB,SAAUA,EAAUiB,MAAOd,EAAKe,IAAI,gBAAiBC,KAAM,iBAGrG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import t,{NETWORK_ERROR as s}from"../../../core/Errors/AdyenCheckoutError.js";import{hasOwnProperty as n}from"../../../utils/hasOwnProperty.js";import i from"../BaseElement/BaseElement.js";import o from"../PayButton/PayButton.js";import{assertIsDropin as r,getRegulatoryDefaults as a,sanitizeResponse as l,verifyPaymentDidNotFail as h,cleanupFinalResult as d}from"./utils.js";import{AnalyticsErrorEvent as c,ErrorEventType as p}from"../../../core/Analytics/events/AnalyticsErrorEvent.js";import{AnalyticsInfoEvent as m,InfoEventType as u}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";import{AnalyticsLogEvent as y,LogEventType as f}from"../../../core/Analytics/events/AnalyticsLogEvent.js";import v from"../../../core/Errors/CancelError.js";import{CoreProvider as b}from"../../../core/Context/CoreProvider.js";import R from"../../../core/Errors/SRPanelProvider.js";function P(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function g(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},n=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),n.forEach(function(t){P(e,t,s[t])})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t.push.apply(t,s)}return t}(Object(t)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(t,s))}),e}class A extends i{createBeforeRenderHook(e){const t=this.render;this.render=(...s)=>(this.beforeRender(e),t.apply(this,s))}beforeRender(e){if(null==e?void 0:e.originalAction)return;const t=new m(g({type:u.rendered,component:this.type,configData:E(g({},e),{showPayButton:this.props.showPayButton})},(null==e?void 0:e.oneClick)&&{isStoredPaymentMethod:!0}));this.analytics.sendAnalytics(t)}reportIntegrationFlavor(){this.analytics.sendFlavor("components")}get analytics(){return this.core.modules.analytics}get srPanel(){return this.core.modules.srPanel}getPaymentMethodConfigFromResponse(e){return(null==e?void 0:e.storedPaymentMethodId)?this.getStoredPaymentMethodDetails(e.storedPaymentMethodId):this.getPaymentMethodFromPaymentMethodsResponse(null==e?void 0:e.type,null==e?void 0:e.paymentMethodId)}buildElementProps(e){const t=g({showPayButton:!0},this.core.getCorePropsForComponent(),this.getPaymentMethodConfigFromResponse(e),e),s=r(this);this.props=this.formatProps(g({},this.constructor.defaultProps,a(this.core.options.countryCode,s),t))}getStoredPaymentMethodDetails(e){return this.core.paymentMethodsResponse.findStoredPaymentMethod(e)}getPaymentMethodFromPaymentMethodsResponse(e,t){var s;return t?this.core.paymentMethodsResponse.findById(t):null===(s=this.core.paymentMethodsResponse)||void 0===s?void 0:s.find(e||this.constructor.type)}storeElementRefOnCore(e){(null==e?void 0:e.isDropin)||this.core.storeElementReference(this)}isAvailable(){return Promise.resolve()}setState(e){this.state=g({},this.state,e),this.onChange()}showValidation(){return this.componentRef&&this.componentRef.showValidation&&this.componentRef.showValidation(),this}setElementStatus(e,t){var s;return null===(s=this.elementRef)||void 0===s||s.setStatus(e,t),this}setStatus(e,t){var s;return(null===(s=this.componentRef)||void 0===s?void 0:s.setStatus)&&this.componentRef.setStatus(e,t),this}onChange(){var e,t;null===(e=(t=this.props).onChange)||void 0===e||e.call(t,{data:this.data,isValid:this.isValid,errors:this.state.errors,valid:this.state.valid},this.elementRef)}submitAnalytics(e){this.analytics.sendAnalytics(e)}submit(){this.isValid?this.makePaymentsCall().then(l).then(h).then(this.handleResponse).catch(e=>{e instanceof v?this.setElementStatus("ready"):this.handleFailedResult(e)}):this.showValidation()}makePaymentsCall(){if(this.setElementStatus("loading"),this.props.onSubmit)return this.submitUsingAdvancedFlow();if(this.core.session){return(this.props.beforeSubmit?new Promise((e,t)=>this.props.beforeSubmit(this.data,this.elementRef,{resolve:e,reject:()=>t(new v("beforeSubmitRejected"))})):Promise.resolve(this.data)).then(this.submitUsingSessionsFlow)}this.handleError(new t("IMPLEMENTATION_ERROR",'It can not perform /payments call. Callback "onSubmit" is missing or Checkout session is not available'))}async submitUsingAdvancedFlow(){const e=new y({component:this.type,type:f.submit,message:"Shopper clicked pay"});return this.submitAnalytics(e),new Promise((e,t)=>{this.props.onSubmit({data:this.data,isValid:this.isValid},this.elementRef,{resolve:e,reject:t})})}async submitUsingSessionsFlow(e){const s=new y({component:this.type,type:f.submit,message:"Shopper clicked pay"});this.submitAnalytics(s);try{return await this.core.session.submitPayment(e)}catch(e){return e instanceof t?this.handleError(e):this.handleError(new t("ERROR","Error when making /payments call",{cause:e})),Promise.reject(e)}}onComplete(e){this.handleAdditionalDetails(e)}handleAdditionalDetails(e){this.makeAdditionalDetailsCall(e).then(l).then(h).then(this.handleResponse).catch(this.handleFailedResult)}makeAdditionalDetailsCall(e){return this.props.onAdditionalDetails?new Promise((t,s)=>{this.props.onAdditionalDetails(e,this.elementRef,{resolve:t,reject:s})}):this.core.session?this.submitAdditionalDetailsUsingSessionsFlow(e.data):void this.handleError(new t("IMPLEMENTATION_ERROR",'It can not perform /payments/details call. Callback "onAdditionalDetails" is missing or Checkout session is not available'))}async submitAdditionalDetailsUsingSessionsFlow(e){try{return await this.core.session.submitDetails(e)}catch(e){return e instanceof t?this.handleError(e):this.handleError(new t("ERROR","Error when making /details call",{cause:e})),Promise.reject(e)}}handleAction(e,t={}){if(!e||!e.type){if(n(e,"action")&&n(e,"resultCode"))throw new Error('handleAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('handleAction::Invalid Action - the passed action object does not have a "type" property')}const s=this.core.createFromAction(e,g({},this.elementRef.props,t));return s?(this.unmount(),s.mount(this._node)):null}onActionHandled(e){var t,s;null===(s=this.props)||void 0===s||null===(t=s.onActionHandled)||void 0===t||t.call(s,g({originalAction:this.props.originalAction},e))}handleResponse(e){var t,s;e.action?this.elementRef.handleAction(e.action):(null===(s=e.order)||void 0===s||null===(t=s.remainingAmount)||void 0===t?void 0:t.value)>0?this.handleOrder(e):this.handleSuccessResult(e)}handleKeyPress(e){var t;"Enter"!==e.key&&"Enter"!==e.code||(e.preventDefault(),this.onEnterKeyPressed(null===(t=document)||void 0===t?void 0:t.activeElement,this))}onEnterKeyPressed(e,t){this.props.onEnterKeyPressed?this.props.onEnterKeyPressed(e,t):(e.blur(),this.submit())}updateParent(e={}){return this.elementRef.core.update(e)}get isValid(){return!1}get icon(){const e=this.props.paymentMethodType||this.type;var t;return null!==(t=this.props.icon)&&void 0!==t?t:this.resources.getImage()(e)}get displayName(){var e,t;const s=null===(t=this.core.paymentMethodsResponse)||void 0===t||null===(e=t.paymentMethods)||void 0===e?void 0:e.find(e=>e.type===this.type);return this.props.name||(null==s?void 0:s.name)||this.type}get accessibleName(){return this.displayName}get additionalInfo(){return null}get type(){return this.props.type||this.constructor.type}async handleAdvanceFlowPaymentMethodsUpdate(e,s){return new Promise((t,s)=>{if(!this.props.onPaymentMethodsRequest)return t();this.props.onPaymentMethodsRequest(E(g({},e&&{order:{orderData:e.orderData,pspReference:e.pspReference}}),{locale:this.core.options.locale}),{resolve:t,reject:s})}).catch(e=>{this.handleError(new t("IMPLEMENTATION_ERROR","Something failed during payment methods update or onPaymentMethodsRequest was not implemented",{cause:e}))}).then(t=>this.core.update(E(g({},t&&{paymentMethodsResponse:t}),{order:e,amount:e?e.remainingAmount:s})))}render(){return e(b,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources,analytics:this.analytics},e(R,{srPanel:this.srPanel},this.componentToRender()))}constructor(t,n){super(t,n),P(this,"componentRef",void 0),P(this,"resources",void 0),P(this,"elementRef",void 0),P(this,"handleError",e=>{if(this.setElementStatus("ready"),e.name===s&&e.options.code){const t=new c({component:this.type,errorType:p.apiError,code:e.options.code});this.submitAnalytics(t)}this.props.onError&&this.props.onError(e,this.elementRef)}),P(this,"handleOrder",e=>{const{order:t}=e;(this.core.session?this.core.update({order:t}):this.handleAdvanceFlowPaymentMethodsUpdate(t)).then(()=>{var e,s;null===(e=(s=this.props).onOrderUpdated)||void 0===e||e.call(s,{order:t})})}),P(this,"handleFailedResult",e=>{var t,s;r(this.elementRef)&&this.elementRef.displayFinalAnimation("error"),d(e),null===(t=(s=this.props).onPaymentFailed)||void 0===t||t.call(s,e,this.elementRef)}),P(this,"handleSuccessResult",e=>{var t,s;r(this.elementRef)&&this.elementRef.displayFinalAnimation("success"),d(e),null===(t=(s=this.props).onPaymentCompleted)||void 0===t||t.call(s,e,this.elementRef)}),P(this,"setComponentRef",e=>{this.componentRef=e}),P(this,"payButton",t=>e(o,E(g({},t),{amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,onClick:this.submit}))),this.core.register(this.constructor),this.submit=this.submit.bind(this),this.setState=this.setState.bind(this),this.onComplete=this.onComplete.bind(this),this.handleAction=this.handleAction.bind(this),this.handleOrder=this.handleOrder.bind(this),this.handleAdditionalDetails=this.handleAdditionalDetails.bind(this),this.handleResponse=this.handleResponse.bind(this),this.setElementStatus=this.setElementStatus.bind(this),this.submitAnalytics=this.submitAnalytics.bind(this),this.makePaymentsCall=this.makePaymentsCall.bind(this),this.makeAdditionalDetailsCall=this.makeAdditionalDetailsCall.bind(this),this.submitUsingSessionsFlow=this.submitUsingSessionsFlow.bind(this),this.elementRef=n&&n.elementRef||this,this.resources=this.props.modules?this.props.modules.resources:void 0,this.storeElementRefOnCore(this.props),this.onEnterKeyPressed=this.onEnterKeyPressed.bind(this),this.onActionHandled=this.onActionHandled.bind(this),this.createBeforeRenderHook(n),this.reportIntegrationFlavor()}}P(A,"type",void 0),P(A,"txVariants",[]);export{A as UIElement,A as default};
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import t,{NETWORK_ERROR as s}from"../../../core/Errors/AdyenCheckoutError.js";import{hasOwnProperty as n}from"../../../utils/hasOwnProperty.js";import i from"../BaseElement/BaseElement.js";import o from"../PayButton/PayButton.js";import{assertIsDropin as r,getRegulatoryDefaults as a,sanitizeResponse as l,verifyPaymentDidNotFail as h,cleanupFinalResult as d}from"./utils.js";import{AnalyticsErrorEvent as c,ErrorEventType as p}from"../../../core/Analytics/events/AnalyticsErrorEvent.js";import{AnalyticsInfoEvent as m,InfoEventType as u}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";import{AnalyticsLogEvent as y,LogEventType as f}from"../../../core/Analytics/events/AnalyticsLogEvent.js";import v from"../../../core/Errors/CancelError.js";import{CoreProvider as b}from"../../../core/Context/CoreProvider.js";import R from"../../../core/Errors/SRPanelProvider.js";function P(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function g(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},n=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),n.forEach(function(t){P(e,t,s[t])})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t.push.apply(t,s)}return t}(Object(t)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(t,s))}),e}class A extends i{createBeforeRenderHook(e){const t=this.render;this.render=(...s)=>(this.beforeRender(e),t.apply(this,s))}beforeRender(e){if(null==e?void 0:e.originalAction)return;const t=new m(g({type:u.rendered,component:this.type,configData:E(g({},e),{showPayButton:this.props.showPayButton})},(null==e?void 0:e.oneClick)&&{isStoredPaymentMethod:!0}));this.analytics.sendAnalytics(t)}reportIntegrationFlavor(){this.analytics.sendFlavor("components")}get analytics(){return this.core.modules.analytics}get srPanel(){return this.core.modules.srPanel}getPaymentMethodConfigFromResponse(e){return(null==e?void 0:e.storedPaymentMethodId)?this.getStoredPaymentMethodDetails(e.storedPaymentMethodId):this.getPaymentMethodFromPaymentMethodsResponse(null==e?void 0:e.type,null==e?void 0:e.paymentMethodId)}buildElementProps(e){const t=g({showPayButton:!0},this.core.getCorePropsForComponent(),this.getPaymentMethodConfigFromResponse(e),e),s=r(this);this.props=this.formatProps(g({},this.constructor.defaultProps,a(this.core.options.countryCode,s),t))}getStoredPaymentMethodDetails(e){return this.core.paymentMethodsResponse.findStoredPaymentMethod(e)}getPaymentMethodFromPaymentMethodsResponse(e,t){var s;return t?this.core.paymentMethodsResponse.findById(t):null===(s=this.core.paymentMethodsResponse)||void 0===s?void 0:s.find(e||this.constructor.type)}storeElementRefOnCore(e){(null==e?void 0:e.isDropin)||this.core.storeElementReference(this)}isAvailable(){return Promise.resolve()}setState(e){this.state=g({},this.state,e),this.onChange()}showValidation(){return this.componentRef&&this.componentRef.showValidation&&this.componentRef.showValidation(),this}setElementStatus(e,t){var s;return null===(s=this.elementRef)||void 0===s||s.setStatus(e,t),this}setStatus(e,t){var s;return(null===(s=this.componentRef)||void 0===s?void 0:s.setStatus)&&this.componentRef.setStatus(e,t),this}onChange(){var e,t;null===(e=(t=this.props).onChange)||void 0===e||e.call(t,{data:this.data,isValid:this.isValid,errors:this.state.errors,valid:this.state.valid},this.elementRef)}submitAnalytics(e){this.analytics.sendAnalytics(e)}submit(){this.isValid?this.makePaymentsCall().then(l).then(h).then(this.handleResponse).catch(e=>{e instanceof v?this.setElementStatus("ready"):this.handleFailedResult(e)}):this.showValidation()}makePaymentsCall(){if(this.setElementStatus("loading"),this.props.onSubmit)return this.submitUsingAdvancedFlow();if(this.core.session){return(this.props.beforeSubmit?new Promise((e,t)=>this.props.beforeSubmit(this.data,this.elementRef,{resolve:e,reject:()=>t(new v("beforeSubmitRejected"))})):Promise.resolve(this.data)).then(this.submitUsingSessionsFlow)}this.handleError(new t("IMPLEMENTATION_ERROR",'It can not perform /payments call. Callback "onSubmit" is missing or Checkout session is not available'))}async submitUsingAdvancedFlow(){const e=new y({component:this.type,type:f.submit,message:"Shopper clicked pay"});return this.submitAnalytics(e),new Promise((e,t)=>{this.props.onSubmit({data:this.data,isValid:this.isValid},this.elementRef,{resolve:e,reject:t})})}async submitUsingSessionsFlow(e){const s=new y({component:this.type,type:f.submit,message:"Shopper clicked pay"});this.submitAnalytics(s);try{return await this.core.session.submitPayment(e)}catch(e){return e instanceof t?this.handleError(e):this.handleError(new t("ERROR","Error when making /payments call",{cause:e})),Promise.reject(e)}}onComplete(e){this.handleAdditionalDetails(e)}handleAdditionalDetails(e){this.makeAdditionalDetailsCall(e).then(l).then(h).then(this.handleResponse).catch(this.handleFailedResult)}makeAdditionalDetailsCall(e){return this.props.onAdditionalDetails?new Promise((t,s)=>{this.props.onAdditionalDetails(e,this.elementRef,{resolve:t,reject:s})}):this.core.session?this.submitAdditionalDetailsUsingSessionsFlow(e.data):void this.handleError(new t("IMPLEMENTATION_ERROR",'It can not perform /payments/details call. Callback "onAdditionalDetails" is missing or Checkout session is not available'))}async submitAdditionalDetailsUsingSessionsFlow(e){try{return await this.core.session.submitDetails(e)}catch(e){return e instanceof t?this.handleError(e):this.handleError(new t("ERROR","Error when making /details call",{cause:e})),Promise.reject(e)}}handleAction(e,t={}){if(!e||!e.type){if(n(e,"action")&&n(e,"resultCode"))throw new Error('handleAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('handleAction::Invalid Action - the passed action object does not have a "type" property')}const s=this.core.createFromAction(e,g({},this.elementRef.props,t));return s?(this.unmount(),s.mount(this._node)):null}onActionHandled(e){var t,s;null===(s=this.props)||void 0===s||null===(t=s.onActionHandled)||void 0===t||t.call(s,g({originalAction:this.props.originalAction},e))}handleResponse(e){var t,s;e.action?this.elementRef.handleAction(e.action):(null===(s=e.order)||void 0===s||null===(t=s.remainingAmount)||void 0===t?void 0:t.value)>0?this.handleOrder(e):this.handleSuccessResult(e)}handleKeyPress(e){var t;"Enter"!==e.key&&"Enter"!==e.code||(e.preventDefault(),this.onEnterKeyPressed(null===(t=document)||void 0===t?void 0:t.activeElement,this))}onEnterKeyPressed(e,t){this.props.onEnterKeyPressed?this.props.onEnterKeyPressed(e,t):(e.blur(),this.submit())}updateParent(e={}){return this.elementRef.core.update(e)}get isValid(){return!1}get icon(){var e;const t=this.props.paymentMethodType||this.type;return null!==(e=this.props.icon)&&void 0!==e?e:this.resources.getImage()(t)}get displayName(){var e,t;const s=null===(t=this.core.paymentMethodsResponse)||void 0===t||null===(e=t.paymentMethods)||void 0===e?void 0:e.find(e=>e.type===this.type);return this.props.name||(null==s?void 0:s.name)||this.type}get accessibleName(){return this.displayName}get additionalInfo(){return null}get type(){return this.props.type||this.constructor.type}async handleAdvanceFlowPaymentMethodsUpdate(e,s){return new Promise((t,s)=>{if(!this.props.onPaymentMethodsRequest)return t();this.props.onPaymentMethodsRequest(E(g({},e&&{order:{orderData:e.orderData,pspReference:e.pspReference}}),{locale:this.core.options.locale}),{resolve:t,reject:s})}).catch(e=>{this.handleError(new t("IMPLEMENTATION_ERROR","Something failed during payment methods update or onPaymentMethodsRequest was not implemented",{cause:e}))}).then(t=>this.core.update(E(g({},t&&{paymentMethodsResponse:t}),{order:e,amount:e?e.remainingAmount:s})))}render(){return e(b,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources,analytics:this.analytics},e(R,{srPanel:this.srPanel},this.componentToRender()))}constructor(t,n){super(t,n),P(this,"componentRef",void 0),P(this,"resources",void 0),P(this,"elementRef",void 0),P(this,"handleError",e=>{if(this.setElementStatus("ready"),e.name===s&&e.options.code){const t=new c({component:this.type,errorType:p.apiError,code:e.options.code});this.submitAnalytics(t)}this.props.onError&&this.props.onError(e,this.elementRef)}),P(this,"handleOrder",e=>{const{order:t}=e;(this.core.session?this.core.update({order:t}):this.handleAdvanceFlowPaymentMethodsUpdate(t)).then(()=>{var e,s;null===(e=(s=this.props).onOrderUpdated)||void 0===e||e.call(s,{order:t})})}),P(this,"handleFailedResult",e=>{var t,s;r(this.elementRef)&&this.elementRef.displayFinalAnimation("error"),d(e),null===(t=(s=this.props).onPaymentFailed)||void 0===t||t.call(s,e,this.elementRef)}),P(this,"handleSuccessResult",e=>{var t,s;r(this.elementRef)&&this.elementRef.displayFinalAnimation("success"),d(e),null===(t=(s=this.props).onPaymentCompleted)||void 0===t||t.call(s,e,this.elementRef)}),P(this,"setComponentRef",e=>{this.componentRef=e}),P(this,"payButton",t=>e(o,E(g({},t),{amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,onClick:this.submit}))),this.core.register(this.constructor),this.submit=this.submit.bind(this),this.setState=this.setState.bind(this),this.onComplete=this.onComplete.bind(this),this.handleAction=this.handleAction.bind(this),this.handleOrder=this.handleOrder.bind(this),this.handleAdditionalDetails=this.handleAdditionalDetails.bind(this),this.handleResponse=this.handleResponse.bind(this),this.setElementStatus=this.setElementStatus.bind(this),this.submitAnalytics=this.submitAnalytics.bind(this),this.makePaymentsCall=this.makePaymentsCall.bind(this),this.makeAdditionalDetailsCall=this.makeAdditionalDetailsCall.bind(this),this.submitUsingSessionsFlow=this.submitUsingSessionsFlow.bind(this),this.elementRef=n&&n.elementRef||this,this.resources=this.props.modules?this.props.modules.resources:void 0,this.storeElementRefOnCore(this.props),this.onEnterKeyPressed=this.onEnterKeyPressed.bind(this),this.onActionHandled=this.onActionHandled.bind(this),this.createBeforeRenderHook(n),this.reportIntegrationFlavor()}}P(A,"type",void 0),P(A,"txVariants",[]);export{A as UIElement,A as default};
|
|
2
2
|
//# sourceMappingURL=UIElement.js.map
|