@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
|
@@ -9,6 +9,7 @@ import { useBEM } from "../../hooks/useBEM.js";
|
|
|
9
9
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
10
10
|
import { safeParse } from "../../utils/index.js";
|
|
11
11
|
import { cdnOrigin } from "../../config.js";
|
|
12
|
+
import { noticeThreeDSOperate, ThreeDSAuthOperate } from "../../api/modules/threeDS/index.js";
|
|
12
13
|
import { MessageAction } from "../../types/message.js";
|
|
13
14
|
import { ThreeDSEventType } from "../../types/event.js";
|
|
14
15
|
import { useBreakpoints } from "../../hooks/useBreakpoints.js";
|
|
@@ -28,62 +29,80 @@ const ThreeDSAuth = (props) => {
|
|
|
28
29
|
checkoutId
|
|
29
30
|
} = props;
|
|
30
31
|
const breakpoints = useBreakpoints();
|
|
31
|
-
const [
|
|
32
|
+
const [continueThreeDS, setContinueThreeDS] = h(false);
|
|
32
33
|
const messageHandler = A();
|
|
33
34
|
const iframeRef = A(null);
|
|
34
35
|
const [iframeName] = h(`${THREE_DS_IFRAME_NAME}-${checkoutId}-${Date.now()}`);
|
|
36
|
+
const innerChannelLoaded = A(false);
|
|
37
|
+
const authId = A(void 0);
|
|
35
38
|
const { i18n } = useI18n();
|
|
36
39
|
const { core } = x(CoreContext) ?? {};
|
|
37
|
-
const
|
|
38
|
-
|
|
40
|
+
const handleLastThreeDS = () => {
|
|
41
|
+
setContinueThreeDS(true);
|
|
39
42
|
};
|
|
40
43
|
const onChange = (status) => {
|
|
41
44
|
var _a, _b;
|
|
42
45
|
if (!status) {
|
|
43
46
|
(_b = (_a = core == null ? void 0 : core.config) == null ? void 0 : _a.onEvent) == null ? void 0 : _b.call(_a, ThreeDSEventType.THREE_DS_CANCELLED);
|
|
44
47
|
onClose == null ? void 0 : onClose();
|
|
48
|
+
console.log("onChange", innerChannelLoaded.current, authId.current);
|
|
49
|
+
if (innerChannelLoaded.current && authId.current) {
|
|
50
|
+
noticeThreeDSOperate(authId.current, ThreeDSAuthOperate.CANCEL);
|
|
51
|
+
}
|
|
45
52
|
}
|
|
46
53
|
};
|
|
47
54
|
const modalWidth = T(() => {
|
|
48
|
-
if (!show)
|
|
55
|
+
if (!show)
|
|
49
56
|
return "0";
|
|
50
|
-
}
|
|
51
57
|
return width || (breakpoints.smaller("sm") ? "90vw" : "600px");
|
|
52
58
|
}, [show, width, breakpoints.matches]);
|
|
53
59
|
y(() => {
|
|
54
|
-
var _a, _b;
|
|
60
|
+
var _a, _b, _c, _d;
|
|
55
61
|
if (show) {
|
|
56
62
|
if (incomplete) {
|
|
57
63
|
(_b = (_a = core == null ? void 0 : core.config) == null ? void 0 : _a.onEvent) == null ? void 0 : _b.call(_a, ThreeDSEventType.THREE_DS_CONTINUE);
|
|
64
|
+
} else {
|
|
65
|
+
(_d = (_c = core == null ? void 0 : core.config) == null ? void 0 : _c.onEvent) == null ? void 0 : _d.call(_c, ThreeDSEventType.THREE_DS_START);
|
|
58
66
|
}
|
|
59
67
|
if (messageHandler.current) {
|
|
60
68
|
window.removeEventListener("message", messageHandler.current);
|
|
61
69
|
}
|
|
62
70
|
messageHandler.current = (event) => {
|
|
63
|
-
var _a2, _b2,
|
|
71
|
+
var _a2, _b2, _c2, _d2, _e, _f;
|
|
64
72
|
const { data, origin } = event;
|
|
65
|
-
if (origin !== cdnOrigin)
|
|
73
|
+
if (origin !== cdnOrigin)
|
|
66
74
|
return;
|
|
67
|
-
}
|
|
68
75
|
const feedbackData = safeParse(data);
|
|
69
76
|
console.log(feedbackData, checkoutId);
|
|
70
|
-
if (feedbackData.checkoutId !== checkoutId)
|
|
77
|
+
if (feedbackData.checkoutId !== checkoutId)
|
|
71
78
|
return;
|
|
72
|
-
}
|
|
73
79
|
switch (feedbackData.action) {
|
|
74
80
|
case MessageAction.CHECK_THREE_DS: {
|
|
75
|
-
|
|
81
|
+
onClose == null ? void 0 : onClose();
|
|
76
82
|
(_b2 = (_a2 = core == null ? void 0 : core.config) == null ? void 0 : _a2.onEvent) == null ? void 0 : _b2.call(_a2, ThreeDSEventType.THREE_DS_END);
|
|
77
83
|
break;
|
|
78
84
|
}
|
|
79
85
|
case MessageAction.THREE_DS_AUTH_LOADED: {
|
|
80
|
-
|
|
86
|
+
const data2 = feedbackData;
|
|
87
|
+
(_d2 = (_c2 = core == null ? void 0 : core.config) == null ? void 0 : _c2.onEvent) == null ? void 0 : _d2.call(_c2, ThreeDSEventType.THREE_DS_AUTH);
|
|
88
|
+
authId.current = data2.authId;
|
|
89
|
+
console.log("认证id", authId.current);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
case MessageAction.THREE_DS_INNER_CHANNEL_LOADED: {
|
|
93
|
+
(_f = (_e = core == null ? void 0 : core.config) == null ? void 0 : _e.onEvent) == null ? void 0 : _f.call(_e, ThreeDSEventType.THREE_DS_INNER_CHANNEL);
|
|
94
|
+
innerChannelLoaded.current = true;
|
|
95
|
+
console.log("innerChannelLoaded", innerChannelLoaded.current, authId.current);
|
|
96
|
+
if (authId.current) {
|
|
97
|
+
noticeThreeDSOperate(authId.current, ThreeDSAuthOperate.OPEN);
|
|
98
|
+
}
|
|
81
99
|
break;
|
|
82
100
|
}
|
|
83
101
|
}
|
|
84
102
|
};
|
|
85
103
|
window.addEventListener("message", messageHandler.current);
|
|
86
104
|
} else {
|
|
105
|
+
innerChannelLoaded.current = false;
|
|
87
106
|
messageHandler.current && window.removeEventListener("message", messageHandler.current);
|
|
88
107
|
}
|
|
89
108
|
}, [show]);
|
|
@@ -99,7 +118,7 @@ const ThreeDSAuth = (props) => {
|
|
|
99
118
|
maxHeight: "calc(100vh - 100px)",
|
|
100
119
|
minWidth: "300px"
|
|
101
120
|
},
|
|
102
|
-
children: /* @__PURE__ */ u("div", { className: bem("content"), children: !incomplete ||
|
|
121
|
+
children: /* @__PURE__ */ u("div", { className: bem("content"), children: !incomplete || continueThreeDS ? /* @__PURE__ */ u(
|
|
103
122
|
"iframe",
|
|
104
123
|
{
|
|
105
124
|
ref: iframeRef,
|
|
@@ -123,7 +142,7 @@ const ThreeDSAuth = (props) => {
|
|
|
123
142
|
backgroundColor: theme == null ? void 0 : theme.payButtonBackgroundColor,
|
|
124
143
|
color: theme == null ? void 0 : theme.payButtonTextColor
|
|
125
144
|
},
|
|
126
|
-
onClick:
|
|
145
|
+
onClick: handleLastThreeDS,
|
|
127
146
|
children: i18n.get("common.confirm")
|
|
128
147
|
}
|
|
129
148
|
) })
|
|
@@ -3,9 +3,9 @@ import { isTimeoutError } from "../../api/http.js";
|
|
|
3
3
|
import "../../utils/card-brand/brands.js";
|
|
4
4
|
import "../../utils/system-info/get-browser-info.js";
|
|
5
5
|
import { normalizedClass, formatAmount } from "../../utils/format.js";
|
|
6
|
-
import { formatPaymentResult } from "../../utils/payment.js";
|
|
6
|
+
import { processPaymentStatus, formatPaymentResult } from "../../utils/payment.js";
|
|
7
7
|
import { getBrowserParams } from "../../api/modules/get-browser-params.js";
|
|
8
|
-
import { COMMON_CLASS_NAME, PaymentType,
|
|
8
|
+
import { PaymentMethod, COMMON_CLASS_NAME, PaymentType, SessionMode } from "../../constant.js";
|
|
9
9
|
import { getWechatPayInfo, wechatPay } from "../../api/modules/wechat-pay/index.js";
|
|
10
10
|
import { CoreContext } from "../../core/context.js";
|
|
11
11
|
import { PayKKaError } from "../../core/error.js";
|
|
@@ -13,7 +13,7 @@ import "../../out/worldpay-jsc-origin.js";
|
|
|
13
13
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
14
14
|
import { usePayState } from "../../hooks/usePayState.js";
|
|
15
15
|
import { useRetry } from "../../hooks/useRetry.js";
|
|
16
|
-
import { AddressField } from "../AddressField/index.js";
|
|
16
|
+
import { DEFAULT_ADDRESS, AddressField } from "../AddressField/index.js";
|
|
17
17
|
import { createEmailCore, EmailField } from "../EmailField/EmailField.js";
|
|
18
18
|
import "../internal/Form/type.js";
|
|
19
19
|
import "../internal/Form/context.js";
|
|
@@ -22,11 +22,12 @@ import { Form } from "../internal/Form/Form.js";
|
|
|
22
22
|
import { Info } from "../internal/Info/Info.js";
|
|
23
23
|
import { RecurringTip } from "../RecurringTip/index.js";
|
|
24
24
|
import { SubmitButton } from "../SubmitButton/index.js";
|
|
25
|
+
const CURR_PAYMENT_METHOD = PaymentMethod.WECHAT_PAY;
|
|
25
26
|
const { bem } = useBEM("wechat-pay");
|
|
26
27
|
const fieldClassNames = bem("field");
|
|
27
28
|
const WechatPay = w((props, ref) => {
|
|
28
29
|
var _a;
|
|
29
|
-
const { session, core, showEmail = false, showAddress = false } = props;
|
|
30
|
+
const { session, core, showEmail = false, showAddress = false, autoQuery = true } = props;
|
|
30
31
|
const addressCore = core.getAddressCore();
|
|
31
32
|
const emailState = createEmailCore();
|
|
32
33
|
const emailFieldRef = A(null);
|
|
@@ -37,56 +38,48 @@ const WechatPay = w((props, ref) => {
|
|
|
37
38
|
},
|
|
38
39
|
startRetry: (timeout) => {
|
|
39
40
|
setSubmitButtonStatus("loading");
|
|
40
|
-
startReFetchPayInfo({
|
|
41
|
-
timeout
|
|
42
|
-
});
|
|
41
|
+
startReFetchPayInfo({ timeout });
|
|
43
42
|
},
|
|
44
43
|
updateAddress: () => {
|
|
45
44
|
var _a2;
|
|
46
45
|
if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
|
|
47
46
|
return;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
(
|
|
51
|
-
|
|
47
|
+
const address = addressCore.getAddressState();
|
|
48
|
+
form.address = address;
|
|
49
|
+
setForm(form);
|
|
50
|
+
(_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(address);
|
|
51
|
+
validateFormSilently();
|
|
52
52
|
},
|
|
53
53
|
updateEmail: () => {
|
|
54
54
|
var _a2;
|
|
55
55
|
if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
|
|
56
56
|
return;
|
|
57
|
-
|
|
58
|
-
setForm(
|
|
57
|
+
form.email = emailState.email;
|
|
58
|
+
setForm(form);
|
|
59
59
|
(_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
|
|
60
|
-
|
|
60
|
+
validateFormSilently();
|
|
61
61
|
}
|
|
62
62
|
}));
|
|
63
|
-
const { setErrorMsg, fraudDetection, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
|
|
63
|
+
const { setErrorMsg, fraudDetection, i18n, errorMsg, sessionReady, disabled } = usePayState(session, props.core);
|
|
64
64
|
const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
|
|
65
65
|
const formRef = A(null);
|
|
66
66
|
const [form, setForm] = h({
|
|
67
67
|
email: "",
|
|
68
|
-
address: {
|
|
69
|
-
country: void 0,
|
|
70
|
-
province: void 0,
|
|
71
|
-
city: void 0,
|
|
72
|
-
area: void 0,
|
|
73
|
-
postCode: void 0,
|
|
74
|
-
address1: void 0,
|
|
75
|
-
address2: void 0
|
|
76
|
-
}
|
|
68
|
+
address: { ...DEFAULT_ADDRESS }
|
|
77
69
|
});
|
|
78
70
|
const [validated, setValidated] = h(false);
|
|
79
71
|
const [fieldStatus, setFieldStatus] = h();
|
|
80
72
|
const addressFieldRef = A(null);
|
|
81
73
|
const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
|
|
82
|
-
|
|
74
|
+
const getPaymentMethodContext = () => {
|
|
75
|
+
return {
|
|
76
|
+
paymentMethod: CURR_PAYMENT_METHOD
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
const validateFormSilently = () => {
|
|
83
80
|
var _a2;
|
|
84
|
-
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() =>
|
|
85
|
-
|
|
86
|
-
}).catch(() => {
|
|
87
|
-
setValidated(false);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
81
|
+
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => setValidated(true)).catch(() => setValidated(false));
|
|
82
|
+
};
|
|
90
83
|
const initFieldStatus = () => {
|
|
91
84
|
const { field, sessionMode } = session.checkout;
|
|
92
85
|
const { email, address } = field;
|
|
@@ -101,25 +94,24 @@ const WechatPay = w((props, ref) => {
|
|
|
101
94
|
setFieldStatus({ ...field });
|
|
102
95
|
};
|
|
103
96
|
y(() => {
|
|
104
|
-
|
|
97
|
+
validateFormSilently();
|
|
105
98
|
}, [form]);
|
|
106
99
|
const processOnSuccess = (res) => {
|
|
107
100
|
var _a2, _b;
|
|
108
101
|
setSubmitButtonStatus("success");
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
})
|
|
115
|
-
);
|
|
102
|
+
const result = formatPaymentResult({
|
|
103
|
+
...res,
|
|
104
|
+
returnUrl: (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.returnUrl
|
|
105
|
+
});
|
|
106
|
+
(_b = props.onSuccess) == null ? void 0 : _b.call(props, result, getPaymentMethodContext());
|
|
116
107
|
};
|
|
117
108
|
y(() => {
|
|
109
|
+
var _a2;
|
|
118
110
|
if (!sessionReady) {
|
|
119
111
|
return;
|
|
120
112
|
}
|
|
121
113
|
const { bill = {}, supportMethods = [], country } = (session == null ? void 0 : session.checkout) || {};
|
|
122
|
-
if (!supportMethods.includes(
|
|
114
|
+
if (!supportMethods.includes(CURR_PAYMENT_METHOD)) {
|
|
123
115
|
return;
|
|
124
116
|
}
|
|
125
117
|
initFieldStatus();
|
|
@@ -127,13 +119,18 @@ const WechatPay = w((props, ref) => {
|
|
|
127
119
|
country && addressCore.setCountry(country);
|
|
128
120
|
form.email = bill.email ?? "";
|
|
129
121
|
form.address.country = country;
|
|
122
|
+
if (autoQuery && ((_a2 = core.payment) == null ? void 0 : _a2.currPaymentMethod.value) === CURR_PAYMENT_METHOD) {
|
|
123
|
+
setSubmitButtonStatus("loading");
|
|
124
|
+
startReFetchPayInfo();
|
|
125
|
+
}
|
|
130
126
|
}, [sessionReady]);
|
|
131
127
|
const onTimeout = q(
|
|
132
128
|
(message) => {
|
|
133
129
|
var _a2;
|
|
130
|
+
core.payment.resetCurrPaymentMethod();
|
|
134
131
|
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
135
132
|
setSubmitButtonStatus("unSubmit");
|
|
136
|
-
(_a2 = props.onTimeout) == null ? void 0 : _a2.call(props, "retry");
|
|
133
|
+
(_a2 = props.onTimeout) == null ? void 0 : _a2.call(props, "retry", getPaymentMethodContext());
|
|
137
134
|
},
|
|
138
135
|
[i18n, props.onTimeout]
|
|
139
136
|
);
|
|
@@ -163,7 +160,7 @@ const WechatPay = w((props, ref) => {
|
|
|
163
160
|
},
|
|
164
161
|
channelUserId: await ((_a2 = props.onGetOpenId) == null ? void 0 : _a2.call(props)),
|
|
165
162
|
payment: {
|
|
166
|
-
paymentMethod:
|
|
163
|
+
paymentMethod: CURR_PAYMENT_METHOD
|
|
167
164
|
},
|
|
168
165
|
browser: await getBrowserParams({
|
|
169
166
|
fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
|
|
@@ -171,61 +168,70 @@ const WechatPay = w((props, ref) => {
|
|
|
171
168
|
};
|
|
172
169
|
};
|
|
173
170
|
async function pay(search = false, timeout) {
|
|
174
|
-
var _a2, _b, _c, _d, _e, _f
|
|
171
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
175
172
|
try {
|
|
173
|
+
core.payment.currPaymentMethod.value = CURR_PAYMENT_METHOD;
|
|
176
174
|
const requestOptions = { locale: i18n.locale, timeout };
|
|
177
175
|
let res = null;
|
|
178
176
|
if (search) {
|
|
179
|
-
const extraParams = (_b = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b.call(_a2, "query",
|
|
177
|
+
const extraParams = (_b = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b.call(_a2, "query", CURR_PAYMENT_METHOD);
|
|
180
178
|
res = await getWechatPayInfo(
|
|
181
179
|
{
|
|
182
180
|
sessionId: session.sessionId,
|
|
183
181
|
clientKey: session.clientKey,
|
|
184
|
-
paymentMethod:
|
|
182
|
+
paymentMethod: CURR_PAYMENT_METHOD
|
|
185
183
|
},
|
|
186
184
|
extraParams,
|
|
187
185
|
requestOptions
|
|
188
186
|
);
|
|
189
187
|
} else {
|
|
190
|
-
const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment",
|
|
188
|
+
const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", CURR_PAYMENT_METHOD);
|
|
191
189
|
res = await wechatPay(await getPaymentParams(), extraParams, requestOptions);
|
|
192
190
|
}
|
|
193
|
-
const {
|
|
191
|
+
const { errorMessage, payInfo, errorCode, sessionId } = res;
|
|
194
192
|
sessionId && (session.sessionId = sessionId);
|
|
195
|
-
!search && ((_e = props.onSubmitResponse) == null ? void 0 : _e.call(props, res));
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
} else if (orderStatus === "SUCCESS") {
|
|
201
|
-
processOnSuccess(res);
|
|
202
|
-
return { end: true };
|
|
203
|
-
} else if (orderStatus === "FAILURE") {
|
|
204
|
-
errorMessage && setErrorMsg(errorMessage);
|
|
205
|
-
setSubmitButtonStatus("unSubmit");
|
|
206
|
-
(_f = props.onError) == null ? void 0 : _f.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
207
|
-
return { end: true };
|
|
208
|
-
} else if (orderStatus === "PROCESSING") {
|
|
193
|
+
!search && ((_e = props.onSubmitResponse) == null ? void 0 : _e.call(props, res, getPaymentMethodContext()));
|
|
194
|
+
let end = true;
|
|
195
|
+
await processPaymentStatus(res, {
|
|
196
|
+
onProcessing: async () => {
|
|
197
|
+
var _a3;
|
|
209
198
|
if (!search) {
|
|
210
|
-
await ((
|
|
199
|
+
await ((_a3 = props.onCallWxPayBox) == null ? void 0 : _a3.call(props, payInfo));
|
|
211
200
|
startReFetchPayInfo();
|
|
212
201
|
}
|
|
213
|
-
|
|
214
|
-
}
|
|
202
|
+
end = false;
|
|
203
|
+
},
|
|
204
|
+
onSuccess: () => {
|
|
205
|
+
processOnSuccess(res);
|
|
206
|
+
},
|
|
207
|
+
onFailure: () => {
|
|
208
|
+
var _a3;
|
|
209
|
+
core.payment.resetCurrPaymentMethod();
|
|
210
|
+
errorMessage && setErrorMsg(errorMessage);
|
|
211
|
+
setSubmitButtonStatus("unSubmit");
|
|
212
|
+
(_a3 = props.onError) == null ? void 0 : _a3.call(
|
|
213
|
+
props,
|
|
214
|
+
new PayKKaError("API_ERROR", errorMessage, { code: errorCode }),
|
|
215
|
+
getPaymentMethodContext()
|
|
216
|
+
);
|
|
217
|
+
},
|
|
218
|
+
onCanceled: () => {
|
|
219
|
+
var _a3;
|
|
220
|
+
core.payment.resetCurrPaymentMethod();
|
|
221
|
+
setSubmitButtonStatus("unSubmit");
|
|
222
|
+
(_a3 = props.onTimeout) == null ? void 0 : _a3.call(props, "channel", getPaymentMethodContext());
|
|
223
|
+
},
|
|
224
|
+
onExpired: () => {
|
|
225
|
+
var _a3;
|
|
226
|
+
setSubmitButtonStatus("unSubmit");
|
|
227
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
228
|
+
},
|
|
229
|
+
onDefault: () => {
|
|
230
|
+
core.payment.resetCurrPaymentMethod();
|
|
215
231
|
setSubmitButtonStatus("unSubmit");
|
|
216
|
-
(_h = props.onTimeout) == null ? void 0 : _h.call(props, "channel");
|
|
217
|
-
return { end: true };
|
|
218
232
|
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return { end: true };
|
|
222
|
-
} else if (status === "EXPIRED") {
|
|
223
|
-
setSubmitButtonStatus("unSubmit");
|
|
224
|
-
(_i = props.onExpired) == null ? void 0 : _i.call(props);
|
|
225
|
-
return { end: true };
|
|
226
|
-
}
|
|
227
|
-
setSubmitButtonStatus("unSubmit");
|
|
228
|
-
return { end: true };
|
|
233
|
+
});
|
|
234
|
+
return { end };
|
|
229
235
|
} catch (error) {
|
|
230
236
|
if (isTimeoutError(error)) {
|
|
231
237
|
if (search) {
|
|
@@ -235,9 +241,14 @@ const WechatPay = w((props, ref) => {
|
|
|
235
241
|
return { end: true };
|
|
236
242
|
}
|
|
237
243
|
} else {
|
|
244
|
+
core.payment.resetCurrPaymentMethod();
|
|
238
245
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
239
246
|
message && setErrorMsg(message);
|
|
240
|
-
(
|
|
247
|
+
(_f = props.onError) == null ? void 0 : _f.call(
|
|
248
|
+
props,
|
|
249
|
+
new PayKKaError("API_ERROR", message, { code: error.code, cause: error }),
|
|
250
|
+
getPaymentMethodContext()
|
|
251
|
+
);
|
|
241
252
|
setSubmitButtonStatus("unSubmit");
|
|
242
253
|
return { end: true };
|
|
243
254
|
}
|
|
@@ -249,7 +260,7 @@ const WechatPay = w((props, ref) => {
|
|
|
249
260
|
(_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
|
|
250
261
|
var _a3;
|
|
251
262
|
(fieldStatus == null ? void 0 : fieldStatus.address.show) && addressCore.setValidateAllFields(true);
|
|
252
|
-
(_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
|
|
263
|
+
(_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors, getPaymentMethodContext());
|
|
253
264
|
if (errors) {
|
|
254
265
|
setSubmitButtonStatus("unSubmit");
|
|
255
266
|
return;
|
|
@@ -270,6 +281,7 @@ const WechatPay = w((props, ref) => {
|
|
|
270
281
|
{
|
|
271
282
|
className: bem("button"),
|
|
272
283
|
status: submitButtonStatus,
|
|
284
|
+
disabled,
|
|
273
285
|
text,
|
|
274
286
|
loadingText: i18n.get("common.payProcessing"),
|
|
275
287
|
successText: i18n.get("common.paySuccess"),
|
|
@@ -280,7 +292,7 @@ const WechatPay = w((props, ref) => {
|
|
|
280
292
|
};
|
|
281
293
|
const setFormRef = (dom) => {
|
|
282
294
|
formRef.current = dom;
|
|
283
|
-
dom &&
|
|
295
|
+
dom && validateFormSilently();
|
|
284
296
|
};
|
|
285
297
|
const Email = () => {
|
|
286
298
|
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.email.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
|
|
@@ -288,19 +300,18 @@ const WechatPay = w((props, ref) => {
|
|
|
288
300
|
{
|
|
289
301
|
ref: emailFieldRef,
|
|
290
302
|
value: form.email,
|
|
291
|
-
disabled: fieldStatus == null ? void 0 : fieldStatus.email.disabled
|
|
303
|
+
disabled: (fieldStatus == null ? void 0 : fieldStatus.email.disabled) || disabled
|
|
292
304
|
}
|
|
293
305
|
) }) });
|
|
294
306
|
};
|
|
295
307
|
const Address = () => {
|
|
296
|
-
var _a2, _b;
|
|
297
308
|
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
|
|
298
309
|
AddressField,
|
|
299
310
|
{
|
|
300
311
|
ref: addressFieldRef,
|
|
301
312
|
value: form.address,
|
|
302
|
-
|
|
303
|
-
|
|
313
|
+
disabled,
|
|
314
|
+
onChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
304
315
|
}
|
|
305
316
|
) }) });
|
|
306
317
|
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { x, h, y, u, b } from "../../../core.js";
|
|
2
|
+
import { useBEM } from "../../../hooks/useBEM.js";
|
|
3
|
+
import { useI18n } from "../../../hooks/useI18n.js";
|
|
4
|
+
import "../../../utils/card-brand/brands.js";
|
|
5
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
6
|
+
import { normalizedClass, trimAll } from "../../../utils/format.js";
|
|
7
|
+
import "../../../core/context.js";
|
|
8
|
+
import "../../../out/worldpay-jsc-origin.js";
|
|
9
|
+
import "../../internal/Form/type.js";
|
|
10
|
+
import { FormContext } from "../../internal/Form/context.js";
|
|
11
|
+
import { FormItem } from "../../internal/Form/FormItem.js";
|
|
12
|
+
import "../../internal/Form/Form.js";
|
|
13
|
+
import { IconInfo } from "../../internal/icons/IconInfo.js";
|
|
14
|
+
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
15
|
+
import { SegmentedDigitInput } from "../SegmentedDigitInput/SegmentedDigitInput.js";
|
|
16
|
+
import "./blik-code-field.js";
|
|
17
|
+
const DIGIT_GROUPS = [3, 3];
|
|
18
|
+
const MAX_DIGITS = 6;
|
|
19
|
+
const BLIK_CODE_REGEX = /^\d{6}$/;
|
|
20
|
+
const BlikCodeField = (props) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const {
|
|
23
|
+
className,
|
|
24
|
+
style,
|
|
25
|
+
disabled,
|
|
26
|
+
label,
|
|
27
|
+
placeholder,
|
|
28
|
+
incompleteText,
|
|
29
|
+
invalidText,
|
|
30
|
+
onInput,
|
|
31
|
+
onValidationStatusChange,
|
|
32
|
+
showInfoTooltip = true
|
|
33
|
+
} = props;
|
|
34
|
+
const { i18n } = useI18n();
|
|
35
|
+
const { bem } = useBEM("blik-code-field");
|
|
36
|
+
const formContext = x(FormContext);
|
|
37
|
+
const [value, setValue] = h("");
|
|
38
|
+
y(() => {
|
|
39
|
+
var _a2;
|
|
40
|
+
const v = (_a2 = formContext == null ? void 0 : formContext.form) == null ? void 0 : _a2.checkCode;
|
|
41
|
+
if (typeof v === "string") {
|
|
42
|
+
setValue(v);
|
|
43
|
+
}
|
|
44
|
+
}, [(_a = formContext == null ? void 0 : formContext.form) == null ? void 0 : _a.checkCode]);
|
|
45
|
+
const rule = {
|
|
46
|
+
trigger: ["blur", "submit"],
|
|
47
|
+
validator(val) {
|
|
48
|
+
const digits = trimAll(val ?? "");
|
|
49
|
+
if (!digits) {
|
|
50
|
+
throw new Error(incompleteText || i18n.get("form.blikCode.incomplete"));
|
|
51
|
+
}
|
|
52
|
+
if (!BLIK_CODE_REGEX.test(digits)) {
|
|
53
|
+
throw new Error(invalidText || i18n.get("form.blikCode.invalid"));
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const onSegmentInput = (event) => {
|
|
59
|
+
setValue(event.currentTarget.value);
|
|
60
|
+
onInput == null ? void 0 : onInput(event);
|
|
61
|
+
};
|
|
62
|
+
const labelContent = /* @__PURE__ */ u(b, { children: [
|
|
63
|
+
typeof label === "string" || label == null ? /* @__PURE__ */ u("span", { className: bem("label-text"), children: label ?? i18n.get("form.blikCode.label") }) : label,
|
|
64
|
+
showInfoTooltip && /* @__PURE__ */ u(Tooltip, { content: i18n.get("form.blikCode.infoTooltip"), children: /* @__PURE__ */ u(IconInfo, { size: 16, className: bem("label-info") }) })
|
|
65
|
+
] });
|
|
66
|
+
return /* @__PURE__ */ u(
|
|
67
|
+
FormItem,
|
|
68
|
+
{
|
|
69
|
+
label: labelContent,
|
|
70
|
+
path: "checkCode",
|
|
71
|
+
rule,
|
|
72
|
+
className: normalizedClass(bem(), className),
|
|
73
|
+
style,
|
|
74
|
+
onValidationStatusChange,
|
|
75
|
+
children: /* @__PURE__ */ u(
|
|
76
|
+
SegmentedDigitInput,
|
|
77
|
+
{
|
|
78
|
+
value,
|
|
79
|
+
digitGroups: DIGIT_GROUPS,
|
|
80
|
+
maxDigits: MAX_DIGITS,
|
|
81
|
+
separator: " ",
|
|
82
|
+
placeholder: placeholder || i18n.get("form.blikCode.placeholder"),
|
|
83
|
+
onInput: onSegmentInput,
|
|
84
|
+
disabled
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
export {
|
|
91
|
+
BlikCodeField
|
|
92
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "../../../core.js";
|
|
2
|
+
import "../../../utils/card-brand/brands.js";
|
|
3
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
4
|
+
import "../../../core/context.js";
|
|
5
|
+
import "../../../out/worldpay-jsc-origin.js";
|
|
6
|
+
import "../../internal/Form/type.js";
|
|
7
|
+
import "../../internal/Form/context.js";
|
|
8
|
+
import "../../internal/Form/FormItem.js";
|
|
9
|
+
import "../../internal/Form/Form.js";
|
|
10
|
+
import "../Tooltip/tooltip2.js";
|
|
11
|
+
import "../../internal/Input/Input.js";
|
|
12
|
+
import "../../internal/Input/type.js";
|
|
13
|
+
import "./blik-code-field.js";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { u, b } from "../../../core.js";
|
|
2
|
+
import { useBEM } from "../../../hooks/useBEM.js";
|
|
3
|
+
import { useI18n } from "../../../hooks/useI18n.js";
|
|
4
|
+
import "../../../utils/card-brand/brands.js";
|
|
5
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
6
|
+
import "../../../core/context.js";
|
|
7
|
+
import "../../../out/worldpay-jsc-origin.js";
|
|
8
|
+
import { useBreakpoints } from "../../../hooks/useBreakpoints.js";
|
|
9
|
+
import { Button } from "../../internal/Button/Button.js";
|
|
10
|
+
import { Modal } from "../../internal/Modal/Modal.js";
|
|
11
|
+
import "./blik-confirm-modal.js";
|
|
12
|
+
import { IconPhone } from "../../internal/icons/IconPhone.js";
|
|
13
|
+
import { LoadingCheck } from "../../internal/LoadingCheck/LoadingCheck.js";
|
|
14
|
+
const { bem } = useBEM("blik-confirm-modal");
|
|
15
|
+
const BlikConfirmModal = (props) => {
|
|
16
|
+
const { show = false, onChange, appendToBody = true } = props;
|
|
17
|
+
const { i18n } = useI18n();
|
|
18
|
+
const breakpoints = useBreakpoints();
|
|
19
|
+
return /* @__PURE__ */ u(
|
|
20
|
+
Modal,
|
|
21
|
+
{
|
|
22
|
+
show,
|
|
23
|
+
width: breakpoints.smaller("xs") ? "90vw" : "340px",
|
|
24
|
+
maskClosable: false,
|
|
25
|
+
appendToBody,
|
|
26
|
+
header: /* @__PURE__ */ u(b, {}),
|
|
27
|
+
onChange,
|
|
28
|
+
children: /* @__PURE__ */ u("div", { className: bem(), children: [
|
|
29
|
+
/* @__PURE__ */ u("div", { className: bem("illustration"), "aria-hidden": true, children: /* @__PURE__ */ u("div", { className: bem("illustration-phone"), children: [
|
|
30
|
+
/* @__PURE__ */ u(IconPhone, { size: 128 }),
|
|
31
|
+
/* @__PURE__ */ u("span", { className: bem("illustration-badge"), children: "1" })
|
|
32
|
+
] }) }),
|
|
33
|
+
/* @__PURE__ */ u("h2", { className: bem("title"), children: i18n.get("blikConfirmModal.title") }),
|
|
34
|
+
/* @__PURE__ */ u("p", { className: bem("description"), children: i18n.get("blikConfirmModal.description") }),
|
|
35
|
+
/* @__PURE__ */ u("div", { className: bem("footer"), children: /* @__PURE__ */ u(Button, { style: { backgroundColor: "var(--paykka-primary2-color)", color: "var(--paykka-primary-color)" }, loading: true, children: [
|
|
36
|
+
/* @__PURE__ */ u(LoadingCheck, { size: 20 }),
|
|
37
|
+
/* @__PURE__ */ u("span", { class: bem("waiting-text"), children: i18n.get("blikConfirmModal.waitingButton") })
|
|
38
|
+
] }) })
|
|
39
|
+
] })
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
BlikConfirmModal
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "../../../core.js";
|
|
2
|
+
import "../../../utils/card-brand/brands.js";
|
|
3
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
4
|
+
import "../../../core/context.js";
|
|
5
|
+
import "../../../out/worldpay-jsc-origin.js";
|
|
6
|
+
import "../../internal/Button/button2.js";
|
|
7
|
+
import "../../internal/Modal/Modal.js";
|
|
8
|
+
import "./blik-confirm-modal.js";
|
|
9
|
+
import "../../internal/LoadingCheck/loading-check.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|