@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
|
@@ -4,25 +4,24 @@ import "../../utils/card-brand/brands.js";
|
|
|
4
4
|
import "../../utils/system-info/get-browser-info.js";
|
|
5
5
|
import { extractAreaCodeAndPhoneNumber } from "../../utils/format.js";
|
|
6
6
|
import { GooglePayEventType } from "../../types/event.js";
|
|
7
|
-
import {
|
|
8
|
-
import { formatPaymentResult } from "../../utils/payment.js";
|
|
9
|
-
import { getBrowserParams } from "../../api/modules/get-browser-params.js";
|
|
7
|
+
import { createUrlWithParams } from "../../utils/location.js";
|
|
10
8
|
import { PaymentMethod, SessionMode } from "../../constant.js";
|
|
9
|
+
import { deepMerge } from "../../utils/object.js";
|
|
10
|
+
import { processPaymentStatus, formatPaymentResult } from "../../utils/payment.js";
|
|
11
|
+
import { buildPaymentParams } from "../../api/utils/index.js";
|
|
11
12
|
import { getGooglePayInfo, googlePay } from "../../api/modules/google-pay/index.js";
|
|
13
|
+
import { getBrowserParams } from "../../api/modules/get-browser-params.js";
|
|
12
14
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
13
15
|
import "../../core/context.js";
|
|
14
16
|
import { PayKKaError } from "../../core/error.js";
|
|
15
|
-
import "../../out/
|
|
17
|
+
import "../../out/fraud-detection.js";
|
|
16
18
|
import { usePayState } from "../../hooks/usePayState.js";
|
|
17
19
|
import { useRetry } from "../../hooks/useRetry.js";
|
|
18
20
|
import { Info } from "../internal/Info/Info.js";
|
|
19
21
|
import { loadScript } from "../../utils/load.js";
|
|
20
22
|
import { ThreeDSAuth } from "../ThreeDS/index.js";
|
|
21
|
-
const createGooglePay = (core, checkout, googlePayConfig, pay, onClick, onCanUse) => {
|
|
22
|
-
const {
|
|
23
|
-
transAmount,
|
|
24
|
-
theme: { merchantName }
|
|
25
|
-
} = checkout;
|
|
23
|
+
const createGooglePay = (core, checkout, googlePayConfig, pay, onClick, onCanUse, onCancel) => {
|
|
24
|
+
const { theme: { merchantName } } = checkout;
|
|
26
25
|
const { googlePay: googlePay2 } = (checkout == null ? void 0 : checkout.channelParams) || {};
|
|
27
26
|
let paymentsClient;
|
|
28
27
|
const baseRequest = {
|
|
@@ -61,11 +60,12 @@ const createGooglePay = (core, checkout, googlePayConfig, pay, onClick, onCanUse
|
|
|
61
60
|
baseCardPaymentMethod
|
|
62
61
|
);
|
|
63
62
|
const getGoogleTransactionInfo = () => {
|
|
63
|
+
var _a, _b, _c, _d;
|
|
64
64
|
return {
|
|
65
65
|
countryCode: googlePay2 == null ? void 0 : googlePay2.countryCode,
|
|
66
|
-
currencyCode:
|
|
66
|
+
currencyCode: ((_b = (_a = core.payment) == null ? void 0 : _a.amount.value) == null ? void 0 : _b.currency) || "",
|
|
67
67
|
totalPriceStatus: "FINAL",
|
|
68
|
-
totalPrice: String(
|
|
68
|
+
totalPrice: String(((_d = (_c = core.payment) == null ? void 0 : _c.amount.value) == null ? void 0 : _d.amount) || 0),
|
|
69
69
|
totalPriceLabel: "Total"
|
|
70
70
|
};
|
|
71
71
|
};
|
|
@@ -136,6 +136,7 @@ const createGooglePay = (core, checkout, googlePayConfig, pay, onClick, onCanUse
|
|
|
136
136
|
(_b = (_a = core.config).onEvent) == null ? void 0 : _b.call(_a, GooglePayEventType.GOOGLE_PAY_CAN_NOT_USE);
|
|
137
137
|
}
|
|
138
138
|
} catch (err) {
|
|
139
|
+
onCanUse == null ? void 0 : onCanUse(false);
|
|
139
140
|
console.error(err);
|
|
140
141
|
(_c = core.logger) == null ? void 0 : _c.reportErrorEvent(new PayKKaError(
|
|
141
142
|
"ERROR",
|
|
@@ -155,7 +156,9 @@ const createGooglePay = (core, checkout, googlePayConfig, pay, onClick, onCanUse
|
|
|
155
156
|
};
|
|
156
157
|
const onGooglePaymentButtonClicked = async () => {
|
|
157
158
|
var _a, _b, _c;
|
|
158
|
-
onClick == null ? void 0 : onClick();
|
|
159
|
+
const clickResult = await (onClick == null ? void 0 : onClick());
|
|
160
|
+
if (clickResult === false)
|
|
161
|
+
return;
|
|
159
162
|
const paymentDataRequest = getGooglePaymentDataRequest();
|
|
160
163
|
paymentDataRequest.transactionInfo = getGoogleTransactionInfo();
|
|
161
164
|
const paymentsClient2 = getGooglePaymentsClient();
|
|
@@ -163,8 +166,10 @@ const createGooglePay = (core, checkout, googlePayConfig, pay, onClick, onCanUse
|
|
|
163
166
|
try {
|
|
164
167
|
await paymentsClient2.loadPaymentData(paymentDataRequest);
|
|
165
168
|
} catch (err) {
|
|
169
|
+
core.payment.resetCurrPaymentMethod();
|
|
166
170
|
if ((err == null ? void 0 : err.statusCode) === "CANCELED") {
|
|
167
171
|
(_b = (_a = core.config).onEvent) == null ? void 0 : _b.call(_a, GooglePayEventType.GOOGLE_PAY_CANCELLED);
|
|
172
|
+
onCancel == null ? void 0 : onCancel();
|
|
168
173
|
} else {
|
|
169
174
|
(_c = core.logger) == null ? void 0 : _c.reportErrorEvent(new PayKKaError(
|
|
170
175
|
"ERROR",
|
|
@@ -206,17 +211,16 @@ const DEFAULT_GOOGLE_PAY_CONFIG = {
|
|
|
206
211
|
};
|
|
207
212
|
const GooglePay = w((props, ref) => {
|
|
208
213
|
var _a;
|
|
209
|
-
const { session, threeDSFrame, isDropIn, core } = props;
|
|
214
|
+
const { session, threeDSFrame, isDropIn, core, enable3DSModal = true } = props;
|
|
210
215
|
const googlePayConfig = deepMerge(DEFAULT_GOOGLE_PAY_CONFIG, props.config || {});
|
|
211
216
|
F(ref, () => ({
|
|
212
217
|
checkThreeDS
|
|
213
218
|
}));
|
|
214
|
-
const { sessionReady, i18n, fraudDetection } = usePayState(session, props.core);
|
|
219
|
+
const { sessionReady, i18n, fraudDetection, disabled } = usePayState(session, props.core);
|
|
215
220
|
const [errorMsg, setErrorMsg] = h("");
|
|
216
221
|
const [showGooglePay, setShowGooglePay] = h(false);
|
|
217
222
|
const [showThreeDSModal, setShowThreeDSModal] = h(false);
|
|
218
223
|
const [threeDSInfo, setThreeDSInfo] = h();
|
|
219
|
-
const [hosted, setHosted] = h(true);
|
|
220
224
|
const getPaymentMethodContext = () => {
|
|
221
225
|
return {
|
|
222
226
|
paymentMethod: CURR_PAYMENT_METHOD
|
|
@@ -224,9 +228,10 @@ const GooglePay = w((props, ref) => {
|
|
|
224
228
|
};
|
|
225
229
|
const onTimeout = q(
|
|
226
230
|
(message) => {
|
|
227
|
-
var _a2;
|
|
231
|
+
var _a2, _b;
|
|
232
|
+
(_a2 = core.payment) == null ? void 0 : _a2.resetCurrPaymentMethod();
|
|
228
233
|
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
229
|
-
(
|
|
234
|
+
(_b = props.onTimeout) == null ? void 0 : _b.call(props, "retry", getPaymentMethodContext());
|
|
230
235
|
},
|
|
231
236
|
[i18n, props.onTimeout]
|
|
232
237
|
);
|
|
@@ -267,23 +272,23 @@ const GooglePay = w((props, ref) => {
|
|
|
267
272
|
(_c = props.onLoad) == null ? void 0 : _c.call(props, false);
|
|
268
273
|
}
|
|
269
274
|
);
|
|
270
|
-
setHosted(sessionMode === SessionMode.HOSTED);
|
|
271
275
|
if (status === "SUCCESS") {
|
|
272
276
|
processOnSuccess(session == null ? void 0 : session.checkout);
|
|
273
277
|
}
|
|
274
278
|
}, [sessionReady]);
|
|
275
279
|
const processThreeDS = (threeDSUrl, incomplete) => {
|
|
276
280
|
var _a2;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
} else {
|
|
281
|
+
const finalUrl = createUrlWithParams(threeDSUrl, { locale: i18n.locale });
|
|
282
|
+
if (enable3DSModal) {
|
|
280
283
|
setShowThreeDSModal(true);
|
|
281
284
|
setThreeDSInfo({
|
|
282
|
-
url:
|
|
285
|
+
url: finalUrl,
|
|
283
286
|
incomplete,
|
|
284
287
|
width: threeDSFrame == null ? void 0 : threeDSFrame.modalWidth,
|
|
285
288
|
height: threeDSFrame == null ? void 0 : threeDSFrame.modalHeight
|
|
286
289
|
});
|
|
290
|
+
} else {
|
|
291
|
+
(_a2 = props.onThreeDS) == null ? void 0 : _a2.call(props, finalUrl, incomplete);
|
|
287
292
|
}
|
|
288
293
|
};
|
|
289
294
|
const handleCloseThreeDSModal = () => {
|
|
@@ -311,7 +316,7 @@ const GooglePay = w((props, ref) => {
|
|
|
311
316
|
bill: {
|
|
312
317
|
firstName: billAddress == null ? void 0 : billAddress.name,
|
|
313
318
|
addressLine1: billAddress == null ? void 0 : billAddress.address1,
|
|
314
|
-
addressLine2: (billAddress == null ? void 0 : billAddress.address2) ?? "" + (billAddress == null ? void 0 : billAddress.address3) ?? "",
|
|
319
|
+
addressLine2: ((billAddress == null ? void 0 : billAddress.address2) ?? "") + ((billAddress == null ? void 0 : billAddress.address3) ?? ""),
|
|
315
320
|
country: billAddress == null ? void 0 : billAddress.countryCode,
|
|
316
321
|
state: billAddress == null ? void 0 : billAddress.administrativeArea,
|
|
317
322
|
city: billAddress == null ? void 0 : billAddress.locality,
|
|
@@ -326,12 +331,13 @@ const GooglePay = w((props, ref) => {
|
|
|
326
331
|
};
|
|
327
332
|
};
|
|
328
333
|
async function pay(token, billAddress, search = false, timeout) {
|
|
329
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i
|
|
334
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
330
335
|
setErrorMsg("");
|
|
331
336
|
if (!search) {
|
|
332
337
|
(_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, void 0, getPaymentMethodContext());
|
|
333
338
|
}
|
|
334
339
|
try {
|
|
340
|
+
core.payment.currPaymentMethod.value = CURR_PAYMENT_METHOD;
|
|
335
341
|
const requestOptions = { locale: i18n.locale, timeout };
|
|
336
342
|
let res = null;
|
|
337
343
|
if (search) {
|
|
@@ -346,38 +352,44 @@ const GooglePay = w((props, ref) => {
|
|
|
346
352
|
requestOptions
|
|
347
353
|
);
|
|
348
354
|
} else {
|
|
355
|
+
const paymentParams = await getPaymentParams(token, billAddress);
|
|
349
356
|
const extraParams = (_e = (_d = core.config)._getExtraParams) == null ? void 0 : _e.call(_d, "payment", CURR_PAYMENT_METHOD);
|
|
350
|
-
|
|
351
|
-
await
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
);
|
|
357
|
+
if ((_f = core.config._checkoutConfig) == null ? void 0 : _f.dynamicSessionId) {
|
|
358
|
+
await core.updateSessionId(buildPaymentParams(paymentParams, extraParams));
|
|
359
|
+
session.sessionId && (paymentParams.sessionId = session.sessionId);
|
|
360
|
+
}
|
|
361
|
+
res = await googlePay(paymentParams, extraParams, requestOptions);
|
|
355
362
|
}
|
|
356
|
-
const {
|
|
363
|
+
const { errorMessage, payInfo = {}, errorCode, sessionId } = res;
|
|
357
364
|
const { threeDSUrl } = payInfo;
|
|
358
365
|
sessionId && (session.sessionId = sessionId);
|
|
359
|
-
!search && ((
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
};
|
|
367
|
-
} else if (orderStatus === "PROCESSING") {
|
|
366
|
+
!search && ((_g = props.onSubmitResponse) == null ? void 0 : _g.call(props, res, getPaymentMethodContext()));
|
|
367
|
+
let result = {
|
|
368
|
+
end: true,
|
|
369
|
+
res: { transactionState: "SUCCESS" }
|
|
370
|
+
};
|
|
371
|
+
await processPaymentStatus(res, {
|
|
372
|
+
onProcessing: async () => {
|
|
368
373
|
const res2 = await startReFetchPayInfo();
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
+
if ((res2 == null ? void 0 : res2.end) === true) {
|
|
375
|
+
result = res2.res;
|
|
376
|
+
} else {
|
|
377
|
+
result = await startReFetchPayInfo();
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
onSuccess: () => {
|
|
381
|
+
processOnSuccess(res);
|
|
382
|
+
},
|
|
383
|
+
onFailure: () => {
|
|
384
|
+
var _a3, _b2;
|
|
374
385
|
errorMessage && setErrorMsg(errorMessage);
|
|
375
|
-
(
|
|
386
|
+
(_a3 = core.payment) == null ? void 0 : _a3.resetCurrPaymentMethod();
|
|
387
|
+
(_b2 = props.onError) == null ? void 0 : _b2.call(
|
|
376
388
|
props,
|
|
377
389
|
new PayKKaError("API_ERROR", errorMessage, { code: errorCode }),
|
|
378
390
|
getPaymentMethodContext()
|
|
379
391
|
);
|
|
380
|
-
|
|
392
|
+
result = {
|
|
381
393
|
end: true,
|
|
382
394
|
res: {
|
|
383
395
|
transactionState: "ERROR",
|
|
@@ -388,48 +400,31 @@ const GooglePay = w((props, ref) => {
|
|
|
388
400
|
}
|
|
389
401
|
}
|
|
390
402
|
};
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
} else if (orderStatus === "IN_THREED") {
|
|
403
|
+
},
|
|
404
|
+
onAuthorized: () => {
|
|
405
|
+
var _a3;
|
|
406
|
+
(_a3 = props.onAuthorized) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
407
|
+
},
|
|
408
|
+
onInThreeDS: () => {
|
|
398
409
|
threeDSUrl && processThreeDS(threeDSUrl, false);
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
res: { transactionState: "SUCCESS" }
|
|
402
|
-
};
|
|
403
|
-
} else if (orderStatus === "IN_PREVIOUS_THREED") {
|
|
410
|
+
},
|
|
411
|
+
onInPreviousThreeDS: () => {
|
|
404
412
|
threeDSUrl && processThreeDS(threeDSUrl, true);
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
|
|
413
|
+
},
|
|
414
|
+
onExpired: () => {
|
|
415
|
+
var _a3;
|
|
416
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
417
|
+
},
|
|
418
|
+
onDefault: () => {
|
|
419
|
+
var _a3;
|
|
420
|
+
(_a3 = core.payment) == null ? void 0 : _a3.resetCurrPaymentMethod();
|
|
421
|
+
result = {
|
|
411
422
|
end: true,
|
|
412
|
-
res: { transactionState: "
|
|
423
|
+
res: { transactionState: "ERROR" }
|
|
413
424
|
};
|
|
414
425
|
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
return {
|
|
418
|
-
end: true,
|
|
419
|
-
res: { transactionState: "SUCCESS" }
|
|
420
|
-
};
|
|
421
|
-
} else if (status === "EXPIRED") {
|
|
422
|
-
(_i = props.onExpired) == null ? void 0 : _i.call(props, getPaymentMethodContext());
|
|
423
|
-
return {
|
|
424
|
-
end: true,
|
|
425
|
-
res: { transactionState: "SUCCESS" }
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
processOnSuccess(res);
|
|
429
|
-
return {
|
|
430
|
-
end: false,
|
|
431
|
-
res: { transactionState: "SUCCESS" }
|
|
432
|
-
};
|
|
426
|
+
});
|
|
427
|
+
return result;
|
|
433
428
|
} catch (error) {
|
|
434
429
|
if (isTimeoutError(error)) {
|
|
435
430
|
if (search) {
|
|
@@ -449,9 +444,10 @@ const GooglePay = w((props, ref) => {
|
|
|
449
444
|
};
|
|
450
445
|
}
|
|
451
446
|
} else {
|
|
447
|
+
(_h = core.payment) == null ? void 0 : _h.resetCurrPaymentMethod();
|
|
452
448
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
453
449
|
setErrorMsg(message);
|
|
454
|
-
(
|
|
450
|
+
(_i = props.onError) == null ? void 0 : _i.call(
|
|
455
451
|
props,
|
|
456
452
|
new PayKKaError("API_ERROR", message, { code: error.code, cause: error }),
|
|
457
453
|
getPaymentMethodContext()
|
|
@@ -478,7 +474,7 @@ const GooglePay = w((props, ref) => {
|
|
|
478
474
|
}
|
|
479
475
|
);
|
|
480
476
|
async function checkThreeDS(search = false) {
|
|
481
|
-
var _a2, _b, _c, _d
|
|
477
|
+
var _a2, _b, _c, _d;
|
|
482
478
|
if (!session)
|
|
483
479
|
return { end: true };
|
|
484
480
|
try {
|
|
@@ -493,35 +489,48 @@ const GooglePay = w((props, ref) => {
|
|
|
493
489
|
locale: i18n.locale
|
|
494
490
|
}
|
|
495
491
|
);
|
|
496
|
-
const {
|
|
497
|
-
|
|
498
|
-
|
|
492
|
+
const { errorMessage } = res;
|
|
493
|
+
let end = true;
|
|
494
|
+
await processPaymentStatus(res, {
|
|
495
|
+
onProcessing: () => {
|
|
499
496
|
startReFetchPayInfo();
|
|
500
|
-
|
|
497
|
+
stopReFetchCardPay3DSInfo();
|
|
498
|
+
},
|
|
499
|
+
onSuccess: () => {
|
|
500
|
+
processOnSuccess(res);
|
|
501
|
+
stopReFetchCardPay3DSInfo();
|
|
502
|
+
},
|
|
503
|
+
onFailure: () => {
|
|
504
|
+
var _a3;
|
|
505
|
+
(_a3 = core.payment) == null ? void 0 : _a3.resetCurrPaymentMethod();
|
|
501
506
|
errorMessage && setErrorMsg(errorMessage);
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
507
|
+
stopReFetchCardPay3DSInfo();
|
|
508
|
+
},
|
|
509
|
+
onAuthorized: () => {
|
|
510
|
+
var _a3;
|
|
511
|
+
(_a3 = props.onAuthorized) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
512
|
+
stopReFetchCardPay3DSInfo();
|
|
513
|
+
},
|
|
514
|
+
onInThreeDS: () => {
|
|
505
515
|
!search && startReFetchCardPay3DSInfo();
|
|
506
|
-
|
|
507
|
-
}
|
|
516
|
+
end = false;
|
|
517
|
+
},
|
|
518
|
+
onInPreviousThreeDS: () => {
|
|
508
519
|
setErrorMsg(i18n.get("common.pay3DSIncomplete"));
|
|
509
|
-
|
|
520
|
+
stopReFetchCardPay3DSInfo();
|
|
521
|
+
},
|
|
522
|
+
onExpired: () => {
|
|
523
|
+
var _a3;
|
|
524
|
+
stopReFetchCardPay3DSInfo();
|
|
525
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
526
|
+
},
|
|
527
|
+
onDefault: () => {
|
|
528
|
+
var _a3;
|
|
529
|
+
stopReFetchCardPay3DSInfo();
|
|
530
|
+
(_a3 = core.payment) == null ? void 0 : _a3.resetCurrPaymentMethod();
|
|
510
531
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
} else if (status === "SUCCESS") {
|
|
514
|
-
processOnSuccess(res);
|
|
515
|
-
stopReFetchCardPay3DSInfo();
|
|
516
|
-
return { end: true };
|
|
517
|
-
} else if (status === "EXPIRED") {
|
|
518
|
-
(_d = props.onExpired) == null ? void 0 : _d.call(props, getPaymentMethodContext());
|
|
519
|
-
stopReFetchCardPay3DSInfo();
|
|
520
|
-
return { end: true };
|
|
521
|
-
}
|
|
522
|
-
processOnSuccess(res);
|
|
523
|
-
stopReFetchCardPay3DSInfo();
|
|
524
|
-
return { end: true };
|
|
532
|
+
});
|
|
533
|
+
return { end };
|
|
525
534
|
} catch (error) {
|
|
526
535
|
if (isTimeoutError(error)) {
|
|
527
536
|
if (search) {
|
|
@@ -533,11 +542,13 @@ const GooglePay = w((props, ref) => {
|
|
|
533
542
|
} else {
|
|
534
543
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
535
544
|
setErrorMsg(message);
|
|
536
|
-
(
|
|
545
|
+
(_c = props.onError) == null ? void 0 : _c.call(
|
|
537
546
|
props,
|
|
538
547
|
new PayKKaError("API_ERROR", message, { code: error.code, cause: error }),
|
|
539
548
|
getPaymentMethodContext()
|
|
540
549
|
);
|
|
550
|
+
(_d = core.payment) == null ? void 0 : _d.resetCurrPaymentMethod();
|
|
551
|
+
stopReFetchCardPay3DSInfo();
|
|
541
552
|
return { end: true };
|
|
542
553
|
}
|
|
543
554
|
}
|
|
@@ -550,18 +561,19 @@ const GooglePay = w((props, ref) => {
|
|
|
550
561
|
session == null ? void 0 : session.checkout,
|
|
551
562
|
googlePayConfig,
|
|
552
563
|
pay,
|
|
553
|
-
() => {
|
|
564
|
+
async () => {
|
|
554
565
|
var _a2, _b, _c;
|
|
555
566
|
(_b = (_a2 = core.config).onEvent) == null ? void 0 : _b.call(_a2, GooglePayEventType.GOOGLE_PAY_BUTTON_CLICKED);
|
|
556
|
-
(_c = props.onBtnClick) == null ? void 0 : _c.call(props);
|
|
567
|
+
return (_c = props.onBtnClick) == null ? void 0 : _c.call(props);
|
|
557
568
|
},
|
|
558
|
-
props.onCanUse
|
|
569
|
+
props.onCanUse,
|
|
570
|
+
props.onCancel
|
|
559
571
|
);
|
|
560
572
|
onGooglePayLoaded(containRef.current);
|
|
561
573
|
}
|
|
562
574
|
}, [sessionReady, containRef, i18n.ready.value, showGooglePay]);
|
|
563
575
|
const Button = () => {
|
|
564
|
-
return /* @__PURE__ */ u("div", { style: "width: 100%; height: 44px", children: /* @__PURE__ */ u("div", { id: "container", style: "width:100%; height: 44px", ref: containRef }) });
|
|
576
|
+
return /* @__PURE__ */ u("div", { style: "width: 100%; height: 44px", className: bem("button", { disabled }), children: /* @__PURE__ */ u("div", { id: "container", style: "width:100%; height: 44px", ref: containRef }) });
|
|
565
577
|
};
|
|
566
578
|
return /* @__PURE__ */ u("div", { children: sessionReady && showGooglePay && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
|
|
567
579
|
!!errorMsg && /* @__PURE__ */ u(Info, { className: bem("error"), content: errorMsg }),
|
|
@@ -2,11 +2,11 @@ import { u, b } from "../../core.js";
|
|
|
2
2
|
import { PaymentCategory } from "../../constant.js";
|
|
3
3
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
4
4
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
5
|
+
import "../../out/fraud-detection.js";
|
|
5
6
|
import "../../utils/card-brand/brands.js";
|
|
6
7
|
import "../../utils/system-info/get-browser-info.js";
|
|
7
8
|
import { isMobile } from "../../utils/system-info/get-system-info.js";
|
|
8
9
|
import "../../core/context.js";
|
|
9
|
-
import "../../out/worldpay-jsc-origin.js";
|
|
10
10
|
import { IconRedirect } from "../internal/icons/IconRedirect.js";
|
|
11
11
|
import { IconScan } from "../internal/icons/IconScan.js";
|
|
12
12
|
const { bem } = useBEM("guide-card");
|
|
@@ -26,7 +26,7 @@ const GuideCard = (props) => {
|
|
|
26
26
|
};
|
|
27
27
|
const guideCardInfoMap = {
|
|
28
28
|
[PaymentCategory.ALI_PAY]: redirectGuideCard,
|
|
29
|
-
[PaymentCategory.WECHAT_PAY]:
|
|
29
|
+
[PaymentCategory.WECHAT_PAY]: getQRCodeGuideCard(i18n.get("common.wechatPayGlobal")),
|
|
30
30
|
[PaymentCategory.BOOST]: redirectGuideCard,
|
|
31
31
|
[PaymentCategory.GRAB_PAY]: redirectGuideCard,
|
|
32
32
|
[PaymentCategory.LINE_PAY]: redirectGuideCard,
|
|
@@ -1,22 +1,37 @@
|
|
|
1
|
-
import { h, y, u } from "../../core.js";
|
|
1
|
+
import { h, x, T, y, u } from "../../core.js";
|
|
2
2
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
3
3
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
4
|
+
import "../../out/fraud-detection.js";
|
|
4
5
|
import "../../utils/card-brand/brands.js";
|
|
5
6
|
import "../../utils/system-info/get-browser-info.js";
|
|
6
|
-
import { normalizedClass } from "../../utils/format.js";
|
|
7
|
-
import "../../core/context.js";
|
|
8
|
-
import "
|
|
9
|
-
import { Button } from "../internal/Button/Button.js";
|
|
7
|
+
import { formatAmount, normalizedClass } from "../../utils/format.js";
|
|
8
|
+
import { CoreContext } from "../../core/context.js";
|
|
9
|
+
import { Button } from "../internal/Button/Button2.js";
|
|
10
10
|
import { IconSafe } from "../internal/icons/IconSafe.js";
|
|
11
11
|
import { LoadingCheck } from "../internal/LoadingCheck/LoadingCheck.js";
|
|
12
12
|
const { bem } = useBEM("payment-button");
|
|
13
13
|
const PaymentButton = (props) => {
|
|
14
|
+
var _a;
|
|
14
15
|
const {
|
|
15
16
|
verified = false,
|
|
16
17
|
status = "unSubmit"
|
|
17
18
|
} = props;
|
|
18
19
|
const { i18n } = useI18n();
|
|
19
20
|
const [text, setText] = h("");
|
|
21
|
+
const coreContext = x(CoreContext);
|
|
22
|
+
const core = coreContext == null ? void 0 : coreContext.core;
|
|
23
|
+
const payAmountText = T(() => {
|
|
24
|
+
var _a2, _b, _c, _d, _e;
|
|
25
|
+
const amount = (_a2 = core == null ? void 0 : core.payment) == null ? void 0 : _a2.amount.value;
|
|
26
|
+
const amountNumber = props.amount ?? ((_c = (_b = core == null ? void 0 : core.payment) == null ? void 0 : _b.amount.value) == null ? void 0 : _c.amount);
|
|
27
|
+
const transAmount = {
|
|
28
|
+
...(_e = (_d = core == null ? void 0 : core.session) == null ? void 0 : _d.checkout) == null ? void 0 : _e.transAmount,
|
|
29
|
+
...amount,
|
|
30
|
+
amount: amountNumber
|
|
31
|
+
};
|
|
32
|
+
const amountText = amountNumber ? formatAmount(transAmount).jointSymbol() : "";
|
|
33
|
+
return i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
|
|
34
|
+
}, [props.amount, (_a = core == null ? void 0 : core.payment) == null ? void 0 : _a.amount.value]);
|
|
20
35
|
const Icon = () => {
|
|
21
36
|
return status === "unSubmit" ? /* @__PURE__ */ u(IconSafe, { size: 20, disabled: !verified }) : /* @__PURE__ */ u(
|
|
22
37
|
LoadingCheck,
|
|
@@ -36,10 +51,10 @@ const PaymentButton = (props) => {
|
|
|
36
51
|
if (props.children) {
|
|
37
52
|
setText("");
|
|
38
53
|
} else {
|
|
39
|
-
setText(
|
|
54
|
+
setText(payAmountText);
|
|
40
55
|
}
|
|
41
56
|
}
|
|
42
|
-
}, [status, props.children]);
|
|
57
|
+
}, [status, props.children, payAmountText]);
|
|
43
58
|
return /* @__PURE__ */ u(
|
|
44
59
|
Button,
|
|
45
60
|
{
|
|
@@ -47,7 +62,7 @@ const PaymentButton = (props) => {
|
|
|
47
62
|
style: props.style,
|
|
48
63
|
icon: Icon(),
|
|
49
64
|
loading: status === "loading",
|
|
50
|
-
disabled: props.disabled || status === "success",
|
|
65
|
+
disabled: (props.disabled || status === "success") && status !== "loading",
|
|
51
66
|
onClick: props.onClick,
|
|
52
67
|
children: /* @__PURE__ */ u("span", { className: bem("text", { "not-verified": !verified }), children: text || props.children })
|
|
53
68
|
}
|
|
@@ -2,7 +2,7 @@ import { u } from "../../core.js";
|
|
|
2
2
|
import { CoreContext } from "../../core/context.js";
|
|
3
3
|
import "../../utils/card-brand/brands.js";
|
|
4
4
|
import "../../utils/system-info/get-browser-info.js";
|
|
5
|
-
import "../../out/
|
|
5
|
+
import "../../out/fraud-detection.js";
|
|
6
6
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
7
7
|
import { IconInfo } from "../internal/icons/IconInfo.js";
|
|
8
8
|
const { bem } = useBEM("recurring-tip");
|
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import "../../utils/card-brand/brands.js";
|
|
8
8
|
import "../../utils/system-info/get-browser-info.js";
|
|
9
|
-
import { w, A,
|
|
9
|
+
import { w, A, y, F, q, u } from "../../core.js";
|
|
10
10
|
import { SessionMode } from "../../constant.js";
|
|
11
11
|
import { cdnUrl, cdnOrigin, apiUrl, apiPrefix } from "../../config.js";
|
|
12
12
|
import { MessageAction } from "../../types/message.js";
|
|
@@ -84,7 +84,7 @@ class SecuredField {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
const SecuredFieldsProvider = w((props, ref) => {
|
|
87
|
-
const { sessionMode, i18n, targetElement, checkoutId, onEvent, core } = props;
|
|
87
|
+
const { sessionMode, i18n, targetElement, checkoutId, onEvent, core, disabled = false } = props;
|
|
88
88
|
const rootNodeRef = A(null);
|
|
89
89
|
const hiddenIframe = A(null);
|
|
90
90
|
const payment = (formData, extraParams) => {
|
|
@@ -97,6 +97,23 @@ const SecuredFieldsProvider = w((props, ref) => {
|
|
|
97
97
|
};
|
|
98
98
|
postMessageToIframe(data, hiddenIframe.current.contentWindow, cdnOrigin);
|
|
99
99
|
};
|
|
100
|
+
const sendSetConfigMessage = (iframeWindow) => {
|
|
101
|
+
console.log("disabled", disabled, iframeWindow);
|
|
102
|
+
const data = {
|
|
103
|
+
action: MessageAction.SET_CONFIG,
|
|
104
|
+
checkoutId,
|
|
105
|
+
disabled
|
|
106
|
+
};
|
|
107
|
+
postMessageToIframe(data, iframeWindow, cdnOrigin);
|
|
108
|
+
};
|
|
109
|
+
y(() => {
|
|
110
|
+
Object.values(securedFieldMap.current).forEach((field) => {
|
|
111
|
+
var _a;
|
|
112
|
+
if ((_a = field == null ? void 0 : field.iframe) == null ? void 0 : _a.contentWindow) {
|
|
113
|
+
sendSetConfigMessage(field.iframe.contentWindow);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}, [disabled]);
|
|
100
117
|
F(ref, () => ({
|
|
101
118
|
payment,
|
|
102
119
|
reload: () => {
|
|
@@ -154,7 +171,8 @@ const SecuredFieldsProvider = w((props, ref) => {
|
|
|
154
171
|
};
|
|
155
172
|
const initHiddenIframe = async () => {
|
|
156
173
|
const iframeEl = createIframe(`${cdnUrl}/secured-iframe.html`);
|
|
157
|
-
|
|
174
|
+
const hiddenIframeName = `${HIDDEN_IFRAME_NAME}-${checkoutId}-${Date.now()}`;
|
|
175
|
+
iframeEl.name = hiddenIframeName;
|
|
158
176
|
iframeEl.width = "0";
|
|
159
177
|
iframeEl.height = "0";
|
|
160
178
|
iframeEl.style.border = "none";
|
|
@@ -211,7 +229,7 @@ const SecuredFieldsProvider = w((props, ref) => {
|
|
|
211
229
|
return isFieldIframe || isHiddenIframe;
|
|
212
230
|
};
|
|
213
231
|
const onReceiveMessage = q((event) => {
|
|
214
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
232
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
215
233
|
const { data, origin, source } = event;
|
|
216
234
|
if (origin !== cdnOrigin) {
|
|
217
235
|
return;
|
|
@@ -277,20 +295,24 @@ const SecuredFieldsProvider = w((props, ref) => {
|
|
|
277
295
|
break;
|
|
278
296
|
case MessageAction.ACTIVATED:
|
|
279
297
|
(_l = props.onActivated) == null ? void 0 : _l.call(props, feedbackData);
|
|
298
|
+
sendSetConfigMessage(source);
|
|
299
|
+
break;
|
|
300
|
+
case MessageAction.HIDDEN_IFRAME_READY:
|
|
301
|
+
(_m = props.onHiddenIframeReady) == null ? void 0 : _m.call(props, feedbackData);
|
|
280
302
|
break;
|
|
281
303
|
case MessageAction.CARD_ENCRYPTED:
|
|
282
|
-
(
|
|
304
|
+
(_n = props.onCardEncrypted) == null ? void 0 : _n.call(props, feedbackData);
|
|
283
305
|
break;
|
|
284
306
|
case MessageAction.CARD_ENCRYPTION_FAILED:
|
|
285
|
-
(
|
|
307
|
+
(_o = props.onCardEncryptionFailed) == null ? void 0 : _o.call(props, feedbackData);
|
|
286
308
|
break;
|
|
287
309
|
case MessageAction.VALIDATED:
|
|
288
|
-
(
|
|
310
|
+
(_p = props.onValidated) == null ? void 0 : _p.call(props, feedbackData);
|
|
289
311
|
break;
|
|
290
312
|
case MessageAction.IFRAME_ERROR: {
|
|
291
313
|
const data2 = feedbackData;
|
|
292
|
-
(
|
|
293
|
-
new PayKKaError(EPayKKaError.ERROR, (
|
|
314
|
+
(_s = core == null ? void 0 : core.logger) == null ? void 0 : _s.reportErrorEvent(
|
|
315
|
+
new PayKKaError(EPayKKaError.ERROR, (_q = data2.error) == null ? void 0 : _q.message, { cause: (_r = data2.error) == null ? void 0 : _r.stack })
|
|
294
316
|
);
|
|
295
317
|
break;
|
|
296
318
|
}
|