@paykka/card-checkout-ui 0.13.16 → 0.14.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/card-checkout-ui.js +54 -26
- package/dist/card-checkout-ui.umd.cjs +54 -26
- package/dist/es/api/modules/boost/index.js +5 -16
- package/dist/es/api/modules/gcash/index.js +5 -16
- package/dist/es/api/modules/get-browser-params.js +1 -4
- package/dist/es/api/modules/grab-pay/index.js +5 -16
- package/dist/es/api/modules/line-pay/index.js +5 -16
- package/dist/es/api/modules/may-bank-qr-pay/index.js +5 -16
- package/dist/es/api/modules/nine-pay/index.js +5 -16
- package/dist/es/api/modules/opay-wallet/index.js +5 -16
- package/dist/es/api/modules/paga-wallet/index.js +5 -16
- package/dist/es/api/modules/paymaya/index.js +5 -16
- package/dist/es/api/modules/shopee-pay/index.js +5 -16
- package/dist/es/api/modules/threeDS/index.js +16 -2
- package/dist/es/api/modules/tng-wallet/index.js +5 -16
- package/dist/es/api/modules/wallet/index.js +16 -0
- package/dist/es/api/modules/zalopay/index.js +5 -16
- package/dist/es/api/utils/index.js +2 -1
- package/dist/es/components/AccordionItem/AccordionItem.js +0 -2
- package/dist/es/components/AddressField/index.js +95 -85
- package/dist/es/components/AliPay/index.js +88 -76
- package/dist/es/components/ApplePay/index.js +61 -43
- package/dist/es/components/CPFField/index.js +2 -1
- package/dist/es/components/Card/index.js +182 -143
- package/dist/es/components/CardExpireDateField/index.js +2 -1
- package/dist/es/components/CardNo/index.js +2 -2
- package/dist/es/components/CardNumberField/index.js +2 -1
- package/dist/es/components/CardSecurityCodeField/index.js +2 -1
- package/dist/es/components/CardSelector/index.js +3 -2
- package/dist/es/components/DropIn/index.js +98 -31
- package/dist/es/components/GooglePay/index.js +190 -151
- package/dist/es/components/GuideCard/index.js +8 -1
- package/dist/es/components/PaymentButton/index.js +58 -0
- package/dist/es/components/RecurringTip/index.js +3 -3
- package/dist/es/components/SecuredFieldsProvider/index.js +81 -17
- package/dist/es/components/SecuredIframe/index.js +120 -52
- package/dist/es/components/Sepa/index.js +23 -25
- package/dist/es/components/SubmitButton/index.js +1 -1
- package/dist/es/components/ThreeDS/index.js +34 -15
- package/dist/es/components/WechatPay/index.js +94 -83
- package/dist/es/components/business/BlikCodeField/BlikCodeField.js +92 -0
- package/dist/es/components/business/BlikCodeField/blik-code-field.js +1 -0
- package/dist/es/components/business/BlikCodeField/index.js +13 -0
- package/dist/es/components/business/BlikConfirmModal/BlikConfirmModal.js +45 -0
- package/dist/es/components/business/BlikConfirmModal/blik-confirm-modal.js +1 -0
- package/dist/es/components/business/BlikConfirmModal/index.js +9 -0
- package/dist/es/components/business/BlikConfirmModal/type.js +1 -0
- package/dist/es/components/business/NameField/NameField.js +51 -0
- package/dist/es/components/business/NameField/index.js +11 -0
- package/dist/es/components/business/NameField/type.js +1 -0
- package/dist/es/components/business/PhoneField/PhoneField.js +125 -0
- package/dist/es/components/business/PhoneField/config.js +33 -0
- package/dist/es/components/business/PhoneField/index.js +14 -0
- package/dist/es/components/business/PhoneField/phone-field.js +1 -0
- package/dist/es/components/business/PhoneField/type.js +1 -0
- package/dist/es/components/business/SegmentedDigitInput/SegmentedDigitInput.js +80 -0
- package/dist/es/components/business/SegmentedDigitInput/format.js +26 -0
- package/dist/es/components/business/SegmentedDigitInput/index.js +5 -0
- package/dist/es/components/business/Tooltip/Tooltip.js +18 -0
- package/dist/es/components/business/Tooltip/index.js +6 -0
- package/dist/es/components/business/Tooltip/tooltip2.js +1 -0
- package/dist/es/components/business/index.js +14 -0
- package/dist/es/components/index.js +14 -7
- package/dist/es/components/internal/CheckBox/CheckBox.js +2 -2
- package/dist/es/components/internal/Input/Input.js +1 -1
- package/dist/es/components/internal/Select/Select.js +7 -1
- package/dist/es/components/internal/icons/IconArrowDown.js +4 -4
- package/dist/es/components/internal/icons/IconBancontact.js +95 -0
- package/dist/es/components/internal/icons/IconBlik.js +567 -0
- package/dist/es/components/internal/icons/IconIdeal.js +86 -0
- package/dist/es/components/internal/icons/IconOvo.js +47 -0
- package/dist/es/components/internal/icons/IconP24.js +40 -0
- package/dist/es/components/internal/icons/IconPhone.js +56 -0
- package/dist/es/components/internal/icons/IconSkrill.js +38 -0
- package/dist/es/components/internal/icons/IconTrustly.js +37 -0
- package/dist/es/components/wallets/Bancontact/Bancontact.js +201 -0
- package/dist/es/components/wallets/Bancontact/bancontact2.js +1 -0
- package/dist/es/components/wallets/Bancontact/index.js +1 -0
- package/dist/es/components/wallets/Bancontact/type.js +1 -0
- package/dist/es/components/wallets/Blik/Blik.js +232 -0
- package/dist/es/components/wallets/Blik/blik2.js +1 -0
- package/dist/es/components/wallets/Blik/index.js +1 -0
- package/dist/es/components/wallets/Blik/type.js +1 -0
- package/dist/es/components/wallets/Boost/Boost.js +183 -0
- package/dist/es/components/wallets/Boost/boost2.js +1 -0
- package/dist/es/components/wallets/Boost/index.js +1 -0
- package/dist/es/components/wallets/Boost/type.js +1 -0
- package/dist/es/components/wallets/GCash/GCash.js +74 -252
- package/dist/es/components/wallets/GrabPay/GrabPay.js +183 -0
- package/dist/es/components/wallets/GrabPay/grab-pay.js +1 -0
- package/dist/es/components/wallets/GrabPay/index.js +1 -0
- package/dist/es/components/wallets/GrabPay/type.js +1 -0
- package/dist/es/components/wallets/IDeal/IDeal.js +201 -0
- package/dist/es/components/wallets/IDeal/ideal2.js +1 -0
- package/dist/es/components/wallets/IDeal/index.js +1 -0
- package/dist/es/components/wallets/IDeal/type.js +1 -0
- package/dist/es/components/wallets/LinePay/LinePay.js +183 -0
- package/dist/es/components/wallets/LinePay/index.js +1 -0
- package/dist/es/components/wallets/LinePay/line-pay.js +1 -0
- package/dist/es/components/wallets/LinePay/type.js +1 -0
- package/dist/es/components/wallets/MayBankQRPay/MayBankQRPay.js +187 -0
- package/dist/es/components/wallets/MayBankQRPay/index.js +1 -0
- package/dist/es/components/wallets/MayBankQRPay/may-bank-qr-pay.js +1 -0
- package/dist/es/components/wallets/MayBankQRPay/type.js +1 -0
- package/dist/es/components/wallets/NinePay/NinePay.js +185 -0
- package/dist/es/components/wallets/NinePay/index.js +1 -0
- package/dist/es/components/wallets/NinePay/nine-pay.js +1 -0
- package/dist/es/components/wallets/NinePay/type.js +1 -0
- package/dist/es/components/wallets/OVO/OVO.js +200 -0
- package/dist/es/components/wallets/OVO/index.js +1 -0
- package/dist/es/components/wallets/OVO/ovo2.js +1 -0
- package/dist/es/components/wallets/OVO/type.js +1 -0
- package/dist/es/components/wallets/OpayWallet/OpayWallet.js +57 -218
- package/dist/es/components/wallets/P24/P24.js +198 -0
- package/dist/es/components/wallets/P24/index.js +1 -0
- package/dist/es/components/wallets/P24/p242.js +1 -0
- package/dist/es/components/wallets/P24/type.js +1 -0
- package/dist/es/components/wallets/PagaWallet/PagaWallet.js +57 -218
- package/dist/es/components/wallets/Paymaya/Paymaya.js +57 -221
- package/dist/es/components/wallets/PicPay/PicPay.js +64 -55
- package/dist/es/components/wallets/Pix/Pix.js +58 -56
- package/dist/es/components/wallets/ShopeePay/ShopeePay.js +185 -0
- package/dist/es/components/wallets/ShopeePay/index.js +1 -0
- package/dist/es/components/wallets/ShopeePay/shopee-pay.js +1 -0
- package/dist/es/components/wallets/ShopeePay/type.js +1 -0
- package/dist/es/components/wallets/Skrill/Skrill.js +200 -0
- package/dist/es/components/wallets/Skrill/index.js +1 -0
- package/dist/es/components/wallets/Skrill/skrill2.js +1 -0
- package/dist/es/components/wallets/Skrill/type.js +1 -0
- package/dist/es/components/wallets/TNGWallet/TNGWallet.js +185 -0
- package/dist/es/components/wallets/TNGWallet/index.js +1 -0
- package/dist/es/components/wallets/TNGWallet/tng-wallet.js +1 -0
- package/dist/es/components/wallets/TNGWallet/type.js +1 -0
- package/dist/es/components/wallets/Trustly/Trustly.js +226 -0
- package/dist/es/components/wallets/Trustly/index.js +1 -0
- package/dist/es/components/wallets/Trustly/trustly2.js +1 -0
- package/dist/es/components/wallets/Trustly/type.js +1 -0
- package/dist/es/components/wallets/Vietqr/Vietqr.js +73 -242
- package/dist/es/components/wallets/Zalopay/Zalopay.js +73 -242
- package/dist/es/components/wallets/index.js +14 -0
- package/dist/es/constant.js +48 -2
- package/dist/es/core/address.js +7 -6
- package/dist/es/core/checkout.js +93 -41
- package/dist/es/core/create-child.js +68 -0
- package/dist/es/core/environment.js +23 -1
- package/dist/es/core/error.js +15 -2
- package/dist/es/core/logger.js +106 -0
- package/dist/es/core/payment.js +65 -0
- package/dist/es/fe-logger.min.js +1 -0
- package/dist/es/hooks/useBaseWallet.js +280 -0
- package/dist/es/hooks/usePayState.js +37 -25
- package/dist/es/hooks/usePayment.js +1 -14
- package/dist/es/hooks/useRetry.js +50 -26
- package/dist/es/i18n/locales/de-DE.js +24 -0
- package/dist/es/i18n/locales/en-GB.js +24 -0
- package/dist/es/i18n/locales/es-ES.js +24 -0
- package/dist/es/i18n/locales/fr-FR.js +24 -0
- package/dist/es/i18n/locales/ja-JP.js +24 -0
- package/dist/es/i18n/locales/ko-KR.js +24 -0
- package/dist/es/i18n/locales/nl-NL.js +24 -0
- package/dist/es/i18n/locales/pt-PT.js +24 -0
- package/dist/es/i18n/locales/ru-RU.js +24 -0
- package/dist/es/i18n/locales/zh-CN.js +24 -0
- package/dist/es/i18n/locales/zh-HK.js +24 -0
- package/dist/es/i18n/locales/zh-TW.js +24 -0
- package/dist/es/index.js +23 -8
- package/dist/es/out/base-fraud-detection.js +4 -1
- package/dist/es/out/config.js +10 -4
- package/dist/es/out/fraud-detection.js +12 -13
- package/dist/es/out/worldpay-ddc-manager.js +7 -14
- package/dist/es/out/worldpay-ddc.js +7 -5
- package/dist/es/polyfill.js +166 -0
- package/dist/es/style.css +1 -1
- package/dist/es/types/event.js +12 -3
- package/dist/es/types/message.js +3 -0
- package/dist/es/utils/iframe.js +1 -1
- package/dist/es/utils/location.js +0 -8
- package/dist/es/utils/payment.js +12 -12
- package/dist/es/utils/redirect.js +4 -5
- package/dist/es/utils/system-info/is-ua-webview.js +1 -20
- package/dist/fe-logger.min.js +1 -0
- package/dist/polyfill.js +166 -0
- package/dist/style.css +1 -1
- package/dist/types/api/modules/index.d.ts +1 -0
- package/dist/types/api/modules/threeDS/index.d.ts +7 -0
- package/dist/types/api/modules/type.d.ts +2 -0
- package/dist/types/api/modules/wallet/index.d.ts +18 -0
- package/dist/types/api/utils/index.d.ts +1 -0
- package/dist/types/components/AddressField/index.d.ts +1 -0
- package/dist/types/components/AddressField/type.d.ts +17 -2
- package/dist/types/components/AddressField/utils.d.ts +22 -0
- package/dist/types/components/AliPay/type.d.ts +11 -15
- package/dist/types/components/ApplePay/type.d.ts +5 -28
- package/dist/types/components/CPFField/type.d.ts +1 -1
- package/dist/types/components/Card/type.d.ts +22 -23
- package/dist/types/components/CardExpireDateField/type.d.ts +1 -1
- package/dist/types/components/CardNo/type.d.ts +3 -2
- package/dist/types/components/CardNumberField/type.d.ts +1 -1
- package/dist/types/components/CardSecurityCodeField/type.d.ts +1 -1
- package/dist/types/components/CardSelector/type.d.ts +4 -4
- package/dist/types/components/DropIn/type.d.ts +10 -22
- package/dist/types/components/GooglePay/createGooglePay.d.ts +4 -4
- package/dist/types/components/GooglePay/type.d.ts +10 -14
- package/dist/types/components/PaymentButton/PaymentButton.d.ts +3 -0
- package/dist/types/components/PaymentButton/index.d.ts +2 -0
- package/dist/types/components/PaymentButton/type.d.ts +13 -0
- package/dist/types/components/RecurringTip/RecurringTip.d.ts +1 -1
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +7 -1
- package/dist/types/components/SecuredIframe/HiddenIframe.d.ts +5 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +0 -6
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +2 -0
- package/dist/types/components/WechatPay/type.d.ts +11 -15
- package/dist/types/components/business/BlikCodeField/BlikCodeField.d.ts +6 -0
- package/dist/types/components/business/BlikCodeField/index.d.ts +2 -0
- package/dist/types/components/business/BlikCodeField/type.d.ts +9 -0
- package/dist/types/components/business/BlikConfirmModal/BlikConfirmModal.d.ts +6 -0
- package/dist/types/components/business/BlikConfirmModal/index.d.ts +2 -0
- package/dist/types/components/business/BlikConfirmModal/type.d.ts +8 -0
- package/dist/types/components/business/NameField/NameField.d.ts +5 -0
- package/dist/types/components/business/NameField/index.d.ts +2 -0
- package/dist/types/components/business/NameField/type.d.ts +7 -0
- package/dist/types/components/business/PhoneField/PhoneField.d.ts +6 -0
- package/dist/types/components/business/PhoneField/config.d.ts +22 -0
- package/dist/types/components/business/PhoneField/index.d.ts +2 -0
- package/dist/types/components/business/PhoneField/type.d.ts +9 -0
- package/dist/types/components/business/SegmentedDigitInput/SegmentedDigitInput.d.ts +5 -0
- package/dist/types/components/business/SegmentedDigitInput/format.d.ts +5 -0
- package/dist/types/components/business/SegmentedDigitInput/index.d.ts +3 -0
- package/dist/types/components/business/SegmentedDigitInput/type.d.ts +13 -0
- package/dist/types/components/business/Tooltip/Tooltip.d.ts +11 -0
- package/dist/types/components/business/Tooltip/index.d.ts +1 -0
- package/dist/types/components/business/index.d.ts +6 -0
- package/dist/types/components/index.d.ts +0 -7
- package/dist/types/components/internal/CheckBox/type.d.ts +2 -1
- package/dist/types/components/internal/Form/type.d.ts +2 -1
- package/dist/types/components/internal/Select/type.d.ts +1 -1
- package/dist/types/components/internal/icons/IconArrowDown.d.ts +1 -1
- package/dist/types/components/internal/icons/IconBancontact.d.ts +2 -0
- package/dist/types/components/internal/icons/IconBlik.d.ts +2 -0
- package/dist/types/components/internal/icons/IconIdeal.d.ts +2 -0
- package/dist/types/components/internal/icons/IconOvo.d.ts +2 -0
- package/dist/types/components/internal/icons/IconP24.d.ts +2 -0
- package/dist/types/components/internal/icons/IconPhone.d.ts +2 -0
- package/dist/types/components/internal/icons/IconSkrill.d.ts +2 -0
- package/dist/types/components/internal/icons/IconTrustly.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +8 -0
- package/dist/types/components/type.d.ts +0 -0
- package/dist/types/components/wallets/Bancontact/Bancontact.d.ts +15 -0
- package/dist/types/components/wallets/Bancontact/index.d.ts +2 -0
- package/dist/types/components/{GrabPay → wallets/Bancontact}/type.d.ts +8 -18
- package/dist/types/components/wallets/Blik/Blik.d.ts +15 -0
- package/dist/types/components/wallets/Blik/index.d.ts +2 -0
- package/dist/types/components/wallets/Blik/type.d.ts +29 -0
- package/dist/types/components/{Boost → wallets/Boost}/Boost.d.ts +9 -4
- package/dist/types/components/{Boost → wallets/Boost}/type.d.ts +3 -14
- package/dist/types/components/wallets/GCash/GCash.d.ts +5 -0
- package/dist/types/components/wallets/GCash/type.d.ts +3 -14
- package/dist/types/components/{GrabPay → wallets/GrabPay}/GrabPay.d.ts +4 -4
- package/dist/types/components/wallets/GrabPay/type.d.ts +17 -0
- package/dist/types/components/wallets/IDeal/IDeal.d.ts +15 -0
- package/dist/types/components/wallets/IDeal/index.d.ts +2 -0
- package/dist/types/components/wallets/IDeal/type.d.ts +29 -0
- package/dist/types/components/{LinePay → wallets/LinePay}/LinePay.d.ts +9 -4
- package/dist/types/components/{LinePay → wallets/LinePay}/type.d.ts +3 -14
- package/dist/types/components/wallets/MayBankQRPay/MayBankQRPay.d.ts +15 -0
- package/dist/types/components/{MayBankQRPay → wallets/MayBankQRPay}/type.d.ts +3 -14
- package/dist/types/components/wallets/NinePay/NinePay.d.ts +15 -0
- package/dist/types/components/{NinePay → wallets/NinePay}/type.d.ts +3 -14
- package/dist/types/components/wallets/OVO/OVO.d.ts +15 -0
- package/dist/types/components/wallets/OVO/index.d.ts +2 -0
- package/dist/types/components/wallets/OVO/type.d.ts +29 -0
- package/dist/types/components/wallets/OpayWallet/OpayWallet.d.ts +5 -0
- package/dist/types/components/wallets/OpayWallet/type.d.ts +4 -15
- package/dist/types/components/wallets/P24/P24.d.ts +15 -0
- package/dist/types/components/wallets/P24/index.d.ts +2 -0
- package/dist/types/components/wallets/P24/type.d.ts +29 -0
- package/dist/types/components/wallets/PagaWallet/PagaWallet.d.ts +5 -0
- package/dist/types/components/wallets/PagaWallet/type.d.ts +5 -16
- package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +5 -0
- package/dist/types/components/wallets/Paymaya/type.d.ts +3 -14
- package/dist/types/components/wallets/PicPay/type.d.ts +5 -16
- package/dist/types/components/wallets/Pix/type.d.ts +5 -16
- package/dist/types/components/{ShopeePay → wallets/ShopeePay}/ShopeePay.d.ts +9 -4
- package/dist/types/components/{ShopeePay → wallets/ShopeePay}/type.d.ts +3 -14
- package/dist/types/components/wallets/Skrill/Skrill.d.ts +15 -0
- package/dist/types/components/wallets/Skrill/index.d.ts +2 -0
- package/dist/types/components/wallets/Skrill/type.d.ts +17 -0
- package/dist/types/components/{TNGWallet → wallets/TNGWallet}/TNGWallet.d.ts +9 -4
- package/dist/types/components/{TNGWallet → wallets/TNGWallet}/type.d.ts +3 -14
- package/dist/types/components/wallets/Trustly/Trustly.d.ts +15 -0
- package/dist/types/components/wallets/Trustly/index.d.ts +2 -0
- package/dist/types/components/wallets/Trustly/type.d.ts +21 -0
- package/dist/types/components/wallets/Vietqr/Vietqr.d.ts +5 -0
- package/dist/types/components/wallets/Vietqr/type.d.ts +3 -14
- package/dist/types/components/wallets/Zalopay/Zalopay.d.ts +5 -0
- package/dist/types/components/wallets/Zalopay/type.d.ts +3 -14
- package/dist/types/components/wallets/index.d.ts +14 -0
- package/dist/types/components/wallets/type.d.ts +18 -4
- package/dist/types/constant.d.ts +15 -1
- package/dist/types/core/address.d.ts +2 -5
- package/dist/types/core/checkout.d.ts +10 -10
- package/dist/types/core/create-child.d.ts +1 -0
- package/dist/types/core/environment.d.ts +5 -0
- package/dist/types/core/error.d.ts +9 -3
- package/dist/types/core/index.d.ts +2 -0
- package/dist/types/core/logger.d.ts +55 -0
- package/dist/types/core/payment.d.ts +21 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useBaseWallet.d.ts +54 -0
- package/dist/types/hooks/usePayState.d.ts +3 -1
- package/dist/types/hooks/useRetry.console-tests.d.ts +41 -0
- package/dist/types/hooks/useRetry.d.ts +22 -3
- package/dist/types/i18n/locales/de-DE.d.ts +23 -0
- package/dist/types/i18n/locales/en-GB.d.ts +23 -0
- package/dist/types/i18n/locales/es-ES.d.ts +23 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +23 -0
- package/dist/types/i18n/locales/ja-JP.d.ts +23 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +23 -0
- package/dist/types/i18n/locales/nl-NL.d.ts +23 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +23 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +23 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +23 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +23 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +23 -0
- package/dist/types/out/base-fraud-detection.d.ts +1 -0
- package/dist/types/out/config.d.ts +6 -1
- package/dist/types/out/fraud-detection.d.ts +2 -8
- package/dist/types/out/types.d.ts +3 -1
- package/dist/types/out/worldpay-ddc-manager.d.ts +6 -7
- package/dist/types/types/event.d.ts +46 -13
- package/dist/types/types/index.d.ts +8 -37
- package/dist/types/types/message.d.ts +48 -7
- package/dist/types/types/payment.d.ts +63 -0
- package/dist/types/utils/app-payment.d.ts +7 -3
- package/dist/types/utils/behavior-tracker.d.ts +36 -0
- package/dist/types/utils/env.d.ts +37 -0
- package/dist/types/utils/iframe.d.ts +1 -1
- package/dist/types/utils/payment.d.ts +10 -10
- package/package.json +12 -5
- package/dist/es/components/Boost/index.js +0 -348
- package/dist/es/components/GrabPay/index.js +0 -348
- package/dist/es/components/LinePay/index.js +0 -348
- package/dist/es/components/MayBankQRPay/index.js +0 -354
- package/dist/es/components/NinePay/index.js +0 -348
- package/dist/es/components/ShopeePay/index.js +0 -348
- package/dist/es/components/TNGWallet/index.js +0 -348
- package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +0 -10
- package/dist/types/components/NinePay/NinePay.d.ts +0 -10
- package/dist/types/utils/logger.d.ts +0 -14
- /package/dist/types/components/{Boost → wallets/Boost}/index.d.ts +0 -0
- /package/dist/types/components/{GrabPay → wallets/GrabPay}/index.d.ts +0 -0
- /package/dist/types/components/{LinePay → wallets/LinePay}/index.d.ts +0 -0
- /package/dist/types/components/{MayBankQRPay → wallets/MayBankQRPay}/index.d.ts +0 -0
- /package/dist/types/components/{NinePay → wallets/NinePay}/index.d.ts +0 -0
- /package/dist/types/components/{ShopeePay → wallets/ShopeePay}/index.d.ts +0 -0
- /package/dist/types/components/{TNGWallet → wallets/TNGWallet}/index.d.ts +0 -0
|
@@ -6,12 +6,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import "../../utils/card-brand/brands.js";
|
|
8
8
|
import "../../utils/system-info/get-browser-info.js";
|
|
9
|
-
import { w, A,
|
|
9
|
+
import { w, A, y, F, q, u } from "../../core.js";
|
|
10
10
|
import { SessionMode } from "../../constant.js";
|
|
11
11
|
import { cdnUrl, cdnOrigin, apiUrl, apiPrefix } from "../../config.js";
|
|
12
12
|
import { MessageAction } from "../../types/message.js";
|
|
13
|
+
import { SecurityIframeEventType } from "../../types/event.js";
|
|
13
14
|
import { createIframe, postMessageToIframe } from "../../utils/iframe.js";
|
|
14
15
|
import { safeParse } from "../../utils/index.js";
|
|
16
|
+
import { PayKKaError, EPayKKaError } from "../../core/error.js";
|
|
15
17
|
var EFieldType = /* @__PURE__ */ ((EFieldType2) => {
|
|
16
18
|
EFieldType2["CARD_NUMBER"] = "CARD_NUMBER";
|
|
17
19
|
EFieldType2["CVV"] = "CVV";
|
|
@@ -57,6 +59,11 @@ class SecuredField {
|
|
|
57
59
|
}
|
|
58
60
|
/** 表单区域iframe加载回调 */
|
|
59
61
|
onFieldIframeLoad() {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
(_b = (_a = this.config).onEvent) == null ? void 0 : _b.call(_a, SecurityIframeEventType.SECURITY_IFRAME_LOADED, {
|
|
64
|
+
fieldType: this.config.fieldType,
|
|
65
|
+
url: this.iframe.src
|
|
66
|
+
});
|
|
60
67
|
this.iframeWindow = this.iframe.contentWindow;
|
|
61
68
|
const { fieldType, placeholder, style, hiddenIframeName, supportedCardBrands, checkoutId } = this.config;
|
|
62
69
|
const data = {
|
|
@@ -77,7 +84,7 @@ class SecuredField {
|
|
|
77
84
|
}
|
|
78
85
|
}
|
|
79
86
|
const SecuredFieldsProvider = w((props, ref) => {
|
|
80
|
-
const { sessionMode, i18n, targetElement, checkoutId } = props;
|
|
87
|
+
const { sessionMode, i18n, targetElement, checkoutId, onEvent, core, disabled = false } = props;
|
|
81
88
|
const rootNodeRef = A(null);
|
|
82
89
|
const hiddenIframe = A(null);
|
|
83
90
|
const payment = (formData, extraParams) => {
|
|
@@ -90,6 +97,23 @@ const SecuredFieldsProvider = w((props, ref) => {
|
|
|
90
97
|
};
|
|
91
98
|
postMessageToIframe(data, hiddenIframe.current.contentWindow, cdnOrigin);
|
|
92
99
|
};
|
|
100
|
+
const sendSetConfigMessage = (iframeWindow) => {
|
|
101
|
+
console.log("disabled", disabled, iframeWindow);
|
|
102
|
+
const data = {
|
|
103
|
+
action: MessageAction.SET_CONFIG,
|
|
104
|
+
checkoutId,
|
|
105
|
+
disabled
|
|
106
|
+
};
|
|
107
|
+
postMessageToIframe(data, iframeWindow, cdnOrigin);
|
|
108
|
+
};
|
|
109
|
+
y(() => {
|
|
110
|
+
Object.values(securedFieldMap.current).forEach((field) => {
|
|
111
|
+
var _a;
|
|
112
|
+
if ((_a = field == null ? void 0 : field.iframe) == null ? void 0 : _a.contentWindow) {
|
|
113
|
+
sendSetConfigMessage(field.iframe.contentWindow);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}, [disabled]);
|
|
93
117
|
F(ref, () => ({
|
|
94
118
|
payment,
|
|
95
119
|
reload: () => {
|
|
@@ -147,7 +171,8 @@ const SecuredFieldsProvider = w((props, ref) => {
|
|
|
147
171
|
};
|
|
148
172
|
const initHiddenIframe = async () => {
|
|
149
173
|
const iframeEl = createIframe(`${cdnUrl}/secured-iframe.html`);
|
|
150
|
-
|
|
174
|
+
const hiddenIframeName = `${HIDDEN_IFRAME_NAME}-${checkoutId}-${Date.now()}`;
|
|
175
|
+
iframeEl.name = hiddenIframeName;
|
|
151
176
|
iframeEl.width = "0";
|
|
152
177
|
iframeEl.height = "0";
|
|
153
178
|
iframeEl.style.border = "none";
|
|
@@ -161,6 +186,10 @@ const SecuredFieldsProvider = w((props, ref) => {
|
|
|
161
186
|
apiPrefix
|
|
162
187
|
};
|
|
163
188
|
iframeEl.addEventListener("load", () => {
|
|
189
|
+
onEvent == null ? void 0 : onEvent(SecurityIframeEventType.SECURITY_IFRAME_LOADED, {
|
|
190
|
+
hidden: true,
|
|
191
|
+
url: iframeEl.src
|
|
192
|
+
});
|
|
164
193
|
postMessageToIframe(data, hiddenIframe.current.contentWindow, cdnOrigin);
|
|
165
194
|
});
|
|
166
195
|
window.document.body.appendChild(iframeEl);
|
|
@@ -186,7 +215,8 @@ const SecuredFieldsProvider = w((props, ref) => {
|
|
|
186
215
|
onPaymentError: props.onPaymentError,
|
|
187
216
|
onPaymentTimeout: props.onPaymentTimeout,
|
|
188
217
|
onValidStatusChanged: props.onValidStatusChanged,
|
|
189
|
-
checkoutId
|
|
218
|
+
checkoutId,
|
|
219
|
+
onEvent: props.onEvent
|
|
190
220
|
});
|
|
191
221
|
});
|
|
192
222
|
};
|
|
@@ -199,7 +229,7 @@ const SecuredFieldsProvider = w((props, ref) => {
|
|
|
199
229
|
return isFieldIframe || isHiddenIframe;
|
|
200
230
|
};
|
|
201
231
|
const onReceiveMessage = q((event) => {
|
|
202
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
232
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
203
233
|
const { data, origin, source } = event;
|
|
204
234
|
if (origin !== cdnOrigin) {
|
|
205
235
|
return;
|
|
@@ -225,33 +255,67 @@ const SecuredFieldsProvider = w((props, ref) => {
|
|
|
225
255
|
case MessageAction.BRAND:
|
|
226
256
|
(_c = props.onBrand) == null ? void 0 : _c.call(props, feedbackData);
|
|
227
257
|
break;
|
|
228
|
-
case MessageAction.AFTER_PAYMENT:
|
|
229
|
-
|
|
258
|
+
case MessageAction.AFTER_PAYMENT: {
|
|
259
|
+
const data2 = feedbackData;
|
|
260
|
+
(_d = core == null ? void 0 : core.logger) == null ? void 0 : _d.reportRequestEvent({
|
|
261
|
+
api: data2.api,
|
|
262
|
+
time: data2.time,
|
|
263
|
+
success: true
|
|
264
|
+
});
|
|
265
|
+
(_e = props.onAfterPayment) == null ? void 0 : _e.call(props, data2);
|
|
230
266
|
break;
|
|
231
|
-
|
|
232
|
-
|
|
267
|
+
}
|
|
268
|
+
case MessageAction.PAYMENT_ERROR: {
|
|
269
|
+
const data2 = feedbackData;
|
|
270
|
+
(_f = core == null ? void 0 : core.logger) == null ? void 0 : _f.reportRequestEvent({
|
|
271
|
+
api: data2.api,
|
|
272
|
+
time: data2.time,
|
|
273
|
+
success: false,
|
|
274
|
+
code: data2.error.code,
|
|
275
|
+
msg: data2.error.message
|
|
276
|
+
});
|
|
277
|
+
(_g = props.onPaymentError) == null ? void 0 : _g.call(props, data2);
|
|
233
278
|
break;
|
|
234
|
-
|
|
235
|
-
|
|
279
|
+
}
|
|
280
|
+
case MessageAction.PAYMENT_TIMEOUT: {
|
|
281
|
+
const data2 = feedbackData;
|
|
282
|
+
(_h = core == null ? void 0 : core.logger) == null ? void 0 : _h.reportRequestEvent({
|
|
283
|
+
api: data2.api,
|
|
284
|
+
time: data2.time,
|
|
285
|
+
success: false
|
|
286
|
+
});
|
|
287
|
+
(_i = props.onPaymentTimeout) == null ? void 0 : _i.call(props, feedbackData);
|
|
236
288
|
break;
|
|
289
|
+
}
|
|
237
290
|
case MessageAction.VALID_STATUS_CHANGED:
|
|
238
|
-
(
|
|
291
|
+
(_j = props.onValidStatusChanged) == null ? void 0 : _j.call(props, feedbackData);
|
|
239
292
|
break;
|
|
240
293
|
case MessageAction.AUTHORIZED:
|
|
241
|
-
(
|
|
294
|
+
(_k = props.onAuthorized) == null ? void 0 : _k.call(props, feedbackData);
|
|
242
295
|
break;
|
|
243
296
|
case MessageAction.ACTIVATED:
|
|
244
|
-
(
|
|
297
|
+
(_l = props.onActivated) == null ? void 0 : _l.call(props, feedbackData);
|
|
298
|
+
sendSetConfigMessage(source);
|
|
299
|
+
break;
|
|
300
|
+
case MessageAction.HIDDEN_IFRAME_READY:
|
|
301
|
+
(_m = props.onHiddenIframeReady) == null ? void 0 : _m.call(props, feedbackData);
|
|
245
302
|
break;
|
|
246
303
|
case MessageAction.CARD_ENCRYPTED:
|
|
247
|
-
(
|
|
304
|
+
(_n = props.onCardEncrypted) == null ? void 0 : _n.call(props, feedbackData);
|
|
248
305
|
break;
|
|
249
306
|
case MessageAction.CARD_ENCRYPTION_FAILED:
|
|
250
|
-
(
|
|
307
|
+
(_o = props.onCardEncryptionFailed) == null ? void 0 : _o.call(props, feedbackData);
|
|
251
308
|
break;
|
|
252
309
|
case MessageAction.VALIDATED:
|
|
253
|
-
(
|
|
310
|
+
(_p = props.onValidated) == null ? void 0 : _p.call(props, feedbackData);
|
|
254
311
|
break;
|
|
312
|
+
case MessageAction.IFRAME_ERROR: {
|
|
313
|
+
const data2 = feedbackData;
|
|
314
|
+
(_s = core == null ? void 0 : core.logger) == null ? void 0 : _s.reportErrorEvent(
|
|
315
|
+
new PayKKaError(EPayKKaError.ERROR, (_q = data2.error) == null ? void 0 : _q.message, { cause: (_r = data2.error) == null ? void 0 : _r.stack })
|
|
316
|
+
);
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
255
319
|
}
|
|
256
320
|
}, []);
|
|
257
321
|
return /* @__PURE__ */ u("div", { ref: rootNodeRef, children: !targetElement && props.children });
|
|
@@ -6,7 +6,7 @@ import { CNPJ_FULL_LENGTH, formatCPFOnInsert, CPF_FULL_LENGTH } from "../../util
|
|
|
6
6
|
import { getSupportedCardBrands, getSupportedCardBrandsLengths, findCardBrand } from "../../utils/card-brand/index.js";
|
|
7
7
|
import { limitedToNumber, trimAll } from "../../utils/format.js";
|
|
8
8
|
import { isUndefined, isNil } from "../../utils/is.js";
|
|
9
|
-
import { cdnOrigin, setApiUrl, setCDNUrl, setApiPrefix } from "../../config.js";
|
|
9
|
+
import { cdnOrigin, apiUrl, apiPrefix, setApiUrl, setCDNUrl, setApiPrefix } from "../../config.js";
|
|
10
10
|
import { MessageAction } from "../../types/message.js";
|
|
11
11
|
import { generateClassNameMap, style2String, createPlaceholderStyle, loadStyle } from "../../utils/style.js";
|
|
12
12
|
import { postMessageToIframe } from "../../utils/iframe.js";
|
|
@@ -199,6 +199,7 @@ const FieldIframe = (props) => {
|
|
|
199
199
|
const inputRef = A(null);
|
|
200
200
|
const { initSecuredInput, getConfigByFieldType, getCurrCardBrand, cardBin, value, brand } = useSecuredInput();
|
|
201
201
|
const [hasInit, setHasInit] = h(false);
|
|
202
|
+
const [disabled, setDisabled] = h(false);
|
|
202
203
|
const inputId = "securedInput";
|
|
203
204
|
const initInput = () => {
|
|
204
205
|
initSecuredInput({
|
|
@@ -281,7 +282,6 @@ const FieldIframe = (props) => {
|
|
|
281
282
|
if (!Reflect.has(feedbackData, "action")) {
|
|
282
283
|
return;
|
|
283
284
|
}
|
|
284
|
-
console.log(feedbackData, checkoutId);
|
|
285
285
|
if (feedbackData.checkoutId !== checkoutId) {
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
@@ -295,6 +295,11 @@ const FieldIframe = (props) => {
|
|
|
295
295
|
processValidStatusChanged("error", error);
|
|
296
296
|
sendValidateMessage("error");
|
|
297
297
|
}
|
|
298
|
+
} else if (feedbackData.action === MessageAction.SET_CONFIG) {
|
|
299
|
+
const data2 = feedbackData;
|
|
300
|
+
if (data2.disabled !== void 0) {
|
|
301
|
+
setDisabled(data2.disabled);
|
|
302
|
+
}
|
|
298
303
|
}
|
|
299
304
|
};
|
|
300
305
|
y(() => {
|
|
@@ -368,9 +373,8 @@ const FieldIframe = (props) => {
|
|
|
368
373
|
checkoutId
|
|
369
374
|
};
|
|
370
375
|
postMessageToIframe(validData, window.parent);
|
|
371
|
-
if (status !== "success")
|
|
376
|
+
if (status !== "success")
|
|
372
377
|
return;
|
|
373
|
-
}
|
|
374
378
|
sendValidWithValueMessage();
|
|
375
379
|
};
|
|
376
380
|
const sendValidWithValueMessage = () => {
|
|
@@ -406,10 +410,11 @@ const FieldIframe = (props) => {
|
|
|
406
410
|
ref: inputRef,
|
|
407
411
|
placeholder: props.placeholder,
|
|
408
412
|
autocomplete: "off",
|
|
409
|
-
disabled: !hasInit
|
|
413
|
+
disabled: !hasInit || disabled
|
|
410
414
|
}
|
|
411
415
|
);
|
|
412
416
|
};
|
|
417
|
+
const bkApi = (path) => `${apiUrl}/bk${path}`;
|
|
413
418
|
const HiddenIframe = ({ checkoutId }) => {
|
|
414
419
|
const formData = {
|
|
415
420
|
expYear: "",
|
|
@@ -419,115 +424,140 @@ const HiddenIframe = ({ checkoutId }) => {
|
|
|
419
424
|
cpf: void 0
|
|
420
425
|
};
|
|
421
426
|
const onReceiveMessage = async (event) => {
|
|
422
|
-
const { data } = event;
|
|
423
|
-
const
|
|
424
|
-
if (!Reflect.has(
|
|
427
|
+
const { data, origin } = event;
|
|
428
|
+
const feedbackData = safeParse(data);
|
|
429
|
+
if (!Reflect.has(feedbackData, "action"))
|
|
425
430
|
return;
|
|
426
|
-
|
|
427
|
-
console.log(parsedData, checkoutId);
|
|
428
|
-
if (parsedData.checkoutId !== checkoutId) {
|
|
431
|
+
if (feedbackData.checkoutId !== checkoutId)
|
|
429
432
|
return;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
switch (feedbackData.fieldType) {
|
|
433
|
+
if (feedbackData.action === MessageAction.VALID_WITH_VALUE) {
|
|
434
|
+
const data2 = feedbackData;
|
|
435
|
+
switch (data2.fieldType) {
|
|
434
436
|
case EFieldType.CVV: {
|
|
435
|
-
formData.cvv =
|
|
437
|
+
formData.cvv = data2.value;
|
|
436
438
|
break;
|
|
437
439
|
}
|
|
438
440
|
case EFieldType.CARD_NUMBER: {
|
|
439
|
-
formData.cardNo = trimAll(
|
|
441
|
+
formData.cardNo = trimAll(data2.value);
|
|
440
442
|
break;
|
|
441
443
|
}
|
|
442
444
|
case EFieldType.EXPIRE_DATE: {
|
|
443
|
-
const [expMonth, expYear] =
|
|
445
|
+
const [expMonth, expYear] = data2.value.split("/");
|
|
444
446
|
formData.expMonth = expMonth;
|
|
445
447
|
formData.expYear = `20${expYear}`;
|
|
446
448
|
break;
|
|
447
449
|
}
|
|
448
450
|
case EInternalFieldType.CPF: {
|
|
449
|
-
formData.cpf = limitedToNumber(trimAll(
|
|
451
|
+
formData.cpf = limitedToNumber(trimAll(data2.value));
|
|
450
452
|
break;
|
|
451
453
|
}
|
|
452
454
|
}
|
|
453
|
-
} else if (
|
|
454
|
-
const
|
|
455
|
-
pay(
|
|
456
|
-
} else if (
|
|
457
|
-
const
|
|
455
|
+
} else if (feedbackData.action === MessageAction.PAYMENT) {
|
|
456
|
+
const data2 = feedbackData;
|
|
457
|
+
pay(data2.formData, data2.locale, data2.extraParams);
|
|
458
|
+
} else if (feedbackData.action === MessageAction.ENCRYPT_CARD) {
|
|
459
|
+
const data2 = feedbackData;
|
|
458
460
|
try {
|
|
459
|
-
const res = await encryptCard({ ...
|
|
461
|
+
const res = await encryptCard({ ...data2, ...formData });
|
|
460
462
|
sendCardEncryptedMessage(res);
|
|
461
463
|
} catch (error) {
|
|
462
464
|
console.log("error", error);
|
|
463
465
|
sendCardEncryptionFailedMessage(error);
|
|
464
466
|
}
|
|
465
|
-
}
|
|
467
|
+
} else if (feedbackData.action === MessageAction.DDC_CARD_BIN) {
|
|
468
|
+
if (origin !== cdnOrigin)
|
|
469
|
+
return;
|
|
470
|
+
sendDDCCardBinMessage(event.source);
|
|
471
|
+
} else
|
|
472
|
+
;
|
|
466
473
|
};
|
|
467
474
|
y(() => {
|
|
468
|
-
console.log("hidden iframe 加载完成");
|
|
469
475
|
window.addEventListener("message", onReceiveMessage);
|
|
470
476
|
}, []);
|
|
471
477
|
const pay = (params, locale, extraParams) => {
|
|
478
|
+
const requestInfo = {
|
|
479
|
+
api: bkApi(`${apiPrefix}/payments`),
|
|
480
|
+
startTime: performance.now()
|
|
481
|
+
};
|
|
472
482
|
const paymentMethod = params.payment.paymentMethod;
|
|
473
483
|
const payMap = {
|
|
474
484
|
[PaymentMethod.PIX]: pixPay,
|
|
475
485
|
[PaymentMethod.PIC_PAY]: picPay
|
|
476
486
|
};
|
|
477
487
|
const payFn = payMap[paymentMethod] || cardPay;
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
payment
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
expMonth: formData.expMonth
|
|
487
|
-
},
|
|
488
|
-
customer: {
|
|
489
|
-
document: formData.cpf
|
|
490
|
-
}
|
|
488
|
+
const data = {
|
|
489
|
+
...params,
|
|
490
|
+
payment: {
|
|
491
|
+
...params.payment,
|
|
492
|
+
cvv: formData.cvv,
|
|
493
|
+
cardNo: formData.cardNo,
|
|
494
|
+
expYear: formData.expYear,
|
|
495
|
+
expMonth: formData.expMonth
|
|
491
496
|
},
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
497
|
+
customer: {
|
|
498
|
+
document: formData.cpf
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
payFn(data, extraParams, { locale }).then((res) => {
|
|
502
|
+
sendAfterPaymentMessage(res, requestInfo);
|
|
503
|
+
}).catch((error) => {
|
|
495
504
|
if (isTimeoutError(error)) {
|
|
496
|
-
sendPaymentTimeoutMessage();
|
|
505
|
+
sendPaymentTimeoutMessage(requestInfo);
|
|
497
506
|
} else {
|
|
498
|
-
sendPaymentErrorMessage(error);
|
|
507
|
+
sendPaymentErrorMessage(error, requestInfo);
|
|
499
508
|
}
|
|
500
509
|
});
|
|
501
510
|
};
|
|
502
|
-
const
|
|
511
|
+
const sendDDCCardBinMessage = (target) => {
|
|
512
|
+
const data = {
|
|
513
|
+
action: MessageAction.DDC_CARD_BIN,
|
|
514
|
+
checkoutId,
|
|
515
|
+
bin: limitedToNumber(formData.cardNo).slice(0, 9)
|
|
516
|
+
};
|
|
517
|
+
postMessageToIframe(data, target);
|
|
518
|
+
};
|
|
519
|
+
const sendAfterPaymentMessage = (response, requestInfo) => {
|
|
503
520
|
const data = {
|
|
504
521
|
action: MessageAction.AFTER_PAYMENT,
|
|
505
522
|
checkoutId,
|
|
506
|
-
response
|
|
523
|
+
response,
|
|
524
|
+
api: requestInfo.api,
|
|
525
|
+
code: "200",
|
|
526
|
+
success: true,
|
|
527
|
+
time: Math.round(performance.now() - requestInfo.startTime)
|
|
507
528
|
};
|
|
508
529
|
postMessageToIframe(data, window.parent);
|
|
509
530
|
};
|
|
510
|
-
const sendPaymentErrorMessage = (error) => {
|
|
531
|
+
const sendPaymentErrorMessage = (error, requestInfo) => {
|
|
511
532
|
const data = {
|
|
512
533
|
action: MessageAction.PAYMENT_ERROR,
|
|
513
534
|
checkoutId,
|
|
514
535
|
error: {
|
|
515
536
|
message: error.message,
|
|
516
537
|
code: error.code
|
|
517
|
-
}
|
|
538
|
+
},
|
|
539
|
+
code: error.code,
|
|
540
|
+
api: requestInfo.api,
|
|
541
|
+
success: false,
|
|
542
|
+
time: Math.round(performance.now() - requestInfo.startTime)
|
|
518
543
|
};
|
|
519
544
|
postMessageToIframe(data, window.parent);
|
|
520
545
|
};
|
|
521
|
-
const sendPaymentTimeoutMessage = () => {
|
|
546
|
+
const sendPaymentTimeoutMessage = (requestInfo) => {
|
|
522
547
|
const data = {
|
|
523
548
|
action: MessageAction.PAYMENT_TIMEOUT,
|
|
524
|
-
checkoutId
|
|
549
|
+
checkoutId,
|
|
550
|
+
api: requestInfo.api,
|
|
551
|
+
message: "timeout",
|
|
552
|
+
success: false,
|
|
553
|
+
time: Math.round(performance.now() - requestInfo.startTime)
|
|
525
554
|
};
|
|
526
555
|
postMessageToIframe(data, window.parent);
|
|
527
556
|
};
|
|
528
557
|
const sendHiddenIframeReadyMessage = () => {
|
|
529
558
|
const data = {
|
|
530
559
|
action: MessageAction.HIDDEN_IFRAME_READY,
|
|
560
|
+
name: window.name,
|
|
531
561
|
checkoutId
|
|
532
562
|
};
|
|
533
563
|
postMessageToIframe(data, window.parent);
|
|
@@ -564,7 +594,6 @@ const SecuredIframe = () => {
|
|
|
564
594
|
if (!Reflect.has(feedbackData, "action")) {
|
|
565
595
|
return;
|
|
566
596
|
}
|
|
567
|
-
console.log(feedbackData, checkoutId.current);
|
|
568
597
|
if (feedbackData.action === MessageAction.INIT) {
|
|
569
598
|
checkoutId.current = feedbackData.checkoutId;
|
|
570
599
|
setHidden(feedbackData.hidden);
|
|
@@ -584,6 +613,45 @@ const SecuredIframe = () => {
|
|
|
584
613
|
return;
|
|
585
614
|
};
|
|
586
615
|
window.addEventListener("message", onReceiveMessage);
|
|
616
|
+
const sendIframeErrorMessage = (error) => {
|
|
617
|
+
const data = {
|
|
618
|
+
fieldType: fieldIframeConfig == null ? void 0 : fieldIframeConfig.fieldType,
|
|
619
|
+
action: MessageAction.IFRAME_ERROR,
|
|
620
|
+
checkoutId: checkoutId.current,
|
|
621
|
+
error: {
|
|
622
|
+
message: error.message,
|
|
623
|
+
code: error.code,
|
|
624
|
+
stack: error.stack
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
postMessageToIframe(data, window.parent);
|
|
628
|
+
};
|
|
629
|
+
y(() => {
|
|
630
|
+
const onError = (event) => {
|
|
631
|
+
var _a;
|
|
632
|
+
sendIframeErrorMessage({
|
|
633
|
+
message: event.message,
|
|
634
|
+
stack: (_a = event.error) == null ? void 0 : _a.stack
|
|
635
|
+
});
|
|
636
|
+
};
|
|
637
|
+
const onRejection = (event) => {
|
|
638
|
+
const r = event.reason;
|
|
639
|
+
const message = r instanceof Error ? r.message : typeof r === "object" && r && "message" in r ? String(r == null ? void 0 : r.message) : String(r);
|
|
640
|
+
const code = typeof r === "object" && r && "code" in r ? String(r.code) : void 0;
|
|
641
|
+
const stack = r instanceof Error ? r.stack : void 0;
|
|
642
|
+
sendIframeErrorMessage({
|
|
643
|
+
message,
|
|
644
|
+
code,
|
|
645
|
+
stack
|
|
646
|
+
});
|
|
647
|
+
};
|
|
648
|
+
window.addEventListener("error", onError);
|
|
649
|
+
window.addEventListener("unhandledrejection", onRejection);
|
|
650
|
+
return () => {
|
|
651
|
+
window.removeEventListener("error", onError);
|
|
652
|
+
window.removeEventListener("unhandledrejection", onRejection);
|
|
653
|
+
};
|
|
654
|
+
}, []);
|
|
587
655
|
return /* @__PURE__ */ u(b, { children: hasInit && (hidden ? /* @__PURE__ */ u(HiddenIframe, { checkoutId: checkoutId.current }) : /* @__PURE__ */ u(FieldIframe, { ...fieldIframeConfig, checkoutId: checkoutId.current })) });
|
|
588
656
|
};
|
|
589
657
|
export {
|
|
@@ -26,7 +26,6 @@ import { AccountNameField } from "../AccountNameField/index.js";
|
|
|
26
26
|
const { bem } = useBEM("sepa");
|
|
27
27
|
const fieldClassNames = bem("field");
|
|
28
28
|
const Sepa = w((props, ref) => {
|
|
29
|
-
var _a, _b;
|
|
30
29
|
const { session, core } = props;
|
|
31
30
|
const addressCore = core.getAddressCore();
|
|
32
31
|
let emailState = createEmailCore();
|
|
@@ -56,28 +55,28 @@ const Sepa = w((props, ref) => {
|
|
|
56
55
|
const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
|
|
57
56
|
F(ref, () => ({
|
|
58
57
|
updateAddress: () => {
|
|
59
|
-
var
|
|
58
|
+
var _a;
|
|
60
59
|
if (!requiredBill)
|
|
61
60
|
return;
|
|
62
61
|
setForm(Object.assign(form, { address: addressCore.getAddressState() }));
|
|
63
|
-
(
|
|
62
|
+
(_a = addressFieldRef.current) == null ? void 0 : _a.update(addressCore.getAddressState());
|
|
64
63
|
},
|
|
65
64
|
updateEmail: () => {
|
|
66
|
-
var
|
|
65
|
+
var _a;
|
|
67
66
|
setForm(Object.assign(form, { email: emailState.email }));
|
|
68
67
|
form.email = emailState.email;
|
|
69
|
-
(
|
|
68
|
+
(_a = emailFieldRef.current) == null ? void 0 : _a.update(emailState.email);
|
|
70
69
|
validateForm();
|
|
71
70
|
}
|
|
72
71
|
}));
|
|
73
72
|
const processOnSuccess = (res) => {
|
|
74
|
-
var
|
|
73
|
+
var _a, _b;
|
|
75
74
|
setSubmitButtonStatus("success");
|
|
76
|
-
(
|
|
75
|
+
(_b = props.onSuccess) == null ? void 0 : _b.call(
|
|
77
76
|
props,
|
|
78
77
|
formatPaymentResult({
|
|
79
78
|
...res,
|
|
80
|
-
returnUrl: (
|
|
79
|
+
returnUrl: (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.returnUrl
|
|
81
80
|
})
|
|
82
81
|
);
|
|
83
82
|
};
|
|
@@ -96,8 +95,8 @@ const Sepa = w((props, ref) => {
|
|
|
96
95
|
});
|
|
97
96
|
}, []);
|
|
98
97
|
const Button = () => {
|
|
99
|
-
var
|
|
100
|
-
const transAmount = (
|
|
98
|
+
var _a;
|
|
99
|
+
const transAmount = (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount;
|
|
101
100
|
const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
|
|
102
101
|
const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
|
|
103
102
|
return /* @__PURE__ */ u(
|
|
@@ -114,8 +113,8 @@ const Sepa = w((props, ref) => {
|
|
|
114
113
|
);
|
|
115
114
|
};
|
|
116
115
|
const validateForm = () => {
|
|
117
|
-
var
|
|
118
|
-
(
|
|
116
|
+
var _a;
|
|
117
|
+
(_a = formRef.current) == null ? void 0 : _a.validate(void 0, false).then(() => {
|
|
119
118
|
setValidated(true);
|
|
120
119
|
}).catch(() => {
|
|
121
120
|
setValidated(false);
|
|
@@ -129,12 +128,12 @@ const Sepa = w((props, ref) => {
|
|
|
129
128
|
validateForm();
|
|
130
129
|
}, [form]);
|
|
131
130
|
async function onSubmit() {
|
|
132
|
-
var
|
|
131
|
+
var _a;
|
|
133
132
|
setErrorMsg("");
|
|
134
|
-
(
|
|
135
|
-
var
|
|
133
|
+
(_a = formRef.current) == null ? void 0 : _a.validate(async (errors) => {
|
|
134
|
+
var _a2;
|
|
136
135
|
requiredBill && addressCore.setValidateAllFields(true);
|
|
137
|
-
(
|
|
136
|
+
(_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, errors);
|
|
138
137
|
if (errors) {
|
|
139
138
|
setSubmitButtonStatus("unSubmit");
|
|
140
139
|
return;
|
|
@@ -146,10 +145,10 @@ const Sepa = w((props, ref) => {
|
|
|
146
145
|
}
|
|
147
146
|
const onTimeout = q(
|
|
148
147
|
(message) => {
|
|
149
|
-
var
|
|
148
|
+
var _a;
|
|
150
149
|
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
151
150
|
setSubmitButtonStatus("unSubmit");
|
|
152
|
-
(
|
|
151
|
+
(_a = props.onTimeout) == null ? void 0 : _a.call(props);
|
|
153
152
|
},
|
|
154
153
|
[i18n, props.onTimeout]
|
|
155
154
|
);
|
|
@@ -184,12 +183,12 @@ const Sepa = w((props, ref) => {
|
|
|
184
183
|
};
|
|
185
184
|
};
|
|
186
185
|
async function pay(search = false, timeout) {
|
|
187
|
-
var
|
|
186
|
+
var _a, _b, _c, _d, _e;
|
|
188
187
|
try {
|
|
189
188
|
const requestOptions = { locale: i18n.locale, timeout };
|
|
190
189
|
let res = null;
|
|
191
190
|
if (search) {
|
|
192
|
-
const extraParams = (
|
|
191
|
+
const extraParams = (_b = (_a = core.config)._getExtraParams) == null ? void 0 : _b.call(_a, "query", PaymentMethod.SEPA_DEBIT);
|
|
193
192
|
res = await getSepaPayInfo(
|
|
194
193
|
{
|
|
195
194
|
sessionId: session.sessionId,
|
|
@@ -222,7 +221,7 @@ const Sepa = w((props, ref) => {
|
|
|
222
221
|
}
|
|
223
222
|
}
|
|
224
223
|
const processAfterPayment = (res, search = false) => {
|
|
225
|
-
var
|
|
224
|
+
var _a, _b, _c;
|
|
226
225
|
const { status, orderStatus, errorMessage, errorCode, sessionId } = res;
|
|
227
226
|
sessionId && (session.sessionId = sessionId);
|
|
228
227
|
if (status === "PROCESSING") {
|
|
@@ -241,10 +240,10 @@ const Sepa = w((props, ref) => {
|
|
|
241
240
|
} else if (orderStatus === "FAILURE") {
|
|
242
241
|
errorMessage && setErrorMsg(errorMessage);
|
|
243
242
|
setSubmitButtonStatus("unSubmit");
|
|
244
|
-
(
|
|
243
|
+
(_a = props.onError) == null ? void 0 : _a.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
245
244
|
} else if (orderStatus === "AUTHORIZED") {
|
|
246
245
|
setSubmitButtonStatus("unSubmit");
|
|
247
|
-
(
|
|
246
|
+
(_b = props.onAuthorized) == null ? void 0 : _b.call(props);
|
|
248
247
|
}
|
|
249
248
|
return { end: true };
|
|
250
249
|
} else if (status === "SUCCESS") {
|
|
@@ -282,8 +281,7 @@ const Sepa = w((props, ref) => {
|
|
|
282
281
|
{
|
|
283
282
|
ref: addressFieldRef,
|
|
284
283
|
value: form.address,
|
|
285
|
-
|
|
286
|
-
onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
284
|
+
onChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
287
285
|
}
|
|
288
286
|
) }),
|
|
289
287
|
!!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }),
|
|
@@ -51,7 +51,7 @@ const SubmitButton = (props) => {
|
|
|
51
51
|
className: normalizedClass(bem({ success: status === "success" }), className),
|
|
52
52
|
style,
|
|
53
53
|
loading: status === "loading",
|
|
54
|
-
disabled: props.disabled || status === "success",
|
|
54
|
+
disabled: (props.disabled || status === "success") && status !== "loading",
|
|
55
55
|
children: /* @__PURE__ */ u("span", { class: bem("text", { "not-verified": !props.verified }), children: content })
|
|
56
56
|
}
|
|
57
57
|
);
|