@paykka/card-checkout-ui 0.13.17 → 0.15.1
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/README.md +1 -1
- package/dist/card-checkout-ui.js +53 -25
- package/dist/card-checkout-ui.umd.cjs +53 -25
- package/dist/es/api/http.js +1 -1
- package/dist/es/api/index.js +1 -1
- package/dist/es/api/modules/checkout/index.js +1 -3
- package/dist/es/api/modules/checkout/map.js +12 -4
- package/dist/es/api/modules/encrypted-card/index.js +3 -2
- package/dist/es/api/modules/get-browser-params.js +4 -8
- package/dist/es/api/modules/index.js +1 -1
- package/dist/es/api/modules/map.js +4 -1
- package/dist/es/api/modules/threeDS/index.js +16 -2
- package/dist/es/components/AccordionItem/AccordionItem.js +1 -3
- package/dist/es/components/AccountNameField/index.js +1 -1
- package/dist/es/components/AddressField/index.js +14 -4
- package/dist/es/components/ApplePay/index.js +74 -58
- package/dist/es/components/CPFField/index.js +3 -2
- package/dist/es/components/Card/index.js +192 -157
- package/dist/es/components/CardBrands/index.js +1 -1
- package/dist/es/components/CardExpireDateField/index.js +3 -2
- package/dist/es/components/CardHolderNameField/index.js +1 -1
- package/dist/es/components/CardIBANField/index.js +1 -1
- package/dist/es/components/CardNo/index.js +3 -3
- package/dist/es/components/CardNumberField/index.js +3 -2
- package/dist/es/components/CardSecurityCodeField/index.js +3 -2
- package/dist/es/components/CardSelector/index.js +5 -4
- package/dist/es/components/CombinedCardInfo/index.js +1 -1
- package/dist/es/components/DropIn/index.js +141 -144
- package/dist/es/components/EmailField/EmailField.js +1 -1
- package/dist/es/components/EncryptedCard/index.js +5 -5
- package/dist/es/components/GooglePay/index.js +126 -114
- package/dist/es/components/GuideCard/index.js +2 -2
- package/dist/es/components/PaymentButton/index.js +23 -8
- package/dist/es/components/RecurringTip/index.js +1 -1
- package/dist/es/components/SecuredFieldsProvider/index.js +31 -9
- package/dist/es/components/SecuredIframe/index.js +43 -27
- package/dist/es/components/Sepa/index.js +15 -7
- package/dist/es/components/SubmitButton/index.js +3 -3
- package/dist/es/components/ThreeDS/index.js +59 -30
- package/dist/es/components/Tip/index.js +1 -1
- package/dist/es/components/business/BlikCodeField/BlikCodeField.js +1 -1
- package/dist/es/components/business/BlikCodeField/index.js +1 -1
- package/dist/es/components/business/BlikConfirmModal/BlikConfirmModal.js +3 -3
- package/dist/es/components/business/BlikConfirmModal/index.js +2 -2
- package/dist/es/components/business/NameField/NameField.js +1 -1
- package/dist/es/components/business/NameField/index.js +1 -1
- package/dist/es/components/business/PhoneField/PhoneField.js +2 -1
- package/dist/es/components/business/PhoneField/index.js +1 -1
- package/dist/es/components/business/QRCodeModal/QRCodeModal.js +2 -2
- package/dist/es/components/business/QRCodeModal/index.js +1 -1
- package/dist/es/components/business/Tooltip/Tooltip.js +1 -1
- package/dist/es/components/business/Tooltip/index.js +1 -1
- package/dist/es/components/business/index.js +2 -2
- package/dist/es/components/index.js +11 -11
- package/dist/es/components/internal/Accordion/index.js +1 -1
- package/dist/es/components/internal/Button/{Button.js → Button2.js} +2 -2
- package/dist/es/components/internal/Button/index.js +2 -2
- package/dist/es/components/internal/CheckBox/CheckBox.js +3 -3
- package/dist/es/components/internal/CheckBox/index.js +1 -1
- package/dist/es/components/internal/Form/type.js +1 -1
- package/dist/es/components/internal/Info/Info.js +1 -1
- package/dist/es/components/internal/Info/index.js +1 -1
- package/dist/es/components/internal/Input/Input.js +1 -1
- package/dist/es/components/internal/Input/type.js +1 -1
- package/dist/es/components/internal/Loading/Loading2.js +20 -0
- package/dist/es/{api/modules/vietqr → components/internal/Loading}/index.js +3 -2
- package/dist/es/components/internal/Loading/loading.js +1 -0
- package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +1 -1
- package/dist/es/components/internal/LoadingCheck/index.js +1 -1
- package/dist/es/components/internal/Modal/Modal.js +1 -1
- package/dist/es/components/internal/QRCode/QRCode.js +1 -1
- package/dist/es/components/internal/QRCode/index.js +1 -1
- package/dist/es/components/internal/Select/Select.js +5 -2
- package/dist/es/components/internal/Select/SelectMenu.js +1 -1
- package/dist/es/components/internal/Select/SelectMenuItem.js +1 -1
- package/dist/es/components/internal/icons/IconAlipayPlus.js +116 -0
- package/dist/es/components/internal/icons/IconArrowDown.js +4 -4
- package/dist/es/components/internal/icons/IconBancontact.js +69 -14
- package/dist/es/components/internal/icons/IconBlik.js +541 -21
- package/dist/es/components/internal/icons/IconError.js +2 -2
- package/dist/es/components/internal/icons/IconIdeal.js +61 -29
- package/dist/es/components/internal/icons/IconSkrill.js +14 -7
- package/dist/es/components/internal/icons/IconSuccess.js +2 -2
- package/dist/es/components/internal/icons/IconTrustly.js +11 -44
- package/dist/es/components/internal/icons/IconWechatPayGlobal.js +45 -0
- package/dist/es/components/internal/icons/IconWechatPayGlobalComplete.js +107 -0
- package/dist/es/components/wallets/AliPay/AliPay.js +186 -0
- package/dist/es/components/wallets/AliPay/ali-pay.js +1 -0
- package/dist/es/components/wallets/AliPay/index.js +1 -0
- package/dist/es/components/wallets/AliPay/type.js +1 -0
- package/dist/es/components/wallets/Bancontact/Bancontact.js +18 -18
- package/dist/es/components/wallets/Blik/Blik.js +26 -20
- package/dist/es/components/wallets/Boost/Boost.js +180 -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 +68 -261
- package/dist/es/components/wallets/GrabPay/GrabPay.js +176 -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 +18 -18
- package/dist/es/components/wallets/LinePay/LinePay.js +180 -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 +184 -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 +182 -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 +14 -15
- package/dist/es/components/wallets/OpayWallet/OpayWallet.js +61 -226
- package/dist/es/components/wallets/P24/P24.js +18 -18
- package/dist/es/components/wallets/PagaWallet/PagaWallet.js +61 -226
- package/dist/es/components/wallets/Paymaya/Paymaya.js +61 -229
- package/dist/es/components/wallets/PicPay/PicPay.js +83 -243
- package/dist/es/components/wallets/Pix/Pix.js +77 -244
- package/dist/es/components/wallets/ShopeePay/ShopeePay.js +182 -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 +34 -35
- package/dist/es/components/wallets/TNGWallet/TNGWallet.js +182 -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 +22 -25
- package/dist/es/components/wallets/Vietqr/Vietqr.js +69 -258
- package/dist/es/components/wallets/WechatPay/WechatPay.js +250 -0
- package/dist/es/components/wallets/WechatPay/index.js +1 -0
- package/dist/es/components/wallets/WechatPay/type.js +1 -0
- package/dist/es/components/wallets/WechatPay/util.js +47 -0
- package/dist/es/components/wallets/WechatPay/wechat-pay.js +1 -0
- package/dist/es/components/wallets/Zalopay/Zalopay.js +67 -258
- package/dist/es/components/wallets/index.js +9 -0
- package/dist/es/constant.js +7 -0
- package/dist/es/core/checkout.js +50 -49
- package/dist/es/core/create-child.js +5 -4
- package/dist/es/core/index.js +1 -1
- package/dist/es/core/logger.js +1 -1
- package/dist/es/core/payment.js +78 -0
- package/dist/es/core/preview.js +29 -0
- package/dist/es/core/query.js +12 -3
- package/dist/es/core/session.js +36 -6
- package/dist/es/core/theme.js +1 -1
- package/dist/es/hooks/index.js +1 -1
- package/dist/es/hooks/useBaseWallet.js +136 -65
- package/dist/es/hooks/useI18n.js +3 -3
- package/dist/es/hooks/usePayState.js +37 -25
- package/dist/es/hooks/useRetry.js +50 -26
- package/dist/es/i18n/locales/de-DE.js +7 -0
- package/dist/es/i18n/locales/en-GB.js +7 -0
- package/dist/es/i18n/locales/es-ES.js +7 -0
- package/dist/es/i18n/locales/fr-FR.js +7 -0
- package/dist/es/i18n/locales/ja-JP.js +7 -0
- package/dist/es/i18n/locales/ko-KR.js +7 -0
- package/dist/es/i18n/locales/nl-NL.js +7 -0
- package/dist/es/i18n/locales/pt-PT.js +7 -0
- package/dist/es/i18n/locales/ru-RU.js +7 -0
- package/dist/es/i18n/locales/zh-CN.js +7 -0
- package/dist/es/i18n/locales/zh-HK.js +7 -0
- package/dist/es/i18n/locales/zh-TW.js +7 -0
- package/dist/es/i18n/util.js +10 -10
- package/dist/es/index.js +14 -12
- package/dist/es/out/base-fraud-detection.js +5 -2
- package/dist/es/out/fraud-detection.js +68 -54
- package/dist/es/out/paykka-detection.js +5 -7
- package/dist/es/out/stripe-radar.js +1 -1
- package/dist/es/out/worldpay-ddc-manager.js +9 -13
- package/dist/es/out/worldpay-ddc.js +8 -6
- package/dist/es/style.css +1 -1
- package/dist/es/types/event.js +11 -1
- package/dist/es/types/index.js +7 -0
- package/dist/es/types/message.js +2 -0
- package/dist/es/utils/array.js +19 -5
- package/dist/es/utils/business/amount.js +15 -0
- package/dist/es/utils/business/index.js +1 -0
- package/dist/es/utils/detect.js +8 -0
- package/dist/es/utils/index.js +7 -9
- package/dist/es/utils/location.js +8 -0
- package/dist/es/utils/number.js +19 -0
- package/dist/es/utils/payment.js +12 -12
- package/dist/es/utils/redirect.js +2 -0
- package/dist/es/utils/system-info/is-ua-webview.js +1 -20
- package/dist/style.css +1 -1
- package/dist/types/api/modules/checkout/type.d.ts +1 -1
- package/dist/types/api/modules/index.d.ts +0 -17
- package/dist/types/api/modules/threeDS/index.d.ts +19 -4
- package/dist/types/components/AddressField/type.d.ts +2 -2
- package/dist/types/components/ApplePay/type.d.ts +6 -2
- package/dist/types/components/CPFField/type.d.ts +1 -1
- package/dist/types/components/Card/type.d.ts +2 -18
- 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/layout.d.ts +33 -0
- package/dist/types/components/DropIn/type.d.ts +6 -6
- package/dist/types/components/GooglePay/createGooglePay.d.ts +1 -1
- package/dist/types/components/GooglePay/type.d.ts +12 -2
- package/dist/types/components/PaymentButton/type.d.ts +2 -0
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +2 -0
- package/dist/types/components/Sepa/type.d.ts +3 -4
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +0 -6
- package/dist/types/components/business/QRCodeModal/type.d.ts +12 -3
- package/dist/types/components/index.d.ts +0 -9
- package/dist/types/components/internal/CheckBox/type.d.ts +2 -1
- package/dist/types/components/internal/Loading/Loading.d.ts +2 -1
- package/dist/types/components/internal/Loading/type.d.ts +8 -0
- package/dist/types/components/internal/ResultMessage/ResultMessage.d.ts +3 -0
- package/dist/types/components/internal/ResultMessage/index.d.ts +2 -0
- package/dist/types/components/internal/ResultMessage/type.d.ts +13 -0
- package/dist/types/components/internal/Select/type.d.ts +1 -1
- package/dist/types/components/internal/icons/IconAlipayPlus.d.ts +2 -0
- package/dist/types/components/internal/icons/IconArrowDown.d.ts +1 -1
- package/dist/types/components/internal/icons/IconError.d.ts +1 -1
- package/dist/types/components/internal/icons/IconSuccess.d.ts +1 -1
- package/dist/types/components/internal/icons/IconWechatPayGlobal.d.ts +2 -0
- package/dist/types/components/internal/icons/IconWechatPayGlobalComplete.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +3 -0
- package/dist/types/components/{AliPay → wallets/AliPay}/AliPay.d.ts +9 -4
- package/dist/types/components/wallets/AliPay/type.d.ts +7 -0
- package/dist/types/components/wallets/Bancontact/type.d.ts +2 -24
- package/dist/types/components/wallets/Blik/type.d.ts +2 -24
- package/dist/types/components/{Boost → wallets/Boost}/Boost.d.ts +9 -4
- package/dist/types/components/wallets/Boost/type.d.ts +6 -0
- package/dist/types/components/wallets/GCash/GCash.d.ts +5 -0
- package/dist/types/components/wallets/GCash/type.d.ts +2 -24
- package/dist/types/components/{GrabPay → wallets/GrabPay}/GrabPay.d.ts +4 -4
- package/dist/types/components/wallets/GrabPay/type.d.ts +7 -0
- package/dist/types/components/wallets/IDeal/type.d.ts +2 -24
- package/dist/types/components/{LinePay → wallets/LinePay}/LinePay.d.ts +9 -4
- package/dist/types/components/wallets/LinePay/type.d.ts +6 -0
- package/dist/types/components/wallets/MayBankQRPay/MayBankQRPay.d.ts +15 -0
- package/dist/types/components/wallets/MayBankQRPay/type.d.ts +6 -0
- package/dist/types/components/wallets/NinePay/NinePay.d.ts +15 -0
- package/dist/types/components/wallets/NinePay/type.d.ts +6 -0
- package/dist/types/components/wallets/OVO/type.d.ts +2 -24
- package/dist/types/components/wallets/OpayWallet/OpayWallet.d.ts +5 -0
- package/dist/types/components/wallets/OpayWallet/type.d.ts +2 -24
- package/dist/types/components/wallets/P24/type.d.ts +2 -24
- package/dist/types/components/wallets/PagaWallet/PagaWallet.d.ts +5 -0
- package/dist/types/components/wallets/PagaWallet/type.d.ts +2 -24
- package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +5 -0
- package/dist/types/components/wallets/Paymaya/type.d.ts +2 -24
- package/dist/types/components/wallets/PicPay/type.d.ts +2 -24
- package/dist/types/components/wallets/Pix/type.d.ts +2 -24
- package/dist/types/components/{ShopeePay → wallets/ShopeePay}/ShopeePay.d.ts +9 -4
- package/dist/types/components/wallets/ShopeePay/type.d.ts +6 -0
- package/dist/types/components/wallets/Skrill/type.d.ts +2 -24
- package/dist/types/components/{TNGWallet → wallets/TNGWallet}/TNGWallet.d.ts +9 -4
- package/dist/types/components/wallets/TNGWallet/type.d.ts +6 -0
- package/dist/types/components/wallets/Trustly/type.d.ts +2 -16
- package/dist/types/components/wallets/Vietqr/Vietqr.d.ts +5 -0
- package/dist/types/components/wallets/Vietqr/type.d.ts +2 -24
- package/dist/types/components/wallets/WechatPay/WechatPay.d.ts +16 -0
- package/dist/types/components/wallets/WechatPay/type.d.ts +12 -0
- package/dist/types/components/wallets/WechatPay/util.d.ts +13 -0
- package/dist/types/components/wallets/Zalopay/Zalopay.d.ts +5 -0
- package/dist/types/components/wallets/Zalopay/type.d.ts +2 -24
- package/dist/types/components/wallets/index.d.ts +9 -0
- package/dist/types/components/wallets/type.d.ts +0 -14
- package/dist/types/constant.d.ts +8 -0
- package/dist/types/core/checkout.d.ts +2 -9
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/payment.d.ts +21 -0
- package/dist/types/core/preview.d.ts +1 -0
- package/dist/types/core/session.d.ts +2 -2
- package/dist/types/hooks/index.d.ts +0 -1
- package/dist/types/hooks/useBaseWallet.d.ts +27 -5
- package/dist/types/hooks/useI18n.d.ts +1 -1
- package/dist/types/hooks/usePayState.d.ts +3 -4
- package/dist/types/hooks/useRetry.d.ts +22 -3
- package/dist/types/i18n/I18n.d.ts +1 -0
- package/dist/types/i18n/locales/de-DE.d.ts +7 -0
- package/dist/types/i18n/locales/en-GB.d.ts +7 -0
- package/dist/types/i18n/locales/es-ES.d.ts +7 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +7 -0
- package/dist/types/i18n/locales/ja-JP.d.ts +7 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +7 -0
- package/dist/types/i18n/locales/nl-NL.d.ts +7 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +7 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +7 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +7 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +7 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +7 -0
- package/dist/types/i18n/util.d.ts +8 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/out/base-fraud-detection.d.ts +1 -0
- package/dist/types/out/config.d.ts +1 -1
- package/dist/types/out/fraud-detection.d.ts +3 -12
- package/dist/types/out/types.d.ts +7 -6
- package/dist/types/out/worldpay-ddc-manager.d.ts +7 -7
- package/dist/types/types/event.d.ts +30 -3
- package/dist/types/types/index.d.ts +14 -0
- package/dist/types/types/message.d.ts +27 -4
- package/dist/types/types/payment.d.ts +30 -3
- package/dist/types/utils/app-payment.d.ts +1 -0
- package/dist/types/utils/array.d.ts +17 -0
- package/dist/types/utils/business/amount.d.ts +7 -0
- package/dist/types/utils/business/index.d.ts +1 -0
- package/dist/types/utils/detect.d.ts +3 -0
- package/dist/types/utils/iframe.d.ts +1 -1
- package/dist/types/utils/index.d.ts +1 -6
- package/dist/types/utils/number.d.ts +4 -0
- package/dist/types/utils/payment.d.ts +10 -10
- package/dist/types/utils/redirect.d.ts +10 -0
- package/dist/types/utils/system-info/get-browser-info.d.ts +4 -0
- package/package.json +11 -5
- package/dist/es/api/modules/ali-pay/index.js +0 -16
- package/dist/es/api/modules/boost/index.js +0 -16
- package/dist/es/api/modules/gcash/index.js +0 -16
- package/dist/es/api/modules/grab-pay/index.js +0 -16
- package/dist/es/api/modules/line-pay/index.js +0 -16
- package/dist/es/api/modules/may-bank-qr-pay/index.js +0 -16
- package/dist/es/api/modules/nine-pay/index.js +0 -16
- package/dist/es/api/modules/opay-wallet/index.js +0 -16
- package/dist/es/api/modules/paga-wallet/index.js +0 -16
- package/dist/es/api/modules/paymaya/index.js +0 -16
- package/dist/es/api/modules/pic-pay/index.js +0 -16
- package/dist/es/api/modules/pix/index.js +0 -16
- package/dist/es/api/modules/shopee-pay/index.js +0 -16
- package/dist/es/api/modules/tng-wallet/index.js +0 -16
- package/dist/es/api/modules/wechat-pay/index.js +0 -16
- package/dist/es/api/modules/zalopay/index.js +0 -16
- package/dist/es/components/AliPay/index.js +0 -330
- package/dist/es/components/Boost/index.js +0 -349
- package/dist/es/components/GrabPay/index.js +0 -349
- package/dist/es/components/LinePay/index.js +0 -349
- package/dist/es/components/MayBankQRPay/index.js +0 -355
- package/dist/es/components/NinePay/index.js +0 -349
- package/dist/es/components/ShopeePay/index.js +0 -349
- package/dist/es/components/TNGWallet/index.js +0 -349
- package/dist/es/components/WechatPay/index.js +0 -339
- package/dist/es/hooks/usePayment.js +0 -14
- package/dist/types/api/modules/ali-pay/index.d.ts +0 -4
- package/dist/types/api/modules/boost/index.d.ts +0 -4
- package/dist/types/api/modules/gcash/index.d.ts +0 -4
- package/dist/types/api/modules/grab-pay/index.d.ts +0 -4
- package/dist/types/api/modules/line-pay/index.d.ts +0 -4
- package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +0 -4
- package/dist/types/api/modules/nine-pay/index.d.ts +0 -4
- package/dist/types/api/modules/opay-wallet/index.d.ts +0 -4
- package/dist/types/api/modules/paga-wallet/index.d.ts +0 -4
- package/dist/types/api/modules/paymaya/index.d.ts +0 -4
- package/dist/types/api/modules/pic-pay/index.d.ts +0 -4
- package/dist/types/api/modules/pix/index.d.ts +0 -4
- package/dist/types/api/modules/shopee-pay/index.d.ts +0 -4
- package/dist/types/api/modules/tng-wallet/index.d.ts +0 -4
- package/dist/types/api/modules/vietqr/index.d.ts +0 -4
- package/dist/types/api/modules/wechat-pay/index.d.ts +0 -4
- package/dist/types/api/modules/zalopay/index.d.ts +0 -4
- package/dist/types/components/AliPay/type.d.ts +0 -26
- package/dist/types/components/Boost/type.d.ts +0 -28
- package/dist/types/components/GrabPay/type.d.ts +0 -28
- package/dist/types/components/LinePay/type.d.ts +0 -28
- package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +0 -10
- package/dist/types/components/MayBankQRPay/type.d.ts +0 -28
- package/dist/types/components/NinePay/NinePay.d.ts +0 -10
- package/dist/types/components/NinePay/type.d.ts +0 -28
- package/dist/types/components/ShopeePay/type.d.ts +0 -28
- package/dist/types/components/TNGWallet/type.d.ts +0 -28
- package/dist/types/components/WechatPay/WechatPay.d.ts +0 -10
- package/dist/types/components/WechatPay/type.d.ts +0 -28
- package/dist/types/hooks/usePayment.d.ts +0 -8
- package/dist/types/utils/behavior-tracker.d.ts +0 -36
- /package/dist/es/components/internal/Button/{button2.js → button.js} +0 -0
- /package/dist/types/components/{AliPay → wallets/AliPay}/index.d.ts +0 -0
- /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
- /package/dist/types/components/{WechatPay → wallets/WechatPay}/index.d.ts +0 -0
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { w, A, h, F, y, q, T, u, b } from "../../core.js";
|
|
2
2
|
import { isTimeoutError } from "../../api/http.js";
|
|
3
|
-
import { intersection } from "../../utils/index.js";
|
|
4
|
-
import { defaultInputStyleConfig } from "../../types/index.js";
|
|
5
3
|
import { getCardPayInfo, cardPay } from "../../api/modules/card/index.js";
|
|
4
|
+
import { safeParse, safeStringify } from "../../utils/index.js";
|
|
5
|
+
import { defaultInputStyleConfig } from "../../types/index.js";
|
|
6
|
+
import { PaymentMethod, PaymentType, SessionMode, COMMON_CLASS_NAME, CardPaymentMethods } from "../../constant.js";
|
|
7
|
+
import { buildPaymentParams } from "../../api/utils/index.js";
|
|
6
8
|
import { getBrowserParams } from "../../api/modules/get-browser-params.js";
|
|
7
|
-
import { PaymentMethod, PaymentType, SessionMode, CardPaymentMethods, COMMON_CLASS_NAME } from "../../constant.js";
|
|
8
9
|
import { CoreContext } from "../../core/context.js";
|
|
9
10
|
import { PayKKaError } from "../../core/error.js";
|
|
10
|
-
import "../../out/
|
|
11
|
+
import "../../out/fraud-detection.js";
|
|
11
12
|
import { createPromise } from "../../utils/create-promise.js";
|
|
12
13
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
13
14
|
import { usePayState } from "../../hooks/usePayState.js";
|
|
14
15
|
import { useRetry } from "../../hooks/useRetry.js";
|
|
15
|
-
import { AddressField } from "../AddressField/index.js";
|
|
16
|
+
import { DEFAULT_ADDRESS, AddressField } from "../AddressField/index.js";
|
|
16
17
|
import { CardBrands } from "../CardBrands/index.js";
|
|
17
18
|
import { CardExpireDateField } from "../CardExpireDateField/index.js";
|
|
18
19
|
import { CardHolderNameField } from "../CardHolderNameField/index.js";
|
|
@@ -29,17 +30,22 @@ import { IconSwitch } from "../internal/icons/IconSwitch.js";
|
|
|
29
30
|
import { Info } from "../internal/Info/Info.js";
|
|
30
31
|
import { RecurringTip } from "../RecurringTip/index.js";
|
|
31
32
|
import { EFieldType, SecuredFieldsProvider } from "../SecuredFieldsProvider/index.js";
|
|
32
|
-
import
|
|
33
|
+
import "../SubmitButton/index.js";
|
|
34
|
+
import "../internal/Button/button.js";
|
|
35
|
+
import "../internal/LoadingCheck/loading-check.js";
|
|
33
36
|
import { ThreeDSAuth } from "../ThreeDS/index.js";
|
|
34
37
|
import { CombinedCardInfo } from "../CombinedCardInfo/index.js";
|
|
38
|
+
import { PaymentButton } from "../PaymentButton/index.js";
|
|
39
|
+
import { intersection } from "../../utils/array.js";
|
|
40
|
+
import { separateInputStyle } from "../../utils/style.js";
|
|
35
41
|
import { cardBrandCodes } from "../../utils/card-brand/brands.js";
|
|
36
42
|
import { findCardBrand } from "../../utils/card-brand/index.js";
|
|
37
|
-
import {
|
|
38
|
-
import { formatPaymentResult } from "../../utils/payment.js";
|
|
39
|
-
import { normalizedClass, trimAll,
|
|
40
|
-
const CURR_PAYMENT_METHOD = PaymentMethod.BANKCARD;
|
|
43
|
+
import { createUrlWithParams } from "../../utils/location.js";
|
|
44
|
+
import { formatPaymentResult, processPaymentStatus } from "../../utils/payment.js";
|
|
45
|
+
import { normalizedClass, trimAll, limitedToNumber } from "../../utils/format.js";
|
|
41
46
|
const { bem } = useBEM("card");
|
|
42
47
|
const fieldClassNames = bem("field");
|
|
48
|
+
const CURR_PAYMENT_METHOD = PaymentMethod.BANKCARD;
|
|
43
49
|
const Card = w((props, ref) => {
|
|
44
50
|
var _a, _b;
|
|
45
51
|
const {
|
|
@@ -56,10 +62,9 @@ const Card = w((props, ref) => {
|
|
|
56
62
|
core,
|
|
57
63
|
hidePaymentButton = false
|
|
58
64
|
} = props;
|
|
59
|
-
console.log(props);
|
|
60
65
|
const addressCore = core.getAddressCore();
|
|
61
66
|
const emailState = createEmailCore();
|
|
62
|
-
const { i18n, fraudDetection, sessionReady } = usePayState(session, core);
|
|
67
|
+
const { i18n, fraudDetection, sessionReady, disabled } = usePayState(session, core);
|
|
63
68
|
const addressFieldRef = A(null);
|
|
64
69
|
const emailFieldRef = A(null);
|
|
65
70
|
const combinedCardInfoRef = A(null);
|
|
@@ -71,15 +76,7 @@ const Card = w((props, ref) => {
|
|
|
71
76
|
securityCode: "",
|
|
72
77
|
holderName: "",
|
|
73
78
|
cardInfo: "",
|
|
74
|
-
address: {
|
|
75
|
-
country: void 0,
|
|
76
|
-
province: void 0,
|
|
77
|
-
city: void 0,
|
|
78
|
-
area: void 0,
|
|
79
|
-
postCode: void 0,
|
|
80
|
-
address1: void 0,
|
|
81
|
-
address2: void 0
|
|
82
|
-
}
|
|
79
|
+
address: { ...DEFAULT_ADDRESS }
|
|
83
80
|
});
|
|
84
81
|
const [validated, setValidated] = h(false);
|
|
85
82
|
const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
|
|
@@ -96,25 +93,27 @@ const Card = w((props, ref) => {
|
|
|
96
93
|
const [inputStyle, setInputStyle] = h({});
|
|
97
94
|
const [splitCardInfo] = h(cardInfoLayout === "split");
|
|
98
95
|
const currentBin = A("");
|
|
96
|
+
const [hiddenIframeName, setHiddenIframeName] = h("");
|
|
99
97
|
F(ref, () => ({
|
|
100
98
|
checkThreeDS,
|
|
101
99
|
updateAddress: () => {
|
|
102
100
|
var _a2;
|
|
103
101
|
if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
|
|
104
102
|
return;
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
(
|
|
108
|
-
|
|
103
|
+
const address = addressCore.getAddressState();
|
|
104
|
+
form.address = address;
|
|
105
|
+
setForm(form);
|
|
106
|
+
(_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(address);
|
|
107
|
+
validateFormSilently();
|
|
109
108
|
},
|
|
110
109
|
updateEmail: () => {
|
|
111
110
|
var _a2;
|
|
112
111
|
if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
|
|
113
112
|
return;
|
|
114
|
-
|
|
115
|
-
setForm(
|
|
113
|
+
form.email = emailState.email;
|
|
114
|
+
setForm(form);
|
|
116
115
|
(_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
|
|
117
|
-
|
|
116
|
+
validateFormSilently();
|
|
118
117
|
},
|
|
119
118
|
payment: () => {
|
|
120
119
|
hidePaymentButton && onSubmit();
|
|
@@ -122,8 +121,14 @@ const Card = w((props, ref) => {
|
|
|
122
121
|
}));
|
|
123
122
|
const initFieldStatus = () => {
|
|
124
123
|
const { field, sessionMode } = session.checkout;
|
|
125
|
-
const
|
|
126
|
-
|
|
124
|
+
const cpyField = safeParse(safeStringify(field));
|
|
125
|
+
const { email, address, holderName } = cpyField;
|
|
126
|
+
const { forceCustomFields = false } = core.config._checkoutConfig || {};
|
|
127
|
+
if (forceCustomFields) {
|
|
128
|
+
email.show = showEmail;
|
|
129
|
+
address.show = showAddress;
|
|
130
|
+
holderName.show = showHolderName;
|
|
131
|
+
} else if (sessionMode === SessionMode.COMPONENT) {
|
|
127
132
|
if (email.disabled) {
|
|
128
133
|
email.show = showEmail;
|
|
129
134
|
}
|
|
@@ -135,12 +140,11 @@ const Card = w((props, ref) => {
|
|
|
135
140
|
holderName.disabled = true;
|
|
136
141
|
}
|
|
137
142
|
}
|
|
138
|
-
setFieldStatus({ ...
|
|
143
|
+
setFieldStatus({ ...cpyField });
|
|
139
144
|
};
|
|
140
145
|
const initElementStyles = () => {
|
|
141
|
-
if (!styles)
|
|
146
|
+
if (!styles)
|
|
142
147
|
return;
|
|
143
|
-
}
|
|
144
148
|
const { input } = separateInputStyle(styles);
|
|
145
149
|
input && setInputStyle(input);
|
|
146
150
|
};
|
|
@@ -151,9 +155,8 @@ const Card = w((props, ref) => {
|
|
|
151
155
|
};
|
|
152
156
|
y(() => {
|
|
153
157
|
var _a2, _b2;
|
|
154
|
-
if (!sessionReady)
|
|
158
|
+
if (!sessionReady)
|
|
155
159
|
return;
|
|
156
|
-
}
|
|
157
160
|
const { status, supportMethods = [], bill = {}, sessionMode, country } = (session == null ? void 0 : session.checkout) || {};
|
|
158
161
|
if (sessionMode === SessionMode.DROP_IN && !isDropIn) {
|
|
159
162
|
(_b2 = (_a2 = props.core.config).onInitError) == null ? void 0 : _b2.call(
|
|
@@ -162,9 +165,8 @@ const Card = w((props, ref) => {
|
|
|
162
165
|
);
|
|
163
166
|
return;
|
|
164
167
|
}
|
|
165
|
-
if (!intersection(supportMethods, CardPaymentMethods).length)
|
|
168
|
+
if (!intersection(supportMethods, CardPaymentMethods).length)
|
|
166
169
|
return;
|
|
167
|
-
}
|
|
168
170
|
initFieldStatus();
|
|
169
171
|
initElementStyles();
|
|
170
172
|
setSecurity(sessionMode !== SessionMode.HOSTED);
|
|
@@ -183,7 +185,7 @@ const Card = w((props, ref) => {
|
|
|
183
185
|
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
184
186
|
setSubmitButtonStatus("unSubmit");
|
|
185
187
|
(_a2 = props.onTimeout) == null ? void 0 : _a2.call(props, "retry", getPaymentMethodContext());
|
|
186
|
-
core.
|
|
188
|
+
core.payment.resetCurrPaymentMethod();
|
|
187
189
|
},
|
|
188
190
|
[i18n, props.onTimeout]
|
|
189
191
|
);
|
|
@@ -199,18 +201,19 @@ const Card = w((props, ref) => {
|
|
|
199
201
|
const processOnError = (error) => {
|
|
200
202
|
var _a2;
|
|
201
203
|
(_a2 = props.onError) == null ? void 0 : _a2.call(props, error, getPaymentMethodContext());
|
|
202
|
-
core.
|
|
204
|
+
core.payment.resetCurrPaymentMethod();
|
|
203
205
|
};
|
|
204
|
-
const { start: startReFetchPayInfo } = useRetry(
|
|
205
|
-
|
|
206
|
-
|
|
206
|
+
const { start: startReFetchPayInfo } = useRetry(
|
|
207
|
+
(timeout) => pay(true, timeout),
|
|
208
|
+
{
|
|
209
|
+
onTimeout: () => onTimeout(i18n.get("common.queryTimeout"))
|
|
210
|
+
}
|
|
211
|
+
);
|
|
207
212
|
const validatePromise = A(createPromise());
|
|
208
213
|
const onValidated = (data) => {
|
|
209
214
|
fieldValidStatusMap.current[data.fieldType].status = data.status;
|
|
210
215
|
const results = Object.values(fieldValidStatusMap.current);
|
|
211
|
-
if (results.includes(null)) {
|
|
212
|
-
return;
|
|
213
|
-
} else {
|
|
216
|
+
if (!results.includes(null)) {
|
|
214
217
|
const validateResult = results.every((result) => result.status === "success");
|
|
215
218
|
if (validateResult) {
|
|
216
219
|
validatePromise.current.resolve(true);
|
|
@@ -219,6 +222,9 @@ const Card = w((props, ref) => {
|
|
|
219
222
|
}
|
|
220
223
|
}
|
|
221
224
|
};
|
|
225
|
+
const onHiddenIframeReady = (data) => {
|
|
226
|
+
setHiddenIframeName(data.name);
|
|
227
|
+
};
|
|
222
228
|
const validateCombineCardInfo = async () => {
|
|
223
229
|
var _a2;
|
|
224
230
|
validatePromise.current = createPromise();
|
|
@@ -242,7 +248,9 @@ const Card = w((props, ref) => {
|
|
|
242
248
|
(_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
|
|
243
249
|
var _a3;
|
|
244
250
|
(fieldStatus == null ? void 0 : fieldStatus.address.show) && addressCore.setValidateAllFields(true);
|
|
245
|
-
(_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors, getPaymentMethodContext());
|
|
251
|
+
const submitResult = await ((_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors, getPaymentMethodContext()));
|
|
252
|
+
if (submitResult === false)
|
|
253
|
+
return;
|
|
246
254
|
if (errors) {
|
|
247
255
|
setSubmitButtonStatus("unSubmit");
|
|
248
256
|
return;
|
|
@@ -253,7 +261,7 @@ const Card = w((props, ref) => {
|
|
|
253
261
|
});
|
|
254
262
|
}
|
|
255
263
|
const getPaymentParams = async () => {
|
|
256
|
-
var _a2
|
|
264
|
+
var _a2;
|
|
257
265
|
const cardNo = trimAll(form.number);
|
|
258
266
|
const cardBrand = findCardBrand(cardNo);
|
|
259
267
|
const [expMonth, expYear] = form.expireDate.split("/");
|
|
@@ -269,10 +277,6 @@ const Card = w((props, ref) => {
|
|
|
269
277
|
paymentMethod = cardBrand.code;
|
|
270
278
|
}
|
|
271
279
|
}
|
|
272
|
-
let cardBin;
|
|
273
|
-
if (security) {
|
|
274
|
-
cardBin = splitCardInfo ? (_b2 = cardNumberFieldRef.current) == null ? void 0 : _b2.binValue() : (_c = combinedCardInfoRef.current) == null ? void 0 : _c.binValue();
|
|
275
|
-
}
|
|
276
280
|
return {
|
|
277
281
|
sessionId: session.sessionId,
|
|
278
282
|
clientKey: session.clientKey,
|
|
@@ -303,14 +307,17 @@ const Card = w((props, ref) => {
|
|
|
303
307
|
},
|
|
304
308
|
browser: await getBrowserParams({
|
|
305
309
|
fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId({
|
|
306
|
-
bin:
|
|
310
|
+
bin: limitedToNumber(form.number).slice(0, 9),
|
|
311
|
+
// 快捷支付场景没有 bin,不需要传 hiddenIframeName
|
|
312
|
+
hiddenIframeName: isFastPayment ? "" : hiddenIframeName
|
|
307
313
|
}))
|
|
308
314
|
})
|
|
309
315
|
};
|
|
310
316
|
};
|
|
311
317
|
async function pay(search = false, timeout) {
|
|
312
|
-
var _a2, _b2, _c, _d, _e;
|
|
318
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
313
319
|
try {
|
|
320
|
+
core.payment.currPaymentMethod.value = CURR_PAYMENT_METHOD;
|
|
314
321
|
const requestOptions = { locale: i18n.locale, timeout };
|
|
315
322
|
let res = null;
|
|
316
323
|
if (search) {
|
|
@@ -326,8 +333,12 @@ const Card = w((props, ref) => {
|
|
|
326
333
|
} else {
|
|
327
334
|
const paymentParams = await getPaymentParams();
|
|
328
335
|
const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", CURR_PAYMENT_METHOD);
|
|
336
|
+
if ((_e = core.config._checkoutConfig) == null ? void 0 : _e.dynamicSessionId) {
|
|
337
|
+
await core.updateSessionId(buildPaymentParams(paymentParams, extraParams));
|
|
338
|
+
session.sessionId && (paymentParams.sessionId = session.sessionId);
|
|
339
|
+
}
|
|
329
340
|
if (security) {
|
|
330
|
-
(
|
|
341
|
+
(_f = SFPRef.current) == null ? void 0 : _f.payment(paymentParams, extraParams);
|
|
331
342
|
return { end: true };
|
|
332
343
|
} else {
|
|
333
344
|
res = await cardPay(paymentParams, extraParams, requestOptions);
|
|
@@ -351,17 +362,18 @@ const Card = w((props, ref) => {
|
|
|
351
362
|
}
|
|
352
363
|
const processThreeDS = (threeDSUrl, incomplete) => {
|
|
353
364
|
var _a2;
|
|
365
|
+
const finalUrl = createUrlWithParams(threeDSUrl, { locale: i18n.locale });
|
|
354
366
|
if (enable3DSModal) {
|
|
355
367
|
console.log("3ds open");
|
|
356
368
|
setShowThreeDSModal(true);
|
|
357
369
|
setThreeDSInfo({
|
|
358
|
-
url:
|
|
370
|
+
url: finalUrl,
|
|
359
371
|
incomplete,
|
|
360
372
|
width: threeDSFrame == null ? void 0 : threeDSFrame.modalWidth,
|
|
361
373
|
height: threeDSFrame == null ? void 0 : threeDSFrame.modalHeight
|
|
362
374
|
});
|
|
363
375
|
} else {
|
|
364
|
-
(_a2 = props.onThreeDS) == null ? void 0 : _a2.call(props,
|
|
376
|
+
(_a2 = props.onThreeDS) == null ? void 0 : _a2.call(props, finalUrl, incomplete);
|
|
365
377
|
}
|
|
366
378
|
};
|
|
367
379
|
const handleCloseThreeDSModal = () => {
|
|
@@ -370,43 +382,58 @@ const Card = w((props, ref) => {
|
|
|
370
382
|
setThreeDSInfo(void 0);
|
|
371
383
|
checkThreeDS();
|
|
372
384
|
};
|
|
373
|
-
const processAfterPayment = (res, search = false) => {
|
|
374
|
-
var _a2
|
|
375
|
-
const {
|
|
385
|
+
const processAfterPayment = async (res, search = false) => {
|
|
386
|
+
var _a2;
|
|
387
|
+
const { errorMessage, errorCode, payInfo = {}, sessionId } = res;
|
|
376
388
|
const { threeDSUrl } = payInfo;
|
|
377
389
|
sessionId && (session.sessionId = sessionId);
|
|
378
|
-
!search
|
|
379
|
-
|
|
380
|
-
|
|
390
|
+
if (!search) {
|
|
391
|
+
(_a2 = props.onSubmitResponse) == null ? void 0 : _a2.call(props, res, getPaymentMethodContext());
|
|
392
|
+
}
|
|
393
|
+
let end = true;
|
|
394
|
+
await processPaymentStatus(res, {
|
|
395
|
+
onProcessing: () => {
|
|
396
|
+
!search && startReFetchPayInfo();
|
|
397
|
+
end = false;
|
|
398
|
+
},
|
|
399
|
+
onAuthorized: () => {
|
|
400
|
+
var _a3;
|
|
381
401
|
setSubmitButtonStatus("unSubmit");
|
|
382
|
-
|
|
402
|
+
(_a3 = props.onAuthorized) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
403
|
+
},
|
|
404
|
+
onInThreeDS: () => {
|
|
405
|
+
if (threeDSUrl) {
|
|
406
|
+
processThreeDS(threeDSUrl, false);
|
|
407
|
+
} else {
|
|
408
|
+
end = false;
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
onInPreviousThreeDS: () => {
|
|
412
|
+
if (threeDSUrl) {
|
|
413
|
+
processThreeDS(threeDSUrl, true);
|
|
414
|
+
} else {
|
|
415
|
+
end = false;
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
onSuccess: () => {
|
|
383
419
|
processOnSuccess(res);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
420
|
+
},
|
|
421
|
+
onExpired: () => {
|
|
422
|
+
var _a3;
|
|
423
|
+
setSubmitButtonStatus("unSubmit");
|
|
424
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
425
|
+
},
|
|
426
|
+
onFailure: () => {
|
|
388
427
|
errorMessage && setErrorMsg(errorMessage);
|
|
389
428
|
setSubmitButtonStatus("unSubmit");
|
|
390
429
|
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
391
|
-
}
|
|
430
|
+
},
|
|
431
|
+
onDefault: () => {
|
|
432
|
+
core.payment.resetCurrPaymentMethod();
|
|
392
433
|
setSubmitButtonStatus("unSubmit");
|
|
393
|
-
(_b2 = props.onAuthorized) == null ? void 0 : _b2.call(props, getPaymentMethodContext());
|
|
394
|
-
} else if (orderStatus === "IN_THREED") {
|
|
395
|
-
threeDSUrl && processThreeDS(threeDSUrl, false);
|
|
396
|
-
} else if (orderStatus === "IN_PREVIOUS_THREED") {
|
|
397
|
-
threeDSUrl && processThreeDS(threeDSUrl, true);
|
|
398
434
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
processOnSuccess(res);
|
|
402
|
-
return { end: true };
|
|
403
|
-
} else if (status === "EXPIRED") {
|
|
404
|
-
setSubmitButtonStatus("unSubmit");
|
|
405
|
-
(_c = props.onExpired) == null ? void 0 : _c.call(props, getPaymentMethodContext());
|
|
406
|
-
return { end: true };
|
|
407
|
-
}
|
|
408
|
-
setSubmitButtonStatus("unSubmit");
|
|
409
|
-
return { end: true };
|
|
435
|
+
});
|
|
436
|
+
return { end };
|
|
410
437
|
};
|
|
411
438
|
const processPaymentError = (error) => {
|
|
412
439
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
@@ -414,32 +441,22 @@ const Card = w((props, ref) => {
|
|
|
414
441
|
setSubmitButtonStatus("unSubmit");
|
|
415
442
|
processOnError(new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
|
|
416
443
|
};
|
|
417
|
-
const
|
|
444
|
+
const validateFormSilently = () => {
|
|
418
445
|
var _a2;
|
|
419
|
-
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() =>
|
|
420
|
-
setValidated(true);
|
|
421
|
-
}).catch(() => {
|
|
422
|
-
setValidated(false);
|
|
423
|
-
});
|
|
446
|
+
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => setValidated(true)).catch(() => setValidated(false));
|
|
424
447
|
};
|
|
425
448
|
y(() => {
|
|
426
|
-
|
|
449
|
+
validateFormSilently();
|
|
427
450
|
}, [form]);
|
|
428
451
|
const Button = () => {
|
|
429
|
-
var _a2;
|
|
430
|
-
const transAmount = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.transAmount;
|
|
431
|
-
const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
|
|
432
|
-
const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
|
|
433
452
|
return /* @__PURE__ */ u(
|
|
434
|
-
|
|
453
|
+
PaymentButton,
|
|
435
454
|
{
|
|
436
455
|
className: bem("button"),
|
|
437
456
|
status: submitButtonStatus,
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
onClick: onSubmit,
|
|
442
|
-
verified: validated
|
|
457
|
+
disabled,
|
|
458
|
+
verified: validated,
|
|
459
|
+
onClick: onSubmit
|
|
443
460
|
}
|
|
444
461
|
);
|
|
445
462
|
};
|
|
@@ -451,7 +468,7 @@ const Card = w((props, ref) => {
|
|
|
451
468
|
}
|
|
452
469
|
);
|
|
453
470
|
async function checkThreeDS(search = false, timeout = 2e4) {
|
|
454
|
-
var _a2, _b2
|
|
471
|
+
var _a2, _b2;
|
|
455
472
|
if (!session)
|
|
456
473
|
return { end: true };
|
|
457
474
|
try {
|
|
@@ -467,42 +484,48 @@ const Card = w((props, ref) => {
|
|
|
467
484
|
timeout
|
|
468
485
|
}
|
|
469
486
|
);
|
|
470
|
-
const {
|
|
471
|
-
|
|
472
|
-
|
|
487
|
+
const { errorMessage, errorCode } = res;
|
|
488
|
+
let end = true;
|
|
489
|
+
await processPaymentStatus(res, {
|
|
490
|
+
onProcessing: () => {
|
|
473
491
|
startReFetchPayInfo();
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
478
|
-
} else if (orderStatus === "AUTHORIZED") {
|
|
492
|
+
},
|
|
493
|
+
onAuthorized: () => {
|
|
494
|
+
var _a3;
|
|
479
495
|
setSubmitButtonStatus("unSubmit");
|
|
480
|
-
(
|
|
481
|
-
}
|
|
496
|
+
(_a3 = props.onAuthorized) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
497
|
+
},
|
|
498
|
+
onInThreeDS: () => {
|
|
482
499
|
setSubmitButtonStatus("loading");
|
|
483
500
|
!search && startReFetchCardPay3DSInfo();
|
|
484
|
-
|
|
485
|
-
}
|
|
501
|
+
end = false;
|
|
502
|
+
},
|
|
503
|
+
onInPreviousThreeDS: () => {
|
|
504
|
+
setSubmitButtonStatus("unSubmit");
|
|
486
505
|
setErrorMsg(i18n.get("common.pay3DSIncomplete"));
|
|
506
|
+
},
|
|
507
|
+
onSuccess: () => {
|
|
508
|
+
processOnSuccess(res);
|
|
509
|
+
stopReFetchCardPay3DSInfo();
|
|
510
|
+
},
|
|
511
|
+
onExpired: () => {
|
|
512
|
+
var _a3;
|
|
487
513
|
setSubmitButtonStatus("unSubmit");
|
|
488
|
-
|
|
514
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
515
|
+
stopReFetchCardPay3DSInfo();
|
|
516
|
+
},
|
|
517
|
+
onFailure: () => {
|
|
518
|
+
errorMessage && setErrorMsg(errorMessage);
|
|
489
519
|
setSubmitButtonStatus("unSubmit");
|
|
520
|
+
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
521
|
+
},
|
|
522
|
+
onDefault: () => {
|
|
523
|
+
core.payment.resetCurrPaymentMethod();
|
|
524
|
+
setSubmitButtonStatus("unSubmit");
|
|
525
|
+
stopReFetchCardPay3DSInfo();
|
|
490
526
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
} else if (status === "SUCCESS") {
|
|
494
|
-
processOnSuccess(res);
|
|
495
|
-
stopReFetchCardPay3DSInfo();
|
|
496
|
-
return { end: true };
|
|
497
|
-
} else if (status === "EXPIRED") {
|
|
498
|
-
setSubmitButtonStatus("unSubmit");
|
|
499
|
-
(_d = props.onExpired) == null ? void 0 : _d.call(props, getPaymentMethodContext());
|
|
500
|
-
stopReFetchCardPay3DSInfo();
|
|
501
|
-
return { end: true };
|
|
502
|
-
}
|
|
503
|
-
setSubmitButtonStatus("unSubmit");
|
|
504
|
-
stopReFetchCardPay3DSInfo();
|
|
505
|
-
return { end: true };
|
|
527
|
+
});
|
|
528
|
+
return { end };
|
|
506
529
|
} catch (error) {
|
|
507
530
|
if (isTimeoutError(error)) {
|
|
508
531
|
if (search) {
|
|
@@ -520,17 +543,15 @@ const Card = w((props, ref) => {
|
|
|
520
543
|
}
|
|
521
544
|
const isFastPayment = T(() => {
|
|
522
545
|
var _a2;
|
|
523
|
-
if (!(session == null ? void 0 : session.checkout))
|
|
546
|
+
if (!(session == null ? void 0 : session.checkout))
|
|
524
547
|
return;
|
|
525
|
-
}
|
|
526
548
|
const isPurchase = (session == null ? void 0 : session.checkout.paymentType) === PaymentType.PURCHASE;
|
|
527
549
|
const hasCardTokens = !!((_a2 = session == null ? void 0 : session.checkout.tokens) == null ? void 0 : _a2.length);
|
|
528
550
|
return isPurchase && hasCardTokens;
|
|
529
551
|
}, [session == null ? void 0 : session.checkout]);
|
|
530
552
|
const isShowStoreCheckBox = T(() => {
|
|
531
|
-
if (!(session == null ? void 0 : session.checkout))
|
|
553
|
+
if (!(session == null ? void 0 : session.checkout))
|
|
532
554
|
return;
|
|
533
|
-
}
|
|
534
555
|
return (session == null ? void 0 : session.checkout.paymentType) === PaymentType.PURCHASE && (session == null ? void 0 : session.checkout.storePaymentMethod);
|
|
535
556
|
}, [session == null ? void 0 : session.checkout]);
|
|
536
557
|
const StoreCheckBox = () => {
|
|
@@ -541,6 +562,7 @@ const Card = w((props, ref) => {
|
|
|
541
562
|
CheckBox,
|
|
542
563
|
{
|
|
543
564
|
label: i18n.get("card.storeInfo"),
|
|
565
|
+
disabled,
|
|
544
566
|
checked: storePaymentMethod,
|
|
545
567
|
onChange: onCheck
|
|
546
568
|
}
|
|
@@ -555,7 +577,7 @@ const Card = w((props, ref) => {
|
|
|
555
577
|
(_a3 = formRef.current) == null ? void 0 : _a3.resetValidation();
|
|
556
578
|
setIsEditOtherCard(false);
|
|
557
579
|
};
|
|
558
|
-
return isPurchase && hasCardTokens && /* @__PURE__ */ u("div", { className: bem("change-box"), onClick, children: [
|
|
580
|
+
return isPurchase && hasCardTokens && /* @__PURE__ */ u("div", { className: bem("change-box", { disabled }), onClick, children: [
|
|
559
581
|
/* @__PURE__ */ u(IconSwitch, {}),
|
|
560
582
|
/* @__PURE__ */ u("span", { style: { marginLeft: "2px" }, children: i18n.get("card.cardSelector.change") })
|
|
561
583
|
] });
|
|
@@ -568,9 +590,8 @@ const Card = w((props, ref) => {
|
|
|
568
590
|
const onClickChangeCard = () => {
|
|
569
591
|
var _a2;
|
|
570
592
|
const tokens = ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.tokens) || [];
|
|
571
|
-
if (tokens.length > 1)
|
|
593
|
+
if (tokens.length > 1)
|
|
572
594
|
return;
|
|
573
|
-
}
|
|
574
595
|
onEditOtherCard();
|
|
575
596
|
};
|
|
576
597
|
const onCardChange = (option) => {
|
|
@@ -579,7 +600,7 @@ const Card = w((props, ref) => {
|
|
|
579
600
|
};
|
|
580
601
|
const setFormRef = (dom) => {
|
|
581
602
|
formRef.current = dom;
|
|
582
|
-
dom &&
|
|
603
|
+
dom && validateFormSilently();
|
|
583
604
|
};
|
|
584
605
|
const cardNumberFieldRef = A(null);
|
|
585
606
|
const cardExpireDateFieldRef = A(null);
|
|
@@ -640,7 +661,7 @@ const Card = w((props, ref) => {
|
|
|
640
661
|
(_d = fieldRef.current) == null ? void 0 : _d.resetValidation(data.status, error);
|
|
641
662
|
}
|
|
642
663
|
setTimeout(() => {
|
|
643
|
-
|
|
664
|
+
validateFormSilently();
|
|
644
665
|
}, 100);
|
|
645
666
|
};
|
|
646
667
|
const onBrand = (data) => {
|
|
@@ -672,16 +693,20 @@ const Card = w((props, ref) => {
|
|
|
672
693
|
{
|
|
673
694
|
ref: emailFieldRef,
|
|
674
695
|
value: form.email,
|
|
675
|
-
disabled: fieldStatus == null ? void 0 : fieldStatus.email.disabled
|
|
696
|
+
disabled: (fieldStatus == null ? void 0 : fieldStatus.email.disabled) || disabled
|
|
676
697
|
}
|
|
677
698
|
) }) });
|
|
678
699
|
};
|
|
700
|
+
const CardHolderName = () => {
|
|
701
|
+
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.holderName.show) && /* @__PURE__ */ u("div", { className: bem("holder-name"), children: /* @__PURE__ */ u(CardHolderNameField, { disabled: (fieldStatus == null ? void 0 : fieldStatus.holderName.disabled) || disabled }) }) });
|
|
702
|
+
};
|
|
679
703
|
const Address = () => {
|
|
680
704
|
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: bem("address"), children: /* @__PURE__ */ u(
|
|
681
705
|
AddressField,
|
|
682
706
|
{
|
|
683
707
|
ref: addressFieldRef,
|
|
684
708
|
value: form.address,
|
|
709
|
+
disabled,
|
|
685
710
|
onChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
686
711
|
}
|
|
687
712
|
) }) });
|
|
@@ -689,9 +714,20 @@ const Card = w((props, ref) => {
|
|
|
689
714
|
const ErrorMessage = () => {
|
|
690
715
|
return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg }) });
|
|
691
716
|
};
|
|
692
|
-
const
|
|
717
|
+
const CardCombineInfo = () => {
|
|
718
|
+
return /* @__PURE__ */ u("div", { className: bem("card-info"), children: /* @__PURE__ */ u(
|
|
719
|
+
CombinedCardInfo,
|
|
720
|
+
{
|
|
721
|
+
ref: combinedCardInfoRef,
|
|
722
|
+
supportedCardBrands,
|
|
723
|
+
showLabel: true,
|
|
724
|
+
security
|
|
725
|
+
}
|
|
726
|
+
) });
|
|
727
|
+
};
|
|
728
|
+
const CardSplitInfo = () => {
|
|
693
729
|
var _a2, _b2, _c, _d;
|
|
694
|
-
return
|
|
730
|
+
return /* @__PURE__ */ u(b, { children: [
|
|
695
731
|
/* @__PURE__ */ u("div", { className: fieldClassNames, children: [
|
|
696
732
|
/* @__PURE__ */ u("div", { className: bem("card-number-wrapper"), children: [
|
|
697
733
|
/* @__PURE__ */ u(
|
|
@@ -700,6 +736,7 @@ const Card = w((props, ref) => {
|
|
|
700
736
|
supportedCardBrands: (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.supportMethods) == null ? void 0 : _b2.filter(Boolean),
|
|
701
737
|
security,
|
|
702
738
|
ref: cardNumberFieldRef,
|
|
739
|
+
disabled,
|
|
703
740
|
onBinValue: onBinValueChanged
|
|
704
741
|
}
|
|
705
742
|
),
|
|
@@ -719,6 +756,7 @@ const Card = w((props, ref) => {
|
|
|
719
756
|
{
|
|
720
757
|
security,
|
|
721
758
|
className: fieldClassNames,
|
|
759
|
+
disabled,
|
|
722
760
|
ref: cardExpireDateFieldRef
|
|
723
761
|
}
|
|
724
762
|
),
|
|
@@ -727,26 +765,19 @@ const Card = w((props, ref) => {
|
|
|
727
765
|
{
|
|
728
766
|
security,
|
|
729
767
|
className: fieldClassNames,
|
|
768
|
+
disabled,
|
|
730
769
|
ref: cardSecurityCodeFieldRef
|
|
731
770
|
}
|
|
732
771
|
)
|
|
733
772
|
] })
|
|
734
|
-
] })
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
ref: combinedCardInfoRef,
|
|
738
|
-
supportedCardBrands,
|
|
739
|
-
showLabel: true,
|
|
740
|
-
security
|
|
741
|
-
}
|
|
742
|
-
) });
|
|
743
|
-
}, [splitCardInfo, security]);
|
|
744
|
-
const cardForm = () => {
|
|
773
|
+
] });
|
|
774
|
+
};
|
|
775
|
+
const PaymentForm = () => {
|
|
745
776
|
var _a2;
|
|
746
777
|
return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
747
778
|
Email(),
|
|
748
|
-
|
|
749
|
-
(
|
|
779
|
+
splitCardInfo ? CardSplitInfo() : CardCombineInfo(),
|
|
780
|
+
CardHolderName(),
|
|
750
781
|
Address(),
|
|
751
782
|
((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentType) === PaymentType.RECURRING && RecurringTip(),
|
|
752
783
|
/* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
|
|
@@ -756,7 +787,7 @@ const Card = w((props, ref) => {
|
|
|
756
787
|
] })
|
|
757
788
|
] }) });
|
|
758
789
|
};
|
|
759
|
-
const
|
|
790
|
+
const FastPaymentForm = () => {
|
|
760
791
|
var _a2, _b2, _c, _d;
|
|
761
792
|
return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
762
793
|
Email(),
|
|
@@ -766,6 +797,7 @@ const Card = w((props, ref) => {
|
|
|
766
797
|
{
|
|
767
798
|
value: (_c = (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.tokens) == null ? void 0 : _b2[0]) == null ? void 0 : _c.token,
|
|
768
799
|
cardList: (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.tokens,
|
|
800
|
+
disabled,
|
|
769
801
|
onClickEdit: onEditOtherCard,
|
|
770
802
|
onClickChange: onClickChangeCard,
|
|
771
803
|
onCardChange,
|
|
@@ -778,6 +810,7 @@ const Card = w((props, ref) => {
|
|
|
778
810
|
{
|
|
779
811
|
className: bem("card-security-code", fieldClassNames),
|
|
780
812
|
style: { flex: 1 },
|
|
813
|
+
disabled,
|
|
781
814
|
security,
|
|
782
815
|
ref: cardSecurityCodeFieldRef
|
|
783
816
|
}
|
|
@@ -796,6 +829,7 @@ const Card = w((props, ref) => {
|
|
|
796
829
|
{
|
|
797
830
|
ref: SFPRef,
|
|
798
831
|
i18n,
|
|
832
|
+
disabled,
|
|
799
833
|
checkoutId: core.id,
|
|
800
834
|
sessionMode: (_a = session.checkout) == null ? void 0 : _a.sessionMode,
|
|
801
835
|
supportedCardBrands,
|
|
@@ -809,11 +843,12 @@ const Card = w((props, ref) => {
|
|
|
809
843
|
onPaymentTimeout: ({ message }) => onTimeout(i18n.get(message)),
|
|
810
844
|
onValidStatusChanged: onFieldValidStatusChanged,
|
|
811
845
|
onValidated,
|
|
846
|
+
onHiddenIframeReady: (data) => onHiddenIframeReady(data),
|
|
812
847
|
onEvent: (type, data) => {
|
|
813
848
|
var _a2, _b2;
|
|
814
849
|
return (_b2 = (_a2 = core.config).onEvent) == null ? void 0 : _b2.call(_a2, type, data);
|
|
815
850
|
},
|
|
816
|
-
children: showFastPaymentForm ?
|
|
851
|
+
children: showFastPaymentForm ? FastPaymentForm() : PaymentForm()
|
|
817
852
|
}
|
|
818
853
|
),
|
|
819
854
|
/* @__PURE__ */ u(
|