@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":"CustomCardInput.js","sources":["../../../../../src/components/CustomCard/CustomCardInput/CustomCardInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef, useMemo } from 'preact/hooks';\nimport Language from '../../../language/Language';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { SFPState } from '../../internal/SecuredFields/SFP/types';\nimport { BinLookupResponse, CardBrandsConfiguration, CardPlaceholders } from '../../Card/types';\nimport SFExtensions from '../../internal/SecuredFields/binLookup/extensions';\nimport { StylesObject } from '../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../core/Context/Resources';\nimport { SFError } from '../../Card/components/CardInput/types';\nimport { ValidationError } from '../types';\n\ninterface SecuredFieldsProps {\n autoFocus?: boolean;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n clientKey?: string;\n countryCode?: string;\n forceCompat?: boolean;\n i18n: Language;\n implementationType?: string;\n keypadFix?: boolean;\n loadingContext?: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n onAdditionalSFConfig?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: () => {};\n onAutoComplete?: () => {};\n onBinValue?: () => {};\n onBrand?: () => {};\n onConfigSuccess?: () => {};\n onChange: (data) => void;\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onError?: () => {};\n onFieldValid?: () => {};\n onFocus?: (e) => {};\n onLoad?: () => {};\n placeholders?: CardPlaceholders;\n rootNode: HTMLElement;\n resources: Resources;\n showWarnings?: boolean;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n}\n\nconst defaultProps = {\n onChange: () => {},\n onError: () => {},\n onValidationError: () => {}\n};\n\nfunction CustomCardInput(props: SecuredFieldsProps) {\n const sfp = useRef(null);\n\n const [errors, setErrors] = useState({});\n const [valid, setValid] = useState({});\n const [data, setData] = useState({});\n\n const [isSfpValid, setIsSfpValid] = useState(false);\n\n const [issuingCountryCode, setIssuingCountryCode] = useState(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState('');\n\n const handleSecuredFieldsChange = (sfState: SFPState): void => {\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n SFExtensions(\n props,\n { sfp },\n { dualBrandSelectElements, setDualBrandSelectElements, setSelectedBrandValue, issuingCountryCode, setIssuingCountryCode }\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPECTED METHODS ON SecuredFields.this\n */\n this.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n this.dualBrandingChangeHandler = extensions.handleDualBrandSelection;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount\n this.setFocusOn = sfp.current.setFocusOn;\n this.updateStyles = sfp.current.updateStyles;\n this.showValidation = sfp.current.showValidation;\n this.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n\n const mappedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors\n\n props.onChange({\n data,\n valid,\n errors: mappedErrors,\n isValid: isSfpValid,\n selectedBrandValue\n });\n\n // Create an array of Validation error objects and send to callback\n if (Object.keys(mappedErrors).length) {\n const validationErrors: ValidationError[] = Object.entries(mappedErrors).map(([fieldType, error]) => {\n const valErr: ValidationError = {\n fieldType,\n ...(error ? (error as SFError) : { error: '', rootNode: this.props.rootNode })\n };\n return valErr;\n });\n this.props.onValidationError?.(validationErrors);\n }\n }, [data, valid, errors, selectedBrandValue]);\n\n /**\n * RENDER\n */\n // prettier-ignore\n return (\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n type={props.brand}\n onChange={handleSecuredFieldsChange}\n render={() => null}\n />\n );\n}\n\nCustomCardInput.defaultProps = defaultProps;\n\nexport default CustomCardInput;\n\nconst extractPropsForSFP = (props: SecuredFieldsProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n forceCompat: props.forceCompat,\n // countryCode: props.countryCode, // only used for korean cards when koreanAuthenticationRequired is true\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onBrand: props.onBrand,\n // onChange // set directly\n onConfigSuccess: props.onConfigSuccess,\n handleKeyPress: props.handleKeyPress,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onFocus: props.onFocus,\n onLoad: props.onLoad,\n // render // set directly\n rootNode: props.rootNode,\n showWarnings: props.showWarnings,\n styles: props.styles,\n trimTrailingSeparator: props.trimTrailingSeparator,\n resources: props.resources,\n maskSecurityCode: props.maskSecurityCode,\n placeholders: props.placeholders\n };\n};\n"],"names":["CustomCardInput","props","sfp","useRef","errors","setErrors","useState","valid","setValid","data","setData","isSfpValid","setIsSfpValid","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","extensions","useMemo","SFExtensions","this","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","dualBrandingChangeHandler","handleDualBrandSelection","useEffect","setFocusOn","current","updateStyles","showValidation","handleUnsupportedCard","destroy","sfStateErrorsObj","mapErrorsToValidationRuleResult","mappedErrors","onChange","isValid","Object","keys","length","validationErrors","entries","map","fieldType","error","rootNode","onValidationError","h","SecuredFieldsProvider","ref","extractPropsForSFP","type","brand","sfState","render","defaultProps","onError","autoFocus","brands","brandsConfiguration","clientKey","forceCompat","i18n","implementationType","keypadFix","legacyInputMode","loadingContext","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onBrand","onConfigSuccess","handleKeyPress","onFieldValid","onFocus","onLoad","showWarnings","styles","trimTrailingSeparator","resources","maskSecurityCode","placeholders"],"mappings":"qUAuDA,SAASA,EAAgBC,GACrB,MAAMC,EAAMC,EAAO,OAEZC,EAAQC,GAAaC,EAAS,CAAA,IAC9BC,EAAOC,GAAYF,EAAS,CAAA,IAC5BG,EAAMC,GAAWJ,EAAS,CAAA,IAE1BK,EAAYC,GAAiBN,GAAS,IAEtCO,EAAoBC,GAAyBR,EAAS,OAEtDS,EAAyBC,GAA8BV,EAAS,KAChEW,EAAoBC,GAAyBZ,EAAS,IAWvDa,EAAaC,EACf,IACIC,EACIpB,EACA,CAAEC,OACF,CAAEa,0BAAyBC,6BAA4BE,wBAAuBL,qBAAoBC,0BAE1G,CAACC,EAAyBF,IA6D9B,OAvDAS,KAAKC,yBAA2B,CAACC,EAAsCC,KACnEN,EAAWO,iBAAiBF,EAAmB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,UACjBC,gBAAiBpE,EAAMoE,gBACvBC,eAAgBrE,EAAMqE,eACtBC,kBAAmBtE,EAAMsE,kBACzBC,qBAAsBvE,EAAMuE,qBAC5BC,sBAAuBxE,EAAMwE,sBAC7BC,WAAYzE,EAAMyE,WAClBC,eAAgB1E,EAAM0E,eACtBC,WAAY3E,EAAM2E,WAClBC,QAAS5E,EAAM4E,QAEfC,gBAAiB7E,EAAM6E,gBACvBC,eAAgB9E,EAAM8E,eACtBnB,QAAS3D,EAAM2D,QACfoB,aAAc/E,EAAM+E,aACpBC,QAAShF,EAAMgF,QACfC,OAAQjF,EAAMiF,OAEdjC,SAAUhD,EAAMgD,SAChBkC,aAAclF,EAAMkF,aACpBC,OAAQnF,EAAMmF,OACdC,sBAAuBpF,EAAMoF,sBAC7BC,UAAWrF,EAAMqF,UACjBC,iBAAkBtF,EAAMsF,iBACxBC,aAAcvF,EAAMuF"}
|
|
1
|
+
{"version":3,"file":"CustomCardInput.js","sources":["../../../../../src/components/CustomCard/CustomCardInput/CustomCardInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef, useMemo } from 'preact/hooks';\nimport Language from '../../../language/Language';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { SFPState } from '../../internal/SecuredFields/SFP/types';\nimport { BinLookupResponse, CardBrandsConfiguration, CardPlaceholders } from '../../Card/types';\nimport SFExtensions from '../../internal/SecuredFields/binLookup/extensions';\nimport { StylesObject } from '../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../core/Context/Resources';\nimport { SFError } from '../../Card/components/CardInput/types';\nimport { ValidationError } from '../types';\nimport type { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\n\ninterface SecuredFieldsProps {\n autoFocus?: boolean;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n clientKey?: string;\n countryCode?: string;\n forceCompat?: boolean;\n i18n: Language;\n implementationType?: string;\n keypadFix?: boolean;\n loadingContext?: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n onAdditionalSFConfig?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: () => {};\n onAutoComplete?: () => {};\n onBinValue?: () => {};\n onBrand?: () => {};\n onConfigSuccess?: () => {};\n onChange: (data) => void;\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onError?: () => {};\n onFieldValid?: () => {};\n onFocus?: (e) => {};\n onLoad?: () => {};\n placeholders?: CardPlaceholders;\n rootNode: HTMLElement;\n resources: Resources;\n showWarnings?: boolean;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n}\n\nconst defaultProps = {\n onChange: () => {},\n onError: () => {},\n onValidationError: () => {}\n};\n\nfunction CustomCardInput(props: SecuredFieldsProps) {\n const sfp = useRef(null);\n\n const [errors, setErrors] = useState({});\n const [valid, setValid] = useState({});\n const [data, setData] = useState({});\n\n const [isSfpValid, setIsSfpValid] = useState(false);\n\n const [issuingCountryCode, setIssuingCountryCode] = useState(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState('');\n\n const handleSecuredFieldsChange = (sfState: SFPState): void => {\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n SFExtensions(\n props,\n { sfp },\n { dualBrandSelectElements, setDualBrandSelectElements, setSelectedBrandValue, issuingCountryCode, setIssuingCountryCode }\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPECTED METHODS ON SecuredFields.this\n */\n this.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n this.dualBrandingChangeHandler = extensions.handleDualBrandSelection;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount\n this.setFocusOn = sfp.current.setFocusOn;\n this.updateStyles = sfp.current.updateStyles;\n this.showValidation = sfp.current.showValidation;\n this.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n\n const mappedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors\n\n props.onChange({\n data,\n valid,\n errors: mappedErrors,\n isValid: isSfpValid,\n selectedBrandValue\n });\n\n // Create an array of Validation error objects and send to callback\n if (Object.keys(mappedErrors).length) {\n const validationErrors: ValidationError[] = Object.entries(mappedErrors).map(([fieldType, error]) => {\n const valErr: ValidationError = {\n fieldType,\n ...(error ? (error as SFError) : { error: '', rootNode: this.props.rootNode })\n };\n return valErr;\n });\n this.props.onValidationError?.(validationErrors);\n }\n }, [data, valid, errors, selectedBrandValue]);\n\n /**\n * RENDER\n */\n // prettier-ignore\n return (\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n type={props.brand}\n componentType={props.type}\n onChange={handleSecuredFieldsChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n render={() => null}\n />\n );\n}\n\nCustomCardInput.defaultProps = defaultProps;\n\nexport default CustomCardInput;\n\nconst extractPropsForSFP = (props: SecuredFieldsProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n forceCompat: props.forceCompat,\n // countryCode: props.countryCode, // only used for korean cards when koreanAuthenticationRequired is true\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onBrand: props.onBrand,\n // onChange // set directly\n onConfigSuccess: props.onConfigSuccess,\n handleKeyPress: props.handleKeyPress,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onFocus: props.onFocus,\n onLoad: props.onLoad,\n // render // set directly\n rootNode: props.rootNode,\n showWarnings: props.showWarnings,\n styles: props.styles,\n trimTrailingSeparator: props.trimTrailingSeparator,\n resources: props.resources,\n maskSecurityCode: props.maskSecurityCode,\n placeholders: props.placeholders\n };\n};\n"],"names":["CustomCardInput","props","sfp","useRef","errors","setErrors","useState","valid","setValid","data","setData","isSfpValid","setIsSfpValid","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","extensions","useMemo","SFExtensions","this","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","dualBrandingChangeHandler","handleDualBrandSelection","useEffect","setFocusOn","current","updateStyles","showValidation","handleUnsupportedCard","destroy","sfStateErrorsObj","mapErrorsToValidationRuleResult","mappedErrors","onChange","isValid","Object","keys","length","validationErrors","entries","map","fieldType","error","rootNode","onValidationError","h","SecuredFieldsProvider","ref","extractPropsForSFP","type","brand","componentType","sfState","onSubmitAnalytics","render","defaultProps","onError","autoFocus","brands","brandsConfiguration","clientKey","forceCompat","i18n","implementationType","keypadFix","legacyInputMode","loadingContext","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onBrand","onConfigSuccess","handleKeyPress","onFieldValid","onFocus","onLoad","showWarnings","styles","trimTrailingSeparator","resources","maskSecurityCode","placeholders"],"mappings":"qUAyDA,SAASA,EAAgBC,GACrB,MAAMC,EAAMC,EAAO,OAEZC,EAAQC,GAAaC,EAAS,CAAA,IAC9BC,EAAOC,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QtD,SAClCI,EAAS,IAAKD,KAAUmD,EAAQnD,QAEhCK,EAAc8C,EAAQ/C,aA+ElBgD,kBAAmB1D,EAAM0D,kBACzBC,OAAQ,IAAM,MAG1B,CAEA5D,EAAgB6D,aA9GK,CACjBtB,SAAU,OACVuB,QAAS,OACTZ,kBAAmB,QA+GvB,MAAMI,EAAsBrD,IACjB,CACH8D,UAAW9D,EAAM8D,UACjBC,OAAQ/D,EAAM+D,OACdC,oBAAqBhE,EAAMgE,oBAC3BC,UAAWjE,EAAMiE,UACjBC,YAAalE,EAAMkE,YAEnBC,KAAMnE,EAAMmE,KACZC,mBAAoBpE,EAAMoE,mBAC1BC,UAAWrE,EAAMqE,UACjBC,gBAAiBtE,EAAMsE,gBACvBC,eAAgBvE,EAAMuE,eACtBC,kBAAmBxE,EAAMwE,kBACzBC,qBAAsBzE,EAAMyE,qBAC5BC,sBAAuB1E,EAAM0E,sBAC7BC,WAAY3E,EAAM2E,WAClBC,eAAgB5E,EAAM4E,eACtBC,WAAY7E,EAAM6E,WAClBC,QAAS9E,EAAM8E,QAEfC,gBAAiB/E,EAAM+E,gBACvBC,eAAgBhF,EAAMgF,eACtBnB,QAAS7D,EAAM6D,QACfoB,aAAcjF,EAAMiF,aACpBC,QAASlF,EAAMkF,QACfC,OAAQnF,EAAMmF,OAEdnC,SAAUhD,EAAMgD,SAChBoC,aAAcpF,EAAMoF,aACpBC,OAAQrF,EAAMqF,OACdC,sBAAuBtF,EAAMsF,sBAC7BC,UAAWvF,EAAMuF,UACjBC,iBAAkBxF,EAAMwF,iBACxBC,aAAczF,EAAMyF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as
|
|
1
|
+
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import n from"./components/EcontextInput/EcontextInput.js";import o from"./components/EcontextVoucherResult/EcontextVoucherResult.js";import{TxVariants as s}from"../tx-variants.js";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class i extends t{get isValid(){return!this.props.personalDetailsRequired||!!this.state.isValid}formatData(){return{...this.state.data,paymentMethod:{type:this.type}}}componentToRender(){return this.props.reference?e(o,{reference:this.props.reference,totalAmount:this.props.totalAmount,expiresAt:this.props.expiresAt,paymentMethodType:this.props.paymentMethodType,maskedTelephoneNumber:this.props.maskedTelephoneNumber,instructionsUrl:this.props.instructionsUrl,alternativeReference:this.props.alternativeReference,collectionInstitutionNumber:this.props.collectionInstitutionNumber,onActionHandled:this.onActionHandled}):e(n,{setComponentRef:this.setComponentRef,data:this.props.data,personalDetailsRequired:this.props.personalDetailsRequired,showPayButton:this.props.showPayButton,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton})}}r(i,"type",s.econtext),r(i,"txVariants",[s.econtext,s.econtext_atm,s.econtext_online,s.econtext_seven_eleven,s.econtext_stores]),r(i,"defaultProps",{personalDetailsRequired:!0});export{i as EcontextElement,i as default};
|
|
2
2
|
//# sourceMappingURL=Econtext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Econtext.js","sources":["../../../../src/components/Econtext/Econtext.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport EcontextInput from './components/EcontextInput';\nimport EcontextVoucherResult from './components/EcontextVoucherResult';\nimport { TxVariants } from '../tx-variants';\nimport { EcontextConfiguration } from './types';\n\nexport class EcontextElement extends UIElement<EcontextConfiguration> {\n public static type = TxVariants.econtext;\n public static txVariants = [\n TxVariants.econtext,\n TxVariants.econtext_atm,\n TxVariants.econtext_online,\n TxVariants.econtext_seven_eleven,\n TxVariants.econtext_stores\n ];\n\n protected static defaultProps = {\n personalDetailsRequired: true\n };\n\n get isValid() {\n if (!this.props.personalDetailsRequired) {\n return true;\n }\n return !!this.state.isValid;\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n return {\n ...this.state.data,\n paymentMethod: {\n type: this.type\n }\n };\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.reference ? (\n <EcontextVoucherResult\n
|
|
1
|
+
{"version":3,"file":"Econtext.js","sources":["../../../../src/components/Econtext/Econtext.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport EcontextInput from './components/EcontextInput';\nimport EcontextVoucherResult from './components/EcontextVoucherResult';\nimport { TxVariants } from '../tx-variants';\nimport { EcontextConfiguration } from './types';\n\nexport class EcontextElement extends UIElement<EcontextConfiguration> {\n public static readonly type = TxVariants.econtext;\n public static readonly txVariants = [\n TxVariants.econtext,\n TxVariants.econtext_atm,\n TxVariants.econtext_online,\n TxVariants.econtext_seven_eleven,\n TxVariants.econtext_stores\n ];\n\n protected static defaultProps = {\n personalDetailsRequired: true\n };\n\n get isValid() {\n if (!this.props.personalDetailsRequired) {\n return true;\n }\n return !!this.state.isValid;\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n return {\n ...this.state.data,\n paymentMethod: {\n type: this.type\n }\n };\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.reference ? (\n <EcontextVoucherResult\n reference={this.props.reference}\n totalAmount={this.props.totalAmount}\n expiresAt={this.props.expiresAt}\n paymentMethodType={this.props.paymentMethodType}\n maskedTelephoneNumber={this.props.maskedTelephoneNumber}\n instructionsUrl={this.props.instructionsUrl}\n alternativeReference={this.props.alternativeReference}\n collectionInstitutionNumber={this.props.collectionInstitutionNumber}\n onActionHandled={this.onActionHandled}\n />\n ) : (\n <EcontextInput\n setComponentRef={this.setComponentRef}\n data={this.props.data}\n personalDetailsRequired={this.props.personalDetailsRequired}\n showPayButton={this.props.showPayButton}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n );\n }\n}\n\nexport default EcontextElement;\n"],"names":["EcontextElement","UIElement","isValid","this","props","personalDetailsRequired","state","formatData","data","paymentMethod","type","componentToRender","reference","h","EcontextVoucherResult","totalAmount","expiresAt","paymentMethodType","maskedTelephoneNumber","instructionsUrl","alternativeReference","collectionInstitutionNumber","onActionHandled","EcontextInput","setComponentRef","showPayButton","onChange","setState","onSubmit","submit","payButton","_define_property","TxVariants","econtext","txVariants","econtext_atm","econtext_online","econtext_seven_eleven","econtext_stores","defaultProps"],"mappings":"ibAOO,MAAMA,UAAwBC,EAcjC,WAAIC,GACA,OAAKC,KAAKC,MAAMC,2BAGPF,KAAKG,MAAMJ,OACxB,CAKAK,UAAAA,GACI,MAAO,IACAJ,KAAKG,MAAME,KACdC,cAAe,CACXC,KAAMP,KAAKO,MAGvB,CAEmBC,iBAAAA,GACf,OAAOR,KAAKC,MAAMQ,UACdC,EAACC,EAAAA,CACGF,UAAWT,KAAKC,MAAMQ,UACtBG,YAAaZ,KAAKC,MAAMW,YACxBC,UAAWb,KAAKC,MAAMY,UACtBC,kBAAmBd,KAAKC,MAAMa,kBAC9BC,sBAAuBf,KAAKC,MAAMc,sBAClCC,gBAAiBhB,KAAKC,MAAMe,gBAC5BC,qBAAsBjB,KAAKC,MAAMgB,qBACjCC,4BAA6BlB,KAAKC,MAAMiB,4BACxCC,gBAAiBnB,KAAKmB,kBAG1BT,EAACU,EAAAA,CACGC,gBAAiBrB,KAAKqB,gBACtBhB,KAAML,KAAKC,MAAMI,KACjBH,wBAAyBF,KAAKC,MAAMC,wBACpCoB,cAAetB,KAAKC,MAAMqB,cAC1BC,SAAUvB,KAAKwB,SACfC,SAAUzB,KAAK0B,OACfC,UAAW3B,KAAK2B,WAG5B,EAxDAC,EADS/B,EACcU,OAAOsB,EAAWC,UACzCF,EAFS/B,EAEckC,aAAa,CAChCF,EAAWC,SACXD,EAAWG,aACXH,EAAWI,gBACXJ,EAAWK,sBACXL,EAAWM,kBAGfP,EAVS/B,EAUQuC,eAAe,CAC5BlC,yBAAyB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e,Fragment as t}from"../../../../external/preact/dist/preact.js";import{
|
|
1
|
+
import{createElement as e,Fragment as t}from"../../../../external/preact/dist/preact.js";import{useState as r,useRef as a,useEffect as o}from"../../../../external/preact/hooks/dist/hooks.js";import n from"../../../internal/PersonalDetails/PersonalDetails.js";import{useCoreContext as s}from"../../../../core/Context/CoreProvider.js";import{econtextValidationRules as i}from"../../validate.js";import l from"../../../internal/FormInstruction/FormInstruction.js";function u({data:u,onChange:m,showPayButton:c,payButton:p,setComponentRef:d,personalDetailsRequired:f=!0}){const{i18n:h}=s(),[x,j]=r("ready"),C=a({setStatus:j});o(()=>{d(C.current)},[d]);const P=a(null);return e("div",{className:"adyen-checkout__econtext-input__field"},f&&e(t,null,e(l,null),e(n,{data:u,requiredFields:["firstName","lastName","telephoneNumber","shopperEmail"],onChange:m,namePrefix:"econtext",setComponentRef:e=>{P.current=e,C.current={setStatus:C.current?.setStatus,showValidation:e.showValidation},d(C.current)},validationRules:i})),c&&p({status:x,label:h.get("confirmPurchase")}))}export{u as default};
|
|
2
2
|
//# sourceMappingURL=EcontextInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EcontextInput.js","sources":["../../../../../../src/components/Econtext/components/EcontextInput/EcontextInput.tsx"],"sourcesContent":["import { Fragment, h, VNode } from 'preact';\nimport { useRef, useState } from 'preact/hooks';\nimport PersonalDetails from '../../../internal/PersonalDetails/PersonalDetails';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { econtextValidationRules } from '../../validate';\nimport { PersonalDetailsSchema } from '../../../../types/global-types';\nimport
|
|
1
|
+
{"version":3,"file":"EcontextInput.js","sources":["../../../../../../src/components/Econtext/components/EcontextInput/EcontextInput.tsx"],"sourcesContent":["import { Fragment, h, VNode } from 'preact';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport PersonalDetails from '../../../internal/PersonalDetails/PersonalDetails';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { econtextValidationRules } from '../../validate';\nimport { PersonalDetailsSchema } from '../../../../types/global-types';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport './EcontextInput.scss';\n\ninterface EcontextInputProps {\n setComponentRef: (ref: ComponentMethodsRef) => void;\n personalDetailsRequired?: boolean;\n data?: PersonalDetailsSchema;\n showPayButton: boolean;\n payButton(config: any): VNode;\n onChange?(data: any): void;\n onSubmit?(state: any, component: any): void;\n}\n\nexport default function EcontextInput({\n data,\n onChange,\n showPayButton,\n payButton,\n setComponentRef,\n personalDetailsRequired = true\n}: Readonly<EcontextInputProps>) {\n const { i18n } = useCoreContext();\n\n const [status, setStatus] = useState('ready');\n\n const econtextRef = useRef<ComponentMethodsRef>({\n setStatus\n });\n\n useEffect(() => {\n setComponentRef(econtextRef.current);\n }, [setComponentRef]);\n\n const personalDetailsRef = useRef<ComponentMethodsRef | null>(null);\n const setPersonalDetailsRef = (ref: ComponentMethodsRef) => {\n personalDetailsRef.current = ref;\n econtextRef.current = {\n setStatus: econtextRef.current?.setStatus,\n showValidation: ref.showValidation\n };\n setComponentRef(econtextRef.current);\n };\n\n return (\n <div className=\"adyen-checkout__econtext-input__field\">\n {personalDetailsRequired && (\n <Fragment>\n <FormInstruction />\n <PersonalDetails\n data={data}\n requiredFields={['firstName', 'lastName', 'telephoneNumber', 'shopperEmail']}\n onChange={onChange}\n namePrefix=\"econtext\"\n setComponentRef={setPersonalDetailsRef}\n validationRules={econtextValidationRules}\n />\n </Fragment>\n )}\n {showPayButton && payButton({ status, label: i18n.get('confirmPurchase') })}\n </div>\n );\n}\n"],"names":["EcontextInput","data","onChange","showPayButton","payButton","setComponentRef","personalDetailsRequired","i18n","useCoreContext","status","setStatus","useState","econtextRef","useRef","useEffect","current","personalDetailsRef","h","div","className","Fragment","FormInstruction","PersonalDetails","requiredFields","namePrefix","ref","showValidation","validationRules","econtextValidationRules","label","get"],"mappings":"6cAoBe,SAASA,GAAcC,KAClCA,EAAIC,SACJA,EAAQC,cACRA,EAAaC,UACbA,EAASC,gBACTA,EAAeC,wBACfA,GAA0B,IAE1B,MAAMC,KAAEA,GAASC,KAEVC,EAAQC,GAAaC,EAAS,SAE/BC,EAAcC,EAA4B,CAC5CH,cAGJI,EAAU,KACNT,EAAgBO,EAAYG,UAC7B,CAACV,IAEJ,MAAMW,EAAqBH,EAAmC,MAU9D,OACII,EAACC,MAAAA,CAAIC,UAAU,yCACVb,GACGW,EAACG,EAAAA,KACGH,EAACI,EAAAA,MACDJ,EAACK,EAAAA,CACGrB,KAAMA,EACNsB,eAAgB,CAAC,YAAa,WAAY,kBAAmB,gBAC7DrB,SAAUA,EACVsB,WAAW,WACXnB,gBAnBWoB,IAC3BT,EAAmBD,QAAUU,EAC7Bb,EAAYG,QAAU,CAClBL,UAAWE,EAAYG,SAASL,UAChCgB,eAAgBD,EAAIC,gBAExBrB,EAAgBO,EAAYG,UAcZY,gBAAiBC,KAI5BzB,GAAiBC,EAAU,CAAEK,SAAQoB,MAAOtB,EAAKuB,IAAI,qBAGlE"}
|
package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../external/preact/dist/preact.js";import t from"../../../internal/Voucher/Voucher.js";import{useCoreContext as r}from"../../../../core/Context/CoreProvider.js";import
|
|
1
|
+
import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useMemo as t}from"../../../../external/preact/hooks/dist/hooks.js";import o from"../../../internal/Voucher/Voucher.js";import{useCoreContext as r}from"../../../../core/Context/CoreProvider.js";import n from"../../../../core/Context/useImage.js";import{extractCommonPropsForVoucher as a}from"../../../internal/Voucher/utils.js";const l=l=>{const{i18n:i}=r(),c=n(),{expiresAt:u,maskedTelephoneNumber:s,instructionsUrl:m,collectionInstitutionNumber:p,alternativeReference:v,reference:b}=l,f=Boolean(v),h=t(()=>[{label:i.get("voucher.collectionInstitutionNumber"),value:p},{label:i.get("econtext.customerNumber"),value:b},{label:i.get("econtext.confirmationNumber"),value:v},{label:i.get("econtext.useBefore"),value:i.date(u)}],[i,p,b,v,u]),x=t(()=>[{label:i.get("voucher.collectionInstitutionNumber"),value:p},{label:i.get("voucher.expirationDate"),value:i.dateTime(u)},{label:i.get("voucher.telephoneNumber"),value:s}],[i,p,u,s]),g=f?h:x;return e(o,{...a({props:l,i18n:i,introKey:"voucher.introduction.econtext",getImage:c()}),instructionsUrl:m,paymentReferenceLabel:f?i.get("econtext.paymentInformation"):void 0,voucherDetails:g,copyBtn:!f,showReferenceValue:!f})};export{l as default};
|
|
2
2
|
//# sourceMappingURL=EcontextVoucherResult.js.map
|
package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EcontextVoucherResult.js","sources":["../../../../../../src/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Voucher from '../../../internal/Voucher';\n\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { EcontextVoucherResultProps } from '../../types';\nimport useImage from '../../../../core/Context/useImage';\nimport { extractCommonPropsForVoucher } from '../../../internal/Voucher/utils';\n\nconst EcontextVoucherResult = (props: EcontextVoucherResultProps) => {\n const {
|
|
1
|
+
{"version":3,"file":"EcontextVoucherResult.js","sources":["../../../../../../src/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useMemo } from 'preact/hooks';\nimport Voucher from '../../../internal/Voucher';\n\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { EcontextVoucherResultProps } from '../../types';\nimport useImage from '../../../../core/Context/useImage';\nimport { extractCommonPropsForVoucher } from '../../../internal/Voucher/utils';\n\nconst EcontextVoucherResult = (props: EcontextVoucherResultProps) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n const { expiresAt, maskedTelephoneNumber, instructionsUrl, collectionInstitutionNumber, alternativeReference, reference } = props;\n\n const hasAlternativeReference = Boolean(alternativeReference);\n\n const alternativeReferenceDetails = useMemo(\n () => [\n { label: i18n.get('voucher.collectionInstitutionNumber'), value: collectionInstitutionNumber },\n { label: i18n.get('econtext.customerNumber'), value: reference },\n { label: i18n.get('econtext.confirmationNumber'), value: alternativeReference },\n { label: i18n.get('econtext.useBefore'), value: i18n.date(expiresAt) }\n ],\n [i18n, collectionInstitutionNumber, reference, alternativeReference, expiresAt]\n );\n\n const standardVoucherDetails = useMemo(\n () => [\n { label: i18n.get('voucher.collectionInstitutionNumber'), value: collectionInstitutionNumber },\n { label: i18n.get('voucher.expirationDate'), value: i18n.dateTime(expiresAt) },\n { label: i18n.get('voucher.telephoneNumber'), value: maskedTelephoneNumber }\n ],\n [i18n, collectionInstitutionNumber, expiresAt, maskedTelephoneNumber]\n );\n\n const voucherDetails = hasAlternativeReference ? alternativeReferenceDetails : standardVoucherDetails;\n\n return (\n <Voucher\n {...extractCommonPropsForVoucher({ props, i18n, introKey: 'voucher.introduction.econtext', getImage: getImage() })}\n instructionsUrl={instructionsUrl}\n paymentReferenceLabel={hasAlternativeReference ? i18n.get('econtext.paymentInformation') : undefined}\n voucherDetails={voucherDetails}\n copyBtn={!hasAlternativeReference}\n showReferenceValue={!hasAlternativeReference}\n />\n );\n};\n\nexport default EcontextVoucherResult;\n"],"names":["EcontextVoucherResult","props","i18n","useCoreContext","getImage","useImage","expiresAt","maskedTelephoneNumber","instructionsUrl","collectionInstitutionNumber","alternativeReference","reference","hasAlternativeReference","Boolean","alternativeReferenceDetails","useMemo","label","get","value","date","standardVoucherDetails","dateTime","voucherDetails","h","Voucher","extractCommonPropsForVoucher","introKey","paymentReferenceLabel","undefined","copyBtn","showReferenceValue"],"mappings":"yZASA,MAAMA,EAAyBC,IAC3B,MAAMC,KAAEA,GAASC,IACXC,EAAWC,KAEXC,UAAEA,EAASC,sBAAEA,EAAqBC,gBAAEA,EAAeC,4BAAEA,EAA2BC,qBAAEA,EAAoBC,UAAEA,GAAcV,EAEtHW,EAA0BC,QAAQH,GAElCI,EAA8BC,EAChC,IAAM,CACF,CAAEC,MAAOd,EAAKe,IAAI,uCAAwCC,MAAOT,GACjE,CAAEO,MAAOd,EAAKe,IAAI,2BAA4BC,MAAOP,GACrD,CAAEK,MAAOd,EAAKe,IAAI,+BAAgCC,MAAOR,GACzD,CAAEM,MAAOd,EAAKe,IAAI,sBAAuBC,MAAOhB,EAAKiB,KAAKb,KAE9D,CAACJ,EAAMO,EAA6BE,EAAWD,EAAsBJ,IAGnEc,EAAyBL,EAC3B,IAAM,CACF,CAAEC,MAAOd,EAAKe,IAAI,uCAAwCC,MAAOT,GACjE,CAAEO,MAAOd,EAAKe,IAAI,0BAA2BC,MAAOhB,EAAKmB,SAASf,IAClE,CAAEU,MAAOd,EAAKe,IAAI,2BAA4BC,MAAOX,IAEzD,CAACL,EAAMO,EAA6BH,EAAWC,IAG7Ce,EAAiBV,EAA0BE,EAA8BM,EAE/E,OACIG,EAACC,EAAAA,IACOC,EAA6B,CAAExB,QAAOC,OAAMwB,SAAU,gCAAiCtB,SAAUA,MACrGI,gBAAiBA,EACjBmB,sBAAuBf,EAA0BV,EAAKe,IAAI,oCAAiCW,EAC3FN,eAAgBA,EAChBO,SAAUjB,EACVkB,oBAAqBlB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as
|
|
1
|
+
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"./components/GiftcardComponent.js";import s from"../internal/PayButton/PayButton.js";import n from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as a}from"../tx-variants.js";function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class o extends e{formatProps(t){return{...t?.configuration,...t}}formatData(){return{paymentMethod:{type:this.constructor.type,brand:this.props.brand,encryptedCardNumber:this.state.data?.encryptedCardNumber,encryptedSecurityCode:this.state.data?.encryptedSecurityCode}}}get isValid(){return!!this.state.isValid}get icon(){return this.props.brandsConfiguration[this.props.brand]?.icon||this.props.icon||this.resources.getImage()(this.props.brand)}get displayName(){return this.props.brandsConfiguration[this.props.brand]?.name||this.props.name}setBalanceCheckError(t){this.componentRef?.setBalanceCheckErrors?.(t)}balanceCheck(){return this.onBalanceCheck()}submit(){this.balanceCheck()}makeSubmitCall(){super.submit()}componentToRender(){return t(r,{ref:t=>{this.componentRef=t},...this.props,handleKeyPress:this.handleKeyPress,showPayButton:this.props.showPayButton,onChange:this.setState,makeBalanceCheck:()=>this.onBalanceCheck(),makePayment:()=>this.makeSubmitCall(),payButton:this.payButton,onSubmitAnalytics:this.submitAnalytics})}constructor(...e){super(...e),i(this,"componentRef",void 0),i(this,"handleBalanceCheck",t=>this.props.onBalanceCheck?new Promise((e,r)=>{this.props.onBalanceCheck(e,r,t)}):this.props.session?this.props.session.checkBalance(t):void 0),i(this,"onOrderRequest",t=>this.props.onOrderRequest?new Promise((e,r)=>{this.props.onOrderRequest(e,r,t)}):this.props.session?this.props.session.createOrder():void 0),i(this,"onBalanceCheck",()=>{if(!this.isValid)return void this.showValidation();if(!(this.props.session||this.props.onBalanceCheck))return super.submit();this.setStatus("loading"),this.handleBalanceCheck(this.formatData()).then(({balance:t,transactionLimit:e={}})=>{if(this.setBalanceCheckError(null),!t)throw new Error("card-error");if(t?.currency!==this.props.amount?.currency)throw new Error("currency-error");if(t?.value<=0)throw new Error("no-balance");return this.props.amount.value>t.value||this.props.amount.value>e.value?this.props.order?this.makeSubmitCall():this.onOrderRequest(this.data).then(t=>(this.setState({order:{orderData:t.orderData,pspReference:t.pspReference}}),this.makeSubmitCall())):this.handleOnRequiringConfirmation(t,e)}).catch(t=>{this.setBalanceCheckError(t?.message),t instanceof n?this.handleError(t):this.handleError(new n("ERROR",t))})}),i(this,"handleOnRequiringConfirmation",(t,e)=>{if(this.componentRef.setBalance({balance:t,transactionLimit:e}),this.setStatus("ready"),!this.props.showPayButton){if(!this.props.onRequiringConfirmation)throw new n("IMPLEMENTATION_ERROR","onRequiringConfirmation must be provided");return new Promise((t,e)=>{this.props.onRequiringConfirmation(t,e)}).then(()=>this.makeSubmitCall()).catch(()=>{})}}),i(this,"payButton",e=>t(s,e))}}i(o,"type",a.giftcard),i(o,"defaultProps",{brandsConfiguration:{}});export{o as GiftcardElement,o as default};
|
|
2
2
|
//# sourceMappingURL=Giftcard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Giftcard.js","sources":["../../../../src/components/Giftcard/Giftcard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport GiftcardComponent from './components/GiftcardComponent';\nimport PayButton from '../internal/PayButton';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { PaymentAmount } from '../../types/global-types';\nimport { GiftCardElementData, GiftCardConfiguration, balanceCheckResponseType, GiftCardBalanceCheckErrorType } from './types';\nimport { TxVariants } from '../tx-variants';\n\nexport class GiftcardElement extends UIElement<GiftCardConfiguration> {\n public static type = TxVariants.giftcard;\n\n protected componentRef: GiftcardComponent | undefined;\n\n protected static defaultProps = {\n brandsConfiguration: {}\n };\n\n formatProps(props) {\n return {\n ...props?.configuration,\n ...props\n };\n }\n\n formatData(): GiftCardElementData {\n return {\n paymentMethod: {\n type: this.constructor['type'],\n brand: this.props.brand,\n encryptedCardNumber: this.state.data?.encryptedCardNumber,\n encryptedSecurityCode: this.state.data?.encryptedSecurityCode\n }\n };\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get icon() {\n return this.props.brandsConfiguration[this.props.brand]?.icon || this.props.icon || this.resources.getImage()(this.props.brand);\n }\n\n get displayName() {\n return this.props.brandsConfiguration[this.props.brand]?.name || this.props.name;\n }\n\n private setBalanceCheckError(errorMessage: GiftCardBalanceCheckErrorType | null): void {\n this.componentRef?.setBalanceCheckErrors?.(errorMessage);\n }\n\n private handleBalanceCheck = (data: GiftCardElementData): Promise<balanceCheckResponseType> => {\n if (this.props.onBalanceCheck) {\n return new Promise((resolve, reject) => {\n void this.props.onBalanceCheck(resolve, reject, data);\n });\n }\n\n if (this.props.session) {\n return this.props.session.checkBalance(data);\n }\n };\n\n private onOrderRequest = data => {\n if (this.props.onOrderRequest)\n return new Promise((resolve, reject) => {\n void this.props.onOrderRequest(resolve, reject, data);\n });\n if (this.props.session) {\n return this.props.session.createOrder();\n }\n };\n\n public balanceCheck() {\n return this.onBalanceCheck();\n }\n\n private onBalanceCheck = (): void => {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n // skip balance check if no onBalanceCheck event has been defined\n const hasBalanceCheck = this.props.session || this.props.onBalanceCheck;\n if (!hasBalanceCheck) return super.submit();\n\n this.setStatus('loading');\n\n this.handleBalanceCheck(this.formatData())\n .then(({ balance, transactionLimit = {} as PaymentAmount }) => {\n // Clear any previous balance check errors on success\n this.setBalanceCheckError(null);\n\n // We still need to throw these errors, otherwise it would be a breaking changing\n if (!balance) throw new Error('card-error'); // card doesn't exist\n if (balance?.currency !== this.props.amount?.currency) throw new Error('currency-error');\n if (balance?.value <= 0) throw new Error('no-balance');\n\n if (this.props.amount.value > balance.value || this.props.amount.value > transactionLimit.value) {\n if (this.props.order) {\n return this.makeSubmitCall();\n }\n\n return this.onOrderRequest(this.data).then((order: { orderData: string; pspReference: string }) => {\n this.setState({ order: { orderData: order.orderData, pspReference: order.pspReference } });\n return this.makeSubmitCall();\n });\n } else {\n return this.handleOnRequiringConfirmation(balance, transactionLimit);\n }\n })\n .catch(error => {\n // Simply pass the raw error message to setBalanceCheckError\n this.setBalanceCheckError(error?.message);\n\n // Still call handleError for other side effects (analytics, onError callback)\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', error));\n }\n });\n };\n\n /**\n * Check if it should call onRequiringConfirmation\n */\n private handleOnRequiringConfirmation = (balance, transactionLimit): Promise<any> => {\n this.componentRef.setBalance({ balance, transactionLimit });\n this.setStatus('ready');\n\n // 1. if we show pay button we don't need to ask for confirmation\n if (this.props.showPayButton) {\n return;\n }\n // 2. there's no callback, we throw error\n if (!this.props.onRequiringConfirmation) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'onRequiringConfirmation must be provided');\n }\n // 3. success case if in case of custom pay button\n return (\n new Promise<void>((resolve, reject) => {\n void this.props.onRequiringConfirmation(resolve, reject);\n })\n //when this resolve passed to onRequiringConfirmation gets resolved make payments call\n .then(() => this.makeSubmitCall())\n //when it gets rejected handle cancellation\n .catch(() => {})\n );\n };\n\n public submit() {\n // for simplicity of the merchant we always only expose .submit()\n // however to make the actual payment call we call makeSubmitCall\n this.balanceCheck();\n }\n\n // this makes the payment, as .submit is used by the merchant to trigger the payButton action\n private makeSubmitCall() {\n super.submit();\n }\n\n // Giftcards override the regular payButton flow\n public payButton = props => {\n return <PayButton {...props} />;\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <GiftcardComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n handleKeyPress={this.handleKeyPress}\n showPayButton={this.props.showPayButton}\n onChange={this.setState}\n makeBalanceCheck={() => this.onBalanceCheck()}\n makePayment={() => this.makeSubmitCall()}\n payButton={this.payButton}\n />\n );\n }\n}\n\nexport default GiftcardElement;\n"],"names":["GiftcardElement","UIElement","formatProps","props","configuration","formatData","paymentMethod","type","this","constructor","brand","encryptedCardNumber","state","data","encryptedSecurityCode","isValid","icon","brandsConfiguration","resources","getImage","displayName","name","setBalanceCheckError","errorMessage","componentRef","setBalanceCheckErrors","balanceCheck","onBalanceCheck","submit","makeSubmitCall","super","componentToRender","h","GiftcardComponent","ref","handleKeyPress","showPayButton","onChange","setState","makeBalanceCheck","makePayment","payButton","args","_define_property","handleBalanceCheck","Promise","resolve","reject","session","checkBalance","onOrderRequest","createOrder","showValidation","setStatus","then","balance","transactionLimit","Error","currency","amount","value","order","orderData","pspReference","handleOnRequiringConfirmation","catch","error","message","AdyenCheckoutError","handleError","setBalance","onRequiringConfirmation","Pay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W,CAAEf,UAASC,qBACxChD,KAAK6C,UAAU,UAGX7C,KAAKL,MAAMiC,cAAf,CAIA,IAAK5B,KAAKL,MAAMoE,wBACZ,MAAM,IAAIH,EAAmB,uBAAwB,4CAGzD,OACI,IAAIvB,QAAc,CAACC,EAASC,KACnBvC,KAAKL,MAAMoE,wBAAwBzB,EAASC,KAGhDO,KAAK,IAAM9C,KAAKqB,kBAEhBoC,MAAM,OAbf,IA6BJtB,EAAAnC,KAAOiC,YAAYtC,GACR6B,EAACwC,EAAcrE,KA5J1BwC,EADS3C,EACKO,OAAOkE,EAAWC,UAIhC/B,EALS3C,EAKQ2E,eAAe,CAC5B1D,oBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"Giftcard.js","sources":["../../../../src/components/Giftcard/Giftcard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport GiftcardComponent from './components/GiftcardComponent';\nimport PayButton from '../internal/PayButton';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { PaymentAmount } from '../../types/global-types';\nimport { GiftCardElementData, GiftCardConfiguration, balanceCheckResponseType, GiftCardBalanceCheckErrorType } from './types';\nimport { TxVariants } from '../tx-variants';\n\nexport class GiftcardElement extends UIElement<GiftCardConfiguration> {\n public static type = TxVariants.giftcard;\n\n protected componentRef: GiftcardComponent | undefined;\n\n protected static defaultProps = {\n brandsConfiguration: {}\n };\n\n formatProps(props) {\n return {\n ...props?.configuration,\n ...props\n };\n }\n\n formatData(): GiftCardElementData {\n return {\n paymentMethod: {\n type: this.constructor['type'],\n brand: this.props.brand,\n encryptedCardNumber: this.state.data?.encryptedCardNumber,\n encryptedSecurityCode: this.state.data?.encryptedSecurityCode\n }\n };\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get icon() {\n return this.props.brandsConfiguration[this.props.brand]?.icon || this.props.icon || this.resources.getImage()(this.props.brand);\n }\n\n get displayName() {\n return this.props.brandsConfiguration[this.props.brand]?.name || this.props.name;\n }\n\n private setBalanceCheckError(errorMessage: GiftCardBalanceCheckErrorType | null): void {\n this.componentRef?.setBalanceCheckErrors?.(errorMessage);\n }\n\n private handleBalanceCheck = (data: GiftCardElementData): Promise<balanceCheckResponseType> => {\n if (this.props.onBalanceCheck) {\n return new Promise((resolve, reject) => {\n void this.props.onBalanceCheck(resolve, reject, data);\n });\n }\n\n if (this.props.session) {\n return this.props.session.checkBalance(data);\n }\n };\n\n private onOrderRequest = data => {\n if (this.props.onOrderRequest)\n return new Promise((resolve, reject) => {\n void this.props.onOrderRequest(resolve, reject, data);\n });\n if (this.props.session) {\n return this.props.session.createOrder();\n }\n };\n\n public balanceCheck() {\n return this.onBalanceCheck();\n }\n\n private onBalanceCheck = (): void => {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n // skip balance check if no onBalanceCheck event has been defined\n const hasBalanceCheck = this.props.session || this.props.onBalanceCheck;\n if (!hasBalanceCheck) return super.submit();\n\n this.setStatus('loading');\n\n this.handleBalanceCheck(this.formatData())\n .then(({ balance, transactionLimit = {} as PaymentAmount }) => {\n // Clear any previous balance check errors on success\n this.setBalanceCheckError(null);\n\n // We still need to throw these errors, otherwise it would be a breaking changing\n if (!balance) throw new Error('card-error'); // card doesn't exist\n if (balance?.currency !== this.props.amount?.currency) throw new Error('currency-error');\n if (balance?.value <= 0) throw new Error('no-balance');\n\n if (this.props.amount.value > balance.value || this.props.amount.value > transactionLimit.value) {\n if (this.props.order) {\n return this.makeSubmitCall();\n }\n\n return this.onOrderRequest(this.data).then((order: { orderData: string; pspReference: string }) => {\n this.setState({ order: { orderData: order.orderData, pspReference: order.pspReference } });\n return this.makeSubmitCall();\n });\n } else {\n return this.handleOnRequiringConfirmation(balance, transactionLimit);\n }\n })\n .catch(error => {\n // Simply pass the raw error message to setBalanceCheckError\n this.setBalanceCheckError(error?.message);\n\n // Still call handleError for other side effects (analytics, onError callback)\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', error));\n }\n });\n };\n\n /**\n * Check if it should call onRequiringConfirmation\n */\n private handleOnRequiringConfirmation = (balance, transactionLimit): Promise<any> => {\n this.componentRef.setBalance({ balance, transactionLimit });\n this.setStatus('ready');\n\n // 1. if we show pay button we don't need to ask for confirmation\n if (this.props.showPayButton) {\n return;\n }\n // 2. there's no callback, we throw error\n if (!this.props.onRequiringConfirmation) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'onRequiringConfirmation must be provided');\n }\n // 3. success case if in case of custom pay button\n return (\n new Promise<void>((resolve, reject) => {\n void this.props.onRequiringConfirmation(resolve, reject);\n })\n //when this resolve passed to onRequiringConfirmation gets resolved make payments call\n .then(() => this.makeSubmitCall())\n //when it gets rejected handle cancellation\n .catch(() => {})\n );\n };\n\n public submit() {\n // for simplicity of the merchant we always only expose .submit()\n // however to make the actual payment call we call makeSubmitCall\n this.balanceCheck();\n }\n\n // this makes the payment, as .submit is used by the merchant to trigger the payButton action\n private makeSubmitCall() {\n super.submit();\n }\n\n // Giftcards override the regular payButton flow\n public payButton = props => {\n return <PayButton {...props} />;\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <GiftcardComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n handleKeyPress={this.handleKeyPress}\n showPayButton={this.props.showPayButton}\n onChange={this.setState}\n makeBalanceCheck={() => this.onBalanceCheck()}\n makePayment={() => this.makeSubmitCall()}\n payButton={this.payButton}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n}\n\nexport default GiftcardElement;\n"],"names":["GiftcardElement","UIElement","formatProps","props","configuration","formatData","paymentMethod","type","this","constructor","brand","encryptedCardNumber","state","data","encryptedSecurityCode","isValid","icon","brandsConfiguration","resources","getImage","displayName","name","setBalanceCheckError","errorMessage","componentRef","setBalanceCheckErrors","balanceCheck","onBalanceCheck","submit","makeSubmitCall","super","componentToRender","h","GiftcardComponent","ref","handleKeyPress","showPayButton","onChange","setState","makeBalanceCheck","makePayment","payButton","onSubmitAnalytics","submitAnalytics","args","_define_property","handleBalanceCheck","Promise","resolve","reject","session","checkBalance","onOrderRequest","createOrder","showValidation","setStatus","then","balance","transactionLimit","Error","currency","amount","value","order","orderData","pspReference","handleOnRequiringConfirmation","catch","error","message","AdyenCheckoutError","handleError","setBalance","onRequiringConfirmation","PayButton","TxVariants","giftcard","defaultProps"],"mappings":"qcASO,MAAMA,UAAwBC,EASjCC,WAAAA,CAAYC,GACR,MAAO,IACAA,GAAOC,iBACPD,EAEX,CAEAE,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMC,KAAKC,YAAY,KACvBC,MAAOF,KAAKL,MAAMO,MAClBC,oBAAqBH,KAAKI,MAAMC,MAAMF,oBACtCG,sBAAuBN,KAAKI,MAAMC,MAAMC,uBAGpD,CAEA,WAAIC,GACA,QAASP,KAAKI,MAAMG,OACxB,CAEA,QAAIC,GACA,OAAOR,KAAKL,MAAMc,oBAAoBT,KAAKL,MAAMO,QAAQM,MAAQR,KAAKL,MAAMa,MAAQR,KAAKU,UAAUC,UAAfX,CAA0BA,KAAKL,MAAMO,MAC7H,CAEA,eAAIU,GACA,OAAOZ,KAAKL,MAAMc,oBAAoBT,KAAKL,MAAMO,QAAQW,MAAQb,KAAKL,MAAMkB,IAChF,CAEQC,oBAAAA,CAAqBC,GACzBf,KAAKgB,cAAcC,wBAAwBF,EAC/C,CAwBOG,YAAAA,GACH,OAAOlB,KAAKmB,gBAChB,CA6EOC,MAAAA,GAGHpB,KAAKkB,cACT,CAGQG,cAAAA,GACJC,MAAMF,QACV,CAOmBG,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,IAAKA,IACD1B,KAAKgB,aAAeU,MAEpB1B,KAAKL,MACTgC,eAAgB3B,KAAK2B,eACrBC,cAAe5B,KAAKL,MAAMiC,cAC1BC,SAAU7B,KAAK8B,SACfC,iBAAkB,IAAM/B,KAAKmB,iBAC7Ba,YAAa,IAAMhC,KAAKqB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,mBAGTrB,KAAK0D,8BAA8BT,EAASC,KAG1DS,MAAMC,IAEH5D,KAAKc,qBAAqB8C,GAAOC,SAG7BD,aAAiBE,EACjB9D,KAAK+D,YAAYH,GAEjB5D,KAAK+D,YAAY,IAAID,EAAmB,QAASF,QAQjEvB,EAAArC,KAAQ0D,gCAAgC,CAACT,EAASC,KAK9C,GAJAlD,KAAKgB,aAAagD,WAAW,CAAEf,UAASC,qBACxClD,KAAK+C,UAAU,UAGX/C,KAAKL,MAAMiC,cAAf,CAIA,IAAK5B,KAAKL,MAAMsE,wBACZ,MAAM,IAAIH,EAAmB,uBAAwB,4CAGzD,OACI,IAAIvB,QAAc,CAACC,EAASC,KACnBzC,KAAKL,MAAMsE,wBAAwBzB,EAASC,KAGhDO,KAAK,IAAMhD,KAAKqB,kBAEhBsC,MAAM,OAbf,IA6BJtB,EAAArC,KAAOiC,YAAYtC,GACR6B,EAAC0C,EAAcvE,KA5J1B0C,EADS7C,EACKO,OAAOoE,EAAWC,UAIhC/B,EALS7C,EAKQ6E,eAAe,CAC5B5D,oBAAqB,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import s from"../../internal/Alert/Alert.js";import a from"./GiftcardResult.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import{GIFT_CARD as n}from"../../internal/SecuredFields/lib/constants.js";import{GiftCardFields as i}from"./GiftcardFields.js";import{useSRPanelForGiftcardErrors as c}from"./useSRPanelForGiftcardErrors.js";function l(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class
|
|
1
|
+
import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import s from"../../internal/Alert/Alert.js";import a from"./GiftcardResult.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import{GIFT_CARD as n}from"../../internal/SecuredFields/lib/constants.js";import{GiftCardFields as i}from"./GiftcardFields.js";import{useSRPanelForGiftcardErrors as c}from"./useSRPanelForGiftcardErrors.js";function l(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class u extends t{generateBalanceCheckErrors(t){const e={};return null===t||(e.encryptedCardNumber={isValid:!1,errorMessage:`error.giftcard.${t}`,error:t}),e}isBalanceCheckError(t){return["no-balance","card-error","currency-error"].includes(t)}render(t,{focusedElement:i,balance:l,transactionLimit:u,isValidating:d,transformedErrors:p}){const{i18n:h}=o();c({errors:p,isValidating:d,sfp:this.sfp});const m=u?.value<l?.value?u:l,f=m?.value>=this.props.amount?.value;if(m&&f)return e(a,{amount:this.props.amount,balance:l,transactionLimit:u,makePayment:t.makePayment,status:this.state.status,makeBalanceCheck:t.makeBalanceCheck,showPayButton:this.props.showPayButton,payButton:this.props.payButton});const y=t=>t.errors.encryptedCardNumber?h.get(t.errors.encryptedCardNumber):p.encryptedCardNumber?h.get(p.encryptedCardNumber.errorMessage):null;return e("div",{className:"adyen-checkout__giftcard"},"error"===this.state.status&&e(s,{icon:"cross"},h.get("error.message.unknown")),e(r,{...this.props,ref:t=>{this.sfp=t},onChange:this.onChange,onFocus:this.handleFocus,onSubmitAnalytics:t.onSubmitAnalytics,type:n,componentType:t.type,render:({setRootNode:t,setFocusOn:e},r)=>this.props.fieldsLayoutComponent({i18n:h,pinRequired:this.props.pinRequired,focusedElement:i,getCardErrorMessage:y,setRootNode:t,setFocusOn:e,sfpState:r})}),this.props.showPayButton&&this.props.payButton({status:this.state.status,onClick:this.props.makeBalanceCheck,label:h.get("applyGiftcard")}))}constructor(...t){super(...t),l(this,"state",{status:"ready",data:{},balance:null,transactionLimit:null,focusedElement:!1,isValid:!1,sfpState:{},isValidating:!1,transformedErrors:{}}),l(this,"sfp",void 0),l(this,"mapErrorsToValidationObjects",()=>this.sfp?this.sfp.mapErrorsToValidationRuleResult():{}),l(this,"updateTransformedErrors",t=>{const e={...this.mapErrorsToValidationObjects(),...t};this.setState({transformedErrors:e})}),l(this,"onChange",t=>{this.setState({sfpState:t},()=>this.updateTransformedErrors()),this.props.onChange({data:t.data,isValid:t.isSfpValid})}),l(this,"handleFocus",t=>{this.setState({focusedElement:t.currentFocusObject});!0===t.focus?this.props.onFocus(t):this.props.onBlur(t)}),l(this,"setBalance",({balance:t,transactionLimit:e})=>{this.setState({balance:t,transactionLimit:e})}),l(this,"setBalanceCheckErrors",t=>{if(this.isBalanceCheckError(t)){const e=this.generateBalanceCheckErrors(t);this.updateTransformedErrors(e)}}),l(this,"showValidation",()=>{this.setState({isValidating:!0}),this.sfp?.showValidation()})}}l(u,"defaultProps",{pinRequired:!0,expiryDateRequired:!1,onChange:()=>{},onFocus:()=>{},onBlur:()=>{},fieldsLayoutComponent:i});export{u as default};
|
|
2
2
|
//# sourceMappingURL=GiftcardComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GiftcardComponent.js","sources":["../../../../../src/components/Giftcard/components/GiftcardComponent.tsx"],"sourcesContent":["import { Component, FunctionComponent, h } from 'preact';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport Alert from '../../internal/Alert';\nimport GiftcardResult from './GiftcardResult';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { PaymentAmount } from '../../../types/global-types';\nimport { GIFT_CARD } from '../../internal/SecuredFields/lib/constants';\nimport { GiftCardFields } from './GiftcardFields';\nimport { GiftcardFieldsProps, Placeholders } from './types';\nimport { useSRPanelForGiftcardErrors } from './useSRPanelForGiftcardErrors';\nimport { GiftCardBalanceCheckErrorType } from '../types';\n\ninterface GiftcardComponentProps {\n onChange: (state) => void;\n onFocus: (event) => void;\n onBlur: (event) => void;\n\n makeBalanceCheck: (event) => void;\n makePayment: (event) => void;\n\n amount?: PaymentAmount;\n showPayButton: boolean;\n payButton: (config) => any;\n\n pinRequired: boolean;\n expiryDateRequired?: boolean;\n fieldsLayoutComponent: FunctionComponent<GiftcardFieldsProps>;\n placeholders?: Placeholders;\n handleKeyPress?: (o: KeyboardEvent) => void;\n}\n\nclass Giftcard extends Component<GiftcardComponentProps> {\n public state = {\n status: 'ready',\n data: {},\n balance: null,\n transactionLimit: null,\n focusedElement: false,\n isValid: false,\n sfpState: {},\n isValidating: false,\n transformedErrors: {}\n };\n\n public static defaultProps = {\n pinRequired: true,\n expiryDateRequired: false,\n onChange: () => {},\n onFocus: () => {},\n onBlur: () => {},\n fieldsLayoutComponent: GiftCardFields\n };\n\n public sfp: SecuredFieldsProvider;\n\n /**\n * Maps string error codes from SecuredFields to validation rule objects\n */\n public mapErrorsToValidationObjects = () => {\n // Use the sfp reference to call mapErrorsToValidationRuleResult\n if (!this.sfp) return {};\n return this.sfp.mapErrorsToValidationRuleResult();\n };\n\n private updateTransformedErrors = (balanceCheckErrors?: Record<string, any>) => {\n const transformedErrors = this.mapErrorsToValidationObjects();\n\n const mergedErrors = { ...transformedErrors, ...balanceCheckErrors };\n\n this.setState({ transformedErrors: mergedErrors });\n };\n\n public onChange = sfpState => {\n this.setState({ sfpState }, () => this.updateTransformedErrors());\n\n this.props.onChange({\n data: sfpState.data,\n isValid: sfpState.isSfpValid\n });\n };\n\n public handleFocus = e => {\n this.setState({ focusedElement: e.currentFocusObject });\n\n const isFocused = e.focus === true;\n if (isFocused) {\n this.props.onFocus(e);\n } else {\n this.props.onBlur(e);\n }\n };\n\n public setBalance = ({ balance, transactionLimit }) => {\n this.setState({ balance, transactionLimit });\n };\n\n /**\n * Generates balance check errors in the same format as SFP errors\n * Compatible with the transformedErrors structure\n */\n private generateBalanceCheckErrors(errorType?: GiftCardBalanceCheckErrorType | null): Record<string, any> {\n const balanceCheckErrors: Record<string, any> = {};\n\n // This is the field that the error is associated with, only used for SR logic\n const fieldToAnnounce = 'encryptedCardNumber';\n\n // If errorType is null, clear errors\n if (errorType === null) {\n return balanceCheckErrors;\n }\n\n // Create error in the same format as SFP errors for consistency\n balanceCheckErrors[fieldToAnnounce] = {\n isValid: false,\n errorMessage: `error.giftcard.${errorType}`,\n error: errorType\n };\n\n return balanceCheckErrors;\n }\n\n /**\n * Checks if a status represents a balance check error\n */\n private isBalanceCheckError(status: string): boolean {\n return ['no-balance', 'card-error', 'currency-error'].includes(status);\n }\n\n /**\n * Method called by GiftcardElement to set balance check errors only\n */\n public setBalanceCheckErrors = (errorType: GiftCardBalanceCheckErrorType | null): void => {\n // Check if the errors should be displayed\n if (this.isBalanceCheckError(errorType)) {\n // Generate balance check errors in the style of useForm\n // This is usefull because then we can use the same logic for SF and balance check errors\n // Also we can use the same logic for SRPanel errors\n const balanceCheckErrors = this.generateBalanceCheckErrors(errorType);\n this.updateTransformedErrors(balanceCheckErrors);\n }\n };\n\n public showValidation = () => {\n this.setState({ isValidating: true });\n\n // Validate SecuredFields\n this.sfp?.showValidation();\n };\n\n render(props, { focusedElement, balance, transactionLimit, isValidating, transformedErrors }) {\n const { i18n } = useCoreContext();\n\n // Handle SRPanel errors in render with transformed error objects\n useSRPanelForGiftcardErrors({\n errors: transformedErrors,\n isValidating,\n sfp: this.sfp\n });\n\n const transactionAmount = transactionLimit?.value < balance?.value ? transactionLimit : balance;\n const hasEnoughBalance = transactionAmount?.value >= this.props.amount?.value;\n\n if (transactionAmount && hasEnoughBalance) {\n return (\n <GiftcardResult\n amount={this.props.amount}\n balance={balance}\n transactionLimit={transactionLimit}\n makePayment={props.makePayment}\n status={this.state.status}\n makeBalanceCheck={props.makeBalanceCheck}\n showPayButton={this.props.showPayButton}\n payButton={this.props.payButton}\n />\n );\n }\n\n const getCardErrorMessage = sfpState => {\n if (sfpState.errors.encryptedCardNumber) return i18n.get(sfpState.errors.encryptedCardNumber);\n\n // This logic is a bit of a hack, but it's the only way to get the error message for balance check errors\n // In the future we should move this logic to useForm\n if (transformedErrors.encryptedCardNumber) {\n return i18n.get(transformedErrors.encryptedCardNumber.errorMessage);\n }\n\n return null;\n };\n\n return (\n <div className=\"adyen-checkout__giftcard\">\n {this.state.status === 'error' && <Alert icon={'cross'}>{i18n.get('error.message.unknown')}</Alert>}\n\n <SecuredFieldsProvider\n {...this.props}\n ref={ref => {\n this.sfp = ref;\n }}\n onChange={this.onChange}\n onFocus={this.handleFocus}\n type={GIFT_CARD}\n render={({ setRootNode, setFocusOn }, sfpState) =>\n this.props.fieldsLayoutComponent({\n i18n: i18n,\n pinRequired: this.props.pinRequired,\n focusedElement: focusedElement,\n getCardErrorMessage: getCardErrorMessage,\n setRootNode: setRootNode,\n setFocusOn: setFocusOn,\n sfpState: sfpState\n })\n }\n />\n\n {this.props.showPayButton &&\n this.props.payButton({\n status: this.state.status,\n onClick: this.props.makeBalanceCheck,\n label: i18n.get('applyGiftcard')\n })}\n </div>\n );\n }\n}\n\nexport default Giftcard;\n"],"names":["Giftcard","Component","generateBalanceCheckErrors","errorType","balanceCheckErrors","isValid","errorMessage","error","isBalanceCheckError","status","includes","render","props","focusedElement","balance","transactionLimit","isValidating","transformedErrors","i18n","useCoreContext","useSRPanelForGiftcardErrors","errors","sfp","this","transactionAmount","value","hasEnoughBalance","amount","h","GiftcardResult","makePayment","state","makeBalanceCheck","showPayButton","payButton","getCardErrorMessage","sfpState","encryptedCardNumber","get","div","className","Alert","icon","SecuredFieldsProvider","ref","onChange","onFocus","handleFocus","type","GIFT_CARD","setRootNode","setFocusOn","fieldsLayoutComponent","pinRequired","onClick","label","super","args","_define_property","data","mapErrorsToValidationObjects","mapErrorsToValidationRuleResult","updateTransformedErrors","mergedErrors","setState","isSfpValid","e","currentFocusObject","focus","onBlur","setBalance","setBalanceCheckErrors","showValidation","defaultProps","expiryDateRequired","GiftCardFields"],"mappings":"6nBA+BA,MAAMA,UAAiBC,EAqEXC,0BAAAA,CAA2BC,GAC/B,MAAMC,EAA0C,CAAA,EAMhD,OAAkB,OAAdD,IAKJC,sBAAsC,CAClCC,SAAS,EACTC,aAAc,kBAAkBH,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O,KAAKD,KAAKkD,oBAtGdd,EAbE1D,EAaYyE,eAAe,CACzBpB,aAAa,EACbqB,oBAAoB,EACpB7B,SAAU,OACVC,QAAS,OACTuB,OAAQ,OACRjB,sBAAuBuB"}
|
|
1
|
+
{"version":3,"file":"GiftcardComponent.js","sources":["../../../../../src/components/Giftcard/components/GiftcardComponent.tsx"],"sourcesContent":["import { Component, FunctionComponent, h } from 'preact';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport Alert from '../../internal/Alert';\nimport GiftcardResult from './GiftcardResult';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { PaymentAmount } from '../../../types/global-types';\nimport { GIFT_CARD } from '../../internal/SecuredFields/lib/constants';\nimport { GiftCardFields } from './GiftcardFields';\nimport { GiftcardFieldsProps, Placeholders } from './types';\nimport { useSRPanelForGiftcardErrors } from './useSRPanelForGiftcardErrors';\nimport { GiftCardBalanceCheckErrorType } from '../types';\nimport type { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\n\ninterface GiftcardComponentProps {\n onChange: (state) => void;\n onFocus: (event) => void;\n onBlur: (event) => void;\n\n makeBalanceCheck: (event) => void;\n makePayment: (event) => void;\n\n amount?: PaymentAmount;\n showPayButton: boolean;\n payButton: (config) => any;\n\n pinRequired: boolean;\n expiryDateRequired?: boolean;\n fieldsLayoutComponent: FunctionComponent<GiftcardFieldsProps>;\n placeholders?: Placeholders;\n handleKeyPress?: (o: KeyboardEvent) => void;\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n}\n\nclass Giftcard extends Component<GiftcardComponentProps> {\n public state = {\n status: 'ready',\n data: {},\n balance: null,\n transactionLimit: null,\n focusedElement: false,\n isValid: false,\n sfpState: {},\n isValidating: false,\n transformedErrors: {}\n };\n\n public static defaultProps = {\n pinRequired: true,\n expiryDateRequired: false,\n onChange: () => {},\n onFocus: () => {},\n onBlur: () => {},\n fieldsLayoutComponent: GiftCardFields\n };\n\n public sfp: SecuredFieldsProvider;\n\n /**\n * Maps string error codes from SecuredFields to validation rule objects\n */\n public mapErrorsToValidationObjects = () => {\n // Use the sfp reference to call mapErrorsToValidationRuleResult\n if (!this.sfp) return {};\n return this.sfp.mapErrorsToValidationRuleResult();\n };\n\n private updateTransformedErrors = (balanceCheckErrors?: Record<string, any>) => {\n const transformedErrors = this.mapErrorsToValidationObjects();\n\n const mergedErrors = { ...transformedErrors, ...balanceCheckErrors };\n\n this.setState({ transformedErrors: mergedErrors });\n };\n\n public onChange = sfpState => {\n this.setState({ sfpState }, () => this.updateTransformedErrors());\n\n this.props.onChange({\n data: sfpState.data,\n isValid: sfpState.isSfpValid\n });\n };\n\n public handleFocus = e => {\n this.setState({ focusedElement: e.currentFocusObject });\n\n const isFocused = e.focus === true;\n if (isFocused) {\n this.props.onFocus(e);\n } else {\n this.props.onBlur(e);\n }\n };\n\n public setBalance = ({ balance, transactionLimit }) => {\n this.setState({ balance, transactionLimit });\n };\n\n /**\n * Generates balance check errors in the same format as SFP errors\n * Compatible with the transformedErrors structure\n */\n private generateBalanceCheckErrors(errorType?: GiftCardBalanceCheckErrorType | null): Record<string, any> {\n const balanceCheckErrors: Record<string, any> = {};\n\n // This is the field that the error is associated with, only used for SR logic\n const fieldToAnnounce = 'encryptedCardNumber';\n\n // If errorType is null, clear errors\n if (errorType === null) {\n return balanceCheckErrors;\n }\n\n // Create error in the same format as SFP errors for consistency\n balanceCheckErrors[fieldToAnnounce] = {\n isValid: false,\n errorMessage: `error.giftcard.${errorType}`,\n error: errorType\n };\n\n return balanceCheckErrors;\n }\n\n /**\n * Checks if a status represents a balance check error\n */\n private isBalanceCheckError(status: string): boolean {\n return ['no-balance', 'card-error', 'currency-error'].includes(status);\n }\n\n /**\n * Method called by GiftcardElement to set balance check errors only\n */\n public setBalanceCheckErrors = (errorType: GiftCardBalanceCheckErrorType | null): void => {\n // Check if the errors should be displayed\n if (this.isBalanceCheckError(errorType)) {\n // Generate balance check errors in the style of useForm\n // This is usefull because then we can use the same logic for SF and balance check errors\n // Also we can use the same logic for SRPanel errors\n const balanceCheckErrors = this.generateBalanceCheckErrors(errorType);\n this.updateTransformedErrors(balanceCheckErrors);\n }\n };\n\n public showValidation = () => {\n this.setState({ isValidating: true });\n\n // Validate SecuredFields\n this.sfp?.showValidation();\n };\n\n render(props, { focusedElement, balance, transactionLimit, isValidating, transformedErrors }) {\n const { i18n } = useCoreContext();\n\n // Handle SRPanel errors in render with transformed error objects\n useSRPanelForGiftcardErrors({\n errors: transformedErrors,\n isValidating,\n sfp: this.sfp\n });\n\n const transactionAmount = transactionLimit?.value < balance?.value ? transactionLimit : balance;\n const hasEnoughBalance = transactionAmount?.value >= this.props.amount?.value;\n\n if (transactionAmount && hasEnoughBalance) {\n return (\n <GiftcardResult\n amount={this.props.amount}\n balance={balance}\n transactionLimit={transactionLimit}\n makePayment={props.makePayment}\n status={this.state.status}\n makeBalanceCheck={props.makeBalanceCheck}\n showPayButton={this.props.showPayButton}\n payButton={this.props.payButton}\n />\n );\n }\n\n const getCardErrorMessage = sfpState => {\n if (sfpState.errors.encryptedCardNumber) return i18n.get(sfpState.errors.encryptedCardNumber);\n\n // This logic is a bit of a hack, but it's the only way to get the error message for balance check errors\n // In the future we should move this logic to useForm\n if (transformedErrors.encryptedCardNumber) {\n return i18n.get(transformedErrors.encryptedCardNumber.errorMessage);\n }\n\n return null;\n };\n\n return (\n <div className=\"adyen-checkout__giftcard\">\n {this.state.status === 'error' && <Alert icon={'cross'}>{i18n.get('error.message.unknown')}</Alert>}\n\n <SecuredFieldsProvider\n {...this.props}\n ref={ref => {\n this.sfp = ref;\n }}\n onChange={this.onChange}\n onFocus={this.handleFocus}\n onSubmitAnalytics={props.onSubmitAnalytics}\n type={GIFT_CARD}\n componentType={props.type}\n render={({ setRootNode, setFocusOn }, sfpState) =>\n this.props.fieldsLayoutComponent({\n i18n: i18n,\n pinRequired: this.props.pinRequired,\n focusedElement: focusedElement,\n getCardErrorMessage: getCardErrorMessage,\n setRootNode: setRootNode,\n setFocusOn: setFocusOn,\n sfpState: sfpState\n })\n }\n />\n\n {this.props.showPayButton &&\n this.props.payButton({\n status: this.state.status,\n onClick: this.props.makeBalanceCheck,\n label: i18n.get('applyGiftcard')\n })}\n </div>\n );\n }\n}\n\nexport default Giftcard;\n"],"names":["Giftcard","Component","generateBalanceCheckErrors","errorType","balanceCheckErrors","isValid","errorMessage","error","isBalanceCheckError","status","includes","render","props","focusedElement","balance","transactionLimit","isValidating","transformedErrors","i18n","useCoreContext","useSRPanelForGiftcardErrors","errors","sfp","this","transactionAmount","value","hasEnoughBalance","amount","h","GiftcardResult","makePayment","state","makeBalanceCheck","showPayButton","payButton","getCardErrorMessage","sfpState","encryptedCardNumber","get","div","className","Alert","icon","SecuredFieldsProvider","ref","onChange","onFocus","handleFocus","onSubmitAnalytics","type","GIFT_CARD","componentType","setRootNode","setFocusOn","fieldsLayoutComponent","pinRequired","onClick","label","super","args","_define_property","data","mapErrorsToValidationObjects","mapErrorsToValidationRuleResult","updateTransformedErrors","mergedErrors","setState","isSfpValid","e","currentFocusObject","focus","onBlur","setBalance","setBalanceCheckErrors","showValidation","defaultProps","expiryDateRequired","GiftCardFields"],"mappings":"6nBAiCA,MAAMA,UAAiBC,EAqEXC,0BAAAA,CAA2BC,GAC/B,MAAMC,EAA0C,CAAA,EAMhD,OAAkB,OAAdD,IAKJC,sBAAsC,CAClCC,SAAS,EACTC,aAAc,kBAAkBH,IAChCI,MAAOJ,IAPAC,CAWf,CAKQI,mBAAAA,CAAoBC,GACxB,MAAO,CAAC,aAAc,aAAc,kBAAkBC,SAASD,EACnE,CAuBAE,MAAAA,CAAOC,GAAOC,eAAEA,EAAcC,QAAEA,EAAOC,iBAAEA,EAAgBC,aAAEA,EAAYC,kBAAEA,IACrE,MAAMC,KAAEA,GAASC,IAGjBC,EAA4B,CACxBC,OAAQJ,EACRD,eACAM,IAAKC,KAAKD,MAGd,MAAME,EAAoBT,GAAkBU,MAA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AS,KACTC,iBAAkB,KAClBF,gBAAgB,EAChBR,SAAS,EACT+B,SAAU,CAAA,EACVpB,cAAc,EACdC,kBAAmB,CAAA,IAYvB2C,EAAArC,KAAOD,WAAP,GAKAsC,OAAOE,+BAA+B,IAE7BvC,KAAKD,IACHC,KAAKD,IAAIyC,kCADM,CAAA,GAI1BH,EAAArC,KAAQyC,0BAA2B5D,IAC/B,MAEM6D,EAAe,IAFK1C,KAAKuC,kCAEiB1D,GAEhDmB,KAAK2C,SAAS,CAAEjD,kBAAmBgD,MAGvCL,EAAArC,KAAOsB,WAAWT,IACdb,KAAK2C,SAAS,CAAE9B,YAAY,IAAMb,KAAKyC,2BAEvCzC,KAAKX,MAAMiC,SAAS,CAChBgB,KAAMzB,EAASyB,KACfxD,QAAS+B,EAAS+B,eAI1BP,EAAArC,KAAOwB,cAAcqB,IACjB7C,KAAK2C,SAAS,CAAErD,eAAgBuD,EAAEC,sBAEJ,IAAZD,EAAEE,MAEhB/C,KAAKX,MAAMkC,QAAQsB,GAEnB7C,KAAKX,MAAM2D,OAAOH,KAI1BR,OAAOY,aAAa,EAAG1D,UAASC,uBAC5BQ,KAAK2C,SAAS,CAAEpD,UAASC,uBAsC7B6C,EAAArC,KAAOkD,wBAAyBtE,IAE5B,GAAIoB,KAAKf,oBAAoBL,GAAY,CAIrC,MAAMC,EAAqBmB,KAAKrB,2BAA2BC,GAC3DoB,KAAKyC,wBAAwB5D,EACjC,IAGJwD,OAAOc,iBAAiB,KACpBnD,KAAK2C,SAAS,CAAElD,cAAc,IAG9BO,KAAKD,KAAKoD,oBAtGdd,EAbE5D,EAaY2E,eAAe,CACzBpB,aAAa,EACbqB,oBAAoB,EACpB/B,SAAU,OACVC,QAAS,OACTyB,OAAQ,OACRjB,sBAAuBuB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createElement as t}from"../../external/preact/dist/preact.js";import o from"../../utils/isMobile.js";import e from"../helpers/IssuerListContainer/IssuerListContainer.js";import{QRLoader as r}from"../internal/QRLoader/QRLoader.js";import"../../core/Context/CoreProvider.js";import"../../external/preact/hooks/dist/hooks.js";import"../../core/Errors/AdyenCheckoutError.js";import"../../core/Errors/SRPanelContext.js";import"../internal/Button/Button.js";import"../internal/QRLoader/QRLoaderDetailsProvider.js";import{TxVariants as s}from"../tx-variants.js";import n from"./components/IrisComponent.js";import{IrisQrCodeInstructions as i}from"./components/IrisQrCodeInstructions.js";import{IrisMode as p}from"./types.js";import{DEFAULT_IRIS_COUNTDOWN_TIME as a}from"./constants.js";function m(t,o,e){return o in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}class d extends e{renderIssuerList(){return super.componentToRender()}formatData(){return this.mode===p.BANK_LIST?{paymentMethod:{type:this.type,issuer:this.state?.data?.issuer}}:{paymentMethod:{type:this.type}}}formatProps(t){return{...super.formatProps(t),countdownTime:t.countdownTime??a}}get isValid(){return this.mode!==p.BANK_LIST||super.isValid}componentToRender(){return"qrCode"===this.props.type?t(r,{type:s.iris,brandLogo:this.icon,clientKey:this.props.clientKey,qrCodeData:this.props.qrCodeData?encodeURIComponent(this.props.qrCodeData):null,countdownTime:this.props.countdownTime,paymentData:this.props.paymentData,amount:this.props.amount,delay:this.props.delay,onActionHandled:this.onActionHandled,onError:this.props.onError,onComplete:this.onComplete,introduction:i,showAmount:!0,copyBtn:!1}):t(n,{setComponentRef:this.setComponentRef,defaultMode:this.mode,onUpdateMode:this.onUpdateMode,issuerListUI:this.renderIssuerList(),showPayButton:this.props.showPayButton,payButton:this.payButton,issuers:this.props.issuers})}constructor(t,e){super(t,e),m(this,"mode",void 0),m(this,"onUpdateMode",t=>{this.mode=t}),this.mode=o()?p.BANK_LIST:p.QR_CODE}}m(d,"type",s.iris);export{d as Iris,d as default};
|
|
2
|
+
//# sourceMappingURL=Iris.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Iris.js","sources":["../../../../src/components/Iris/Iris.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { ICore } from '../../types';\nimport isMobile from '../../utils/isMobile';\nimport IssuerListContainer from '../helpers/IssuerListContainer/IssuerListContainer';\nimport { QRLoader } from '../internal/QRLoader';\nimport { TxVariants } from '../tx-variants';\nimport IrisComponent from './components/IrisComponent';\nimport { IrisQrCodeInstructions } from './components/IrisQrCodeInstructions';\nimport { IrisConfiguration, IrisData, IrisMode } from './types';\nimport { DEFAULT_IRIS_COUNTDOWN_TIME } from './constants';\n\nexport class Iris extends IssuerListContainer<IrisConfiguration, IrisData> {\n public static readonly type = TxVariants.iris;\n\n private mode: IrisMode;\n\n constructor(checkout: ICore, props: IrisConfiguration) {\n super(checkout, props);\n this.mode = isMobile() ? IrisMode.BANK_LIST : IrisMode.QR_CODE;\n }\n\n private readonly onUpdateMode = (mode: IrisMode): void => {\n this.mode = mode;\n };\n\n private renderIssuerList(): h.JSX.Element {\n return super.componentToRender();\n }\n\n formatData(): IrisData {\n if (this.mode === IrisMode.BANK_LIST) {\n return {\n paymentMethod: {\n type: this.type,\n issuer: this.state?.data?.issuer\n }\n };\n }\n\n return {\n paymentMethod: {\n type: this.type\n }\n };\n }\n\n formatProps(props: IrisConfiguration): IrisConfiguration {\n return {\n ...super.formatProps(props),\n countdownTime: props.countdownTime ?? DEFAULT_IRIS_COUNTDOWN_TIME\n };\n }\n\n get isValid() {\n if (this.mode === IrisMode.BANK_LIST) {\n return super.isValid;\n }\n\n return true;\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.type === 'qrCode') {\n return (\n <QRLoader\n type={TxVariants.iris}\n brandLogo={this.icon}\n clientKey={this.props.clientKey}\n qrCodeData={this.props.qrCodeData ? encodeURIComponent(this.props.qrCodeData) : null}\n countdownTime={this.props.countdownTime}\n paymentData={this.props.paymentData}\n amount={this.props.amount}\n delay={this.props.delay}\n onActionHandled={this.onActionHandled}\n onError={this.props.onError}\n onComplete={this.onComplete}\n introduction={IrisQrCodeInstructions}\n showAmount\n copyBtn={false}\n />\n );\n }\n\n return (\n <IrisComponent\n setComponentRef={this.setComponentRef}\n defaultMode={this.mode}\n onUpdateMode={this.onUpdateMode}\n issuerListUI={this.renderIssuerList()}\n showPayButton={this.props.showPayButton}\n payButton={this.payButton}\n issuers={this.props.issuers}\n />\n );\n }\n}\n\nexport default Iris;\n"],"names":["Iris","IssuerListContainer","renderIssuerList","super","componentToRender","formatData","this","mode","IrisMode","BANK_LIST","paymentMethod","type","issuer","state","data","formatProps","props","countdownTime","DEFAULT_IRIS_COUNTDOWN_TIME","isValid","h","QRLoader","TxVariants","iris","brandLogo","icon","clientKey","qrCodeData","encodeURIComponent","paymentData","amount","delay","onActionHandled","onError","onComplete","introduction","IrisQrCodeInstructions","showAmount","copyBtn","IrisComponent","setComponentRef","defaultMode","onUpdateMode","issuerListUI","showPayButton","payButton","issuers","constructor","checkout","_define_property","isMobile","QR_CODE"],"mappings":"04BAWO,MAAMA,UAAaC,EAcdC,gBAAAA,GACJ,OAAOC,MAAMC,mBACjB,CAEAC,UAAAA,GACI,OAAIC,KAAKC,OAASC,EAASC,UAChB,CACHC,cAAe,CACXC,KAAML,KAAKK,KACXC,OAAQN,KAAKO,OAAOC,MAAMF,SAK/B,CACHF,cAAe,CACXC,KAAML,KAAKK,MAGvB,CAEAI,WAAAA,CAAYC,GACR,MAAO,IACAb,MAAMY,YAAYC,GACrBC,cAAeD,EAAMC,eAAiBC,EAE9C,CAEA,WAAIC,GACA,OAAIb,KAAKC,OAASC,EAASC,WAChBN,MAAMgB,OAIrB,CAEmBf,iBAAAA,GACf,MAAwB,WAApBE,KAAKU,MAAML,KAEPS,EAACC,EAAAA,CACGV,KAAMW,EAAWC,KACjBC,UAAWlB,KAAKmB,KAChBC,UAAWpB,KAAKU,MAAMU,UACtBC,WAAYrB,KAAKU,MAAMW,WAAaC,mBAAmBtB,KAAKU,MAAMW,YAAc,KAChFV,cAAeX,KAAKU,MAAMC,cAC1BY,YAAavB,KAAKU,MAAMa,YACxBC,OAAQxB,KAAKU,MAAMc,OACnBC,MAAOzB,KAAKU,MAAMe,MAClBC,gBAAiB1B,KAAK0B,gBACtBC,QAAS3B,KAAKU,MAAMiB,QACpBC,WAAY5B,KAAK4B,WACjBC,aAAcC,EACdC,YAAAA,EACAC,SAAS,IAMjBlB,EAACmB,EAAAA,CACGC,gBAAiBlC,KAAKkC,gBACtBC,YAAanC,KAAKC,KAClBmC,aAAcpC,KAAKoC,aACnBC,aAAcrC,KAAKJ,mBACnB0C,cAAetC,KAAKU,MAAM4B,cAC1BC,UAAWvC,KAAKuC,UAChBC,QAASxC,KAAKU,MAAM8B,SAGhC,CA9EA,WAAAC,CAAYC,EAAiBhC,GACzBb,MAAM6C,EAAUhC,GAHpBiC,EAAA3C,KAAQC,YAAR,GAOA0C,EAAA3C,KAAiBoC,eAAgBnC,IAC7BD,KAAKC,KAAOA,IAJZD,KAAKC,KAAO2C,IAAa1C,EAASC,UAAYD,EAAS2C,OAC3D,EAPAF,EADSjD,EACcW,OAAOW,EAAWC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createElement as t}from"../../../external/preact/dist/preact.js";import{IrisMode as e}from"../types.js";import{useState as o,useMemo as s,useRef as n,useEffect as r}from"../../../external/preact/hooks/dist/hooks.js";import{IRIS_ALLY_LABELS as a}from"../constants.js";import{getIrisSegmentedControlOptions as i}from"../utils.js";import{useCoreContext as d}from"../../../core/Context/CoreProvider.js";import{SegmentedControl as l}from"../../internal/SegmentedControl/SegmentedControl.js";import{SegmentedControlRegion as m}from"../../internal/SegmentedControl/SegmentedControlRegion.js";import u from"./IrisGenerateQRCode.js";import p from"./IrisComponent.module.scss.js";import{AnalyticsInfoEvent as c,UiTarget as f,InfoEventType as y}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";import{TxVariants as C}from"../../tx-variants.js";import B from"../../../core/Analytics/useAnalytics.js";function j(j){const{i18n:g}=d(),{analytics:A}=B(),[I,R]=o(j.defaultMode),[S,h]=o("ready"),E=s(()=>i(g,j.defaultMode),[g,j.defaultMode]),L=j.issuers.length>0,_=(t,e=!1)=>{if(R(t),j.onUpdateMode(t),e){const e=new c({type:y.selected,target:f.segmentedControl,component:C.iris,selectedValue:t});A.sendAnalytics(e)}},w=n({setStatus:h});return r(()=>{j.setComponentRef(w.current)},[j.setComponentRef]),r(()=>{if(L){const t=new c({type:y.displayed,target:f.segmentedControl,component:C.iris,selectedValue:j.defaultMode});A.sendAnalytics(t)}},[]),r(()=>{L||_(e.QR_CODE)},[L]),L?t("div",null,t(l,{onChange:t=>_(t,!0),selectedValue:I,disabled:"loading"===S,options:E}),I===e.BANK_LIST&&t(m,{id:a.AreaId.BANK_LIST,ariaLabelledBy:a.ButtonId.BANK_LIST,className:p.bankList},j.issuerListUI),I===e.QR_CODE&&t(m,{id:a.AreaId.QR_CODE,ariaLabelledBy:a.ButtonId.QR_CODE},t(u,{showPayButton:j.showPayButton,payButton:j.payButton,status:S}))):t(u,{showPayButton:j.showPayButton,payButton:j.payButton,status:S})}export{j as default};
|
|
2
|
+
//# sourceMappingURL=IrisComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisComponent.js","sources":["../../../../../src/components/Iris/components/IrisComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport { IrisMode } from '../types';\nimport { useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport { IRIS_ALLY_LABELS } from '../constants';\nimport { getIrisSegmentedControlOptions } from '../utils';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { SegmentedControl, SegmentedControlRegion } from '../../internal/SegmentedControl';\nimport { ComponentMethodsRef, UIElementStatus } from '../../types';\nimport { IssuerItem } from '../../internal/IssuerList/types';\nimport IrisGenerateQRCode from './IrisGenerateQRCode';\nimport styles from './IrisComponent.module.scss';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { TxVariants } from '../../tx-variants';\nimport useAnalytics from '../../../core/Analytics/useAnalytics';\n\ninterface IrisComponentProps {\n defaultMode: IrisMode;\n showPayButton?: boolean;\n issuers: IssuerItem[];\n issuerListUI: h.JSX.Element;\n onUpdateMode: (mode: IrisMode) => void;\n payButton: (props: Partial<PayButtonProps>) => h.JSX.Element;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n}\n\nexport default function IrisComponent(props: Readonly<IrisComponentProps>) {\n const { i18n } = useCoreContext();\n const { analytics } = useAnalytics();\n\n const [mode, setMode] = useState<IrisMode>(props.defaultMode);\n const [status, setStatus] = useState<UIElementStatus>('ready');\n const segmentedControlOptions = useMemo(() => getIrisSegmentedControlOptions(i18n, props.defaultMode), [i18n, props.defaultMode]);\n\n const issuersAvailable = props.issuers.length > 0;\n\n const handleModeChange = (mode: IrisMode, sendAnalytics = false) => {\n setMode(mode);\n props.onUpdateMode(mode);\n if (sendAnalytics) {\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.selected,\n target: UiTarget.segmentedControl,\n component: TxVariants.iris,\n selectedValue: mode\n });\n analytics.sendAnalytics(event);\n }\n };\n\n const irisRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus\n });\n\n useEffect(() => {\n props.setComponentRef(irisRef.current);\n }, [props.setComponentRef]);\n\n useEffect(() => {\n if (issuersAvailable) {\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.displayed,\n target: UiTarget.segmentedControl,\n component: TxVariants.iris,\n selectedValue: props.defaultMode\n });\n analytics.sendAnalytics(event);\n }\n }, []);\n\n useEffect(() => {\n if (!issuersAvailable) {\n handleModeChange(IrisMode.QR_CODE);\n }\n }, [issuersAvailable]);\n\n if (!issuersAvailable) {\n return <IrisGenerateQRCode showPayButton={props.showPayButton} payButton={props.payButton} status={status} />;\n }\n\n return (\n <div>\n <SegmentedControl\n onChange={mode => handleModeChange(mode, true)}\n selectedValue={mode}\n disabled={status === 'loading'}\n options={segmentedControlOptions}\n />\n {mode === IrisMode.BANK_LIST && (\n <SegmentedControlRegion\n id={IRIS_ALLY_LABELS.AreaId.BANK_LIST}\n ariaLabelledBy={IRIS_ALLY_LABELS.ButtonId.BANK_LIST}\n className={styles.bankList}\n >\n {props.issuerListUI}\n </SegmentedControlRegion>\n )}\n {mode === IrisMode.QR_CODE && (\n <SegmentedControlRegion id={IRIS_ALLY_LABELS.AreaId.QR_CODE} ariaLabelledBy={IRIS_ALLY_LABELS.ButtonId.QR_CODE}>\n <IrisGenerateQRCode showPayButton={props.showPayButton} payButton={props.payButton} status={status} />\n </SegmentedControlRegion>\n )}\n </div>\n );\n}\n"],"names":["IrisComponent","props","i18n","useCoreContext","analytics","useAnalytics","mode","setMode","useState","defaultMode","status","setStatus","segmentedControlOptions","useMemo","getIrisSegmentedControlOptions","issuersAvailable","issuers","length","handleModeChange","sendAnalytics","onUpdateMode","event","AnalyticsInfoEvent","type","InfoEventType","selected","target","UiTarget","segmentedControl","component","TxVariants","iris","selectedValue","irisRef","useRef","useEffect","setComponentRef","current","displayed","IrisMode","QR_CODE","h","div","SegmentedControl","onChange","disabled","options","BANK_LIST","SegmentedControlRegion","id","IRIS_ALLY_LABELS","AreaId","ariaLabelledBy","ButtonId","className","styles","bankList","issuerListUI","IrisGenerateQRCode","showPayButton","payButton"],"mappings":"y4BA0Be,SAASA,EAAcC,GAClC,MAAMC,KAAEA,GAASC,KACXC,UAAEA,GAAcC,KAEfC,EAAMC,GAAWC,EAAmBP,EAAMQ,cAC1CC,EAAQC,GAAaH,EAA0B,SAChDI,EAA0BC,EAAQ,IAAMC,EAA+BZ,EAAMD,EAAMQ,aAAc,CAACP,EAAMD,EAAMQ,cAE9GM,EAAmBd,EAAMe,QAAQC,OAAS,EAE1CC,EAAmB,CAACZ,EAAgBa,GAAgB,KAGtD,GAFAZ,EAAQD,GACRL,EAAMmB,aAAad,GACfa,EAAe,CACf,MAAME,EAAQ,IAAIC,EAAmB,CACjCC,KAAMC,EAAcC,SACpBC,OAAQC,EAASC,iBACjBC,UAAWC,EAAWC,KACtBC,cAAe1B,IAEnBF,EAAUe,cAAcE,EAC5B,GAGEY,EAAUC,EAA4B,CACxCvB,UAAWA,IAyBf,OAtBAwB,EAAU,KACNlC,EAAMmC,gBAAgBH,EAAQI,UAC/B,CAACpC,EAAMmC,kBAEVD,EAAU,KACN,GAAIpB,EAAkB,CAClB,MAAMM,EAAQ,IAAIC,EAAmB,CACjCC,KAAMC,EAAcc,UACpBZ,OAAQC,EAASC,iBACjBC,UAAWC,EAAWC,KACtBC,cAAe/B,EAAMQ,cAEzBL,EAAUe,cAAcE,EAC5B,GACD,IAEHc,EAAU,KACDpB,GACDG,EAAiBqB,EAASC,UAE/B,CAACzB,IAECA,EAKD0B,EAACC,WACGD,EAACE,EAAAA,CACGC,SAAUtC,GAAQY,EAAiBZ,GAAM,GACzC0B,cAAe1B,EACfuC,SAAqB,YAAXnC,EACVoC,QAASlC,IAEZN,IAASiC,EAASQ,WACfN,EAACO,EAAAA,CACGC,GAAIC,EAAiBC,OAAOJ,UAC5BK,eAAgBF,EAAiBG,SAASN,UAC1CO,UAAWC,EAAOC,UAEjBvD,EAAMwD,cAGdnD,IAASiC,EAASC,SACfC,EAACO,EAAAA,CAAuBC,GAAIC,EAAiBC,OAAOX,QAASY,eAAgBF,EAAiBG,SAASb,SACnGC,EAACiB,EAAAA,CAAmBC,cAAe1D,EAAM0D,cAAeC,UAAW3D,EAAM2D,UAAWlD,OAAQA,MAtBjG+B,EAACiB,EAAAA,CAAmBC,cAAe1D,EAAM0D,cAAeC,UAAW3D,EAAM2D,UAAWlD,OAAQA,GA2B3G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisComponent.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import r from"../../../core/Context/useImage.js";import o from"./IrisGenerateQRCode.module.scss.js";function s(s){const{i18n:a}=t(),n=r();return e("div",{"data-testid":"iris-generate-qr-code"},e("p",{className:o.instruction},a.get("iris.instructions.generateQrCode")),s.showPayButton&&s.payButton({label:a.get("generateQRCode"),icon:n({imageFolder:"components/"})("qr"),status:s.status}))}export{s as default};
|
|
2
|
+
//# sourceMappingURL=IrisGenerateQRCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisGenerateQRCode.js","sources":["../../../../../src/components/Iris/components/IrisGenerateQRCode.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport useImage from '../../../core/Context/useImage';\nimport { UIElementStatus } from '../../types';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport styles from './IrisGenerateQRCode.module.scss';\n\ninterface IrisGenerateQRCodeProps {\n showPayButton?: boolean;\n payButton: (props: Partial<PayButtonProps>) => h.JSX.Element;\n status: UIElementStatus;\n}\n\nexport default function IrisGenerateQRCode(props: Readonly<IrisGenerateQRCodeProps>) {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n return (\n <div data-testid=\"iris-generate-qr-code\">\n <p className={styles.instruction}>{i18n.get('iris.instructions.generateQrCode')}</p>\n {props.showPayButton &&\n props.payButton({\n label: i18n.get('generateQRCode'),\n icon: getImage({ imageFolder: 'components/' })('qr'),\n status: props.status\n })}\n </div>\n );\n}\n"],"names":["IrisGenerateQRCode","props","i18n","useCoreContext","getImage","useImage","h","div","data-testid","p","className","styles","instruction","get","showPayButton","payButton","label","icon","imageFolder","status"],"mappings":"mPAae,SAASA,EAAmBC,GACvC,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IAEjB,OACIC,EAACC,MAAAA,CAAIC,cAAY,yBACbF,EAACG,IAAAA,CAAEC,UAAWC,EAAOC,aAAcV,EAAKW,IAAI,qCAC3CZ,EAAMa,eACHb,EAAMc,UAAU,CACZC,MAAOd,EAAKW,IAAI,kBAChBI,KAAMb,EAAS,CAAEc,YAAa,eAAxBd,CAAyC,MAC/Ce,OAAQlB,EAAMkB,SAIlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisGenerateQRCode.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createElement as t}from"../../../external/preact/dist/preact.js";import{TimelineWrapper as e}from"../../internal/Timeline/TimelineWrapper.js";import{Timeline as i}from"../../internal/Timeline/Timeline.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";const n=()=>{const{i18n:n}=r();return t(e,null,t(i,{instructions:[n.get("iris.instructions.payment.step1"),n.get("iris.instructions.payment.step2"),n.get("iris.instructions.payment.step3")]}))};export{n as IrisQrCodeInstructions};
|
|
2
|
+
//# sourceMappingURL=IrisQrCodeInstructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisQrCodeInstructions.js","sources":["../../../../../src/components/Iris/components/IrisQrCodeInstructions.tsx"],"sourcesContent":["import { h } from 'preact';\n\nimport { Timeline, TimelineWrapper } from '../../internal/Timeline';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\n\nexport const IrisQrCodeInstructions = () => {\n const { i18n } = useCoreContext();\n return (\n <TimelineWrapper>\n <Timeline\n instructions={[\n i18n.get('iris.instructions.payment.step1'),\n i18n.get('iris.instructions.payment.step2'),\n i18n.get('iris.instructions.payment.step3')\n ]}\n />\n </TimelineWrapper>\n );\n};\n"],"names":["IrisQrCodeInstructions","i18n","useCoreContext","h","TimelineWrapper","Timeline","instructions","get"],"mappings":"iSAKaA,EAAyB,KAClC,MAAMC,KAAEA,GAASC,IACjB,OACIC,EAACC,OACGD,EAACE,EAAAA,CACGC,aAAc,CACVL,EAAKM,IAAI,mCACTN,EAAKM,IAAI,mCACTN,EAAKM,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/components/Iris/constants.ts"],"sourcesContent":["export const IRIS_ALLY_LABELS = {\n ButtonId: {\n BANK_LIST: 'iris-button-bank-list',\n QR_CODE: 'iris-button-qrCode'\n },\n AreaId: {\n BANK_LIST: 'iris-area-bank-list',\n QR_CODE: 'iris-area-qrCode'\n }\n};\n\nexport const DEFAULT_IRIS_COUNTDOWN_TIME = 10;\n"],"names":["IRIS_ALLY_LABELS","ButtonId","BANK_LIST","QR_CODE","AreaId","DEFAULT_IRIS_COUNTDOWN_TIME"],"mappings":"MAAaA,EAAmB,CAC5BC,SAAU,CACNC,UAAW,wBACXC,QAAS,sBAEbC,OAAQ,CACJF,UAAW,sBACXC,QAAS,qBAIJE,EAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/Iris/types.ts"],"sourcesContent":["import { IssuerListConfiguration, QRLoaderConfiguration } from '../types';\n\nexport type IrisConfiguration = IssuerListConfiguration & Pick<QRLoaderConfiguration, 'countdownTime' | 'qrCodeData' | 'paymentData' | 'delay'>;\n\n/**\n * Iris data format for /payment request\n * @internal\n */\nexport interface IrisData {\n paymentMethod: {\n type: string;\n issuer?: string;\n };\n}\n\n/**\n * Iris component display modes\n * @internal\n */\nexport enum IrisMode {\n QR_CODE = 'qrCode',\n BANK_LIST = 'bankList'\n}\n"],"names":["IrisMode"],"mappings":"AAmBO,IAAKA,EAAAA,SAAAA,GAAAA,iDAAAA,CAGX,CAHWA,CAGX,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{IRIS_ALLY_LABELS as t}from"./constants.js";import{IrisMode as o}from"./types.js";const e=(e,r)=>[{label:e.get("qrCode"),value:o.QR_CODE,id:t.ButtonId.QR_CODE,controls:t.AreaId.QR_CODE},{label:e.get("bankList"),value:o.BANK_LIST,id:t.ButtonId.BANK_LIST,controls:t.AreaId.BANK_LIST}].sort((t,o)=>t.value===r?-1:o.value===r?1:0);export{e as getIrisSegmentedControlOptions};
|
|
2
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/components/Iris/utils.ts"],"sourcesContent":["import Language from '../../language';\nimport { SegmentedControlOption } from '../internal/SegmentedControl/SegmentedControl';\nimport { IRIS_ALLY_LABELS } from './constants';\nimport { IrisMode } from './types';\n\nexport const getIrisSegmentedControlOptions = (i18n: Language, defaultMode: IrisMode): SegmentedControlOption<IrisMode>[] => {\n const options = [\n {\n label: i18n.get('qrCode'),\n value: IrisMode.QR_CODE,\n id: IRIS_ALLY_LABELS.ButtonId.QR_CODE,\n controls: IRIS_ALLY_LABELS.AreaId.QR_CODE\n },\n {\n label: i18n.get('bankList'),\n value: IrisMode.BANK_LIST,\n id: IRIS_ALLY_LABELS.ButtonId.BANK_LIST,\n controls: IRIS_ALLY_LABELS.AreaId.BANK_LIST\n }\n ];\n\n return options.sort((a, b) => {\n if (a.value === defaultMode) return -1;\n if (b.value === defaultMode) return 1;\n return 0;\n });\n};\n"],"names":["getIrisSegmentedControlOptions","i18n","defaultMode","label","get","value","IrisMode","QR_CODE","id","IRIS_ALLY_LABELS","ButtonId","controls","AreaId","BANK_LIST","sort","a","b"],"mappings":"wFAKO,MAAMA,EAAiC,CAACC,EAAgBC,IAC3C,CACZ,CACIC,MAAOF,EAAKG,IAAI,UAChBC,MAAOC,EAASC,QAChBC,GAAIC,EAAiBC,SAASH,QAC9BI,SAAUF,EAAiBG,OAAOL,SAEtC,CACIJ,MAAOF,EAAKG,IAAI,YAChBC,MAAOC,EAASO,UAChBL,GAAIC,EAAiBC,SAASG,UAC9BF,SAAUF,EAAiBG,OAAOC,YAI3BC,KAAK,CAACC,EAAGC,IAChBD,EAAEV,QAAUH,GAAoB,EAChCc,EAAEX,QAAUH,EAAoB,EAC7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as t}from"../../../external/preact/dist/preact.js";import e
|
|
1
|
+
import{createElement as t}from"../../../external/preact/dist/preact.js";import{SegmentedControl as e}from"../../internal/SegmentedControl/SegmentedControl.js";import{useState as o,useMemo as a}from"../../../external/preact/hooks/dist/hooks.js";import n from"./PayIDInput.js";import s from"./BSBInput.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import i from"../../../_virtual/index.js";import{getUniqueId as p}from"../../../utils/idGenerator.js";function l(l){const{i18n:d}=r(),[u,m]=o("ready"),c=a(()=>p("payid-input"),[]),f=a(()=>p("bsb-input"),[]),b=a(()=>[{value:"payid-option",label:"PayID",id:"payid-option",controls:c},{value:"bsb-option",label:d.get("payto.bsb.option.label"),id:"bsb-option",controls:f}],[d,c,f]),y=b[0].value,[h,C]=o(y),g=({data:t,valid:e,errors:o,isValid:a})=>{l.onChange({data:{selectedInput:h,...t},valid:e,errors:o,isValid:a})};return t("div",{className:i({"adyen-checkout__payto-component":!0,"adyen-checkout__payto-component--loading":"loading"===u})},t(e,{selectedValue:h,options:b,onChange:C}),"payid-option"===h&&t(n,{id:c,status:u,setStatus:m,setComponentRef:l.setComponentRef,onChange:g,defaultData:l.data,placeholders:l.placeholders}),"bsb-option"===h&&t(s,{id:f,status:u,setStatus:m,setComponentRef:l.setComponentRef,onChange:g,defaultData:l.data,placeholders:l.placeholders}),l.showPayButton&&l.payButton({status:u,label:d.get("continue")}))}export{l as default};
|
|
2
2
|
//# sourceMappingURL=PayToComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayToComponent.js","sources":["../../../../../src/components/PayTo/components/PayToComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport SegmentedControl from '../../internal/SegmentedControl';\nimport { useMemo, useState } from 'preact/hooks';\nimport { SegmentedControlOptions } from '../../internal/SegmentedControl/SegmentedControl';\nimport PayIDInput from './PayIDInput';\nimport BSBInput from './BSBInput';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport { PayToData, PayToPlaceholdersType } from '../types';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport classNames from 'classnames';\nimport { getUniqueId } from '../../../utils/idGenerator';\nimport './PayToComponent.scss';\n\nexport type PayToInputOption = 'payid-option' | 'bsb-option';\n\nexport type PayToComponentData = { selectedInput: PayToInputOption };\n\nexport interface PayToComponentProps {\n showPayButton: boolean;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n data: PayToData;\n placeholders: PayToPlaceholdersType;\n payButton: (props: Partial<PayButtonProps>) => h.JSX.Element;\n}\n\nexport default function PayToComponent(props: PayToComponentProps) {\n const { i18n } = useCoreContext();\n\n const [status, setStatus] = useState<UIElementStatus>('ready');\n\n // Generate unique IDs for the input sections\n const payidInputId = useMemo(() => getUniqueId('payid-input'), []);\n const bsbInputId = useMemo(() => getUniqueId('bsb-input'), []);\n\n const inputOptions: SegmentedControlOptions<PayToInputOption> = useMemo(\n () => [\n {\n value: 'payid-option',\n label: 'PayID',\n id: 'payid-option',\n controls: payidInputId\n },\n {\n value: 'bsb-option',\n label: i18n.get('payto.bsb.option.label'),\n id: 'bsb-option',\n controls: bsbInputId\n }\n ],\n [i18n, payidInputId, bsbInputId]\n );\n\n const defaultOption = inputOptions[0].value;\n const [selectedInput, setSelectedInput] = useState<PayToInputOption>(defaultOption);\n\n const onChange = ({ data, valid, errors, isValid }) => {\n // merge selected input to as data, this keep the input layers untouched\n props.onChange({ data: { selectedInput: selectedInput, ...data }, valid, errors, isValid });\n };\n\n return (\n <div\n className={classNames({\n 'adyen-checkout__payto-component': true,\n 'adyen-checkout__payto-component--loading': status === 'loading'\n })}\n >\n <SegmentedControl selectedValue={selectedInput} options={inputOptions} onChange={setSelectedInput} />\n {selectedInput === 'payid-option' && (\n <PayIDInput\n id={payidInputId}\n status={status}\n setStatus={setStatus}\n setComponentRef={props.setComponentRef}\n onChange={onChange}\n defaultData={props.data}\n placeholders={props.placeholders}\n />\n )}\n {selectedInput === 'bsb-option' && (\n <BSBInput\n id={bsbInputId}\n status={status}\n setStatus={setStatus}\n setComponentRef={props.setComponentRef}\n onChange={onChange}\n defaultData={props.data}\n placeholders={props.placeholders}\n />\n )}\n\n {props.showPayButton && props.payButton({ status, label: i18n.get('continue') })}\n </div>\n );\n}\n"],"names":["PayToComponent","props","i18n","useCoreContext","status","setStatus","useState","payidInputId","useMemo","getUniqueId","bsbInputId","inputOptions","value","label","id","controls","get","defaultOption","selectedInput","setSelectedInput","onChange","data","valid","errors","isValid","h","div","className","classNames","SegmentedControl","selectedValue","options","PayIDInput","setComponentRef","defaultData","placeholders","BSBInput","showPayButton","payButton"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PayToComponent.js","sources":["../../../../../src/components/PayTo/components/PayToComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { SegmentedControl } from '../../internal/SegmentedControl';\nimport { useMemo, useState } from 'preact/hooks';\nimport { SegmentedControlOptions } from '../../internal/SegmentedControl/SegmentedControl';\nimport PayIDInput from './PayIDInput';\nimport BSBInput from './BSBInput';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport { PayToData, PayToPlaceholdersType } from '../types';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport classNames from 'classnames';\nimport { getUniqueId } from '../../../utils/idGenerator';\nimport './PayToComponent.scss';\n\nexport type PayToInputOption = 'payid-option' | 'bsb-option';\n\nexport type PayToComponentData = { selectedInput: PayToInputOption };\n\nexport interface PayToComponentProps {\n showPayButton: boolean;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n data: PayToData;\n placeholders: PayToPlaceholdersType;\n payButton: (props: Partial<PayButtonProps>) => h.JSX.Element;\n}\n\nexport default function PayToComponent(props: PayToComponentProps) {\n const { i18n } = useCoreContext();\n\n const [status, setStatus] = useState<UIElementStatus>('ready');\n\n // Generate unique IDs for the input sections\n const payidInputId = useMemo(() => getUniqueId('payid-input'), []);\n const bsbInputId = useMemo(() => getUniqueId('bsb-input'), []);\n\n const inputOptions: SegmentedControlOptions<PayToInputOption> = useMemo(\n () => [\n {\n value: 'payid-option',\n label: 'PayID',\n id: 'payid-option',\n controls: payidInputId\n },\n {\n value: 'bsb-option',\n label: i18n.get('payto.bsb.option.label'),\n id: 'bsb-option',\n controls: bsbInputId\n }\n ],\n [i18n, payidInputId, bsbInputId]\n );\n\n const defaultOption = inputOptions[0].value;\n const [selectedInput, setSelectedInput] = useState<PayToInputOption>(defaultOption);\n\n const onChange = ({ data, valid, errors, isValid }) => {\n // merge selected input to as data, this keep the input layers untouched\n props.onChange({ data: { selectedInput: selectedInput, ...data }, valid, errors, isValid });\n };\n\n return (\n <div\n className={classNames({\n 'adyen-checkout__payto-component': true,\n 'adyen-checkout__payto-component--loading': status === 'loading'\n })}\n >\n <SegmentedControl selectedValue={selectedInput} options={inputOptions} onChange={setSelectedInput} />\n {selectedInput === 'payid-option' && (\n <PayIDInput\n id={payidInputId}\n status={status}\n setStatus={setStatus}\n setComponentRef={props.setComponentRef}\n onChange={onChange}\n defaultData={props.data}\n placeholders={props.placeholders}\n />\n )}\n {selectedInput === 'bsb-option' && (\n <BSBInput\n id={bsbInputId}\n status={status}\n setStatus={setStatus}\n setComponentRef={props.setComponentRef}\n onChange={onChange}\n defaultData={props.data}\n placeholders={props.placeholders}\n />\n )}\n\n {props.showPayButton && props.payButton({ status, label: i18n.get('continue') })}\n </div>\n );\n}\n"],"names":["PayToComponent","props","i18n","useCoreContext","status","setStatus","useState","payidInputId","useMemo","getUniqueId","bsbInputId","inputOptions","value","label","id","controls","get","defaultOption","selectedInput","setSelectedInput","onChange","data","valid","errors","isValid","h","div","className","classNames","SegmentedControl","selectedValue","options","PayIDInput","setComponentRef","defaultData","placeholders","BSBInput","showPayButton","payButton"],"mappings":"6dA2Be,SAASA,EAAeC,GACnC,MAAMC,KAAEA,GAASC,KAEVC,EAAQC,GAAaC,EAA0B,SAGhDC,EAAeC,EAAQ,IAAMC,EAAY,eAAgB,IACzDC,EAAaF,EAAQ,IAAMC,EAAY,aAAc,IAErDE,EAA0DH,EAC5D,IAAM,CACF,CACII,MAAO,eACPC,MAAO,QACPC,GAAI,eACJC,SAAUR,GAEd,CACIK,MAAO,aACPC,MAAOX,EAAKc,IAAI,0BAChBF,GAAI,aACJC,SAAUL,IAGlB,CAACR,EAAMK,EAAcG,IAGnBO,EAAgBN,EAAa,GAAGC,OAC/BM,EAAeC,GAAoBb,EAA2BW,GAE/DG,EAAW,EAAGC,OAAMC,QAAOC,SAAQC,cAErCvB,EAAMmB,SAAS,CAAEC,KAAM,CAAEH,cAAeA,KAAkBG,GAAQC,QAAOC,SAAQC,aAGrF,OACIC,EAACC,MAAAA,CACGC,UAAWC,EAAW,CAClB,mCAAmC,EACnC,2CAAuD,YAAXxB,KAGhDqB,EAACI,EAAAA,CAAiBC,cAAeZ,EAAea,QAASpB,EAAcS,SAAUD,IAC9D,iBAAlBD,GACGO,EAACO,EAAAA,CACGlB,GAAIP,EACJH,OAAQA,EACRC,UAAWA,EACX4B,gBAAiBhC,EAAMgC,gBACvBb,SAAUA,EACVc,YAAajC,EAAMoB,KACnBc,aAAclC,EAAMkC,eAGT,eAAlBjB,GACGO,EAACW,EAAAA,CACGtB,GAAIJ,EACJN,OAAQA,EACRC,UAAWA,EACX4B,gBAAiBhC,EAAMgC,gBACvBb,SAAUA,EACVc,YAAajC,EAAMoB,KACnBc,aAAclC,EAAMkC,eAI3BlC,EAAMoC,eAAiBpC,EAAMqC,UAAU,CAAElC,SAAQS,MAAOX,EAAKc,IAAI,cAG9E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import"../../internal/QRLoader/QRLoader.js";import{QRImage as o}from"../../internal/QRLoader/components/QRImage.js";import{QRProgressbar as r}from"../../internal/QRLoader/components/QRProgressbar.js";import{QRCountdown as a}from"../../internal/QRLoader/components/QRCountdown.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import{QRCodeCopyButton as n}from"../../internal/QRLoader/components/QRCodeCopyButton.js";import{useQRLoaderDetails as i}from"../../internal/QRLoader/QRLoaderDetailsProvider.js";import d from"../../internal/FormFields/Field/Field.js";import l from"../../internal/FormFields/InputText.js";const
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import"../../internal/QRLoader/QRLoader.js";import{QRImage as o}from"../../internal/QRLoader/components/QRImage.js";import{QRProgressbar as r}from"../../internal/QRLoader/components/QRProgressbar.js";import{QRCountdown as a}from"../../internal/QRLoader/components/QRCountdown.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import{QRCodeCopyButton as n}from"../../internal/QRLoader/components/QRCodeCopyButton.js";import{useQRLoaderDetails as i}from"../../internal/QRLoader/QRLoaderDetailsProvider.js";import d from"../../internal/FormFields/Field/Field.js";import l from"../../internal/FormFields/InputText.js";import{TxVariants as m}from"../../tx-variants.js";const p=()=>{const{i18n:p}=t(),{qrCodeData:s,qrCodeImage:c,percentage:_,timeToPay:x,onTick:L,countdownTime:Q,onQRCodeLoad:R,onTimeUp:u,handleCopy:y}=i();return e("div",{className:"adyen-checkout__qr-loader--pix__qr_details"},e(o,{type:m.pix,src:c,onLoad:R}),e("div",{className:"adyen-checkout__qr-loader--pix__qr_details__timer"},e(r,{percentage:_}),e(a,{countdownTime:Q,timeToPay:x,onTick:L,onCompleted:u})),e(d,{name:"pix-code",useLabelElement:!1},e(l,{className:"adyen-checkout__qr-loader--pix__qr_details__code",value:s,readonly:!0,"aria-label":p.get("pix.code.label")})),e(n,{text:s,copyLabel:p.get("pix.code.copy.label"),copiedLabel:p.get("pix.code.copied.label"),handleCopy:y}))};export{p as default};
|
|
2
2
|
//# sourceMappingURL=PixQRDetails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PixQRDetails.js","sources":["../../../../../src/components/Pix/components/PixQRDetails.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { QRImage, QRProgressbar, QRCountdown, QRCodeCopyButton, useQRLoaderDetails } from '../../internal/QRLoader';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Field from '../../internal/FormFields/Field';\nimport InputText from '../../internal/FormFields/InputText';\n\nconst PixQRDetails = () => {\n const { i18n } = useCoreContext();\n const { qrCodeData, qrCodeImage, percentage, timeToPay, onTick, countdownTime, onQRCodeLoad, onTimeUp, handleCopy } = useQRLoaderDetails();\n\n return (\n <div className=\"adyen-checkout__qr-loader--pix__qr_details\">\n <QRImage src={qrCodeImage} onLoad={onQRCodeLoad} />\n <div className=\"adyen-checkout__qr-loader--pix__qr_details__timer\">\n <QRProgressbar percentage={percentage} />\n <QRCountdown countdownTime={countdownTime} timeToPay={timeToPay} onTick={onTick} onCompleted={onTimeUp} />\n </div>\n <Field name=\"pix-code\" useLabelElement={false}>\n <InputText\n className=\"adyen-checkout__qr-loader--pix__qr_details__code\"\n value={qrCodeData}\n readonly\n aria-label={i18n.get('pix.code.label')}\n />\n </Field>\n <QRCodeCopyButton\n text={qrCodeData}\n copyLabel={i18n.get('pix.code.copy.label')}\n copiedLabel={i18n.get('pix.code.copied.label')}\n handleCopy={handleCopy}\n />\n </div>\n );\n};\n\nexport default PixQRDetails;\n"],"names":["PixQRDetails","i18n","useCoreContext","qrCodeData","qrCodeImage","percentage","timeToPay","onTick","countdownTime","onQRCodeLoad","onTimeUp","handleCopy","useQRLoaderDetails","h","div","className","QRImage","src","onLoad","QRProgressbar","QRCountdown","onCompleted","Field","name","useLabelElement","InputText","value","readonly","aria-label","get","QRCodeCopyButton","text","copyLabel","copiedLabel"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PixQRDetails.js","sources":["../../../../../src/components/Pix/components/PixQRDetails.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { QRImage, QRProgressbar, QRCountdown, QRCodeCopyButton, useQRLoaderDetails } from '../../internal/QRLoader';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Field from '../../internal/FormFields/Field';\nimport InputText from '../../internal/FormFields/InputText';\nimport { TxVariants } from '../../tx-variants';\n\nconst PixQRDetails = () => {\n const { i18n } = useCoreContext();\n const { qrCodeData, qrCodeImage, percentage, timeToPay, onTick, countdownTime, onQRCodeLoad, onTimeUp, handleCopy } = useQRLoaderDetails();\n\n return (\n <div className=\"adyen-checkout__qr-loader--pix__qr_details\">\n <QRImage type={TxVariants.pix} src={qrCodeImage} onLoad={onQRCodeLoad} />\n <div className=\"adyen-checkout__qr-loader--pix__qr_details__timer\">\n <QRProgressbar percentage={percentage} />\n <QRCountdown countdownTime={countdownTime} timeToPay={timeToPay} onTick={onTick} onCompleted={onTimeUp} />\n </div>\n <Field name=\"pix-code\" useLabelElement={false}>\n <InputText\n className=\"adyen-checkout__qr-loader--pix__qr_details__code\"\n value={qrCodeData}\n readonly\n aria-label={i18n.get('pix.code.label')}\n />\n </Field>\n <QRCodeCopyButton\n text={qrCodeData}\n copyLabel={i18n.get('pix.code.copy.label')}\n copiedLabel={i18n.get('pix.code.copied.label')}\n handleCopy={handleCopy}\n />\n </div>\n );\n};\n\nexport default PixQRDetails;\n"],"names":["PixQRDetails","i18n","useCoreContext","qrCodeData","qrCodeImage","percentage","timeToPay","onTick","countdownTime","onQRCodeLoad","onTimeUp","handleCopy","useQRLoaderDetails","h","div","className","QRImage","type","TxVariants","pix","src","onLoad","QRProgressbar","QRCountdown","onCompleted","Field","name","useLabelElement","InputText","value","readonly","aria-label","get","QRCodeCopyButton","text","copyLabel","copiedLabel"],"mappings":"yvBAOA,MAAMA,EAAe,KACjB,MAAMC,KAAEA,GAASC,KACXC,WAAEA,EAAUC,YAAEA,EAAWC,WAAEA,EAAUC,UAAEA,EAASC,OAAEA,EAAMC,cAAEA,EAAaC,aAAEA,EAAYC,SAAEA,EAAQC,WAAEA,GAAeC,IAEtH,OACIC,EAACC,MAAAA,CAAIC,UAAU,8CACXF,EAACG,EAAAA,CAAQC,KAAMC,EAAWC,IAAKC,IAAKhB,EAAaiB,OAAQZ,IACzDI,EAACC,MAAAA,CAAIC,UAAU,qDACXF,EAACS,EAAAA,CAAcjB,WAAYA,IAC3BQ,EAACU,EAAAA,CAAYf,cAAeA,EAAeF,UAAWA,EAAWC,OAAQA,EAAQiB,YAAad,KAElGG,EAACY,EAAAA,CAAMC,KAAK,WAAWC,iBAAiB,GACpCd,EAACe,EAAAA,CACGb,UAAU,mDACVc,MAAO1B,EACP2B,UAAAA,EACAC,aAAY9B,EAAK+B,IAAI,qBAG7BnB,EAACoB,EAAAA,CACGC,KAAM/B,EACNgC,UAAWlC,EAAK+B,IAAI,uBACpBI,YAAanC,EAAK+B,IAAI,yBACtBrB,WAAYA"}
|