@paykka/card-checkout-ui 0.8.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/card-checkout-ui.js +21 -14
- package/dist/card-checkout-ui.umd.cjs +21 -14
- package/dist/es/_commonjsHelpers.js +1 -0
- package/dist/es/api/http.js +19 -21
- package/dist/es/api/index.js +1 -1
- package/dist/es/api/modules/ali-pay/index.js +19 -11
- package/dist/es/api/modules/apple-pay/index.js +10 -26
- package/dist/es/api/modules/boost/index.js +56 -0
- package/dist/es/api/modules/card/index.js +17 -11
- package/dist/es/api/modules/checkout/index.js +6 -6
- package/dist/es/api/modules/checkout/map.js +23 -6
- package/dist/es/api/modules/gcash/index.js +56 -0
- package/dist/es/api/modules/get-browser-params.js +2 -2
- package/dist/es/api/modules/google-pay/index.js +10 -26
- package/dist/es/api/modules/grab-pay/index.js +56 -0
- package/dist/es/api/modules/index.js +1 -1
- package/dist/es/api/modules/line-pay/index.js +56 -0
- package/dist/es/api/modules/may-bank-qr-pay/index.js +56 -0
- package/dist/es/api/modules/nine-pay/index.js +56 -0
- package/dist/es/api/modules/paymaya/index.js +56 -0
- package/dist/es/api/modules/risk/index.js +13 -0
- package/dist/es/api/modules/sepa/index.js +19 -11
- package/dist/es/api/modules/shopee-pay/index.js +56 -0
- package/dist/es/api/modules/threeDS/index.js +1 -0
- package/dist/es/api/modules/tng-wallet/index.js +56 -0
- package/dist/es/api/modules/wechat-pay/index.js +18 -31
- package/dist/es/components/AccordionItem/AccordionItem.js +37 -0
- package/dist/es/components/AccountNameField/index.js +1 -0
- package/dist/es/components/AddressField/index.js +1 -0
- package/dist/es/components/AliPay/index.js +28 -40
- package/dist/es/components/ApplePay/index.js +18 -39
- package/dist/es/components/Boost/index.js +324 -0
- package/dist/es/components/Card/index.js +80 -48
- package/dist/es/components/CardBrands/index.js +3 -2
- package/dist/es/components/CardExpireDateField/index.js +1 -0
- package/dist/es/components/CardHolderNameField/index.js +1 -0
- package/dist/es/components/CardIBANField/index.js +1 -0
- package/dist/es/components/CardNo/index.js +1 -0
- package/dist/es/components/CardNumberField/index.js +124 -106
- package/dist/es/components/CardSecurityCodeField/index.js +1 -0
- package/dist/es/components/CardSelector/index.js +1 -0
- package/dist/es/components/CombinedCardInfo/index.js +4 -0
- package/dist/es/components/DropIn/index.js +206 -50
- package/dist/es/components/EmailField/EmailField.js +14 -15
- package/dist/es/components/EncryptedCard/index.js +1 -0
- package/dist/es/components/GooglePay/index.js +7 -6
- package/dist/es/components/GrabPay/index.js +324 -0
- package/dist/es/components/GuideCard/index.js +44 -0
- package/dist/es/components/LinePay/index.js +324 -0
- package/dist/es/components/MayBankQRPay/index.js +324 -0
- package/dist/es/components/NinePay/index.js +324 -0
- package/dist/es/components/RecurringTip/index.js +1 -0
- package/dist/es/components/SecuredFieldsProvider/index.js +2 -1
- package/dist/es/components/SecuredIframe/index.js +57 -4
- package/dist/es/components/Sepa/index.js +7 -10
- package/dist/es/components/ShopeePay/index.js +324 -0
- package/dist/es/components/SubmitButton/index.js +7 -20
- package/dist/es/components/TNGWallet/index.js +324 -0
- package/dist/es/components/ThreeDS/index.js +1 -0
- package/dist/es/components/WechatPay/index.js +30 -49
- package/dist/es/components/business/QRCodeModal/QRCodeModal.js +42 -0
- package/dist/es/components/business/QRCodeModal/index.js +7 -0
- package/dist/es/components/business/QRCodeModal/qr-code-modal.js +1 -0
- package/dist/es/components/business/QRCodeModal/type.js +1 -0
- package/dist/es/components/business/index.js +7 -0
- package/dist/es/components/index.js +10 -0
- package/dist/es/components/internal/Accordion/Accordion.js +14 -0
- package/dist/es/components/internal/Accordion/accordion2.js +1 -0
- package/dist/es/components/internal/Accordion/accordionTransition.js +26 -0
- package/dist/es/components/internal/Accordion/index.js +8 -0
- package/dist/es/components/internal/Accordion/type.js +10 -0
- package/dist/es/components/internal/Button/Button.js +1 -0
- package/dist/es/components/internal/Button/index.js +1 -0
- package/dist/es/components/internal/CheckBox/CheckBox.js +1 -0
- package/dist/es/components/internal/CheckBox/index.js +1 -0
- package/dist/es/components/internal/Form/type.js +1 -0
- package/dist/es/components/internal/Info/Info.js +1 -0
- package/dist/es/components/internal/Info/index.js +1 -0
- package/dist/es/components/internal/Input/type.js +1 -0
- package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +1 -0
- package/dist/es/components/internal/LoadingCheck/index.js +1 -0
- package/dist/es/components/internal/Modal/Modal.js +18 -3
- package/dist/es/components/internal/Modal/index.js +1 -0
- package/dist/es/components/internal/Modal/type.js +1 -0
- package/dist/es/components/internal/QRCode/QRCode.js +32 -0
- package/dist/es/components/internal/QRCode/index.js +5 -0
- package/dist/es/components/internal/QRCode/type.js +1 -0
- package/dist/es/components/internal/Select/Select.js +11 -9
- package/dist/es/components/internal/Select/SelectMenu.js +1 -0
- package/dist/es/components/internal/Select/SelectMenuItem.js +1 -0
- package/dist/es/components/internal/icons/IconBoost.js +63 -0
- package/dist/es/components/internal/icons/IconCard.js +1 -40
- package/dist/es/components/internal/icons/IconCard2.js +60 -0
- package/dist/es/components/internal/icons/IconGCash.js +196 -0
- package/dist/es/components/internal/icons/IconGcashComplete.js +184 -0
- package/dist/es/components/internal/icons/IconGrabPay.js +59 -0
- package/dist/es/components/internal/icons/IconLinePay.js +99 -0
- package/dist/es/components/internal/icons/IconMayBankQRPay.js +69 -0
- package/dist/es/components/internal/icons/IconNinePay.js +255 -0
- package/dist/es/components/internal/icons/IconPaymaya.js +114 -0
- package/dist/es/components/internal/icons/IconRedirect.js +58 -0
- package/dist/es/components/internal/icons/IconScan.js +102 -0
- package/dist/es/components/internal/icons/IconShopeePay.js +108 -0
- package/dist/es/components/internal/icons/IconTNGWallet.js +119 -0
- package/dist/es/components/internal/icons/IconUnionPay.js +65 -0
- package/dist/es/components/wallets/GCash/GCash.js +368 -0
- package/dist/es/components/wallets/GCash/g-cash.js +1 -0
- package/dist/es/components/wallets/GCash/index.js +1 -0
- package/dist/es/components/wallets/GCash/type.js +1 -0
- package/dist/es/components/wallets/Paymaya/Paymaya.js +325 -0
- package/dist/es/components/wallets/Paymaya/index.js +1 -0
- package/dist/es/components/wallets/Paymaya/paymaya2.js +1 -0
- package/dist/es/components/wallets/Paymaya/type.js +1 -0
- package/dist/es/config.js +12 -12
- package/dist/es/constant.js +84 -4
- package/dist/es/core/PayKKaCheckout.js +35 -5
- package/dist/es/core/Session.js +24 -23
- package/dist/es/core/error.js +7 -0
- package/dist/es/core/index.js +1 -0
- package/dist/es/core/query.js +3 -3
- package/dist/es/core.js +2082 -70
- package/dist/es/hooks/index.js +1 -0
- package/dist/es/hooks/useI18n.js +1 -0
- package/dist/es/hooks/usePayState.js +7 -5
- package/dist/es/i18n/I18n.js +8 -2
- package/dist/es/i18n/locales/de-DE.js +16 -1
- package/dist/es/i18n/locales/en-GB.js +16 -1
- package/dist/es/i18n/locales/es-ES.js +16 -1
- package/dist/es/i18n/locales/fr-FR.js +16 -1
- package/dist/es/i18n/locales/index.js +2 -1
- package/dist/es/i18n/locales/ja-JP.js +16 -1
- package/dist/es/i18n/locales/ko-KR.js +16 -1
- package/dist/es/i18n/locales/nl-NL.js +88 -0
- package/dist/es/i18n/locales/pt-PT.js +16 -1
- package/dist/es/i18n/locales/ru-RU.js +16 -1
- package/dist/es/i18n/locales/zh-CN.js +16 -1
- package/dist/es/i18n/locales/zh-HK.js +16 -1
- package/dist/es/i18n/locales/zh-TW.js +16 -1
- package/dist/es/i18n/util.js +12 -3
- package/dist/es/index.js +22 -0
- package/dist/es/out/fraud-detection.js +39 -13
- package/dist/es/out/worldpay-ddc.js +143 -0
- package/dist/es/style.css +1 -1192
- package/dist/es/types/event.js +15 -0
- package/dist/es/types/fraud-detection.js +1 -0
- package/dist/es/types/index.js +1 -0
- package/dist/es/types/message.js +3 -0
- package/dist/es/utils/array.js +9 -0
- package/dist/es/utils/card-brand/brands.js +11 -1
- package/dist/es/utils/card-brand/index.js +4 -3
- package/dist/es/utils/card-brand/luhn.js +25 -0
- package/dist/es/utils/date.js +25 -0
- package/dist/es/utils/detect.js +6 -0
- package/dist/es/utils/format.js +28 -12
- package/dist/es/utils/iframe.js +1 -1
- package/dist/es/utils/index.js +9 -1
- package/dist/es/utils/location.js +37 -0
- package/dist/es/utils/object.js +14 -0
- package/dist/es/utils/redirect.js +32 -0
- package/dist/es/utils/reg-exp.js +4 -0
- package/dist/es/utils/system-info/get-browser-info.js +4 -4
- package/dist/es/utils/system-info/get-system-info.js +11 -7
- package/dist/es/utils/system-info/index.js +4 -4
- package/dist/style.css +1 -1
- package/dist/types/api/http.d.ts +4 -10
- package/dist/types/api/modules/ali-pay/index.d.ts +2 -1
- package/dist/types/api/modules/apple-pay/index.d.ts +2 -1
- package/dist/types/api/modules/boost/index.d.ts +24 -0
- package/dist/types/api/modules/card/index.d.ts +1 -1
- package/dist/types/api/modules/checkout/index.d.ts +2 -2
- package/dist/types/api/modules/checkout/type.d.ts +9 -0
- package/dist/types/api/modules/gcash/index.d.ts +24 -0
- package/dist/types/api/modules/get-browser-params.d.ts +2 -2
- package/dist/types/api/modules/google-pay/index.d.ts +2 -1
- package/dist/types/api/modules/grab-pay/index.d.ts +24 -0
- package/dist/types/api/modules/index.d.ts +11 -0
- package/dist/types/api/modules/line-pay/index.d.ts +24 -0
- package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +24 -0
- package/dist/types/api/modules/nine-pay/index.d.ts +24 -0
- package/dist/types/api/modules/paymaya/index.d.ts +24 -0
- package/dist/types/api/modules/risk/index.d.ts +8 -0
- package/dist/types/api/modules/sepa/index.d.ts +2 -1
- package/dist/types/api/modules/shopee-pay/index.d.ts +24 -0
- package/dist/types/api/modules/threeDS/index.d.ts +3 -0
- package/dist/types/api/modules/tng-wallet/index.d.ts +24 -0
- package/dist/types/api/modules/wechat-pay/index.d.ts +2 -1
- package/dist/types/components/Boost/Boost.d.ts +7 -0
- package/dist/types/components/Boost/index.d.ts +2 -0
- package/dist/types/components/Boost/type.d.ts +61 -0
- package/dist/types/components/CardNumberField/type.d.ts +7 -1
- package/dist/types/components/CombinedCardInfo/type.d.ts +1 -0
- package/dist/types/components/DropIn/components/PaymentTabs/type.d.ts +1 -1
- package/dist/types/components/DropIn/config.d.ts +7 -0
- package/dist/types/components/DropIn/type.d.ts +11 -3
- package/dist/types/components/GrabPay/GrabPay.d.ts +7 -0
- package/dist/types/components/GrabPay/index.d.ts +2 -0
- package/dist/types/components/GrabPay/type.d.ts +61 -0
- package/dist/types/components/GuideCard/GuideCard.d.ts +3 -0
- package/dist/types/components/GuideCard/index.d.ts +2 -0
- package/dist/types/components/GuideCard/type.d.ts +4 -0
- package/dist/types/components/LinePay/LinePay.d.ts +7 -0
- package/dist/types/components/LinePay/index.d.ts +2 -0
- package/dist/types/components/LinePay/type.d.ts +61 -0
- package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +6 -0
- package/dist/types/components/MayBankQRPay/index.d.ts +2 -0
- package/dist/types/components/MayBankQRPay/type.d.ts +61 -0
- package/dist/types/components/NinePay/NinePay.d.ts +6 -0
- package/dist/types/components/NinePay/index.d.ts +2 -0
- package/dist/types/components/NinePay/type.d.ts +61 -0
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +1 -1
- package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +1 -1
- package/dist/types/components/ShopeePay/ShopeePay.d.ts +7 -0
- package/dist/types/components/ShopeePay/index.d.ts +2 -0
- package/dist/types/components/ShopeePay/type.d.ts +61 -0
- package/dist/types/components/SubmitButton/SubmitButton.d.ts +1 -1
- package/dist/types/components/TNGWallet/TNGWallet.d.ts +7 -0
- package/dist/types/components/TNGWallet/index.d.ts +2 -0
- package/dist/types/components/TNGWallet/type.d.ts +61 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +1 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/output.d.ts +1 -1
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +13 -3
- package/dist/types/components/business/QRCodeModal/QRCodeModal.d.ts +3 -0
- package/dist/types/components/business/QRCodeModal/index.d.ts +2 -0
- package/dist/types/components/business/QRCodeModal/type.d.ts +18 -0
- package/dist/types/components/business/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +9 -0
- package/dist/types/components/internal/Accordion/Accordion.d.ts +3 -0
- package/dist/types/components/internal/Accordion/accordionTransition.d.ts +8 -0
- package/dist/types/components/internal/Accordion/components/AccordionItem/AccordionItem.d.ts +3 -0
- package/dist/types/components/internal/Accordion/components/AccordionItem/index.d.ts +2 -0
- package/dist/types/components/internal/Accordion/components/AccordionItem/type.d.ts +18 -0
- package/dist/types/components/internal/Accordion/index.d.ts +3 -0
- package/dist/types/components/internal/Accordion/type.d.ts +18 -0
- package/dist/types/components/internal/Modal/type.d.ts +2 -0
- package/dist/types/components/internal/QRCode/QRCode.d.ts +2 -0
- package/dist/types/components/internal/QRCode/index.d.ts +2 -0
- package/dist/types/components/internal/QRCode/type.d.ts +9 -0
- package/dist/types/components/internal/Select/Select.d.ts +1 -17
- package/dist/types/components/internal/Select/type.d.ts +26 -1
- package/dist/types/components/internal/icons/IconBoost.d.ts +2 -0
- package/dist/types/components/internal/icons/IconCard2.d.ts +2 -0
- package/dist/types/components/internal/icons/IconGCash.d.ts +2 -0
- package/dist/types/components/internal/icons/IconGcashComplete.d.ts +2 -0
- package/dist/types/components/internal/icons/IconGrabPay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconLinePay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconMayBankQRPay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconNinePay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconPaymaya.d.ts +2 -0
- package/dist/types/components/internal/icons/IconRedirect.d.ts +2 -0
- package/dist/types/components/internal/icons/IconScan.d.ts +2 -0
- package/dist/types/components/internal/icons/IconShopeePay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconTNGWallet.d.ts +2 -0
- package/dist/types/components/internal/icons/IconUnionPay.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +13 -0
- package/dist/types/components/wallets/GCash/GCash.d.ts +6 -0
- package/dist/types/components/wallets/GCash/index.d.ts +2 -0
- package/dist/types/components/wallets/GCash/type.d.ts +71 -0
- package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +6 -0
- package/dist/types/components/wallets/Paymaya/index.d.ts +2 -0
- package/dist/types/components/wallets/Paymaya/type.d.ts +61 -0
- package/dist/types/config.d.ts +9 -9
- package/dist/types/constant.d.ts +28 -3
- package/dist/types/core/PayKKaCheckout.d.ts +10 -0
- package/dist/types/core/Session.d.ts +2 -0
- package/dist/types/core/error.d.ts +15 -2
- package/dist/types/core/query.d.ts +2 -2
- package/dist/types/hooks/usePayState.d.ts +5 -5
- package/dist/types/i18n/I18n.d.ts +1 -1
- package/dist/types/i18n/locales/de-DE.d.ts +13 -0
- package/dist/types/i18n/locales/en-GB.d.ts +13 -0
- package/dist/types/i18n/locales/es-ES.d.ts +13 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +13 -0
- package/dist/types/i18n/locales/index.d.ts +2 -0
- package/dist/types/i18n/locales/ja-JP.d.ts +13 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +13 -0
- package/dist/types/i18n/locales/nl-NL.d.ts +71 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +13 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +13 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +13 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +13 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +13 -0
- package/dist/types/i18n/util.d.ts +5 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/out/fraud-detection.d.ts +5 -1
- package/dist/types/out/types.d.ts +4 -0
- package/dist/types/out/worldpay-ddc-iframe.d.ts +1 -0
- package/dist/types/out/worldpay-ddc.d.ts +37 -0
- package/dist/types/types/event.d.ts +26 -0
- package/dist/types/types/fraud-detection.d.ts +3 -1
- package/dist/types/types/index.d.ts +23 -4
- package/dist/types/types/message.d.ts +22 -2
- package/dist/types/utils/array.d.ts +1 -0
- package/dist/types/utils/card-brand/brands.d.ts +4 -3
- package/dist/types/utils/card-brand/index.d.ts +9 -6
- package/dist/types/utils/card-brand/luhn.d.ts +9 -0
- package/dist/types/utils/date.d.ts +9 -0
- package/dist/types/utils/detect.d.ts +1 -0
- package/dist/types/utils/format.d.ts +7 -1
- package/dist/types/utils/iframe.d.ts +1 -1
- package/dist/types/utils/index.d.ts +8 -0
- package/dist/types/utils/location.d.ts +7 -0
- package/dist/types/utils/object.d.ts +1 -0
- package/dist/types/utils/redirect.d.ts +5 -0
- package/dist/types/utils/reg-exp.d.ts +1 -0
- package/dist/types/utils/system-info/get-browser-info.d.ts +1 -1
- package/dist/types/utils/system-info/get-system-info.d.ts +3 -2
- package/dist/types/utils/system-info/index.d.ts +3 -3
- package/package.json +6 -2
|
@@ -2,24 +2,64 @@ import { u, w, h, A, F, y, b } from "../../core.js";
|
|
|
2
2
|
import "../../utils/card-brand/brands.js";
|
|
3
3
|
import "../../utils/system-info/get-browser-info.js";
|
|
4
4
|
import { CoreContext } from "../../core/context.js";
|
|
5
|
-
import
|
|
5
|
+
import "../../api/http.js";
|
|
6
|
+
import { CardPaymentMethods, PaymentMethod, PaymentCategory, SessionMode, PaymentMethod2CategoryMap } from "../../constant.js";
|
|
6
7
|
import { Card } from "../Card/index.js";
|
|
7
8
|
import { ApplePay } from "../ApplePay/index.js";
|
|
8
9
|
import { GooglePay } from "../GooglePay/index.js";
|
|
10
|
+
import { Boost } from "../Boost/index.js";
|
|
11
|
+
import { NinePay } from "../NinePay/index.js";
|
|
12
|
+
import { LinePay } from "../LinePay/index.js";
|
|
13
|
+
import { TNGWallet } from "../TNGWallet/index.js";
|
|
14
|
+
import { MayBankQRPay } from "../MayBankQRPay/index.js";
|
|
15
|
+
import { ShopeePay } from "../ShopeePay/index.js";
|
|
16
|
+
import { GrabPay } from "../GrabPay/index.js";
|
|
17
|
+
import { GCash } from "../wallets/GCash/GCash.js";
|
|
18
|
+
import { Paymaya } from "../wallets/Paymaya/Paymaya.js";
|
|
9
19
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
10
20
|
import { intersection } from "../../utils/index.js";
|
|
11
21
|
import { PayKKaError } from "../../core/error.js";
|
|
12
22
|
import { usePayState } from "../../hooks/usePayState.js";
|
|
13
|
-
import {
|
|
23
|
+
import { Accordion } from "../internal/Accordion/Accordion.js";
|
|
24
|
+
import { AccordionItem } from "../AccordionItem/AccordionItem.js";
|
|
25
|
+
import { IconLinePay } from "../internal/icons/IconLinePay.js";
|
|
26
|
+
import { IconBoost } from "../internal/icons/IconBoost.js";
|
|
27
|
+
import { IconGrabPay } from "../internal/icons/IconGrabPay.js";
|
|
28
|
+
import { IconNinePay } from "../internal/icons/IconNinePay.js";
|
|
29
|
+
import { IconMayBankQRPay } from "../internal/icons/IconMayBankQRPay.js";
|
|
30
|
+
import { IconShopeePay } from "../internal/icons/IconShopeePay.js";
|
|
31
|
+
import { IconTNGWallet } from "../internal/icons/IconTNGWallet.js";
|
|
32
|
+
import { IconCard2 } from "../internal/icons/IconCard2.js";
|
|
33
|
+
import { IconGCash } from "../internal/icons/IconGCash.js";
|
|
34
|
+
import { IconPaymaya } from "../internal/icons/IconPaymaya.js";
|
|
35
|
+
import { removeElementFromArray } from "../../utils/array.js";
|
|
14
36
|
const dropInSupportedPaymentMethods = [
|
|
15
37
|
...CardPaymentMethods,
|
|
16
38
|
PaymentMethod.GOOGLE_PAY,
|
|
17
|
-
PaymentMethod.APPLE_PAY
|
|
39
|
+
PaymentMethod.APPLE_PAY,
|
|
40
|
+
PaymentMethod.BOOST,
|
|
41
|
+
PaymentMethod.GRAB_PAY,
|
|
42
|
+
PaymentMethod.LINE_PAY,
|
|
43
|
+
PaymentMethod.NINE_PAY,
|
|
44
|
+
PaymentMethod.SHOPEE_PAY,
|
|
45
|
+
PaymentMethod.TNG_WALLET,
|
|
46
|
+
PaymentMethod.MAY_BANK_QR_PAY,
|
|
47
|
+
PaymentMethod.GCASH,
|
|
48
|
+
PaymentMethod.PAYMAYA
|
|
18
49
|
];
|
|
19
50
|
const PaymentComponentMap = {
|
|
20
51
|
[PaymentCategory.CARD]: Card,
|
|
21
52
|
[PaymentCategory.APPLE_PAY]: ApplePay,
|
|
22
|
-
[PaymentCategory.GOOGLE_PAY]: GooglePay
|
|
53
|
+
[PaymentCategory.GOOGLE_PAY]: GooglePay,
|
|
54
|
+
[PaymentCategory.BOOST]: Boost,
|
|
55
|
+
[PaymentCategory.NINE_PAY]: NinePay,
|
|
56
|
+
[PaymentCategory.LINE_PAY]: LinePay,
|
|
57
|
+
[PaymentCategory.TNG_WALLET]: TNGWallet,
|
|
58
|
+
[PaymentCategory.MAY_BANK_QR_PAY]: MayBankQRPay,
|
|
59
|
+
[PaymentCategory.SHOPEE_PAY]: ShopeePay,
|
|
60
|
+
[PaymentCategory.GRAB_PAY]: GrabPay,
|
|
61
|
+
[PaymentCategory.GCASH]: GCash,
|
|
62
|
+
[PaymentCategory.PAYMAYA]: Paymaya
|
|
23
63
|
// [PaymentCategory.WECHAT_PAY]: WechatPay,
|
|
24
64
|
// [PaymentCategory.ALI_PAY]: AliPay,
|
|
25
65
|
// [PaymentCategory.SEPA_DEBIT]: Sepa
|
|
@@ -54,14 +94,61 @@ const PaymentTabs = (props) => {
|
|
|
54
94
|
}
|
|
55
95
|
)) });
|
|
56
96
|
};
|
|
97
|
+
const paymentCategoryOptionMap = {
|
|
98
|
+
[PaymentCategory.CARD]: {
|
|
99
|
+
icon: IconCard2,
|
|
100
|
+
nameKey: "dropIn.card.label"
|
|
101
|
+
},
|
|
102
|
+
[PaymentCategory.LINE_PAY]: {
|
|
103
|
+
icon: IconLinePay,
|
|
104
|
+
nameKey: "dropIn.linePay.label"
|
|
105
|
+
},
|
|
106
|
+
[PaymentCategory.BOOST]: {
|
|
107
|
+
icon: IconBoost,
|
|
108
|
+
nameKey: "dropIn.boost.label"
|
|
109
|
+
},
|
|
110
|
+
[PaymentCategory.GRAB_PAY]: {
|
|
111
|
+
icon: IconGrabPay,
|
|
112
|
+
nameKey: "dropIn.grabPay.label"
|
|
113
|
+
},
|
|
114
|
+
[PaymentCategory.NINE_PAY]: {
|
|
115
|
+
icon: IconNinePay,
|
|
116
|
+
nameKey: "dropIn.ninePay.label"
|
|
117
|
+
},
|
|
118
|
+
[PaymentCategory.MAY_BANK_QR_PAY]: {
|
|
119
|
+
icon: IconMayBankQRPay,
|
|
120
|
+
nameKey: "dropIn.mayBankQRPay.label"
|
|
121
|
+
},
|
|
122
|
+
[PaymentCategory.SHOPEE_PAY]: {
|
|
123
|
+
icon: IconShopeePay,
|
|
124
|
+
nameKey: "dropIn.shopeePay.label"
|
|
125
|
+
},
|
|
126
|
+
[PaymentCategory.TNG_WALLET]: {
|
|
127
|
+
icon: IconTNGWallet,
|
|
128
|
+
nameKey: "dropIn.TNGWallet.label"
|
|
129
|
+
},
|
|
130
|
+
[PaymentCategory.GCASH]: {
|
|
131
|
+
icon: IconGCash,
|
|
132
|
+
nameKey: "dropIn.gcash.label"
|
|
133
|
+
},
|
|
134
|
+
[PaymentCategory.PAYMAYA]: {
|
|
135
|
+
icon: IconPaymaya,
|
|
136
|
+
nameKey: "dropIn.paymaya.label"
|
|
137
|
+
}
|
|
138
|
+
};
|
|
57
139
|
const { bem } = useBEM("drop-in");
|
|
58
140
|
const DropIn = w((props, ref) => {
|
|
59
|
-
const {
|
|
60
|
-
|
|
141
|
+
const {
|
|
142
|
+
paymentMethods: paymentMethodsConfig,
|
|
143
|
+
layout = "accordion",
|
|
144
|
+
session,
|
|
145
|
+
core,
|
|
146
|
+
enableAccordionTransition = true
|
|
147
|
+
} = props;
|
|
148
|
+
const { i18n, sessionReady } = usePayState(session, props.core);
|
|
61
149
|
const [paymentCategoryOptions, setPaymentCategoryOptions] = h([]);
|
|
62
|
-
const [activePaymentCategory, setActivePaymentCategory] = h(
|
|
63
|
-
|
|
64
|
-
);
|
|
150
|
+
const [activePaymentCategory, setActivePaymentCategory] = h();
|
|
151
|
+
const [enablePaymentMethod, setEnablePaymentMethod] = h();
|
|
65
152
|
const [headerPaymentCategories, setHeaderPaymentCategories] = h(
|
|
66
153
|
[]
|
|
67
154
|
);
|
|
@@ -78,14 +165,24 @@ const DropIn = w((props, ref) => {
|
|
|
78
165
|
}
|
|
79
166
|
}));
|
|
80
167
|
y(() => {
|
|
168
|
+
var _a, _b;
|
|
81
169
|
if (!activePaymentCategory) {
|
|
82
170
|
return;
|
|
83
171
|
}
|
|
84
|
-
|
|
85
|
-
|
|
172
|
+
const currCompInst = componentInstMap.current[activePaymentCategory];
|
|
173
|
+
if (currCompInst) {
|
|
174
|
+
const ref2 = currCompInst.ref;
|
|
175
|
+
(_a = ref2.updateAddress) == null ? void 0 : _a.call(ref2);
|
|
176
|
+
(_b = ref2.updateEmail) == null ? void 0 : _b.call(ref2);
|
|
86
177
|
}
|
|
87
|
-
renderComponent(activePaymentCategory);
|
|
88
178
|
}, [activePaymentCategory]);
|
|
179
|
+
y(() => {
|
|
180
|
+
if (paymentCategories == null ? void 0 : paymentCategories.length) {
|
|
181
|
+
paymentCategories.forEach((category) => {
|
|
182
|
+
renderComponent(category);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}, [paymentCategories]);
|
|
89
186
|
y(() => {
|
|
90
187
|
if (headerPaymentCategories == null ? void 0 : headerPaymentCategories.length) {
|
|
91
188
|
renderComponent(PaymentCategory.APPLE_PAY);
|
|
@@ -113,32 +210,46 @@ const DropIn = w((props, ref) => {
|
|
|
113
210
|
}
|
|
114
211
|
};
|
|
115
212
|
const initPaymentCategories = (enablePaymentMethods) => {
|
|
213
|
+
const cpyEnablePaymentMethods = [...enablePaymentMethods];
|
|
116
214
|
const paymentCategoryOptions2 = [];
|
|
117
215
|
const paymentCategories2 = [];
|
|
118
216
|
const headerPaymentCategories2 = [];
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
} else {
|
|
123
|
-
paymentCategories2.push(PaymentCategory.APPLE_PAY);
|
|
124
|
-
}
|
|
217
|
+
if (cpyEnablePaymentMethods.includes(PaymentMethod.APPLE_PAY)) {
|
|
218
|
+
headerPaymentCategories2.push(PaymentCategory.APPLE_PAY);
|
|
219
|
+
removeElementFromArray(cpyEnablePaymentMethods, PaymentMethod.APPLE_PAY);
|
|
125
220
|
}
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
} else {
|
|
130
|
-
paymentCategories2.push(PaymentCategory.APPLE_PAY);
|
|
131
|
-
}
|
|
221
|
+
if (cpyEnablePaymentMethods.includes(PaymentMethod.GOOGLE_PAY)) {
|
|
222
|
+
headerPaymentCategories2.push(PaymentCategory.GOOGLE_PAY);
|
|
223
|
+
removeElementFromArray(cpyEnablePaymentMethods, PaymentMethod.GOOGLE_PAY);
|
|
132
224
|
}
|
|
133
|
-
const isCardEnable = !!intersection(
|
|
225
|
+
const isCardEnable = !!intersection(cpyEnablePaymentMethods, CardPaymentMethods).length;
|
|
134
226
|
if (isCardEnable) {
|
|
135
227
|
paymentCategories2.push(PaymentCategory.CARD);
|
|
136
228
|
paymentCategoryOptions2.push({
|
|
137
229
|
type: PaymentCategory.CARD,
|
|
138
|
-
|
|
139
|
-
|
|
230
|
+
icon: () => {
|
|
231
|
+
const Icon = paymentCategoryOptionMap[PaymentCategory.CARD].icon;
|
|
232
|
+
return Icon ? /* @__PURE__ */ u(Icon, { size: 24 }) : null;
|
|
233
|
+
},
|
|
234
|
+
name: i18n.get(paymentCategoryOptionMap[PaymentCategory.CARD].nameKey)
|
|
140
235
|
});
|
|
141
236
|
}
|
|
237
|
+
cpyEnablePaymentMethods.forEach((method) => {
|
|
238
|
+
if (cpyEnablePaymentMethods.includes(method)) {
|
|
239
|
+
const type = PaymentMethod2CategoryMap[method];
|
|
240
|
+
if (type) {
|
|
241
|
+
paymentCategories2.push(type);
|
|
242
|
+
paymentCategoryOptions2.push({
|
|
243
|
+
type,
|
|
244
|
+
icon: () => {
|
|
245
|
+
const Icon = paymentCategoryOptionMap[type].icon;
|
|
246
|
+
return Icon ? /* @__PURE__ */ u(Icon, { size: 24 }) : null;
|
|
247
|
+
},
|
|
248
|
+
name: i18n.get(paymentCategoryOptionMap[type].nameKey)
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
142
253
|
if (paymentCategoryOptions2.length) {
|
|
143
254
|
setPaymentCategoryOptions(paymentCategoryOptions2);
|
|
144
255
|
setActivePaymentCategory(paymentCategoryOptions2[0].type);
|
|
@@ -157,7 +268,7 @@ const DropIn = w((props, ref) => {
|
|
|
157
268
|
if (((_a = session.checkout) == null ? void 0 : _a.sessionMode) === SessionMode.COMPONENT) {
|
|
158
269
|
(_c = (_b = props.core.config).onInitError) == null ? void 0 : _c.call(
|
|
159
270
|
_b,
|
|
160
|
-
new PayKKaError("ERROR", "Please send the correct
|
|
271
|
+
new PayKKaError("ERROR", "Please send the correct session when creating the checkout")
|
|
161
272
|
);
|
|
162
273
|
return;
|
|
163
274
|
}
|
|
@@ -170,38 +281,83 @@ const DropIn = w((props, ref) => {
|
|
|
170
281
|
return;
|
|
171
282
|
}
|
|
172
283
|
initPaymentCategories(enablePaymentMethods);
|
|
284
|
+
if (core.processingPaymentMethod) {
|
|
285
|
+
const category = PaymentMethod2CategoryMap[core.processingPaymentMethod];
|
|
286
|
+
category && setActivePaymentCategory(category);
|
|
287
|
+
core.enablePaymentMethod.value = core.processingPaymentMethod;
|
|
288
|
+
}
|
|
173
289
|
}, [sessionReady, i18n.ready.value]);
|
|
174
|
-
|
|
175
|
-
|
|
290
|
+
y(() => {
|
|
291
|
+
if (core.enablePaymentMethod.value) {
|
|
292
|
+
setEnablePaymentMethod(
|
|
293
|
+
PaymentMethod2CategoryMap[core.enablePaymentMethod.value]
|
|
294
|
+
);
|
|
295
|
+
} else {
|
|
296
|
+
setEnablePaymentMethod(void 0);
|
|
297
|
+
}
|
|
298
|
+
}, [core.enablePaymentMethod.value]);
|
|
299
|
+
const HeaderField = () => {
|
|
300
|
+
return /* @__PURE__ */ u(b, { children: headerPaymentCategories == null ? void 0 : headerPaymentCategories.map((category) => /* @__PURE__ */ u(
|
|
176
301
|
"div",
|
|
177
302
|
{
|
|
178
303
|
className: bem("header-payment"),
|
|
179
304
|
ref: (el) => componentMountRefMap.current[category] = el
|
|
180
305
|
}
|
|
181
|
-
))
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
306
|
+
)) });
|
|
307
|
+
};
|
|
308
|
+
const OtherLine = () => {
|
|
309
|
+
return /* @__PURE__ */ u(b, { children: !!(headerPaymentCategories == null ? void 0 : headerPaymentCategories.length) && /* @__PURE__ */ u("div", { className: bem("other"), children: [
|
|
310
|
+
/* @__PURE__ */ u("div", { className: bem("other-line") }),
|
|
311
|
+
/* @__PURE__ */ u("div", { className: bem("other-text"), children: i18n.get("dropIn.otherPaymentMethod") }),
|
|
312
|
+
/* @__PURE__ */ u("div", { className: bem("other-line") })
|
|
313
|
+
] }) });
|
|
314
|
+
};
|
|
315
|
+
return /* @__PURE__ */ u(CoreContext.Provider, { value: { i18n }, children: i18n.ready.value && /* @__PURE__ */ u("div", { className: bem(), children: [
|
|
316
|
+
HeaderField(),
|
|
317
|
+
!!paymentCategoryOptions.length && /* @__PURE__ */ u(b, { children: [
|
|
318
|
+
OtherLine(),
|
|
319
|
+
layout === "accordion" ? /* @__PURE__ */ u(b, { children: /* @__PURE__ */ u("div", { className: bem("accordion-wrapper"), children: /* @__PURE__ */ u(
|
|
320
|
+
Accordion,
|
|
190
321
|
{
|
|
191
322
|
value: activePaymentCategory,
|
|
192
|
-
|
|
193
|
-
onChange: (item) => handlePaymentCategoryChange(item)
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
323
|
+
enableTransition: enableAccordionTransition,
|
|
324
|
+
onChange: (item) => handlePaymentCategoryChange(item),
|
|
325
|
+
children: paymentCategoryOptions.map((item) => /* @__PURE__ */ u(
|
|
326
|
+
AccordionItem,
|
|
327
|
+
{
|
|
328
|
+
title: item.name,
|
|
329
|
+
value: item.type,
|
|
330
|
+
header: /* @__PURE__ */ u("div", { className: bem("accordion-icon"), children: item.icon() }),
|
|
331
|
+
disabled: !!enablePaymentMethod && enablePaymentMethod !== item.type,
|
|
332
|
+
children: /* @__PURE__ */ u(
|
|
333
|
+
"div",
|
|
334
|
+
{
|
|
335
|
+
style: "padding: 0 2px",
|
|
336
|
+
ref: (el) => componentMountRefMap.current[item.type] = el
|
|
337
|
+
}
|
|
338
|
+
)
|
|
339
|
+
}
|
|
340
|
+
))
|
|
201
341
|
}
|
|
202
|
-
))
|
|
342
|
+
) }) }) : /* @__PURE__ */ u(b, { children: [
|
|
343
|
+
/* @__PURE__ */ u("div", { className: bem("tabs-wrapper"), children: /* @__PURE__ */ u(
|
|
344
|
+
PaymentTabs,
|
|
345
|
+
{
|
|
346
|
+
value: activePaymentCategory,
|
|
347
|
+
tabs: paymentCategoryOptions,
|
|
348
|
+
onChange: (item) => handlePaymentCategoryChange(item)
|
|
349
|
+
}
|
|
350
|
+
) }),
|
|
351
|
+
paymentCategories == null ? void 0 : paymentCategories.map((category) => /* @__PURE__ */ u(
|
|
352
|
+
"div",
|
|
353
|
+
{
|
|
354
|
+
style: { display: category === activePaymentCategory ? "block" : "none" },
|
|
355
|
+
ref: (el) => componentMountRefMap.current[category] = el
|
|
356
|
+
}
|
|
357
|
+
))
|
|
358
|
+
] })
|
|
203
359
|
] })
|
|
204
|
-
] }) })
|
|
360
|
+
] }) });
|
|
205
361
|
});
|
|
206
362
|
export {
|
|
207
363
|
DropIn,
|
|
@@ -8,7 +8,9 @@ import { w, h, A, F, y, u } from "../../core.js";
|
|
|
8
8
|
import { isValuable } from "../../utils/is.js";
|
|
9
9
|
import "../../utils/card-brand/brands.js";
|
|
10
10
|
import "../../utils/system-info/get-browser-info.js";
|
|
11
|
+
import { EMAIL_REG } from "../../utils/reg-exp.js";
|
|
11
12
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
13
|
+
import "../../api/http.js";
|
|
12
14
|
import "../internal/Form/type.js";
|
|
13
15
|
import "../internal/Form/context.js";
|
|
14
16
|
import { FormItem } from "../internal/Form/FormItem.js";
|
|
@@ -50,42 +52,39 @@ const EmailField = w((props, ref) => {
|
|
|
50
52
|
const emailCore = createEmailCore(props.value ?? "");
|
|
51
53
|
F(ref, () => ({
|
|
52
54
|
update: (value2) => {
|
|
53
|
-
var _a
|
|
54
|
-
|
|
55
|
-
emailCore.
|
|
56
|
-
if (emailCore.isValid) {
|
|
55
|
+
var _a;
|
|
56
|
+
updateEmail(value2);
|
|
57
|
+
if (emailCore.isValid || isValuable(value2)) {
|
|
57
58
|
(_a = formItemRef.current) == null ? void 0 : _a.validate(value2, { trigger: "submit", setResult: true });
|
|
58
|
-
} else {
|
|
59
|
-
isValuable(value2) && ((_b = formItemRef.current) == null ? void 0 : _b.validate(value2, { trigger: "submit", setResult: true }));
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
}));
|
|
63
62
|
y(() => {
|
|
64
|
-
|
|
65
|
-
emailCore.email = props.value ?? "";
|
|
63
|
+
updateEmail(props.value);
|
|
66
64
|
}, [props.value]);
|
|
67
|
-
|
|
68
|
-
emailCore.email =
|
|
69
|
-
|
|
65
|
+
const updateEmail = (value2) => {
|
|
66
|
+
emailCore.email = value2 ?? "";
|
|
67
|
+
setValue(value2 ?? "");
|
|
68
|
+
};
|
|
70
69
|
const rule = {
|
|
71
70
|
trigger: ["blur", "submit"],
|
|
72
71
|
validator(value2) {
|
|
73
72
|
if (!value2) {
|
|
74
73
|
throw new Error(i18n.get("common.email.incomplete"));
|
|
75
74
|
}
|
|
76
|
-
const emailReg = new RegExp(
|
|
75
|
+
const emailReg = new RegExp(EMAIL_REG);
|
|
77
76
|
if (!emailReg.test(value2)) {
|
|
78
77
|
throw new Error(i18n.get("common.email.incorrect"));
|
|
79
78
|
}
|
|
80
79
|
return true;
|
|
81
80
|
}
|
|
82
81
|
};
|
|
83
|
-
|
|
82
|
+
const onInput = (event) => {
|
|
84
83
|
var _a;
|
|
85
84
|
const { currentTarget } = event;
|
|
86
|
-
|
|
85
|
+
updateEmail(currentTarget.value);
|
|
87
86
|
(_a = props.onInput) == null ? void 0 : _a.call(props, event);
|
|
88
|
-
}
|
|
87
|
+
};
|
|
89
88
|
return /* @__PURE__ */ u(
|
|
90
89
|
FormItem,
|
|
91
90
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { setApiUrl, setCDNUrl } from "../../config.js";
|
|
2
2
|
import { CoreContext } from "../../core/context.js";
|
|
3
3
|
import { create } from "../../core/create.js";
|
|
4
|
+
import "../../api/http.js";
|
|
4
5
|
import "../../utils/card-brand/brands.js";
|
|
5
6
|
import { getBrowserInfo } from "../../utils/system-info/get-browser-info.js";
|
|
6
7
|
import { w, F, h, A, y, u } from "../../core.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { w, F, h, q, y, A, u, b } from "../../core.js";
|
|
2
2
|
import { isTimeoutError } from "../../api/http.js";
|
|
3
3
|
import { SessionMode, PaymentMethod } from "../../constant.js";
|
|
4
|
+
import "../../utils/card-brand/brands.js";
|
|
5
|
+
import "../../utils/system-info/get-browser-info.js";
|
|
6
|
+
import { extractAreaCodeAndPhoneNumber } from "../../utils/format.js";
|
|
4
7
|
import { getBrowserParams } from "../../api/modules/get-browser-params.js";
|
|
5
8
|
import { getGooglePayInfo, googlePay } from "../../api/modules/google-pay/index.js";
|
|
6
9
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
7
10
|
import "../../core/context.js";
|
|
8
|
-
import "../../utils/card-brand/brands.js";
|
|
9
|
-
import "../../utils/system-info/get-browser-info.js";
|
|
10
|
-
import { extractAreaCodeAndPhoneNumber } from "../../utils/format.js";
|
|
11
11
|
import { PayKKaError } from "../../core/error.js";
|
|
12
12
|
import { usePayState } from "../../hooks/usePayState.js";
|
|
13
13
|
import { useRetry } from "../../hooks/useRetry.js";
|
|
@@ -180,7 +180,7 @@ const GooglePay = w((props, ref) => {
|
|
|
180
180
|
F(ref, () => ({
|
|
181
181
|
checkThreeDS
|
|
182
182
|
}));
|
|
183
|
-
const { sessionReady, i18n, fraudDetection } = usePayState(session);
|
|
183
|
+
const { sessionReady, i18n, fraudDetection } = usePayState(session, props.core);
|
|
184
184
|
const [errorMsg, setErrorMsg] = h("");
|
|
185
185
|
const [showGooglePay, setShowGooglePay] = h(false);
|
|
186
186
|
const [showThreeDSModal, setShowThreeDSModal] = h(false);
|
|
@@ -206,7 +206,7 @@ const GooglePay = w((props, ref) => {
|
|
|
206
206
|
if (sessionMode === SessionMode.DROP_IN && !isDropIn) {
|
|
207
207
|
(_b = (_a2 = props.core.config).onInitError) == null ? void 0 : _b.call(
|
|
208
208
|
_a2,
|
|
209
|
-
new PayKKaError("ERROR", "Please send the correct
|
|
209
|
+
new PayKKaError("ERROR", "Please send the correct session when creating the checkout")
|
|
210
210
|
);
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
@@ -290,9 +290,10 @@ const GooglePay = w((props, ref) => {
|
|
|
290
290
|
areaCode: phone == null ? void 0 : phone.areaCode
|
|
291
291
|
},
|
|
292
292
|
browser: await getBrowserParams({
|
|
293
|
-
fraudDetectionId: fraudDetection == null ? void 0 : fraudDetection.
|
|
293
|
+
fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
|
|
294
294
|
})
|
|
295
295
|
},
|
|
296
|
+
props.core,
|
|
296
297
|
{ locale: i18n.locale }
|
|
297
298
|
);
|
|
298
299
|
}());
|