@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
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { w, F, y, A, h, u, b } from "../../../core.js";
|
|
2
|
+
import { useBEM } from "../../../hooks/useBEM.js";
|
|
3
|
+
import { CoreContext } from "../../../core/context.js";
|
|
4
|
+
import "../../../utils/card-brand/brands.js";
|
|
5
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
6
|
+
import { normalizedClass, formatAmount } from "../../../utils/format.js";
|
|
7
|
+
import { PaymentMethod, PaymentCategory, COMMON_CLASS_NAME } from "../../../constant.js";
|
|
8
|
+
import "../../../out/worldpay-jsc-origin.js";
|
|
9
|
+
import { usePayState } from "../../../hooks/usePayState.js";
|
|
10
|
+
import { useBaseWallet } from "../../../hooks/useBaseWallet.js";
|
|
11
|
+
import "./trustly2.js";
|
|
12
|
+
import { GuideCard } from "../../GuideCard/index.js";
|
|
13
|
+
import "../../internal/Form/type.js";
|
|
14
|
+
import "../../internal/Form/context.js";
|
|
15
|
+
import "../../internal/Form/FormItem.js";
|
|
16
|
+
import { Form } from "../../internal/Form/Form.js";
|
|
17
|
+
import { PaymentButton } from "../../PaymentButton/index.js";
|
|
18
|
+
import { Info } from "../../internal/Info/Info.js";
|
|
19
|
+
import "../../internal/Modal/Modal.js";
|
|
20
|
+
import "../../business/QRCodeModal/qr-code-modal.js";
|
|
21
|
+
import { NameField } from "../../business/NameField/NameField.js";
|
|
22
|
+
import "../../internal/Select/Select.js";
|
|
23
|
+
import "../../internal/Input/Input.js";
|
|
24
|
+
import "../../internal/Input/type.js";
|
|
25
|
+
import "../../business/PhoneField/config.js";
|
|
26
|
+
import "../../business/PhoneField/phone-field.js";
|
|
27
|
+
import "../../business/Tooltip/tooltip2.js";
|
|
28
|
+
import "../../business/BlikCodeField/blik-code-field.js";
|
|
29
|
+
import "../../internal/Button/button2.js";
|
|
30
|
+
import "../../business/BlikConfirmModal/blik-confirm-modal.js";
|
|
31
|
+
import "../../internal/LoadingCheck/loading-check.js";
|
|
32
|
+
import { DEFAULT_ADDRESS, AddressField } from "../../AddressField/index.js";
|
|
33
|
+
import { createEmailCore, EmailField } from "../../EmailField/EmailField.js";
|
|
34
|
+
const { bem } = useBEM("trustly");
|
|
35
|
+
const fieldClassNames = bem("field");
|
|
36
|
+
const CURR_PAYMENT_METHOD = PaymentMethod.TRUSTLY;
|
|
37
|
+
const ALLOWED_COUNTRIES = [
|
|
38
|
+
"AT",
|
|
39
|
+
"DE",
|
|
40
|
+
"DK",
|
|
41
|
+
"EE",
|
|
42
|
+
"FI",
|
|
43
|
+
"GB",
|
|
44
|
+
"LT",
|
|
45
|
+
"LV",
|
|
46
|
+
"NL",
|
|
47
|
+
"NO",
|
|
48
|
+
"SE"
|
|
49
|
+
];
|
|
50
|
+
const Trustly = w((props, ref) => {
|
|
51
|
+
const {
|
|
52
|
+
session,
|
|
53
|
+
core,
|
|
54
|
+
showGuideCard = true,
|
|
55
|
+
hidePaymentButton = false
|
|
56
|
+
} = props;
|
|
57
|
+
F(ref, () => ({
|
|
58
|
+
stopRetry: () => stopRetry(),
|
|
59
|
+
startRetry: (timeout) => startRetry(timeout),
|
|
60
|
+
updateAddress: () => {
|
|
61
|
+
var _a;
|
|
62
|
+
if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
|
|
63
|
+
return;
|
|
64
|
+
const country = addressCore.getAddressState().country ?? "";
|
|
65
|
+
if (!ALLOWED_COUNTRIES.includes(country)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const address = addressCore.getAddressState();
|
|
69
|
+
form.address = address;
|
|
70
|
+
setForm(form);
|
|
71
|
+
(_a = addressFieldRef.current) == null ? void 0 : _a.update(address);
|
|
72
|
+
validateFormSilently();
|
|
73
|
+
},
|
|
74
|
+
updateEmail: () => {
|
|
75
|
+
var _a;
|
|
76
|
+
if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
|
|
77
|
+
return;
|
|
78
|
+
form.email = emailState.email;
|
|
79
|
+
setForm(form);
|
|
80
|
+
(_a = emailFieldRef.current) == null ? void 0 : _a.update(emailState.email);
|
|
81
|
+
validateFormSilently();
|
|
82
|
+
},
|
|
83
|
+
payment: () => {
|
|
84
|
+
hidePaymentButton && onSubmit();
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
const { i18n, sessionReady, disabled } = usePayState(session, props.core);
|
|
88
|
+
y(() => {
|
|
89
|
+
if (!sessionReady)
|
|
90
|
+
return;
|
|
91
|
+
const { country, bill = {} } = (session == null ? void 0 : session.checkout) || {};
|
|
92
|
+
country && addressCore.setCountry(country);
|
|
93
|
+
form.email = bill.email ?? "";
|
|
94
|
+
if (!ALLOWED_COUNTRIES.includes(country ?? "")) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
form.address.country = country;
|
|
98
|
+
}, [sessionReady]);
|
|
99
|
+
const {
|
|
100
|
+
isEnabled,
|
|
101
|
+
fieldStatus,
|
|
102
|
+
paymentButtonStatus,
|
|
103
|
+
setPaymentButtonStatus,
|
|
104
|
+
errorMessage,
|
|
105
|
+
setErrorMessage,
|
|
106
|
+
payment,
|
|
107
|
+
startRetry,
|
|
108
|
+
stopRetry,
|
|
109
|
+
getPaymentMethodContext
|
|
110
|
+
} = useBaseWallet(CURR_PAYMENT_METHOD, props, {
|
|
111
|
+
getFormData: () => {
|
|
112
|
+
return {
|
|
113
|
+
...form,
|
|
114
|
+
firstName: form.name,
|
|
115
|
+
address: form.address
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const addressCore = core.getAddressCore();
|
|
120
|
+
const addressFieldRef = A(null);
|
|
121
|
+
const emailState = createEmailCore();
|
|
122
|
+
const emailFieldRef = A(null);
|
|
123
|
+
const formRef = A(null);
|
|
124
|
+
const [form, setForm] = h({
|
|
125
|
+
address: { ...DEFAULT_ADDRESS },
|
|
126
|
+
name: "",
|
|
127
|
+
email: ""
|
|
128
|
+
});
|
|
129
|
+
const [validated, setValidated] = h(false);
|
|
130
|
+
const validateFormSilently = () => {
|
|
131
|
+
var _a;
|
|
132
|
+
(_a = formRef.current) == null ? void 0 : _a.validate(void 0, false).then(() => setValidated(true)).catch(() => setValidated(false));
|
|
133
|
+
};
|
|
134
|
+
const setFormRef = (dom) => {
|
|
135
|
+
formRef.current = dom;
|
|
136
|
+
dom && validateFormSilently();
|
|
137
|
+
};
|
|
138
|
+
y(() => validateFormSilently(), [form]);
|
|
139
|
+
const Address = () => {
|
|
140
|
+
var _a;
|
|
141
|
+
const mode = (fieldStatus == null ? void 0 : fieldStatus.address.show) ? (_a = core.config._checkoutConfig) == null ? void 0 : _a.addressMode : "country";
|
|
142
|
+
return /* @__PURE__ */ u(b, {
|
|
143
|
+
// 这里没有判断 fieldStatus?.address.show,因为 Trustly 对国家有要求,直接用账单地址可能会失败
|
|
144
|
+
children: /* @__PURE__ */ u("div", { className: bem("address"), children: /* @__PURE__ */ u(
|
|
145
|
+
AddressField,
|
|
146
|
+
{
|
|
147
|
+
ref: addressFieldRef,
|
|
148
|
+
mode,
|
|
149
|
+
value: form.address,
|
|
150
|
+
allowedCountries: ALLOWED_COUNTRIES,
|
|
151
|
+
disabled,
|
|
152
|
+
onChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
153
|
+
}
|
|
154
|
+
) })
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
const onSubmit = () => {
|
|
158
|
+
var _a;
|
|
159
|
+
setErrorMessage("");
|
|
160
|
+
(_a = formRef.current) == null ? void 0 : _a.validate(async (errors) => {
|
|
161
|
+
var _a2;
|
|
162
|
+
(_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, errors, getPaymentMethodContext());
|
|
163
|
+
if (errors) {
|
|
164
|
+
setPaymentButtonStatus("unSubmit");
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
setPaymentButtonStatus("loading");
|
|
168
|
+
await payment();
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
const Email = () => {
|
|
172
|
+
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.email.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
|
|
173
|
+
EmailField,
|
|
174
|
+
{
|
|
175
|
+
ref: emailFieldRef,
|
|
176
|
+
value: form.email,
|
|
177
|
+
disabled: (fieldStatus == null ? void 0 : fieldStatus.email.disabled) || disabled
|
|
178
|
+
}
|
|
179
|
+
) }) });
|
|
180
|
+
};
|
|
181
|
+
const Button = () => {
|
|
182
|
+
var _a;
|
|
183
|
+
const transAmount = (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount;
|
|
184
|
+
const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
|
|
185
|
+
const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
|
|
186
|
+
return /* @__PURE__ */ u(
|
|
187
|
+
PaymentButton,
|
|
188
|
+
{
|
|
189
|
+
className: bem("button"),
|
|
190
|
+
status: paymentButtonStatus,
|
|
191
|
+
verified: validated,
|
|
192
|
+
disabled,
|
|
193
|
+
onClick: onSubmit,
|
|
194
|
+
children: text
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
const ErrorMessage = () => {
|
|
199
|
+
return /* @__PURE__ */ u(b, { children: !!errorMessage && /* @__PURE__ */ u(Info, { content: errorMessage }) });
|
|
200
|
+
};
|
|
201
|
+
return /* @__PURE__ */ u(
|
|
202
|
+
CoreContext.Provider,
|
|
203
|
+
{
|
|
204
|
+
value: {
|
|
205
|
+
i18n,
|
|
206
|
+
session,
|
|
207
|
+
core
|
|
208
|
+
},
|
|
209
|
+
children: isEnabled && i18n.ready.value && /* @__PURE__ */ u("div", { className: core.theme.className, children: [
|
|
210
|
+
showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.SKRILL }),
|
|
211
|
+
/* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
212
|
+
Email(),
|
|
213
|
+
/* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(NameField, { disabled }) }),
|
|
214
|
+
Address(),
|
|
215
|
+
/* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
|
|
216
|
+
ErrorMessage(),
|
|
217
|
+
!hidePaymentButton && Button()
|
|
218
|
+
] })
|
|
219
|
+
] }) })
|
|
220
|
+
] })
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
});
|
|
224
|
+
export {
|
|
225
|
+
Trustly
|
|
226
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./Trustly.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,323 +1,155 @@
|
|
|
1
|
-
import { w, F, A, h, y,
|
|
1
|
+
import { w, F, A, h, y, u, b } from "../../../core.js";
|
|
2
2
|
import { useBEM } from "../../../hooks/useBEM.js";
|
|
3
3
|
import { CoreContext } from "../../../core/context.js";
|
|
4
4
|
import "../../../utils/card-brand/brands.js";
|
|
5
5
|
import "../../../utils/system-info/get-browser-info.js";
|
|
6
|
-
import { isMobile } from "../../../utils/system-info/get-system-info.js";
|
|
7
6
|
import { normalizedClass, formatAmount } from "../../../utils/format.js";
|
|
8
|
-
import {
|
|
9
|
-
import { processPaymentStatus } from "../../../utils/payment.js";
|
|
10
|
-
import { isTimeoutError } from "../../../api/http.js";
|
|
11
|
-
import { getBrowserParams } from "../../../api/modules/get-browser-params.js";
|
|
12
|
-
import { PaymentCategory, COMMON_CLASS_NAME, PaymentMethod, SessionMode } from "../../../constant.js";
|
|
13
|
-
import { getZalopayPayInfo, zalopayPay } from "../../../api/modules/zalopay/index.js";
|
|
14
|
-
import { PayKKaError } from "../../../core/error.js";
|
|
7
|
+
import { PaymentMethod, PaymentCategory, COMMON_CLASS_NAME } from "../../../constant.js";
|
|
15
8
|
import "../../../out/worldpay-jsc-origin.js";
|
|
16
9
|
import { usePayState } from "../../../hooks/usePayState.js";
|
|
17
|
-
import {
|
|
18
|
-
import { usePaymentStatus } from "../../../hooks/usePayment.js";
|
|
10
|
+
import { useBaseWallet } from "../../../hooks/useBaseWallet.js";
|
|
19
11
|
import { createEmailCore, EmailField } from "../../EmailField/EmailField.js";
|
|
20
|
-
import { SubmitButton } from "../../SubmitButton/index.js";
|
|
21
12
|
import { GuideCard } from "../../GuideCard/index.js";
|
|
22
|
-
import { AddressField } from "../../AddressField/index.js";
|
|
13
|
+
import { DEFAULT_ADDRESS, AddressField } from "../../AddressField/index.js";
|
|
23
14
|
import { Info } from "../../internal/Info/Info.js";
|
|
24
15
|
import "../../internal/Form/type.js";
|
|
25
16
|
import "../../internal/Form/context.js";
|
|
26
17
|
import "../../internal/Form/FormItem.js";
|
|
27
18
|
import { Form } from "../../internal/Form/Form.js";
|
|
28
19
|
import { QRCodeModal } from "../../business/QRCodeModal/QRCodeModal.js";
|
|
20
|
+
import "../../internal/Input/Input.js";
|
|
21
|
+
import "../../internal/Input/type.js";
|
|
22
|
+
import "../../internal/Select/Select.js";
|
|
23
|
+
import "../../business/PhoneField/config.js";
|
|
24
|
+
import "../../business/PhoneField/phone-field.js";
|
|
29
25
|
import { IconVietqrComplete } from "../../internal/icons/IconVietqrComplete.js";
|
|
26
|
+
import "../../business/Tooltip/tooltip2.js";
|
|
27
|
+
import "../../business/BlikCodeField/blik-code-field.js";
|
|
28
|
+
import "../../internal/Button/button2.js";
|
|
29
|
+
import "../../internal/Modal/Modal.js";
|
|
30
|
+
import "../../business/BlikConfirmModal/blik-confirm-modal.js";
|
|
31
|
+
import "../../internal/LoadingCheck/loading-check.js";
|
|
30
32
|
import "./vietqr2.js";
|
|
33
|
+
import { PaymentButton } from "../../PaymentButton/index.js";
|
|
31
34
|
const { bem } = useBEM("vietqr");
|
|
32
35
|
const fieldClassNames = bem("field");
|
|
36
|
+
const CURR_PAYMENT_METHOD = PaymentMethod.VIETQR;
|
|
33
37
|
const Vietqr = w((props, ref) => {
|
|
34
38
|
var _a;
|
|
35
39
|
const {
|
|
36
40
|
session,
|
|
37
|
-
showEmail = false,
|
|
38
|
-
showAddress = false,
|
|
39
41
|
core,
|
|
40
|
-
redirectMode = "auto",
|
|
41
|
-
autoQuery = true,
|
|
42
42
|
showGuideCard = true,
|
|
43
|
-
enableQRCodeModal = true,
|
|
44
43
|
hidePaymentButton = false
|
|
45
44
|
} = props;
|
|
46
45
|
F(ref, () => ({
|
|
47
|
-
stopRetry: () =>
|
|
48
|
-
|
|
49
|
-
stopReFetchPayInfo();
|
|
50
|
-
},
|
|
51
|
-
startRetry: (timeout) => {
|
|
52
|
-
setPaymentButtonStatus("loading");
|
|
53
|
-
startReFetchPayInfo({ timeout });
|
|
54
|
-
},
|
|
46
|
+
stopRetry: () => stopRetry(),
|
|
47
|
+
startRetry: (timeout) => startRetry(timeout),
|
|
55
48
|
updateAddress: () => {
|
|
56
49
|
var _a2;
|
|
57
50
|
if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
|
|
58
51
|
return;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
(
|
|
62
|
-
|
|
52
|
+
const address = addressCore.getAddressState();
|
|
53
|
+
form.address = address;
|
|
54
|
+
setForm(form);
|
|
55
|
+
(_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(address);
|
|
56
|
+
validateFormSilently();
|
|
63
57
|
},
|
|
64
58
|
updateEmail: () => {
|
|
65
59
|
var _a2;
|
|
66
60
|
if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
|
|
67
61
|
return;
|
|
68
|
-
|
|
69
|
-
setForm(
|
|
62
|
+
form.email = emailState.email;
|
|
63
|
+
setForm(form);
|
|
70
64
|
(_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
|
|
71
|
-
|
|
65
|
+
validateFormSilently();
|
|
72
66
|
},
|
|
73
67
|
payment: () => {
|
|
74
68
|
hidePaymentButton && onSubmit();
|
|
75
69
|
}
|
|
76
70
|
}));
|
|
71
|
+
const {
|
|
72
|
+
isEnabled,
|
|
73
|
+
fieldStatus,
|
|
74
|
+
paymentButtonStatus,
|
|
75
|
+
setPaymentButtonStatus,
|
|
76
|
+
errorMessage,
|
|
77
|
+
setErrorMessage,
|
|
78
|
+
payment,
|
|
79
|
+
startRetry,
|
|
80
|
+
stopRetry,
|
|
81
|
+
showQRCodeModal,
|
|
82
|
+
qrCodeInfo,
|
|
83
|
+
processCloseQRCodeModal,
|
|
84
|
+
getPaymentMethodContext
|
|
85
|
+
} = useBaseWallet(CURR_PAYMENT_METHOD, props, {
|
|
86
|
+
retryTimeout: 10 * 60 * 1e3,
|
|
87
|
+
supportQRCodeModal: true,
|
|
88
|
+
getFormData: () => {
|
|
89
|
+
return {
|
|
90
|
+
...form
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
77
94
|
const addressCore = core.getAddressCore();
|
|
78
95
|
const emailState = createEmailCore();
|
|
79
96
|
const addressFieldRef = A(null);
|
|
80
97
|
const emailFieldRef = A(null);
|
|
81
|
-
const
|
|
82
|
-
const { i18n, fraudDetection, sessionReady } = usePayState(session);
|
|
83
|
-
const { errorMsg, setErrorMsg, paymentButtonStatus, setPaymentButtonStatus } = usePaymentStatus();
|
|
98
|
+
const { i18n, sessionReady, disabled } = usePayState(session, props.core);
|
|
84
99
|
const formRef = A(null);
|
|
85
100
|
const [form, setForm] = h({
|
|
86
101
|
email: "",
|
|
87
|
-
address: {
|
|
88
|
-
country: void 0,
|
|
89
|
-
province: void 0,
|
|
90
|
-
city: void 0,
|
|
91
|
-
area: void 0,
|
|
92
|
-
postCode: void 0,
|
|
93
|
-
address1: void 0,
|
|
94
|
-
address2: void 0
|
|
95
|
-
}
|
|
102
|
+
address: { ...DEFAULT_ADDRESS }
|
|
96
103
|
});
|
|
97
104
|
const [validated, setValidated] = h(false);
|
|
98
|
-
const [fieldStatus, setFieldStatus] = h();
|
|
99
|
-
const [showQRCodeModal, setShowQRCodeModal] = h(false);
|
|
100
|
-
const [qrCodeInfo, setQrCodeInfo] = h();
|
|
101
|
-
const initFieldStatus = () => {
|
|
102
|
-
const { field, sessionMode } = session.checkout;
|
|
103
|
-
const { email, address } = field;
|
|
104
|
-
if (sessionMode === SessionMode.COMPONENT) {
|
|
105
|
-
if (email.disabled) {
|
|
106
|
-
email.show = showEmail;
|
|
107
|
-
}
|
|
108
|
-
if (showAddress && !(address == null ? void 0 : address.show)) {
|
|
109
|
-
address.show = true;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
setFieldStatus({ ...field });
|
|
113
|
-
};
|
|
114
105
|
y(() => {
|
|
115
|
-
if (!sessionReady)
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const { bill = {}, supportMethods = [], country } = (session == null ? void 0 : session.checkout) || {};
|
|
119
|
-
if (!supportMethods.includes(PaymentMethod.VIETQR)) {
|
|
106
|
+
if (!sessionReady)
|
|
120
107
|
return;
|
|
121
|
-
}
|
|
122
|
-
initFieldStatus();
|
|
123
|
-
setIsCheckoutEnabled(true);
|
|
108
|
+
const { bill = {}, country } = (session == null ? void 0 : session.checkout) || {};
|
|
124
109
|
country && addressCore.setCountry(country);
|
|
125
110
|
form.email = bill.email ?? "";
|
|
126
111
|
form.address.country = country;
|
|
127
|
-
if (autoQuery && core.processingPaymentMethod === PaymentMethod.VIETQR) {
|
|
128
|
-
setPaymentButtonStatus("loading");
|
|
129
|
-
startReFetchPayInfo();
|
|
130
|
-
}
|
|
131
112
|
}, [sessionReady]);
|
|
132
|
-
const
|
|
113
|
+
const validateFormSilently = () => {
|
|
133
114
|
var _a2;
|
|
134
|
-
|
|
135
|
-
(_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
|
|
136
|
-
core.resetEnablePaymentMethod();
|
|
137
|
-
};
|
|
138
|
-
const onTimeout = q(
|
|
139
|
-
(message) => {
|
|
140
|
-
var _a2;
|
|
141
|
-
setShowQRCodeModal(false);
|
|
142
|
-
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
143
|
-
setPaymentButtonStatus("unSubmit");
|
|
144
|
-
(_a2 = props.onTimeout) == null ? void 0 : _a2.call(props, "retry");
|
|
145
|
-
core.resetEnablePaymentMethod();
|
|
146
|
-
},
|
|
147
|
-
[i18n, props.onTimeout]
|
|
148
|
-
);
|
|
149
|
-
const { start: startReFetchPayInfo, stop: stopReFetchPayInfo } = useRetry(
|
|
150
|
-
(timeout) => pay(true, timeout),
|
|
151
|
-
{
|
|
152
|
-
timeout: 10 * 60 * 1e3,
|
|
153
|
-
onTimeout: () => onTimeout(i18n.get("common.queryTimeout"))
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
const getPaymentParams = async () => {
|
|
157
|
-
return {
|
|
158
|
-
sessionId: session.sessionId,
|
|
159
|
-
clientKey: session.clientKey,
|
|
160
|
-
payment: {
|
|
161
|
-
paymentMethod: PaymentMethod.VIETQR
|
|
162
|
-
},
|
|
163
|
-
bill: {
|
|
164
|
-
email: form.email,
|
|
165
|
-
addressLine1: form.address.address1,
|
|
166
|
-
addressLine2: form.address.address2,
|
|
167
|
-
postalCode: form.address.postCode,
|
|
168
|
-
country: form.address.country,
|
|
169
|
-
district: form.address.area,
|
|
170
|
-
state: form.address.province ? addressCore.getLabel(form.address.province, addressCore.getProvinceOption()) ?? form.address.province : void 0,
|
|
171
|
-
city: form.address.city ? addressCore.getLabel(form.address.city, addressCore.getCityOptions()) ?? form.address.city : void 0
|
|
172
|
-
},
|
|
173
|
-
browser: await getBrowserParams({
|
|
174
|
-
fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
|
|
175
|
-
})
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
const pay = async (search = false, timeout) => {
|
|
179
|
-
var _a2, _b, _c, _d, _e;
|
|
180
|
-
try {
|
|
181
|
-
const requestOptions = { locale: i18n.locale, timeout };
|
|
182
|
-
let res = null;
|
|
183
|
-
if (search) {
|
|
184
|
-
const extraParams = (_b = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b.call(_a2, "query", PaymentMethod.VIETQR);
|
|
185
|
-
res = await getZalopayPayInfo(
|
|
186
|
-
{
|
|
187
|
-
sessionId: session.sessionId,
|
|
188
|
-
clientKey: session.clientKey,
|
|
189
|
-
paymentMethod: PaymentMethod.VIETQR
|
|
190
|
-
},
|
|
191
|
-
extraParams,
|
|
192
|
-
requestOptions
|
|
193
|
-
);
|
|
194
|
-
} else {
|
|
195
|
-
const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", PaymentMethod.VIETQR);
|
|
196
|
-
res = await zalopayPay(await getPaymentParams(), extraParams, requestOptions);
|
|
197
|
-
}
|
|
198
|
-
!search && ((_e = props.onSubmitResponse) == null ? void 0 : _e.call(props, res));
|
|
199
|
-
const { errorMessage, errorCode, payInfo = {}, sessionId } = res;
|
|
200
|
-
sessionId && (session.sessionId = sessionId);
|
|
201
|
-
const { paymentExpiredAt } = payInfo;
|
|
202
|
-
let end = true;
|
|
203
|
-
processPaymentStatus(res, {
|
|
204
|
-
onProcessing: () => {
|
|
205
|
-
if (!search && payInfo) {
|
|
206
|
-
if (isMobile()) {
|
|
207
|
-
if (redirectMode === "auto") {
|
|
208
|
-
redirectToPayment(payInfo);
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
} else {
|
|
212
|
-
if (enableQRCodeModal) {
|
|
213
|
-
setShowQRCodeModal(true);
|
|
214
|
-
setQrCodeInfo({
|
|
215
|
-
qrCode: payInfo.qr_code || payInfo.request_url,
|
|
216
|
-
expiredTime: paymentExpiredAt
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
startReFetchPayInfo();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
end = false;
|
|
223
|
-
},
|
|
224
|
-
onSuccess: () => {
|
|
225
|
-
var _a3;
|
|
226
|
-
setShowQRCodeModal(false);
|
|
227
|
-
setPaymentButtonStatus("success");
|
|
228
|
-
(_a3 = props.onSuccess) == null ? void 0 : _a3.call(props, res);
|
|
229
|
-
},
|
|
230
|
-
onFailure: () => {
|
|
231
|
-
errorMessage && setErrorMsg(errorMessage);
|
|
232
|
-
setPaymentButtonStatus("unSubmit");
|
|
233
|
-
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
234
|
-
},
|
|
235
|
-
onCanceled: () => {
|
|
236
|
-
var _a3;
|
|
237
|
-
core.resetEnablePaymentMethod();
|
|
238
|
-
setPaymentButtonStatus("unSubmit");
|
|
239
|
-
(_a3 = props.onTimeout) == null ? void 0 : _a3.call(props, "channel");
|
|
240
|
-
},
|
|
241
|
-
onExpired: () => {
|
|
242
|
-
var _a3;
|
|
243
|
-
setShowQRCodeModal(false);
|
|
244
|
-
setPaymentButtonStatus("unSubmit");
|
|
245
|
-
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props);
|
|
246
|
-
},
|
|
247
|
-
onDefault: () => {
|
|
248
|
-
setPaymentButtonStatus("unSubmit");
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
return { end };
|
|
252
|
-
} catch (error) {
|
|
253
|
-
if (isTimeoutError(error)) {
|
|
254
|
-
if (search) {
|
|
255
|
-
return { end: false };
|
|
256
|
-
} else {
|
|
257
|
-
onTimeout();
|
|
258
|
-
return { end: true };
|
|
259
|
-
}
|
|
260
|
-
} else {
|
|
261
|
-
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
262
|
-
message && setErrorMsg(message);
|
|
263
|
-
processOnError(new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
|
|
264
|
-
setPaymentButtonStatus("unSubmit");
|
|
265
|
-
return { end: true };
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
const validateForm = () => {
|
|
270
|
-
var _a2;
|
|
271
|
-
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => {
|
|
272
|
-
setValidated(true);
|
|
273
|
-
}).catch(() => {
|
|
274
|
-
setValidated(false);
|
|
275
|
-
});
|
|
115
|
+
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => setValidated(true)).catch(() => setValidated(false));
|
|
276
116
|
};
|
|
277
117
|
y(() => {
|
|
278
|
-
|
|
118
|
+
validateFormSilently();
|
|
279
119
|
}, [form]);
|
|
280
120
|
const onSubmit = async () => {
|
|
281
121
|
var _a2;
|
|
282
|
-
|
|
122
|
+
setErrorMessage("");
|
|
283
123
|
(_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
|
|
284
124
|
var _a3;
|
|
285
125
|
(fieldStatus == null ? void 0 : fieldStatus.address.show) && addressCore.setValidateAllFields(true);
|
|
286
|
-
(_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
|
|
126
|
+
(_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors, getPaymentMethodContext());
|
|
287
127
|
if (errors) {
|
|
288
128
|
setPaymentButtonStatus("unSubmit");
|
|
289
129
|
return;
|
|
290
130
|
}
|
|
291
|
-
setErrorMsg("");
|
|
292
131
|
setPaymentButtonStatus("loading");
|
|
293
|
-
await
|
|
132
|
+
await payment();
|
|
294
133
|
});
|
|
295
134
|
};
|
|
296
|
-
const handleCloseQRCodeModal = () => {
|
|
297
|
-
var _a2;
|
|
298
|
-
setPaymentButtonStatus("unSubmit");
|
|
299
|
-
stopReFetchPayInfo();
|
|
300
|
-
setShowQRCodeModal(false);
|
|
301
|
-
setQrCodeInfo(void 0);
|
|
302
|
-
(_a2 = props.onCloseModal) == null ? void 0 : _a2.call(props);
|
|
303
|
-
};
|
|
304
135
|
const setFormRef = (dom) => {
|
|
305
136
|
formRef.current = dom;
|
|
306
|
-
dom &&
|
|
137
|
+
dom && validateFormSilently();
|
|
307
138
|
};
|
|
308
|
-
const
|
|
139
|
+
const WalletButton = () => {
|
|
309
140
|
var _a2;
|
|
310
141
|
const transAmount = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.transAmount;
|
|
311
142
|
const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
|
|
312
143
|
const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
|
|
313
144
|
return /* @__PURE__ */ u(
|
|
314
|
-
|
|
145
|
+
PaymentButton,
|
|
315
146
|
{
|
|
316
147
|
className: bem("button"),
|
|
317
148
|
status: paymentButtonStatus,
|
|
318
|
-
|
|
149
|
+
disabled,
|
|
319
150
|
onClick: onSubmit,
|
|
320
|
-
verified: validated
|
|
151
|
+
verified: validated,
|
|
152
|
+
children: text
|
|
321
153
|
}
|
|
322
154
|
);
|
|
323
155
|
};
|
|
@@ -327,22 +159,21 @@ const Vietqr = w((props, ref) => {
|
|
|
327
159
|
{
|
|
328
160
|
ref: emailFieldRef,
|
|
329
161
|
value: form.email,
|
|
330
|
-
disabled: fieldStatus == null ? void 0 : fieldStatus.email.disabled
|
|
162
|
+
disabled: (fieldStatus == null ? void 0 : fieldStatus.email.disabled) || disabled
|
|
331
163
|
}
|
|
332
164
|
) }) });
|
|
333
165
|
};
|
|
334
166
|
const ErrorMessage = () => {
|
|
335
|
-
return /* @__PURE__ */ u(b, { children: !!
|
|
167
|
+
return /* @__PURE__ */ u(b, { children: !!errorMessage && /* @__PURE__ */ u(Info, { content: errorMessage, style: { marginTop: "12px" } }) });
|
|
336
168
|
};
|
|
337
169
|
const Address = () => {
|
|
338
|
-
var _a2, _b;
|
|
339
170
|
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
|
|
340
171
|
AddressField,
|
|
341
172
|
{
|
|
342
173
|
ref: addressFieldRef,
|
|
343
174
|
value: form.address,
|
|
344
|
-
|
|
345
|
-
|
|
175
|
+
disabled,
|
|
176
|
+
onChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
346
177
|
}
|
|
347
178
|
) }) });
|
|
348
179
|
};
|
|
@@ -354,13 +185,13 @@ const Vietqr = w((props, ref) => {
|
|
|
354
185
|
session,
|
|
355
186
|
core
|
|
356
187
|
},
|
|
357
|
-
children:
|
|
188
|
+
children: isEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
|
|
358
189
|
showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.VIETQR }),
|
|
359
190
|
/* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
360
191
|
Email(),
|
|
361
192
|
Address(),
|
|
362
193
|
ErrorMessage(),
|
|
363
|
-
!hidePaymentButton &&
|
|
194
|
+
!hidePaymentButton && WalletButton()
|
|
364
195
|
] }) }),
|
|
365
196
|
showQRCodeModal && /* @__PURE__ */ u(
|
|
366
197
|
QRCodeModal,
|
|
@@ -371,7 +202,7 @@ const Vietqr = w((props, ref) => {
|
|
|
371
202
|
amount: (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount,
|
|
372
203
|
expiredTime: qrCodeInfo.expiredTime,
|
|
373
204
|
borderColor: "#DC2626",
|
|
374
|
-
onClose:
|
|
205
|
+
onClose: processCloseQRCodeModal
|
|
375
206
|
}
|
|
376
207
|
)
|
|
377
208
|
] })
|