@paykka/card-checkout-ui 0.11.6 → 0.13.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 +19 -19
- package/dist/card-checkout-ui.umd.cjs +19 -19
- package/dist/es/_commonjsHelpers.js +82 -1
- package/dist/es/api/index.js +1 -0
- package/dist/es/api/modules/address/index.js +9 -9
- package/dist/es/api/modules/ali-pay/index.js +10 -49
- package/dist/es/api/modules/apple-pay/index.js +13 -59
- package/dist/es/api/modules/boost/index.js +8 -48
- package/dist/es/api/modules/card/index.js +10 -54
- package/dist/es/api/modules/checkout/index.js +11 -9
- package/dist/es/api/modules/checkout/map.js +25 -18
- package/dist/es/api/modules/encrypted-card/index.js +3 -2
- package/dist/es/api/modules/gcash/index.js +8 -48
- package/dist/es/api/modules/get-browser-params.js +4 -1
- package/dist/es/api/modules/google-pay/index.js +10 -56
- package/dist/es/api/modules/grab-pay/index.js +8 -48
- package/dist/es/api/modules/index.js +1 -0
- package/dist/es/api/modules/line-pay/index.js +8 -48
- package/dist/es/api/modules/map.js +17 -11
- package/dist/es/api/modules/may-bank-qr-pay/index.js +8 -48
- package/dist/es/api/modules/nine-pay/index.js +8 -48
- package/dist/es/api/modules/paymaya/index.js +8 -48
- package/dist/es/api/modules/risk/index.js +2 -1
- package/dist/es/api/modules/sepa/index.js +10 -51
- package/dist/es/api/modules/shopee-pay/index.js +8 -48
- package/dist/es/api/modules/threeDS/index.js +3 -0
- package/dist/es/api/modules/tng-wallet/index.js +8 -48
- package/dist/es/api/modules/wechat-pay/index.js +10 -51
- package/dist/es/api/modules/zalopay/index.js +16 -0
- package/dist/es/api/utils/index.js +59 -0
- package/dist/es/components/AddressField/index.js +37 -37
- package/dist/es/components/AliPay/index.js +158 -111
- package/dist/es/components/ApplePay/index.js +99 -67
- package/dist/es/components/Boost/index.js +91 -70
- package/dist/es/components/Card/index.js +114 -107
- package/dist/es/components/CardSelector/index.js +1 -1
- package/dist/es/components/DropIn/index.js +12 -4
- package/dist/es/components/EncryptedCard/index.js +6 -2
- package/dist/es/components/GooglePay/index.js +94 -60
- package/dist/es/components/GrabPay/index.js +91 -70
- package/dist/es/components/GuideCard/index.js +10 -7
- package/dist/es/components/LinePay/index.js +91 -70
- package/dist/es/components/MayBankQRPay/index.js +302 -275
- package/dist/es/components/NinePay/index.js +91 -70
- package/dist/es/components/SecuredFieldsProvider/index.js +26 -9
- package/dist/es/components/SecuredIframe/index.js +40 -61
- package/dist/es/components/Sepa/index.js +72 -53
- package/dist/es/components/ShopeePay/index.js +91 -70
- package/dist/es/components/SubmitButton/index.js +8 -7
- package/dist/es/components/TNGWallet/index.js +91 -70
- package/dist/es/components/ThreeDS/index.js +32 -7
- package/dist/es/components/WechatPay/index.js +151 -102
- package/dist/es/components/business/QRCodeModal/QRCodeModal.js +26 -6
- package/dist/es/components/index.js +1 -0
- package/dist/es/components/internal/Form/FormItem.js +1 -1
- package/dist/es/components/internal/Form/util.js +1 -1
- package/dist/es/components/internal/Modal/Modal.js +1 -1
- package/dist/es/components/internal/Select/Select.js +19 -8
- package/dist/es/components/internal/Select/SelectMenu.js +2 -2
- package/dist/es/components/internal/Select/SelectMenuItem.js +12 -4
- package/dist/es/components/internal/icons/IconError.js +7 -4
- package/dist/es/components/internal/icons/IconZalopay.js +47 -0
- package/dist/es/components/internal/icons/IconZalopayComplete.js +48 -0
- package/dist/es/components/wallets/GCash/GCash.js +80 -56
- package/dist/es/components/wallets/Paymaya/Paymaya.js +91 -70
- package/dist/es/components/wallets/Zalopay/Zalopay.js +381 -0
- package/dist/es/components/wallets/Zalopay/index.js +1 -0
- package/dist/es/components/wallets/Zalopay/type.js +1 -0
- package/dist/es/components/wallets/Zalopay/zalopay2.js +1 -0
- package/dist/es/config.js +5 -5
- package/dist/es/constant.js +8 -2
- package/dist/es/core/{Address.js → address.js} +8 -16
- package/dist/es/core/{PayKKaCheckout.js → checkout.js} +101 -27
- package/dist/es/core/create.js +1 -1
- package/dist/es/core/query.js +3 -2
- package/dist/es/core/{Session.js → session.js} +28 -32
- package/dist/es/core/theme.js +65 -0
- package/dist/es/core.js +0 -4
- package/dist/es/hooks/usePayment.js +14 -0
- package/dist/es/i18n/locales/de-DE.js +3 -1
- package/dist/es/i18n/locales/en-GB.js +3 -1
- package/dist/es/i18n/locales/es-ES.js +3 -1
- package/dist/es/i18n/locales/fr-FR.js +3 -1
- package/dist/es/i18n/locales/ja-JP.js +3 -1
- package/dist/es/i18n/locales/ko-KR.js +3 -1
- package/dist/es/i18n/locales/nl-NL.js +3 -1
- package/dist/es/i18n/locales/pt-PT.js +3 -1
- package/dist/es/i18n/locales/ru-RU.js +3 -1
- package/dist/es/i18n/locales/zh-CN.js +3 -1
- package/dist/es/i18n/locales/zh-HK.js +3 -1
- package/dist/es/i18n/locales/zh-TW.js +3 -1
- package/dist/es/index.js +21 -7
- package/dist/es/style.css +1 -1
- package/dist/es/types/index.js +7 -0
- package/dist/es/utils/colors.js +5 -1
- package/dist/es/utils/format.js +0 -5
- package/dist/es/utils/object.js +31 -1
- package/dist/es/utils/payment.js +82 -0
- package/dist/es/utils/redirect.js +4 -4
- package/dist/es/utils/string.js +10 -0
- package/dist/es/utils/system-info/is-ua-webview.js +14 -12
- package/dist/es/utils/theme.js +7 -0
- package/dist/style.css +1 -1
- package/dist/types/api/modules/address/index.d.ts +15 -6
- package/dist/types/api/modules/ali-pay/index.d.ts +3 -19
- package/dist/types/api/modules/apple-pay/index.d.ts +4 -14
- package/dist/types/api/modules/boost/index.d.ts +3 -23
- package/dist/types/api/modules/card/index.d.ts +3 -30
- package/dist/types/api/modules/checkout/index.d.ts +3 -3
- package/dist/types/api/modules/checkout/map.d.ts +3 -3
- package/dist/types/api/modules/checkout/type.d.ts +33 -4
- package/dist/types/api/modules/gcash/index.d.ts +3 -23
- package/dist/types/api/modules/get-browser-params.d.ts +1 -0
- package/dist/types/api/modules/google-pay/index.d.ts +3 -13
- package/dist/types/api/modules/grab-pay/index.d.ts +3 -23
- package/dist/types/api/modules/index.d.ts +1 -0
- package/dist/types/api/modules/line-pay/index.d.ts +3 -23
- package/dist/types/api/modules/map.d.ts +2 -2
- package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +3 -23
- package/dist/types/api/modules/nine-pay/index.d.ts +3 -23
- package/dist/types/api/modules/paymaya/index.d.ts +3 -23
- package/dist/types/api/modules/sepa/index.d.ts +3 -24
- package/dist/types/api/modules/shopee-pay/index.d.ts +3 -23
- package/dist/types/api/modules/tng-wallet/index.d.ts +3 -23
- package/dist/types/api/modules/type.d.ts +74 -21
- package/dist/types/api/modules/wechat-pay/index.d.ts +3 -20
- package/dist/types/api/modules/zalopay/index.d.ts +4 -0
- package/dist/types/api/utils/index.d.ts +48 -0
- package/dist/types/components/AddressField/type.d.ts +3 -9
- package/dist/types/components/AliPay/AliPay.d.ts +6 -2
- package/dist/types/components/AliPay/type.d.ts +15 -2
- package/dist/types/components/ApplePay/ApplePay.d.ts +6 -2
- package/dist/types/components/ApplePay/type.d.ts +10 -14
- package/dist/types/components/ApplePay/utils.d.ts +1 -1
- package/dist/types/components/Boost/Boost.d.ts +6 -2
- package/dist/types/components/Boost/type.d.ts +2 -24
- package/dist/types/components/Card/Card.d.ts +6 -2
- package/dist/types/components/Card/type.d.ts +3 -43
- package/dist/types/components/DropIn/DropIn.d.ts +6 -2
- package/dist/types/components/DropIn/type.d.ts +4 -10
- package/dist/types/components/GooglePay/GooglePay.d.ts +6 -2
- package/dist/types/components/GooglePay/createGooglePay.d.ts +2 -1
- package/dist/types/components/GooglePay/type.d.ts +10 -26
- package/dist/types/components/GrabPay/GrabPay.d.ts +6 -2
- package/dist/types/components/GrabPay/type.d.ts +3 -25
- package/dist/types/components/LinePay/LinePay.d.ts +6 -2
- package/dist/types/components/LinePay/type.d.ts +3 -25
- package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +6 -2
- package/dist/types/components/MayBankQRPay/type.d.ts +3 -25
- package/dist/types/components/NinePay/NinePay.d.ts +6 -2
- package/dist/types/components/NinePay/type.d.ts +3 -25
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +5 -0
- package/dist/types/components/SecuredIframe/HiddenIframe.d.ts +3 -1
- package/dist/types/components/Sepa/Sepa.d.ts +6 -2
- package/dist/types/components/Sepa/type.d.ts +3 -2
- package/dist/types/components/ShopeePay/ShopeePay.d.ts +6 -2
- package/dist/types/components/ShopeePay/type.d.ts +3 -25
- package/dist/types/components/TNGWallet/TNGWallet.d.ts +6 -2
- package/dist/types/components/TNGWallet/type.d.ts +3 -25
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +2 -0
- package/dist/types/components/WechatPay/WechatPay.d.ts +6 -2
- package/dist/types/components/WechatPay/type.d.ts +15 -2
- package/dist/types/components/business/QRCodeModal/type.d.ts +2 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
- package/dist/types/components/internal/Select/SelectMenu.d.ts +1 -1
- package/dist/types/components/internal/icons/IconZalopay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconZalopayComplete.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +3 -0
- package/dist/types/components/wallets/GCash/GCash.d.ts +6 -2
- package/dist/types/components/wallets/GCash/type.d.ts +3 -35
- package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +6 -2
- package/dist/types/components/wallets/Paymaya/type.d.ts +3 -25
- package/dist/types/components/wallets/Zalopay/Zalopay.d.ts +10 -0
- package/dist/types/components/wallets/Zalopay/index.d.ts +2 -0
- package/dist/types/components/wallets/Zalopay/type.d.ts +39 -0
- package/dist/types/config.d.ts +2 -4
- package/dist/types/constant.d.ts +3 -1
- package/dist/types/core/{Address.d.ts → address.d.ts} +23 -24
- package/dist/types/core/{PayKKaCheckout.d.ts → checkout.d.ts} +9 -3
- package/dist/types/core/context.d.ts +3 -2
- package/dist/types/core/index.d.ts +3 -2
- package/dist/types/core/query.d.ts +2 -2
- package/dist/types/core/session.d.ts +23 -0
- package/dist/types/core/theme.d.ts +7 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/usePayment.d.ts +8 -0
- package/dist/types/i18n/locales/de-DE.d.ts +2 -0
- package/dist/types/i18n/locales/en-GB.d.ts +2 -0
- package/dist/types/i18n/locales/es-ES.d.ts +2 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +2 -0
- package/dist/types/i18n/locales/ja-JP.d.ts +2 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +2 -0
- package/dist/types/i18n/locales/nl-NL.d.ts +2 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +2 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +2 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +2 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +2 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +2 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts +70 -32
- package/dist/types/types/message.d.ts +30 -25
- package/dist/types/utils/card-brand/index.d.ts +3 -3
- package/dist/types/utils/colors.d.ts +1 -0
- package/dist/types/utils/index.d.ts +4 -2
- package/dist/types/utils/object.d.ts +7 -0
- package/dist/types/utils/payment.d.ts +37 -0
- package/dist/types/utils/string.d.ts +1 -0
- package/dist/types/utils/style.d.ts +1 -1
- package/dist/types/utils/system-info/is-ua-webview.d.ts +1 -1
- package/dist/types/utils/theme.d.ts +4 -0
- package/package.json +3 -3
- package/dist/es/utils/deep-freeze.js +0 -13
- package/dist/es/utils/obj.js +0 -22
- package/dist/types/core/Session.d.ts +0 -16
- package/dist/types/utils/deep-freeze.d.ts +0 -1
- package/dist/types/utils/obj.d.ts +0 -6
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { u } from "../../../core.js";
|
|
2
|
+
import { COMMON_CLASS_NAME } from "../../../constant.js";
|
|
3
|
+
import { isUndefined } from "../../../utils/is.js";
|
|
4
|
+
import "../../../utils/card-brand/brands.js";
|
|
5
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
6
|
+
import { normalizedClass } from "../../../utils/format.js";
|
|
7
|
+
const IconZalopayComplete = ({ size, style, className }) => {
|
|
8
|
+
const computedSize = !isUndefined(size) ? `${size}px` : "1em";
|
|
9
|
+
return /* @__PURE__ */ u(
|
|
10
|
+
"svg",
|
|
11
|
+
{
|
|
12
|
+
height: computedSize,
|
|
13
|
+
viewBox: "0 0 100 22",
|
|
14
|
+
fill: "none",
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
+
style,
|
|
17
|
+
className: normalizedClass(COMMON_CLASS_NAME, className),
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ u("g", { id: "logo-Zalopay", "clip-path": "url(#clip0_979_2746)", children: [
|
|
20
|
+
/* @__PURE__ */ u(
|
|
21
|
+
"path",
|
|
22
|
+
{
|
|
23
|
+
id: "Vector",
|
|
24
|
+
"fill-rule": "evenodd",
|
|
25
|
+
"clip-rule": "evenodd",
|
|
26
|
+
d: "M82.8549 3.38495V13.5354H84.5426V16.9278H83.3429C81.982 16.9278 80.7885 16.2275 80.0939 15.1694C78.9495 16.2562 77.436 16.9259 75.7694 16.9259C72.2105 16.9259 69.3233 13.899 69.3233 10.164C69.3233 6.42913 72.2087 3.40217 75.7694 3.40217C77.1433 3.40217 78.4138 3.85564 79.4584 4.6229V3.38495H82.8549ZM72.7118 10.1621C72.7118 12.0258 74.2215 13.5354 76.0851 13.5354C77.9488 13.5354 79.4584 12.0258 79.4584 10.1621C79.4584 8.29848 77.9488 6.78884 76.0851 6.78884C74.2215 6.78884 72.7118 8.29848 72.7118 10.1621ZM61.2871 3.38503C57.5522 3.38503 54.5156 6.42347 54.5156 10.1565V22.0002H57.9061V16.0152C58.9031 16.593 60.0549 16.9279 61.2871 16.9279C65.022 16.9279 68.0585 13.8895 68.0585 10.1565C68.0585 6.42347 65.0201 3.38503 61.2871 3.38503ZM61.2871 13.5374C59.4234 13.5374 57.9061 12.0201 57.9061 10.1565C57.9061 8.29283 59.4234 6.77553 61.2871 6.77553C63.1507 6.77553 64.6681 8.29283 64.6681 10.1565C64.6681 12.0201 63.1527 13.5374 61.2871 13.5374ZM94.8363 3.38881L91.2299 11.8019L87.8049 3.38881H84.1427L89.3528 16.1855L86.8597 22.0002H90.5502L98.5268 3.38881H94.8363Z",
|
|
27
|
+
fill: "#00CF6A"
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ u(
|
|
31
|
+
"path",
|
|
32
|
+
{
|
|
33
|
+
id: "Vector_2",
|
|
34
|
+
"fill-rule": "evenodd",
|
|
35
|
+
"clip-rule": "evenodd",
|
|
36
|
+
d: "M14.7098 0.962429C15.0064 1.55557 14.9433 2.25395 14.5452 2.78396L6.48228 13.5352H14.9337V16.9257H3.17788C2.51585 16.9257 1.91888 16.5584 1.6223 15.9652C1.32573 15.372 1.38887 14.6737 1.78685 14.1436L9.85176 3.3905H1.39844V0H13.1523C13.8162 0 14.4132 0.369281 14.7098 0.962429ZM38.451 10.1563C38.451 6.42329 41.4894 3.38485 45.2224 3.38485C48.9554 3.38485 51.9939 6.42329 51.9939 10.1563C51.9939 13.8893 48.9554 16.9277 45.2224 16.9277C41.4894 16.9277 38.451 13.8893 38.451 10.1563ZM41.8415 10.1563C41.8415 12.0199 43.3588 13.5372 45.2224 13.5372C47.0879 13.5372 48.6033 12.0199 48.6033 10.1563C48.6033 8.29266 47.0879 6.77536 45.2224 6.77536C43.3568 6.77536 41.8415 8.29266 41.8415 10.1563ZM29.7336 13.5353V3.38485H26.3374V4.62281C25.2927 3.85554 24.0222 3.40207 22.6484 3.40207C19.0876 3.40207 16.2022 6.42904 16.2022 10.1639C16.2022 13.8989 19.0896 16.9258 22.6484 16.9258C24.3149 16.9258 25.8285 16.2561 26.9726 15.1693C27.6672 16.2274 28.8612 16.9277 30.2216 16.9277H31.4213V13.5353H29.7336ZM22.9641 13.5353C21.1005 13.5353 19.5908 12.0257 19.5908 10.162C19.5908 8.2984 21.1005 6.78875 22.9641 6.78875C24.8277 6.78875 26.3374 8.2984 26.3374 10.162C26.3374 12.0257 24.8277 13.5353 22.9641 13.5353ZM36.1051 13.5314V0H32.707V13.0377C32.707 15.1846 34.4463 16.9257 36.5931 16.9257H37.8042V13.5314H36.1051Z",
|
|
37
|
+
fill: "#0033C9"
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ u("defs", { children: /* @__PURE__ */ u("clipPath", { id: "clip0_979_2746", children: /* @__PURE__ */ u("rect", { width: "98.2143", height: "22", fill: "white", transform: "translate(0.894531)" }) }) })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
IconZalopayComplete
|
|
48
|
+
};
|
|
@@ -4,17 +4,16 @@ import { CoreContext } from "../../../core/context.js";
|
|
|
4
4
|
import "../../../utils/card-brand/brands.js";
|
|
5
5
|
import "../../../utils/system-info/get-browser-info.js";
|
|
6
6
|
import { isMobile } from "../../../utils/system-info/get-system-info.js";
|
|
7
|
-
import {
|
|
7
|
+
import { normalizedClass, formatAmount } from "../../../utils/format.js";
|
|
8
8
|
import { redirectToPayment } from "../../../utils/redirect.js";
|
|
9
|
+
import { formatPaymentResult } from "../../../utils/payment.js";
|
|
9
10
|
import { isTimeoutError } from "../../../api/http.js";
|
|
10
|
-
import { PaymentCategory, COMMON_CLASS_NAME, PaymentMethod, SessionMode } from "../../../constant.js";
|
|
11
11
|
import { getBrowserParams } from "../../../api/modules/get-browser-params.js";
|
|
12
|
+
import { PaymentCategory, COMMON_CLASS_NAME, PaymentMethod, SessionMode } from "../../../constant.js";
|
|
12
13
|
import { getGcashPayInfo, gcashPay } from "../../../api/modules/gcash/index.js";
|
|
13
14
|
import { PayKKaError } from "../../../core/error.js";
|
|
14
|
-
import { hidePaymentButton } from "../../../config.js";
|
|
15
15
|
import { usePayState } from "../../../hooks/usePayState.js";
|
|
16
16
|
import { useRetry } from "../../../hooks/useRetry.js";
|
|
17
|
-
import { createAddressCore } from "../../../core/Address.js";
|
|
18
17
|
import { createEmailCore, EmailField } from "../../EmailField/EmailField.js";
|
|
19
18
|
import { SubmitButton } from "../../SubmitButton/index.js";
|
|
20
19
|
import { GuideCard } from "../../GuideCard/index.js";
|
|
@@ -30,7 +29,7 @@ import "./g-cash.js";
|
|
|
30
29
|
const { bem } = useBEM("gcash");
|
|
31
30
|
const fieldClassNames = bem("field");
|
|
32
31
|
const GCash = w((props, ref) => {
|
|
33
|
-
var _a
|
|
32
|
+
var _a;
|
|
34
33
|
const {
|
|
35
34
|
session,
|
|
36
35
|
showEmail = false,
|
|
@@ -39,7 +38,8 @@ const GCash = w((props, ref) => {
|
|
|
39
38
|
redirectMode = "auto",
|
|
40
39
|
autoQuery = true,
|
|
41
40
|
showGuideCard = true,
|
|
42
|
-
enableQRCodeModal = true
|
|
41
|
+
enableQRCodeModal = true,
|
|
42
|
+
hidePaymentButton = false
|
|
43
43
|
} = props;
|
|
44
44
|
F(ref, () => ({
|
|
45
45
|
stopRetry: () => {
|
|
@@ -54,15 +54,17 @@ const GCash = w((props, ref) => {
|
|
|
54
54
|
var _a2;
|
|
55
55
|
if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
|
|
56
56
|
return;
|
|
57
|
-
|
|
58
|
-
(
|
|
57
|
+
const newForm = Object.assign(form, { address: addressCore.getAddressState() });
|
|
58
|
+
setForm(newForm);
|
|
59
|
+
(_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressCore.getAddressState());
|
|
60
|
+
validateForm();
|
|
59
61
|
},
|
|
60
62
|
updateEmail: () => {
|
|
61
63
|
var _a2;
|
|
62
64
|
if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
|
|
63
65
|
return;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
const newForm = Object.assign(form, { email: emailState.email });
|
|
67
|
+
setForm(newForm);
|
|
66
68
|
(_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
|
|
67
69
|
validateForm();
|
|
68
70
|
},
|
|
@@ -70,7 +72,7 @@ const GCash = w((props, ref) => {
|
|
|
70
72
|
hidePaymentButton && onSubmit();
|
|
71
73
|
}
|
|
72
74
|
}));
|
|
73
|
-
const
|
|
75
|
+
const addressCore = core.getAddressCore();
|
|
74
76
|
const emailState = createEmailCore();
|
|
75
77
|
const addressFieldRef = A(null);
|
|
76
78
|
const emailFieldRef = A(null);
|
|
@@ -81,13 +83,13 @@ const GCash = w((props, ref) => {
|
|
|
81
83
|
const [form, setForm] = h({
|
|
82
84
|
email: "",
|
|
83
85
|
address: {
|
|
84
|
-
country:
|
|
85
|
-
province:
|
|
86
|
-
city:
|
|
87
|
-
area:
|
|
88
|
-
postCode:
|
|
89
|
-
address1:
|
|
90
|
-
address2:
|
|
86
|
+
country: void 0,
|
|
87
|
+
province: void 0,
|
|
88
|
+
city: void 0,
|
|
89
|
+
area: void 0,
|
|
90
|
+
postCode: void 0,
|
|
91
|
+
address1: void 0,
|
|
92
|
+
address2: void 0
|
|
91
93
|
}
|
|
92
94
|
});
|
|
93
95
|
const [validated, setValidated] = h(false);
|
|
@@ -107,17 +109,27 @@ const GCash = w((props, ref) => {
|
|
|
107
109
|
}
|
|
108
110
|
setFieldStatus({ ...field });
|
|
109
111
|
};
|
|
112
|
+
const processOnSuccess = (res) => {
|
|
113
|
+
var _a2, _b;
|
|
114
|
+
setSubmitButtonStatus("success");
|
|
115
|
+
(_b = props.onSuccess) == null ? void 0 : _b.call(props, formatPaymentResult({
|
|
116
|
+
...res,
|
|
117
|
+
returnUrl: (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.returnUrl
|
|
118
|
+
}));
|
|
119
|
+
};
|
|
110
120
|
y(() => {
|
|
111
121
|
if (!sessionReady) {
|
|
112
122
|
return;
|
|
113
123
|
}
|
|
114
|
-
const { bill = {},
|
|
115
|
-
if (!
|
|
124
|
+
const { bill = {}, supportMethods = [], country } = (session == null ? void 0 : session.checkout) || {};
|
|
125
|
+
if (!supportMethods.includes(PaymentMethod.GCASH)) {
|
|
116
126
|
return;
|
|
117
127
|
}
|
|
118
128
|
initFieldStatus();
|
|
119
129
|
setIsCheckoutEnabled(true);
|
|
130
|
+
country && addressCore.setCountry(country);
|
|
120
131
|
form.email = bill.email ?? "";
|
|
132
|
+
form.address.country = country;
|
|
121
133
|
if (autoQuery && core.processingPaymentMethod === PaymentMethod.GCASH) {
|
|
122
134
|
setSubmitButtonStatus("loading");
|
|
123
135
|
startReFetchPayInfo();
|
|
@@ -156,35 +168,51 @@ const GCash = w((props, ref) => {
|
|
|
156
168
|
},
|
|
157
169
|
bill: {
|
|
158
170
|
email: form.email,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
171
|
+
addressLine1: form.address.address1,
|
|
172
|
+
addressLine2: form.address.address2,
|
|
173
|
+
postalCode: form.address.postCode,
|
|
174
|
+
country: form.address.country,
|
|
175
|
+
district: form.address.area,
|
|
176
|
+
state: form.address.province ? addressCore.getLabel(form.address.province, addressCore.getProvinceOption()) ?? form.address.province : void 0,
|
|
177
|
+
city: form.address.city ? addressCore.getLabel(form.address.city, addressCore.getCityOptions()) ?? form.address.city : void 0
|
|
162
178
|
},
|
|
163
179
|
browser: await getBrowserParams()
|
|
164
180
|
};
|
|
165
181
|
};
|
|
166
182
|
const pay = async (search = false, timeout) => {
|
|
167
|
-
var _a2,
|
|
183
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
168
184
|
try {
|
|
169
|
-
const paymentParams = await getPaymentParams();
|
|
170
185
|
const requestOptions = { locale: i18n.locale, timeout };
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
186
|
+
let res = null;
|
|
187
|
+
if (search) {
|
|
188
|
+
const extraParams = (_b = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b.call(_a2, "query", PaymentMethod.GCASH);
|
|
189
|
+
res = await getGcashPayInfo(
|
|
190
|
+
{
|
|
191
|
+
sessionId: session.sessionId,
|
|
192
|
+
clientKey: session.clientKey,
|
|
193
|
+
paymentMethod: PaymentMethod.GCASH
|
|
194
|
+
},
|
|
195
|
+
extraParams,
|
|
196
|
+
requestOptions
|
|
197
|
+
);
|
|
198
|
+
} else {
|
|
199
|
+
const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", PaymentMethod.GCASH);
|
|
200
|
+
res = await gcashPay(await getPaymentParams(), extraParams, requestOptions);
|
|
201
|
+
}
|
|
202
|
+
!search && ((_e = props.onSubmitResponse) == null ? void 0 : _e.call(props, res));
|
|
203
|
+
const { status, orderStatus, errorMessage, errorCode, payInfo = {}, sessionId } = res;
|
|
204
|
+
const { paymentExpiredAt } = payInfo;
|
|
205
|
+
sessionId && (session.sessionId = sessionId);
|
|
177
206
|
if (status === "PROCESSING") {
|
|
178
207
|
if (!orderStatus) {
|
|
179
208
|
setSubmitButtonStatus("unSubmit");
|
|
180
209
|
return { end: true };
|
|
181
210
|
} else if (orderStatus === "SUCCESS") {
|
|
182
211
|
setShowQRCodeModal(false);
|
|
183
|
-
|
|
184
|
-
(_b2 = props.onSuccess) == null ? void 0 : _b2.call(props);
|
|
212
|
+
processOnSuccess(res);
|
|
185
213
|
return { end: true };
|
|
186
214
|
} else if (orderStatus === "FAILURE") {
|
|
187
|
-
setErrorMsg(errorMessage);
|
|
215
|
+
errorMessage && setErrorMsg(errorMessage);
|
|
188
216
|
setSubmitButtonStatus("unSubmit");
|
|
189
217
|
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
190
218
|
return { end: true };
|
|
@@ -209,19 +237,18 @@ const GCash = w((props, ref) => {
|
|
|
209
237
|
return { end: false };
|
|
210
238
|
} else if (orderStatus === "CANCELED") {
|
|
211
239
|
setSubmitButtonStatus("unSubmit");
|
|
212
|
-
(
|
|
240
|
+
(_f = props.onTimeout) == null ? void 0 : _f.call(props);
|
|
213
241
|
core.resetEnablePaymentMethod();
|
|
214
242
|
return { end: true };
|
|
215
243
|
}
|
|
216
244
|
} else if (status === "SUCCESS") {
|
|
217
245
|
setShowQRCodeModal(false);
|
|
218
|
-
|
|
219
|
-
(_d2 = props.onSuccess) == null ? void 0 : _d2.call(props);
|
|
246
|
+
processOnSuccess(res);
|
|
220
247
|
return { end: true };
|
|
221
248
|
} else if (status === "EXPIRED") {
|
|
222
249
|
setShowQRCodeModal(false);
|
|
223
250
|
setSubmitButtonStatus("unSubmit");
|
|
224
|
-
(
|
|
251
|
+
(_g = props.onExpired) == null ? void 0 : _g.call(props);
|
|
225
252
|
return { end: true };
|
|
226
253
|
}
|
|
227
254
|
setSubmitButtonStatus("unSubmit");
|
|
@@ -236,7 +263,7 @@ const GCash = w((props, ref) => {
|
|
|
236
263
|
}
|
|
237
264
|
} else {
|
|
238
265
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
239
|
-
setErrorMsg(message);
|
|
266
|
+
message && setErrorMsg(message);
|
|
240
267
|
processOnError(new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
|
|
241
268
|
setSubmitButtonStatus("unSubmit");
|
|
242
269
|
return { end: true };
|
|
@@ -259,7 +286,7 @@ const GCash = w((props, ref) => {
|
|
|
259
286
|
setErrorMsg("");
|
|
260
287
|
(_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
|
|
261
288
|
var _a3;
|
|
262
|
-
(fieldStatus == null ? void 0 : fieldStatus.address.show) &&
|
|
289
|
+
(fieldStatus == null ? void 0 : fieldStatus.address.show) && addressCore.setValidateAllFields(true);
|
|
263
290
|
(_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
|
|
264
291
|
if (errors) {
|
|
265
292
|
setSubmitButtonStatus("unSubmit");
|
|
@@ -310,24 +337,17 @@ const GCash = w((props, ref) => {
|
|
|
310
337
|
}
|
|
311
338
|
) }) });
|
|
312
339
|
};
|
|
313
|
-
const formStyle = {
|
|
314
|
-
[cssVarPrefix("button-bg-color")]: (_a = session == null ? void 0 : session.colors) == null ? void 0 : _a.primary,
|
|
315
|
-
[cssVarPrefix("button-bg-color-hover")]: (_b = session == null ? void 0 : session.colors) == null ? void 0 : _b.primaryHover,
|
|
316
|
-
[cssVarPrefix("button-bg-color-active")]: (_c = session == null ? void 0 : session.colors) == null ? void 0 : _c.primaryActive,
|
|
317
|
-
[cssVarPrefix("button-text-color")]: (_e = (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.theme) == null ? void 0 : _e.payButtonTextColor,
|
|
318
|
-
[cssVarPrefix("input-color")]: (_f = session == null ? void 0 : session.colors) == null ? void 0 : _f.primary
|
|
319
|
-
};
|
|
320
340
|
const ErrorMessage = () => {
|
|
321
|
-
return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg
|
|
341
|
+
return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg }) });
|
|
322
342
|
};
|
|
323
343
|
const Address = () => {
|
|
324
|
-
var _a2,
|
|
344
|
+
var _a2, _b;
|
|
325
345
|
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
|
|
326
346
|
AddressField,
|
|
327
347
|
{
|
|
328
348
|
ref: addressFieldRef,
|
|
329
349
|
value: form.address,
|
|
330
|
-
country: ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.country) || ((
|
|
350
|
+
country: ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.country) || ((_b = session == null ? void 0 : session.checkout) == null ? void 0 : _b.bill.country),
|
|
331
351
|
onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
332
352
|
}
|
|
333
353
|
) }) });
|
|
@@ -337,24 +357,28 @@ const GCash = w((props, ref) => {
|
|
|
337
357
|
{
|
|
338
358
|
value: {
|
|
339
359
|
i18n,
|
|
340
|
-
session
|
|
360
|
+
session,
|
|
361
|
+
core
|
|
341
362
|
},
|
|
342
|
-
children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(
|
|
363
|
+
children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u("div", { className: core.theme.className, children: [
|
|
343
364
|
showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.GCASH }),
|
|
344
|
-
/* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()),
|
|
365
|
+
/* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
345
366
|
Email(),
|
|
346
367
|
Address(),
|
|
347
|
-
|
|
348
|
-
|
|
368
|
+
/* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
|
|
369
|
+
ErrorMessage(),
|
|
370
|
+
!hidePaymentButton && Button()
|
|
371
|
+
] })
|
|
349
372
|
] }) }),
|
|
350
373
|
showQRCodeModal && /* @__PURE__ */ u(
|
|
351
374
|
QRCodeModal,
|
|
352
375
|
{
|
|
353
376
|
title: i18n.get("qrCode.scanByGcash"),
|
|
354
377
|
bgColor: "#002CB8",
|
|
378
|
+
textColor: "#FFFFFF",
|
|
355
379
|
qrCode: qrCodeInfo.qrCode,
|
|
356
380
|
icon: /* @__PURE__ */ u(IconGcashComplete, { size: 22 }),
|
|
357
|
-
amount: (
|
|
381
|
+
amount: (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount,
|
|
358
382
|
expiredTime: qrCodeInfo.expiredTime,
|
|
359
383
|
onClose: handleCloseQRCodeModal
|
|
360
384
|
}
|