@paykka/card-checkout-ui 0.14.0 → 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 +20 -20
- package/dist/card-checkout-ui.umd.cjs +20 -20
- 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 -5
- package/dist/es/api/modules/index.js +1 -1
- package/dist/es/api/modules/map.js +4 -1
- package/dist/es/components/AccordionItem/AccordionItem.js +1 -1
- package/dist/es/components/AccountNameField/index.js +1 -1
- package/dist/es/components/AddressField/index.js +1 -1
- package/dist/es/components/ApplePay/index.js +34 -21
- package/dist/es/components/CPFField/index.js +1 -1
- package/dist/es/components/Card/index.js +38 -30
- package/dist/es/components/CardBrands/index.js +1 -1
- package/dist/es/components/CardExpireDateField/index.js +1 -1
- 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 +1 -1
- package/dist/es/components/CardNumberField/index.js +1 -1
- package/dist/es/components/CardSecurityCodeField/index.js +1 -1
- package/dist/es/components/CardSelector/index.js +2 -2
- package/dist/es/components/CombinedCardInfo/index.js +1 -1
- package/dist/es/components/DropIn/index.js +117 -123
- 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 +32 -29
- package/dist/es/components/GuideCard/index.js +2 -2
- package/dist/es/components/PaymentButton/index.js +22 -7
- package/dist/es/components/RecurringTip/index.js +1 -1
- package/dist/es/components/SecuredIframe/index.js +3 -4
- package/dist/es/components/Sepa/index.js +15 -7
- package/dist/es/components/SubmitButton/index.js +2 -2
- package/dist/es/components/ThreeDS/index.js +32 -20
- 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 +1 -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 +4 -4
- 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 +1 -1
- 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/type.js +1 -1
- package/dist/es/components/internal/Loading/Loading2.js +20 -0
- package/dist/es/{api/modules/line-pay → 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 +1 -1
- 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/IconError.js +2 -2
- package/dist/es/components/internal/icons/IconSuccess.js +2 -2
- 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 +7 -10
- package/dist/es/components/wallets/Blik/Blik.js +14 -11
- package/dist/es/components/wallets/Boost/Boost.js +6 -9
- package/dist/es/components/wallets/GCash/GCash.js +7 -10
- package/dist/es/components/wallets/GrabPay/GrabPay.js +7 -14
- package/dist/es/components/wallets/IDeal/IDeal.js +7 -10
- package/dist/es/components/wallets/LinePay/LinePay.js +6 -9
- package/dist/es/components/wallets/MayBankQRPay/MayBankQRPay.js +6 -9
- package/dist/es/components/wallets/NinePay/NinePay.js +6 -9
- package/dist/es/components/wallets/OVO/OVO.js +7 -10
- package/dist/es/components/wallets/OpayWallet/OpayWallet.js +6 -9
- package/dist/es/components/wallets/P24/P24.js +7 -10
- package/dist/es/components/wallets/PagaWallet/PagaWallet.js +6 -9
- package/dist/es/components/wallets/Paymaya/Paymaya.js +6 -9
- package/dist/es/components/wallets/PicPay/PicPay.js +54 -217
- package/dist/es/components/wallets/Pix/Pix.js +54 -217
- package/dist/es/components/wallets/ShopeePay/ShopeePay.js +6 -9
- package/dist/es/components/wallets/Skrill/Skrill.js +7 -10
- package/dist/es/components/wallets/TNGWallet/TNGWallet.js +6 -9
- package/dist/es/components/wallets/Trustly/Trustly.js +7 -10
- package/dist/es/components/wallets/Vietqr/Vietqr.js +14 -15
- 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 +10 -13
- package/dist/es/components/wallets/index.js +2 -0
- package/dist/es/constant.js +7 -0
- package/dist/es/core/checkout.js +36 -9
- 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 +13 -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 +121 -52
- package/dist/es/hooks/useI18n.js +3 -3
- 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 +7 -5
- package/dist/es/out/base-fraud-detection.js +1 -1
- package/dist/es/out/fraud-detection.js +59 -44
- 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 +3 -0
- package/dist/es/out/worldpay-ddc.js +1 -1
- package/dist/es/style.css +1 -1
- package/dist/es/types/event.js +10 -1
- package/dist/es/types/index.js +7 -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/redirect.js +2 -0
- 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 +13 -5
- package/dist/types/components/ApplePay/type.d.ts +6 -2
- package/dist/types/components/Card/type.d.ts +2 -18
- 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 +6 -2
- package/dist/types/components/PaymentButton/type.d.ts +2 -0
- package/dist/types/components/Sepa/type.d.ts +3 -4
- package/dist/types/components/business/QRCodeModal/type.d.ts +12 -3
- package/dist/types/components/index.d.ts +0 -2
- 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/icons/IconAlipayPlus.d.ts +2 -0
- 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/wallets/Boost/type.d.ts +2 -24
- package/dist/types/components/wallets/GCash/type.d.ts +2 -24
- package/dist/types/components/wallets/GrabPay/type.d.ts +2 -12
- package/dist/types/components/wallets/IDeal/type.d.ts +2 -24
- package/dist/types/components/wallets/LinePay/type.d.ts +2 -24
- package/dist/types/components/wallets/MayBankQRPay/type.d.ts +2 -24
- package/dist/types/components/wallets/NinePay/type.d.ts +2 -24
- package/dist/types/components/wallets/OVO/type.d.ts +2 -24
- 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/type.d.ts +2 -24
- 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/wallets/ShopeePay/type.d.ts +2 -24
- package/dist/types/components/wallets/Skrill/type.d.ts +2 -12
- package/dist/types/components/wallets/TNGWallet/type.d.ts +2 -24
- package/dist/types/components/wallets/Trustly/type.d.ts +2 -16
- 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/type.d.ts +2 -24
- package/dist/types/components/wallets/index.d.ts +2 -0
- package/dist/types/components/wallets/type.d.ts +0 -14
- package/dist/types/constant.d.ts +8 -0
- package/dist/types/core/index.d.ts +1 -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 +1 -4
- 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/fraud-detection.d.ts +2 -5
- package/dist/types/out/types.d.ts +5 -6
- package/dist/types/out/worldpay-ddc-manager.d.ts +1 -0
- package/dist/types/types/event.d.ts +24 -2
- package/dist/types/types/index.d.ts +14 -0
- package/dist/types/types/message.d.ts +3 -1
- package/dist/types/types/payment.d.ts +26 -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/index.d.ts +1 -6
- package/dist/types/utils/number.d.ts +4 -0
- 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 +4 -2
- package/dist/es/api/modules/ali-pay/index.js +0 -16
- package/dist/es/api/modules/boost/index.js +0 -5
- package/dist/es/api/modules/gcash/index.js +0 -5
- package/dist/es/api/modules/grab-pay/index.js +0 -5
- package/dist/es/api/modules/may-bank-qr-pay/index.js +0 -5
- package/dist/es/api/modules/nine-pay/index.js +0 -5
- package/dist/es/api/modules/opay-wallet/index.js +0 -5
- package/dist/es/api/modules/paga-wallet/index.js +0 -5
- package/dist/es/api/modules/paymaya/index.js +0 -5
- 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 -5
- package/dist/es/api/modules/tng-wallet/index.js +0 -5
- package/dist/es/api/modules/vietqr/index.js +0 -5
- package/dist/es/api/modules/wechat-pay/index.js +0 -16
- package/dist/es/api/modules/zalopay/index.js +0 -5
- package/dist/es/components/AliPay/index.js +0 -332
- package/dist/es/components/WechatPay/index.js +0 -340
- package/dist/es/hooks/usePayment.js +0 -1
- 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/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/hooks/useRetry.console-tests.d.ts +0 -41
- 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/{WechatPay → wallets/WechatPay}/index.d.ts +0 -0
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../
|
|
3
|
-
import "../../utils/system-info/get-browser-info.js";
|
|
4
|
-
import { CoreContext } from "../../core/context.js";
|
|
5
|
-
import "../../out/worldpay-jsc-origin.js";
|
|
6
|
-
import { CardPaymentMethods, PaymentMethod, PaymentCategory, SessionMode, PaymentMethod2CategoryMap } from "../../constant.js";
|
|
1
|
+
import { w, h, A, F, y, u, b } from "../../core.js";
|
|
2
|
+
import { CardPaymentMethods, PaymentMethod, PaymentCategory, PaymentMethod2CategoryMap, SessionMode } from "../../constant.js";
|
|
7
3
|
import { Card } from "../Card/index.js";
|
|
8
4
|
import { ApplePay } from "../ApplePay/index.js";
|
|
9
5
|
import { GooglePay } from "../GooglePay/index.js";
|
|
@@ -29,9 +25,14 @@ import { IDeal } from "../wallets/IDeal/IDeal.js";
|
|
|
29
25
|
import { Skrill } from "../wallets/Skrill/Skrill.js";
|
|
30
26
|
import { P24 } from "../wallets/P24/P24.js";
|
|
31
27
|
import { Trustly } from "../wallets/Trustly/Trustly.js";
|
|
28
|
+
import { AliPay } from "../wallets/AliPay/AliPay.js";
|
|
29
|
+
import { WechatPay } from "../wallets/WechatPay/WechatPay.js";
|
|
32
30
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
33
|
-
import {
|
|
31
|
+
import { CoreContext } from "../../core/context.js";
|
|
32
|
+
import "../../utils/card-brand/brands.js";
|
|
33
|
+
import "../../utils/system-info/get-browser-info.js";
|
|
34
34
|
import { PayKKaError } from "../../core/error.js";
|
|
35
|
+
import "../../out/fraud-detection.js";
|
|
35
36
|
import { createCheckoutChild } from "../../core/create-child.js";
|
|
36
37
|
import { usePayState } from "../../hooks/usePayState.js";
|
|
37
38
|
import { Accordion } from "../internal/Accordion/Accordion.js";
|
|
@@ -59,11 +60,15 @@ import { IconOvo } from "../internal/icons/IconOvo.js";
|
|
|
59
60
|
import { IconSkrill } from "../internal/icons/IconSkrill.js";
|
|
60
61
|
import { IconBancontact } from "../internal/icons/IconBancontact.js";
|
|
61
62
|
import { IconIdeal } from "../internal/icons/IconIdeal.js";
|
|
62
|
-
import {
|
|
63
|
+
import { IconWechatPayGlobal } from "../internal/icons/IconWechatPayGlobal.js";
|
|
64
|
+
import { IconAlipayPlus } from "../internal/icons/IconAlipayPlus.js";
|
|
65
|
+
import { intersection } from "../../utils/array.js";
|
|
63
66
|
const dropInSupportedPaymentMethods = [
|
|
64
67
|
...CardPaymentMethods,
|
|
65
68
|
PaymentMethod.GOOGLE_PAY,
|
|
66
69
|
PaymentMethod.APPLE_PAY,
|
|
70
|
+
PaymentMethod.ALI_PAY,
|
|
71
|
+
PaymentMethod.WECHAT_PAY,
|
|
67
72
|
PaymentMethod.BOOST,
|
|
68
73
|
PaymentMethod.GRAB_PAY,
|
|
69
74
|
PaymentMethod.LINE_PAY,
|
|
@@ -112,41 +117,11 @@ const PaymentComponentMap = {
|
|
|
112
117
|
[PaymentCategory.OVO]: OVO,
|
|
113
118
|
[PaymentCategory.SKRILL]: Skrill,
|
|
114
119
|
[PaymentCategory.TRUSTLY]: Trustly,
|
|
115
|
-
[PaymentCategory.P24]: P24
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
[PaymentCategory.P24]: P24,
|
|
121
|
+
[PaymentCategory.WECHAT_PAY]: WechatPay,
|
|
122
|
+
[PaymentCategory.ALI_PAY]: AliPay
|
|
118
123
|
// [PaymentCategory.SEPA_DEBIT]: Sepa
|
|
119
124
|
};
|
|
120
|
-
const { bem: bem$1 } = useBEM("payment-tabs");
|
|
121
|
-
const PaymentTabs = (props) => {
|
|
122
|
-
const { value, tabs, themeColor = "#4F43DF" } = props;
|
|
123
|
-
const handleClickTab = (tab) => {
|
|
124
|
-
var _a;
|
|
125
|
-
if (tab.type === value) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
(_a = props.onChange) == null ? void 0 : _a.call(props, tab.type);
|
|
129
|
-
};
|
|
130
|
-
return /* @__PURE__ */ u("div", { className: bem$1(), children: tabs.map((tab) => /* @__PURE__ */ u(
|
|
131
|
-
"div",
|
|
132
|
-
{
|
|
133
|
-
className: bem$1("tab"),
|
|
134
|
-
style: tab.type === value ? { borderColor: themeColor } : "",
|
|
135
|
-
onClick: () => handleClickTab(tab),
|
|
136
|
-
children: [
|
|
137
|
-
tab.icon,
|
|
138
|
-
/* @__PURE__ */ u(
|
|
139
|
-
"div",
|
|
140
|
-
{
|
|
141
|
-
className: bem$1("name"),
|
|
142
|
-
style: tab.type === value ? { color: themeColor } : "",
|
|
143
|
-
children: tab.name
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
]
|
|
147
|
-
}
|
|
148
|
-
)) });
|
|
149
|
-
};
|
|
150
125
|
const paymentCategoryOptionMap = {
|
|
151
126
|
[PaymentCategory.CARD]: {
|
|
152
127
|
icon: IconCard2,
|
|
@@ -239,25 +214,94 @@ const paymentCategoryOptionMap = {
|
|
|
239
214
|
[PaymentCategory.P24]: {
|
|
240
215
|
icon: IconP24,
|
|
241
216
|
nameKey: "dropIn.p24.label"
|
|
217
|
+
},
|
|
218
|
+
[PaymentCategory.ALI_PAY]: {
|
|
219
|
+
icon: IconAlipayPlus,
|
|
220
|
+
nameKey: "dropIn.aliPay.label"
|
|
221
|
+
},
|
|
222
|
+
[PaymentCategory.WECHAT_PAY]: {
|
|
223
|
+
icon: IconWechatPayGlobal,
|
|
224
|
+
nameKey: "dropIn.wechatPay.label"
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
const HEADER_CATEGORIES = [
|
|
228
|
+
PaymentCategory.APPLE_PAY,
|
|
229
|
+
PaymentCategory.GOOGLE_PAY
|
|
230
|
+
];
|
|
231
|
+
const toDropInCategories = (methods) => {
|
|
232
|
+
const categories = [];
|
|
233
|
+
const added = /* @__PURE__ */ new Set();
|
|
234
|
+
const add = (category) => {
|
|
235
|
+
if (added.has(category))
|
|
236
|
+
return;
|
|
237
|
+
added.add(category);
|
|
238
|
+
categories.push(category);
|
|
239
|
+
};
|
|
240
|
+
const cpy = [...methods];
|
|
241
|
+
if (intersection(cpy, CardPaymentMethods).length) {
|
|
242
|
+
add(PaymentCategory.CARD);
|
|
243
|
+
CardPaymentMethods.forEach((m) => {
|
|
244
|
+
const i = cpy.indexOf(m);
|
|
245
|
+
if (i > -1)
|
|
246
|
+
cpy.splice(i, 1);
|
|
247
|
+
});
|
|
242
248
|
}
|
|
249
|
+
cpy.forEach((method) => {
|
|
250
|
+
const category = PaymentMethod2CategoryMap[method];
|
|
251
|
+
category && add(category);
|
|
252
|
+
});
|
|
253
|
+
return categories;
|
|
254
|
+
};
|
|
255
|
+
const sortByOrder = (items, order = []) => {
|
|
256
|
+
const orderIndex = new Map(order.map((item, index) => [item, index]));
|
|
257
|
+
return [...items].sort((a, b2) => {
|
|
258
|
+
const ai = orderIndex.get(a);
|
|
259
|
+
const bi = orderIndex.get(b2);
|
|
260
|
+
if (ai !== void 0 && bi !== void 0)
|
|
261
|
+
return ai - bi;
|
|
262
|
+
if (ai !== void 0)
|
|
263
|
+
return -1;
|
|
264
|
+
if (bi !== void 0)
|
|
265
|
+
return 1;
|
|
266
|
+
return items.indexOf(a) - items.indexOf(b2);
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
const resolveDropInDisplayCategories = (options) => {
|
|
270
|
+
const { supportMethods, layout } = options;
|
|
271
|
+
const enabledMethods = intersection(supportMethods, dropInSupportedPaymentMethods);
|
|
272
|
+
const defaultCategories = toDropInCategories(enabledMethods);
|
|
273
|
+
const hidden = new Set((layout == null ? void 0 : layout.hidden) ?? []);
|
|
274
|
+
const visible = defaultCategories.filter((c) => !hidden.has(c));
|
|
275
|
+
return sortByOrder(visible, layout == null ? void 0 : layout.order);
|
|
276
|
+
};
|
|
277
|
+
const splitHeaderAndMain = (categories) => {
|
|
278
|
+
const header = [];
|
|
279
|
+
const main = [];
|
|
280
|
+
categories.forEach((category) => {
|
|
281
|
+
if (HEADER_CATEGORIES.includes(category)) {
|
|
282
|
+
header.push(category);
|
|
283
|
+
} else {
|
|
284
|
+
main.push(category);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
return { header, main };
|
|
243
288
|
};
|
|
244
289
|
const { bem } = useBEM("drop-in");
|
|
245
290
|
const DropIn = w((props, ref) => {
|
|
246
291
|
var _a;
|
|
247
292
|
const {
|
|
248
293
|
paymentMethods: paymentMethodsConfig,
|
|
249
|
-
layout =
|
|
294
|
+
// layout = 'accordion',
|
|
250
295
|
session,
|
|
251
296
|
core,
|
|
252
|
-
enableAccordionTransition = true
|
|
297
|
+
enableAccordionTransition = true,
|
|
298
|
+
paymentMethodLayout
|
|
253
299
|
} = props;
|
|
254
300
|
const { i18n, sessionReady } = usePayState(session, props.core);
|
|
255
301
|
const [paymentCategoryOptions, setPaymentCategoryOptions] = h([]);
|
|
256
302
|
const [activePaymentCategory, setActivePaymentCategory] = h();
|
|
257
303
|
const [enablePaymentMethod, setEnablePaymentMethod] = h();
|
|
258
|
-
const [headerPaymentCategories, setHeaderPaymentCategories] = h(
|
|
259
|
-
[]
|
|
260
|
-
);
|
|
304
|
+
const [headerPaymentCategories, setHeaderPaymentCategories] = h([]);
|
|
261
305
|
const [paymentCategories, setPaymentCategories] = h([]);
|
|
262
306
|
const componentMountRefMap = A({});
|
|
263
307
|
const componentInstMap = A({});
|
|
@@ -272,9 +316,8 @@ const DropIn = w((props, ref) => {
|
|
|
272
316
|
}));
|
|
273
317
|
y(() => {
|
|
274
318
|
var _a2, _b;
|
|
275
|
-
if (!activePaymentCategory)
|
|
319
|
+
if (!activePaymentCategory)
|
|
276
320
|
return;
|
|
277
|
-
}
|
|
278
321
|
const currCompInst = componentInstMap.current[activePaymentCategory];
|
|
279
322
|
if (currCompInst) {
|
|
280
323
|
const ref2 = currCompInst.ref;
|
|
@@ -290,10 +333,9 @@ const DropIn = w((props, ref) => {
|
|
|
290
333
|
}
|
|
291
334
|
}, [paymentCategories]);
|
|
292
335
|
y(() => {
|
|
293
|
-
|
|
294
|
-
renderComponent(
|
|
295
|
-
|
|
296
|
-
}
|
|
336
|
+
headerPaymentCategories == null ? void 0 : headerPaymentCategories.forEach((category) => {
|
|
337
|
+
renderComponent(category);
|
|
338
|
+
});
|
|
297
339
|
}, [headerPaymentCategories]);
|
|
298
340
|
const createComponent = (category) => {
|
|
299
341
|
const { onError, onSuccess, onTimeout, onExpired, onSubmit, onAuthorized, onSubmitResponse } = props;
|
|
@@ -323,62 +365,31 @@ const DropIn = w((props, ref) => {
|
|
|
323
365
|
componentInstMap.current[category] = inst;
|
|
324
366
|
}
|
|
325
367
|
};
|
|
326
|
-
const initPaymentCategories = (
|
|
327
|
-
const
|
|
328
|
-
const paymentCategoryOptions2 =
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
const isCardEnable = !!intersection(cpyEnablePaymentMethods, CardPaymentMethods).length;
|
|
340
|
-
if (isCardEnable) {
|
|
341
|
-
paymentCategories2.push(PaymentCategory.CARD);
|
|
342
|
-
paymentCategoryOptions2.push({
|
|
343
|
-
type: PaymentCategory.CARD,
|
|
344
|
-
icon: () => {
|
|
345
|
-
const Icon = paymentCategoryOptionMap[PaymentCategory.CARD].icon;
|
|
346
|
-
return Icon ? /* @__PURE__ */ u(Icon, { size: 24 }) : null;
|
|
347
|
-
},
|
|
348
|
-
name: i18n.get(paymentCategoryOptionMap[PaymentCategory.CARD].nameKey)
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
cpyEnablePaymentMethods.forEach((method) => {
|
|
352
|
-
if (cpyEnablePaymentMethods.includes(method)) {
|
|
353
|
-
const type = PaymentMethod2CategoryMap[method];
|
|
354
|
-
if (type) {
|
|
355
|
-
paymentCategories2.push(type);
|
|
356
|
-
paymentCategoryOptions2.push({
|
|
357
|
-
type,
|
|
358
|
-
icon: () => {
|
|
359
|
-
const Icon = paymentCategoryOptionMap[type].icon;
|
|
360
|
-
return Icon ? /* @__PURE__ */ u(Icon, { size: 24 }) : null;
|
|
361
|
-
},
|
|
362
|
-
name: i18n.get(paymentCategoryOptionMap[type].nameKey)
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
if (paymentCategoryOptions2.length) {
|
|
368
|
-
setPaymentCategoryOptions(paymentCategoryOptions2);
|
|
368
|
+
const initPaymentCategories = (displayCategories) => {
|
|
369
|
+
const { header, main } = splitHeaderAndMain(displayCategories);
|
|
370
|
+
const paymentCategoryOptions2 = main.map((category) => ({
|
|
371
|
+
type: category,
|
|
372
|
+
icon: () => {
|
|
373
|
+
const Icon = paymentCategoryOptionMap[category].icon;
|
|
374
|
+
const iconHeight = 24;
|
|
375
|
+
return Icon ? /* @__PURE__ */ u(Icon, { size: category === PaymentCategory.ALI_PAY ? 20 : iconHeight }) : null;
|
|
376
|
+
},
|
|
377
|
+
name: i18n.get(paymentCategoryOptionMap[category].nameKey)
|
|
378
|
+
}));
|
|
379
|
+
if (paymentCategoryOptions2.length === 1) {
|
|
369
380
|
setActivePaymentCategory(paymentCategoryOptions2[0].type);
|
|
370
381
|
}
|
|
371
|
-
|
|
372
|
-
|
|
382
|
+
setPaymentCategoryOptions(paymentCategoryOptions2);
|
|
383
|
+
setHeaderPaymentCategories(header);
|
|
384
|
+
setPaymentCategories(main);
|
|
373
385
|
};
|
|
374
386
|
const handlePaymentCategoryChange = (newPaymentCategory) => {
|
|
375
387
|
setActivePaymentCategory(newPaymentCategory);
|
|
376
388
|
};
|
|
377
389
|
y(() => {
|
|
378
390
|
var _a2, _b, _c, _d;
|
|
379
|
-
if (!sessionReady || !i18n.ready.value)
|
|
391
|
+
if (!sessionReady || !i18n.ready.value)
|
|
380
392
|
return;
|
|
381
|
-
}
|
|
382
393
|
if (((_a2 = session.checkout) == null ? void 0 : _a2.sessionMode) === SessionMode.COMPONENT) {
|
|
383
394
|
(_c = (_b = props.core.config).onInitError) == null ? void 0 : _c.call(
|
|
384
395
|
_b,
|
|
@@ -387,14 +398,13 @@ const DropIn = w((props, ref) => {
|
|
|
387
398
|
return;
|
|
388
399
|
}
|
|
389
400
|
const { supportMethods = [] } = (session == null ? void 0 : session.checkout) || {};
|
|
390
|
-
const
|
|
401
|
+
const displayCategories = resolveDropInDisplayCategories({
|
|
391
402
|
supportMethods,
|
|
392
|
-
|
|
393
|
-
);
|
|
394
|
-
if (!
|
|
403
|
+
layout: paymentMethodLayout
|
|
404
|
+
});
|
|
405
|
+
if (!displayCategories.length)
|
|
395
406
|
return;
|
|
396
|
-
|
|
397
|
-
initPaymentCategories(enablePaymentMethods);
|
|
407
|
+
initPaymentCategories(displayCategories);
|
|
398
408
|
const currPaymentMethod = (_d = core.payment) == null ? void 0 : _d.currPaymentMethod.value;
|
|
399
409
|
if (currPaymentMethod) {
|
|
400
410
|
const category = PaymentMethod2CategoryMap[currPaymentMethod];
|
|
@@ -431,7 +441,7 @@ const DropIn = w((props, ref) => {
|
|
|
431
441
|
HeaderField(),
|
|
432
442
|
!!paymentCategoryOptions.length && /* @__PURE__ */ u(b, { children: [
|
|
433
443
|
OtherLine(),
|
|
434
|
-
|
|
444
|
+
/* @__PURE__ */ u("div", { className: bem("accordion-wrapper"), children: /* @__PURE__ */ u(
|
|
435
445
|
Accordion,
|
|
436
446
|
{
|
|
437
447
|
value: activePaymentCategory,
|
|
@@ -454,23 +464,7 @@ const DropIn = w((props, ref) => {
|
|
|
454
464
|
}
|
|
455
465
|
))
|
|
456
466
|
}
|
|
457
|
-
) })
|
|
458
|
-
/* @__PURE__ */ u("div", { className: bem("tabs-wrapper"), children: /* @__PURE__ */ u(
|
|
459
|
-
PaymentTabs,
|
|
460
|
-
{
|
|
461
|
-
value: activePaymentCategory,
|
|
462
|
-
tabs: paymentCategoryOptions,
|
|
463
|
-
onChange: (item) => handlePaymentCategoryChange(item)
|
|
464
|
-
}
|
|
465
|
-
) }),
|
|
466
|
-
paymentCategories == null ? void 0 : paymentCategories.map((category) => /* @__PURE__ */ u(
|
|
467
|
-
"div",
|
|
468
|
-
{
|
|
469
|
-
style: { display: category === activePaymentCategory ? "block" : "none" },
|
|
470
|
-
ref: (el) => componentMountRefMap.current[category] = el
|
|
471
|
-
}
|
|
472
|
-
))
|
|
473
|
-
] })
|
|
467
|
+
) })
|
|
474
468
|
] })
|
|
475
469
|
] }) });
|
|
476
470
|
});
|
|
@@ -10,8 +10,8 @@ import "../../utils/card-brand/brands.js";
|
|
|
10
10
|
import "../../utils/system-info/get-browser-info.js";
|
|
11
11
|
import { EMAIL_REG } from "../../utils/reg-exp.js";
|
|
12
12
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
13
|
+
import "../../out/fraud-detection.js";
|
|
13
14
|
import "../../core/context.js";
|
|
14
|
-
import "../../out/worldpay-jsc-origin.js";
|
|
15
15
|
import "../internal/Form/type.js";
|
|
16
16
|
import "../internal/Form/context.js";
|
|
17
17
|
import { FormItem } from "../internal/Form/FormItem.js";
|
|
@@ -4,13 +4,15 @@ import { create } from "../../core/create.js";
|
|
|
4
4
|
import { w, F, h, A, y, u } from "../../core.js";
|
|
5
5
|
import "../../utils/card-brand/brands.js";
|
|
6
6
|
import { getBrowserInfo } from "../../utils/system-info/get-browser-info.js";
|
|
7
|
-
import "../../out/
|
|
7
|
+
import "../../out/fraud-detection.js";
|
|
8
8
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
9
9
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
10
|
-
import { intersection } from "../../utils/index.js";
|
|
11
|
-
import { defaultInputStyleConfig } from "../../types/index.js";
|
|
12
10
|
import { createPromise } from "../../utils/create-promise.js";
|
|
11
|
+
import { separateInputStyle, genComponentStyle, loadStyle } from "../../utils/style.js";
|
|
13
12
|
import { EFieldType, SecuredFieldsProvider } from "../SecuredFieldsProvider/index.js";
|
|
13
|
+
import { intersection } from "../../utils/array.js";
|
|
14
|
+
import { genShortId } from "../../utils/string.js";
|
|
15
|
+
import { defaultInputStyleConfig } from "../../types/index.js";
|
|
14
16
|
import { CardNumberField } from "../CardNumberField/index.js";
|
|
15
17
|
import { CardExpireDateField } from "../CardExpireDateField/index.js";
|
|
16
18
|
import { CardSecurityCodeField } from "../CardSecurityCodeField/index.js";
|
|
@@ -22,8 +24,6 @@ import "../internal/Form/Form.js";
|
|
|
22
24
|
import { CombinedCardInfo } from "../CombinedCardInfo/index.js";
|
|
23
25
|
import "../internal/Input/Input.js";
|
|
24
26
|
import { inputWrapperClassName } from "../internal/Input/type.js";
|
|
25
|
-
import { separateInputStyle, genComponentStyle, loadStyle } from "../../utils/style.js";
|
|
26
|
-
import { genShortId } from "../../utils/string.js";
|
|
27
27
|
const ENCRYPTED_CARD_WRAPPER_ID = "encryptedCardWrapper";
|
|
28
28
|
const ENCRYPTED_CARD_ITEM_ATTR = "data-eci";
|
|
29
29
|
var EEncryptedCardType = /* @__PURE__ */ ((EEncryptedCardType2) => {
|
|
@@ -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 { createUrlWithParams } from "../../utils/location.js";
|
|
8
|
+
import { PaymentMethod, SessionMode } from "../../constant.js";
|
|
7
9
|
import { deepMerge } from "../../utils/object.js";
|
|
8
10
|
import { processPaymentStatus, formatPaymentResult } from "../../utils/payment.js";
|
|
9
|
-
import {
|
|
10
|
-
import { PaymentMethod, SessionMode } from "../../constant.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
23
|
const createGooglePay = (core, checkout, googlePayConfig, pay, onClick, onCanUse, onCancel) => {
|
|
22
|
-
const {
|
|
23
|
-
transAmount,
|
|
24
|
-
theme: { merchantName }
|
|
25
|
-
} = checkout;
|
|
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();
|
|
@@ -208,7 +211,7 @@ const DEFAULT_GOOGLE_PAY_CONFIG = {
|
|
|
208
211
|
};
|
|
209
212
|
const GooglePay = w((props, ref) => {
|
|
210
213
|
var _a;
|
|
211
|
-
const { session, threeDSFrame, isDropIn, core } = props;
|
|
214
|
+
const { session, threeDSFrame, isDropIn, core, enable3DSModal = true } = props;
|
|
212
215
|
const googlePayConfig = deepMerge(DEFAULT_GOOGLE_PAY_CONFIG, props.config || {});
|
|
213
216
|
F(ref, () => ({
|
|
214
217
|
checkThreeDS
|
|
@@ -218,7 +221,6 @@ const GooglePay = w((props, ref) => {
|
|
|
218
221
|
const [showGooglePay, setShowGooglePay] = h(false);
|
|
219
222
|
const [showThreeDSModal, setShowThreeDSModal] = h(false);
|
|
220
223
|
const [threeDSInfo, setThreeDSInfo] = h();
|
|
221
|
-
const [hosted, setHosted] = h(true);
|
|
222
224
|
const getPaymentMethodContext = () => {
|
|
223
225
|
return {
|
|
224
226
|
paymentMethod: CURR_PAYMENT_METHOD
|
|
@@ -270,23 +272,23 @@ const GooglePay = w((props, ref) => {
|
|
|
270
272
|
(_c = props.onLoad) == null ? void 0 : _c.call(props, false);
|
|
271
273
|
}
|
|
272
274
|
);
|
|
273
|
-
setHosted(sessionMode === SessionMode.HOSTED);
|
|
274
275
|
if (status === "SUCCESS") {
|
|
275
276
|
processOnSuccess(session == null ? void 0 : session.checkout);
|
|
276
277
|
}
|
|
277
278
|
}, [sessionReady]);
|
|
278
279
|
const processThreeDS = (threeDSUrl, incomplete) => {
|
|
279
280
|
var _a2;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
} else {
|
|
281
|
+
const finalUrl = createUrlWithParams(threeDSUrl, { locale: i18n.locale });
|
|
282
|
+
if (enable3DSModal) {
|
|
283
283
|
setShowThreeDSModal(true);
|
|
284
284
|
setThreeDSInfo({
|
|
285
|
-
url:
|
|
285
|
+
url: finalUrl,
|
|
286
286
|
incomplete,
|
|
287
287
|
width: threeDSFrame == null ? void 0 : threeDSFrame.modalWidth,
|
|
288
288
|
height: threeDSFrame == null ? void 0 : threeDSFrame.modalHeight
|
|
289
289
|
});
|
|
290
|
+
} else {
|
|
291
|
+
(_a2 = props.onThreeDS) == null ? void 0 : _a2.call(props, finalUrl, incomplete);
|
|
290
292
|
}
|
|
291
293
|
};
|
|
292
294
|
const handleCloseThreeDSModal = () => {
|
|
@@ -314,7 +316,7 @@ const GooglePay = w((props, ref) => {
|
|
|
314
316
|
bill: {
|
|
315
317
|
firstName: billAddress == null ? void 0 : billAddress.name,
|
|
316
318
|
addressLine1: billAddress == null ? void 0 : billAddress.address1,
|
|
317
|
-
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) ?? ""),
|
|
318
320
|
country: billAddress == null ? void 0 : billAddress.countryCode,
|
|
319
321
|
state: billAddress == null ? void 0 : billAddress.administrativeArea,
|
|
320
322
|
city: billAddress == null ? void 0 : billAddress.locality,
|
|
@@ -329,7 +331,7 @@ const GooglePay = w((props, ref) => {
|
|
|
329
331
|
};
|
|
330
332
|
};
|
|
331
333
|
async function pay(token, billAddress, search = false, timeout) {
|
|
332
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
334
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
333
335
|
setErrorMsg("");
|
|
334
336
|
if (!search) {
|
|
335
337
|
(_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, void 0, getPaymentMethodContext());
|
|
@@ -350,17 +352,18 @@ const GooglePay = w((props, ref) => {
|
|
|
350
352
|
requestOptions
|
|
351
353
|
);
|
|
352
354
|
} else {
|
|
355
|
+
const paymentParams = await getPaymentParams(token, billAddress);
|
|
353
356
|
const extraParams = (_e = (_d = core.config)._getExtraParams) == null ? void 0 : _e.call(_d, "payment", CURR_PAYMENT_METHOD);
|
|
354
|
-
|
|
355
|
-
await
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
);
|
|
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);
|
|
359
362
|
}
|
|
360
363
|
const { errorMessage, payInfo = {}, errorCode, sessionId } = res;
|
|
361
364
|
const { threeDSUrl } = payInfo;
|
|
362
365
|
sessionId && (session.sessionId = sessionId);
|
|
363
|
-
!search && ((
|
|
366
|
+
!search && ((_g = props.onSubmitResponse) == null ? void 0 : _g.call(props, res, getPaymentMethodContext()));
|
|
364
367
|
let result = {
|
|
365
368
|
end: true,
|
|
366
369
|
res: { transactionState: "SUCCESS" }
|
|
@@ -441,10 +444,10 @@ const GooglePay = w((props, ref) => {
|
|
|
441
444
|
};
|
|
442
445
|
}
|
|
443
446
|
} else {
|
|
444
|
-
(
|
|
447
|
+
(_h = core.payment) == null ? void 0 : _h.resetCurrPaymentMethod();
|
|
445
448
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
446
449
|
setErrorMsg(message);
|
|
447
|
-
(
|
|
450
|
+
(_i = props.onError) == null ? void 0 : _i.call(
|
|
448
451
|
props,
|
|
449
452
|
new PayKKaError("API_ERROR", message, { code: error.code, cause: error }),
|
|
450
453
|
getPaymentMethodContext()
|
|
@@ -558,10 +561,10 @@ const GooglePay = w((props, ref) => {
|
|
|
558
561
|
session == null ? void 0 : session.checkout,
|
|
559
562
|
googlePayConfig,
|
|
560
563
|
pay,
|
|
561
|
-
() => {
|
|
564
|
+
async () => {
|
|
562
565
|
var _a2, _b, _c;
|
|
563
566
|
(_b = (_a2 = core.config).onEvent) == null ? void 0 : _b.call(_a2, GooglePayEventType.GOOGLE_PAY_BUTTON_CLICKED);
|
|
564
|
-
(_c = props.onBtnClick) == null ? void 0 : _c.call(props);
|
|
567
|
+
return (_c = props.onBtnClick) == null ? void 0 : _c.call(props);
|
|
565
568
|
},
|
|
566
569
|
props.onCanUse,
|
|
567
570
|
props.onCancel
|
|
@@ -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
|
{
|
|
@@ -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");
|