@paykka/card-checkout-ui 0.13.1 → 0.13.5
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 -21
- package/dist/card-checkout-ui.umd.cjs +21 -21
- package/dist/es/_commonjsHelpers.js +82 -1
- package/dist/es/api/modules/get-browser-params.js +4 -1
- package/dist/es/api/modules/opay-wallet/index.js +16 -0
- package/dist/es/api/modules/paga-wallet/index.js +16 -0
- package/dist/es/api/modules/pic-pay/index.js +16 -0
- package/dist/es/api/modules/pix/index.js +16 -0
- package/dist/es/api/modules/vietqr/index.js +4 -0
- package/dist/es/components/AliPay/index.js +29 -35
- package/dist/es/components/Boost/index.js +34 -40
- package/dist/es/components/Card/index.js +35 -39
- package/dist/es/components/DropIn/index.js +42 -2
- package/dist/es/components/EncryptedCard/index.js +5 -1
- package/dist/es/components/GooglePay/index.js +1 -0
- package/dist/es/components/GrabPay/index.js +34 -40
- package/dist/es/components/GuideCard/index.js +6 -1
- package/dist/es/components/LinePay/index.js +34 -40
- package/dist/es/components/MayBankQRPay/index.js +35 -41
- package/dist/es/components/NinePay/index.js +34 -40
- package/dist/es/components/SecuredFieldsProvider/index.js +23 -7
- package/dist/es/components/SecuredIframe/index.js +36 -59
- package/dist/es/components/Sepa/index.js +17 -21
- package/dist/es/components/ShopeePay/index.js +34 -40
- package/dist/es/components/TNGWallet/index.js +34 -40
- package/dist/es/components/ThreeDS/index.js +32 -7
- package/dist/es/components/WechatPay/index.js +19 -24
- package/dist/es/components/business/QRCodeModal/QRCodeModal.js +6 -6
- package/dist/es/components/index.js +5 -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/Select/SelectMenu.js +2 -2
- package/dist/es/components/internal/icons/IconError.js +7 -4
- package/dist/es/components/internal/icons/IconOpayWallet.js +71 -0
- package/dist/es/components/internal/icons/IconPagaWallet.js +141 -0
- package/dist/es/components/internal/icons/IconPaymaya.js +42 -86
- package/dist/es/components/internal/icons/IconPicPay.js +49 -0
- package/dist/es/components/internal/icons/IconPix.js +75 -0
- package/dist/es/components/internal/icons/IconVietqr.js +45 -0
- package/dist/es/components/internal/icons/IconVietqrComplete.js +49 -0
- package/dist/es/components/wallets/GCash/GCash.js +20 -25
- package/dist/es/components/wallets/OpayWallet/OpayWallet.js +346 -0
- package/dist/es/components/wallets/OpayWallet/index.js +1 -0
- package/dist/es/components/wallets/OpayWallet/opay-wallet.js +1 -0
- package/dist/es/components/wallets/OpayWallet/type.js +1 -0
- package/dist/es/components/wallets/PagaWallet/PagaWallet.js +346 -0
- package/dist/es/components/wallets/PagaWallet/index.js +1 -0
- package/dist/es/components/wallets/PagaWallet/paga-wallet.js +1 -0
- package/dist/es/components/wallets/PagaWallet/type.js +1 -0
- package/dist/es/components/wallets/Paymaya/Paymaya.js +34 -40
- package/dist/es/components/wallets/PicPay/PicPay.js +346 -0
- package/dist/es/components/wallets/PicPay/index.js +1 -0
- package/dist/es/components/wallets/PicPay/pic-pay.js +1 -0
- package/dist/es/components/wallets/PicPay/type.js +1 -0
- package/dist/es/components/wallets/Pix/Pix.js +346 -0
- package/dist/es/components/wallets/Pix/index.js +1 -0
- package/dist/es/components/wallets/Pix/pix2.js +1 -0
- package/dist/es/components/wallets/Pix/type.js +1 -0
- package/dist/es/components/wallets/Vietqr/Vietqr.js +380 -0
- package/dist/es/components/wallets/Vietqr/index.js +1 -0
- package/dist/es/components/wallets/Vietqr/type.js +1 -0
- package/dist/es/components/wallets/Vietqr/vietqr2.js +1 -0
- package/dist/es/components/wallets/Zalopay/Zalopay.js +17 -21
- package/dist/es/components/wallets/index.js +8 -0
- package/dist/es/constant.js +32 -2
- package/dist/es/core/checkout.js +24 -1
- package/dist/es/core/create.js +1 -1
- package/dist/es/core/session.js +2 -23
- package/dist/es/core/theme.js +65 -0
- package/dist/es/core.js +34 -34
- package/dist/es/i18n/locales/de-DE.js +8 -2
- package/dist/es/i18n/locales/en-GB.js +8 -2
- package/dist/es/i18n/locales/es-ES.js +8 -2
- package/dist/es/i18n/locales/fr-FR.js +8 -2
- package/dist/es/i18n/locales/ja-JP.js +8 -2
- package/dist/es/i18n/locales/ko-KR.js +8 -2
- package/dist/es/i18n/locales/nl-NL.js +8 -2
- package/dist/es/i18n/locales/pt-PT.js +8 -2
- package/dist/es/i18n/locales/ru-RU.js +8 -2
- package/dist/es/i18n/locales/zh-CN.js +10 -4
- package/dist/es/i18n/locales/zh-HK.js +10 -4
- package/dist/es/i18n/locales/zh-TW.js +10 -4
- package/dist/es/index.js +17 -5
- package/dist/es/style.css +1 -1
- package/dist/es/utils/format.js +0 -5
- package/dist/es/utils/object.js +31 -1
- 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/get-browser-params.d.ts +1 -0
- package/dist/types/api/modules/index.d.ts +5 -0
- package/dist/types/api/modules/opay-wallet/index.d.ts +4 -0
- package/dist/types/api/modules/paga-wallet/index.d.ts +4 -0
- package/dist/types/api/modules/pic-pay/index.d.ts +4 -0
- package/dist/types/api/modules/pix/index.d.ts +4 -0
- package/dist/types/api/modules/vietqr/index.d.ts +4 -0
- package/dist/types/components/DropIn/type.d.ts +3 -2
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +5 -0
- package/dist/types/components/SecuredIframe/HiddenIframe.d.ts +3 -1
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +2 -0
- package/dist/types/components/business/QRCodeModal/type.d.ts +2 -0
- package/dist/types/components/index.d.ts +1 -3
- 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/IconOpayWallet.d.ts +2 -0
- package/dist/types/components/internal/icons/IconPagaWallet.d.ts +2 -0
- package/dist/types/components/internal/icons/IconPicPay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconPix.d.ts +2 -0
- package/dist/types/components/internal/icons/IconVietqr.d.ts +2 -0
- package/dist/types/components/internal/icons/IconVietqrComplete.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +6 -0
- package/dist/types/components/wallets/OpayWallet/OpayWallet.d.ts +10 -0
- package/dist/types/components/wallets/OpayWallet/index.d.ts +2 -0
- package/dist/types/components/wallets/OpayWallet/type.d.ts +40 -0
- package/dist/types/components/wallets/PagaWallet/PagaWallet.d.ts +10 -0
- package/dist/types/components/wallets/PagaWallet/index.d.ts +2 -0
- package/dist/types/components/wallets/PagaWallet/type.d.ts +40 -0
- package/dist/types/components/wallets/PicPay/PicPay.d.ts +10 -0
- package/dist/types/components/wallets/PicPay/index.d.ts +2 -0
- package/dist/types/components/wallets/PicPay/type.d.ts +40 -0
- package/dist/types/components/wallets/Pix/Pix.d.ts +10 -0
- package/dist/types/components/wallets/Pix/index.d.ts +2 -0
- package/dist/types/components/wallets/Pix/type.d.ts +40 -0
- package/dist/types/components/wallets/Vietqr/Vietqr.d.ts +10 -0
- package/dist/types/components/wallets/Vietqr/index.d.ts +2 -0
- package/dist/types/components/wallets/Vietqr/type.d.ts +39 -0
- package/dist/types/components/wallets/index.d.ts +8 -0
- package/dist/types/components/wallets/type.d.ts +9 -0
- package/dist/types/constant.d.ts +11 -1
- package/dist/types/core/checkout.d.ts +4 -0
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/session.d.ts +1 -11
- package/dist/types/core/theme.d.ts +7 -0
- package/dist/types/i18n/locales/de-DE.d.ts +6 -0
- package/dist/types/i18n/locales/en-GB.d.ts +6 -0
- package/dist/types/i18n/locales/es-ES.d.ts +6 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +6 -0
- package/dist/types/i18n/locales/ja-JP.d.ts +6 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +6 -0
- package/dist/types/i18n/locales/nl-NL.d.ts +6 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +6 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +6 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +6 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +6 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +6 -0
- package/dist/types/types/message.d.ts +29 -25
- package/dist/types/utils/index.d.ts +3 -2
- package/dist/types/utils/object.d.ts +7 -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 +67 -67
- package/dist/es/utils/deep-freeze.js +0 -13
- package/dist/es/utils/obj.js +0 -22
- package/dist/types/utils/deep-freeze.d.ts +0 -1
- package/dist/types/utils/obj.d.ts +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./Pix.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { w, F, A, h, y, q, u, b } from "../../../core.js";
|
|
2
|
+
import { useBEM } from "../../../hooks/useBEM.js";
|
|
3
|
+
import { CoreContext } from "../../../core/context.js";
|
|
4
|
+
import "../../../utils/card-brand/brands.js";
|
|
5
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
6
|
+
import { isMobile } from "../../../utils/system-info/get-system-info.js";
|
|
7
|
+
import { normalizedClass, formatAmount } from "../../../utils/format.js";
|
|
8
|
+
import { redirectToPayment } from "../../../utils/redirect.js";
|
|
9
|
+
import { processPaymentStatus } from "../../../utils/payment.js";
|
|
10
|
+
import { isTimeoutError } from "../../../api/http.js";
|
|
11
|
+
import { getBrowserParams } from "../../../api/modules/get-browser-params.js";
|
|
12
|
+
import { PaymentCategory, COMMON_CLASS_NAME, PaymentMethod, SessionMode } from "../../../constant.js";
|
|
13
|
+
import { getZalopayPayInfo, zalopayPay } from "../../../api/modules/zalopay/index.js";
|
|
14
|
+
import { PayKKaError } from "../../../core/error.js";
|
|
15
|
+
import { usePayState } from "../../../hooks/usePayState.js";
|
|
16
|
+
import { useRetry } from "../../../hooks/useRetry.js";
|
|
17
|
+
import { usePaymentStatus } from "../../../hooks/usePayment.js";
|
|
18
|
+
import { createEmailCore, EmailField } from "../../EmailField/EmailField.js";
|
|
19
|
+
import { SubmitButton } from "../../SubmitButton/index.js";
|
|
20
|
+
import { GuideCard } from "../../GuideCard/index.js";
|
|
21
|
+
import { AddressField } from "../../AddressField/index.js";
|
|
22
|
+
import { Info } from "../../internal/Info/Info.js";
|
|
23
|
+
import "../../internal/Form/type.js";
|
|
24
|
+
import "../../internal/Form/context.js";
|
|
25
|
+
import "../../internal/Form/FormItem.js";
|
|
26
|
+
import { Form } from "../../internal/Form/Form.js";
|
|
27
|
+
import { QRCodeModal } from "../../business/QRCodeModal/QRCodeModal.js";
|
|
28
|
+
import { IconVietqrComplete } from "../../internal/icons/IconVietqrComplete.js";
|
|
29
|
+
import "./vietqr2.js";
|
|
30
|
+
const { bem } = useBEM("vietqr");
|
|
31
|
+
const fieldClassNames = bem("field");
|
|
32
|
+
const Vietqr = w((props, ref) => {
|
|
33
|
+
var _a;
|
|
34
|
+
const {
|
|
35
|
+
session,
|
|
36
|
+
showEmail = false,
|
|
37
|
+
showAddress = false,
|
|
38
|
+
core,
|
|
39
|
+
redirectMode = "auto",
|
|
40
|
+
autoQuery = true,
|
|
41
|
+
showGuideCard = true,
|
|
42
|
+
enableQRCodeModal = true,
|
|
43
|
+
hidePaymentButton = false
|
|
44
|
+
} = props;
|
|
45
|
+
F(ref, () => ({
|
|
46
|
+
stopRetry: () => {
|
|
47
|
+
setPaymentButtonStatus("unSubmit");
|
|
48
|
+
stopReFetchPayInfo();
|
|
49
|
+
},
|
|
50
|
+
startRetry: (timeout) => {
|
|
51
|
+
setPaymentButtonStatus("loading");
|
|
52
|
+
startReFetchPayInfo({ timeout });
|
|
53
|
+
},
|
|
54
|
+
updateAddress: () => {
|
|
55
|
+
var _a2;
|
|
56
|
+
if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
|
|
57
|
+
return;
|
|
58
|
+
const newForm = Object.assign(form, { address: addressCore.getAddressState() });
|
|
59
|
+
setForm(newForm);
|
|
60
|
+
(_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressCore.getAddressState());
|
|
61
|
+
validateForm();
|
|
62
|
+
},
|
|
63
|
+
updateEmail: () => {
|
|
64
|
+
var _a2;
|
|
65
|
+
if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
|
|
66
|
+
return;
|
|
67
|
+
const newForm = Object.assign(form, { email: emailState.email });
|
|
68
|
+
setForm(newForm);
|
|
69
|
+
(_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
|
|
70
|
+
validateForm();
|
|
71
|
+
},
|
|
72
|
+
payment: () => {
|
|
73
|
+
hidePaymentButton && onSubmit();
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
const addressCore = core.getAddressCore();
|
|
77
|
+
const emailState = createEmailCore();
|
|
78
|
+
const addressFieldRef = A(null);
|
|
79
|
+
const emailFieldRef = A(null);
|
|
80
|
+
const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
|
|
81
|
+
const { i18n, sessionReady } = usePayState(session);
|
|
82
|
+
const { errorMsg, setErrorMsg, paymentButtonStatus, setPaymentButtonStatus } = usePaymentStatus();
|
|
83
|
+
const formRef = A(null);
|
|
84
|
+
const [form, setForm] = h({
|
|
85
|
+
email: "",
|
|
86
|
+
address: {
|
|
87
|
+
country: void 0,
|
|
88
|
+
province: void 0,
|
|
89
|
+
city: void 0,
|
|
90
|
+
area: void 0,
|
|
91
|
+
postCode: void 0,
|
|
92
|
+
address1: void 0,
|
|
93
|
+
address2: void 0
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const [validated, setValidated] = h(false);
|
|
97
|
+
const [fieldStatus, setFieldStatus] = h();
|
|
98
|
+
const [showQRCodeModal, setShowQRCodeModal] = h(false);
|
|
99
|
+
const [qrCodeInfo, setQrCodeInfo] = h();
|
|
100
|
+
const initFieldStatus = () => {
|
|
101
|
+
const { field, sessionMode } = session.checkout;
|
|
102
|
+
const { email, address } = field;
|
|
103
|
+
if (sessionMode === SessionMode.COMPONENT) {
|
|
104
|
+
if (email.disabled) {
|
|
105
|
+
email.show = showEmail;
|
|
106
|
+
}
|
|
107
|
+
if (showAddress && !(address == null ? void 0 : address.show)) {
|
|
108
|
+
address.show = true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
setFieldStatus({ ...field });
|
|
112
|
+
};
|
|
113
|
+
y(() => {
|
|
114
|
+
if (!sessionReady) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const { bill = {}, supportMethods = [], country } = (session == null ? void 0 : session.checkout) || {};
|
|
118
|
+
if (!supportMethods.includes(PaymentMethod.VIETQR)) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
initFieldStatus();
|
|
122
|
+
setIsCheckoutEnabled(true);
|
|
123
|
+
country && addressCore.setCountry(country);
|
|
124
|
+
form.email = bill.email ?? "";
|
|
125
|
+
form.address.country = country;
|
|
126
|
+
if (autoQuery && core.processingPaymentMethod === PaymentMethod.VIETQR) {
|
|
127
|
+
setPaymentButtonStatus("loading");
|
|
128
|
+
startReFetchPayInfo();
|
|
129
|
+
}
|
|
130
|
+
}, [sessionReady]);
|
|
131
|
+
const processOnError = (error) => {
|
|
132
|
+
var _a2;
|
|
133
|
+
setShowQRCodeModal(false);
|
|
134
|
+
(_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
|
|
135
|
+
core.resetEnablePaymentMethod();
|
|
136
|
+
};
|
|
137
|
+
const onTimeout = q(
|
|
138
|
+
(message) => {
|
|
139
|
+
var _a2;
|
|
140
|
+
setShowQRCodeModal(false);
|
|
141
|
+
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
142
|
+
setPaymentButtonStatus("unSubmit");
|
|
143
|
+
(_a2 = props.onTimeout) == null ? void 0 : _a2.call(props, "retry");
|
|
144
|
+
core.resetEnablePaymentMethod();
|
|
145
|
+
},
|
|
146
|
+
[i18n, props.onTimeout]
|
|
147
|
+
);
|
|
148
|
+
const { start: startReFetchPayInfo, stop: stopReFetchPayInfo } = useRetry(
|
|
149
|
+
(timeout) => pay(true, timeout),
|
|
150
|
+
{
|
|
151
|
+
timeout: 10 * 60 * 1e3,
|
|
152
|
+
onTimeout: () => onTimeout(i18n.get("common.queryTimeout"))
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
const getPaymentParams = async () => {
|
|
156
|
+
return {
|
|
157
|
+
sessionId: session.sessionId,
|
|
158
|
+
clientKey: session.clientKey,
|
|
159
|
+
payment: {
|
|
160
|
+
paymentMethod: PaymentMethod.VIETQR
|
|
161
|
+
},
|
|
162
|
+
bill: {
|
|
163
|
+
email: form.email,
|
|
164
|
+
addressLine1: form.address.address1,
|
|
165
|
+
addressLine2: form.address.address2,
|
|
166
|
+
postalCode: form.address.postCode,
|
|
167
|
+
country: form.address.country,
|
|
168
|
+
district: form.address.area,
|
|
169
|
+
state: form.address.province ? addressCore.getLabel(form.address.province, addressCore.getProvinceOption()) ?? form.address.province : void 0,
|
|
170
|
+
city: form.address.city ? addressCore.getLabel(form.address.city, addressCore.getCityOptions()) ?? form.address.city : void 0
|
|
171
|
+
},
|
|
172
|
+
browser: await getBrowserParams()
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
const pay = async (search = false, timeout) => {
|
|
176
|
+
var _a2, _b, _c, _d, _e;
|
|
177
|
+
try {
|
|
178
|
+
const requestOptions = { locale: i18n.locale, timeout };
|
|
179
|
+
let res = null;
|
|
180
|
+
if (search) {
|
|
181
|
+
const extraParams = (_b = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b.call(_a2, "query", PaymentMethod.VIETQR);
|
|
182
|
+
res = await getZalopayPayInfo(
|
|
183
|
+
{
|
|
184
|
+
sessionId: session.sessionId,
|
|
185
|
+
clientKey: session.clientKey,
|
|
186
|
+
paymentMethod: PaymentMethod.VIETQR
|
|
187
|
+
},
|
|
188
|
+
extraParams,
|
|
189
|
+
requestOptions
|
|
190
|
+
);
|
|
191
|
+
} else {
|
|
192
|
+
const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", PaymentMethod.VIETQR);
|
|
193
|
+
res = await zalopayPay(await getPaymentParams(), extraParams, requestOptions);
|
|
194
|
+
}
|
|
195
|
+
!search && ((_e = props.onSubmitResponse) == null ? void 0 : _e.call(props, res));
|
|
196
|
+
const { errorMessage, errorCode, payInfo = {}, sessionId } = res;
|
|
197
|
+
sessionId && (session.sessionId = sessionId);
|
|
198
|
+
const { paymentExpiredAt } = payInfo;
|
|
199
|
+
let end = true;
|
|
200
|
+
processPaymentStatus(res, {
|
|
201
|
+
onProcessing: () => {
|
|
202
|
+
if (!search && payInfo) {
|
|
203
|
+
if (isMobile()) {
|
|
204
|
+
if (redirectMode === "auto") {
|
|
205
|
+
redirectToPayment(payInfo);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
if (enableQRCodeModal) {
|
|
210
|
+
setShowQRCodeModal(true);
|
|
211
|
+
setQrCodeInfo({
|
|
212
|
+
qrCode: payInfo.qr_code || payInfo.request_url,
|
|
213
|
+
expiredTime: paymentExpiredAt
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
startReFetchPayInfo();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
end = false;
|
|
220
|
+
},
|
|
221
|
+
onSuccess: () => {
|
|
222
|
+
var _a3;
|
|
223
|
+
setShowQRCodeModal(false);
|
|
224
|
+
setPaymentButtonStatus("success");
|
|
225
|
+
(_a3 = props.onSuccess) == null ? void 0 : _a3.call(props, res);
|
|
226
|
+
},
|
|
227
|
+
onFailure: () => {
|
|
228
|
+
errorMessage && setErrorMsg(errorMessage);
|
|
229
|
+
setPaymentButtonStatus("unSubmit");
|
|
230
|
+
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
231
|
+
},
|
|
232
|
+
onCanceled: () => {
|
|
233
|
+
var _a3;
|
|
234
|
+
core.resetEnablePaymentMethod();
|
|
235
|
+
setPaymentButtonStatus("unSubmit");
|
|
236
|
+
(_a3 = props.onTimeout) == null ? void 0 : _a3.call(props, "channel");
|
|
237
|
+
},
|
|
238
|
+
onExpired: () => {
|
|
239
|
+
var _a3;
|
|
240
|
+
setShowQRCodeModal(false);
|
|
241
|
+
setPaymentButtonStatus("unSubmit");
|
|
242
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props);
|
|
243
|
+
},
|
|
244
|
+
onDefault: () => {
|
|
245
|
+
setPaymentButtonStatus("unSubmit");
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
return { end };
|
|
249
|
+
} catch (error) {
|
|
250
|
+
if (isTimeoutError(error)) {
|
|
251
|
+
if (search) {
|
|
252
|
+
return { end: false };
|
|
253
|
+
} else {
|
|
254
|
+
onTimeout();
|
|
255
|
+
return { end: true };
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
259
|
+
message && setErrorMsg(message);
|
|
260
|
+
processOnError(new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
|
|
261
|
+
setPaymentButtonStatus("unSubmit");
|
|
262
|
+
return { end: true };
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
const validateForm = () => {
|
|
267
|
+
var _a2;
|
|
268
|
+
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => {
|
|
269
|
+
setValidated(true);
|
|
270
|
+
}).catch(() => {
|
|
271
|
+
setValidated(false);
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
y(() => {
|
|
275
|
+
validateForm();
|
|
276
|
+
}, [form]);
|
|
277
|
+
const onSubmit = async () => {
|
|
278
|
+
var _a2;
|
|
279
|
+
setErrorMsg("");
|
|
280
|
+
(_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
|
|
281
|
+
var _a3;
|
|
282
|
+
(fieldStatus == null ? void 0 : fieldStatus.address.show) && addressCore.setValidateAllFields(true);
|
|
283
|
+
(_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
|
|
284
|
+
if (errors) {
|
|
285
|
+
setPaymentButtonStatus("unSubmit");
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
setErrorMsg("");
|
|
289
|
+
setPaymentButtonStatus("loading");
|
|
290
|
+
await pay();
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
const handleCloseQRCodeModal = () => {
|
|
294
|
+
var _a2;
|
|
295
|
+
setPaymentButtonStatus("unSubmit");
|
|
296
|
+
stopReFetchPayInfo();
|
|
297
|
+
setShowQRCodeModal(false);
|
|
298
|
+
setQrCodeInfo(void 0);
|
|
299
|
+
(_a2 = props.onCloseModal) == null ? void 0 : _a2.call(props);
|
|
300
|
+
};
|
|
301
|
+
const setFormRef = (dom) => {
|
|
302
|
+
formRef.current = dom;
|
|
303
|
+
dom && validateForm();
|
|
304
|
+
};
|
|
305
|
+
const PaymentButton = () => {
|
|
306
|
+
var _a2;
|
|
307
|
+
const transAmount = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.transAmount;
|
|
308
|
+
const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
|
|
309
|
+
const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
|
|
310
|
+
return /* @__PURE__ */ u(
|
|
311
|
+
SubmitButton,
|
|
312
|
+
{
|
|
313
|
+
className: bem("button"),
|
|
314
|
+
status: paymentButtonStatus,
|
|
315
|
+
text,
|
|
316
|
+
onClick: onSubmit,
|
|
317
|
+
verified: validated
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
};
|
|
321
|
+
const Email = () => {
|
|
322
|
+
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.email.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
|
|
323
|
+
EmailField,
|
|
324
|
+
{
|
|
325
|
+
ref: emailFieldRef,
|
|
326
|
+
value: form.email,
|
|
327
|
+
disabled: fieldStatus == null ? void 0 : fieldStatus.email.disabled
|
|
328
|
+
}
|
|
329
|
+
) }) });
|
|
330
|
+
};
|
|
331
|
+
const ErrorMessage = () => {
|
|
332
|
+
return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }) });
|
|
333
|
+
};
|
|
334
|
+
const Address = () => {
|
|
335
|
+
var _a2, _b;
|
|
336
|
+
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
|
|
337
|
+
AddressField,
|
|
338
|
+
{
|
|
339
|
+
ref: addressFieldRef,
|
|
340
|
+
value: form.address,
|
|
341
|
+
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),
|
|
342
|
+
onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
343
|
+
}
|
|
344
|
+
) }) });
|
|
345
|
+
};
|
|
346
|
+
return /* @__PURE__ */ u(
|
|
347
|
+
CoreContext.Provider,
|
|
348
|
+
{
|
|
349
|
+
value: {
|
|
350
|
+
i18n,
|
|
351
|
+
session,
|
|
352
|
+
core
|
|
353
|
+
},
|
|
354
|
+
children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
|
|
355
|
+
showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.VIETQR }),
|
|
356
|
+
/* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
357
|
+
Email(),
|
|
358
|
+
Address(),
|
|
359
|
+
ErrorMessage(),
|
|
360
|
+
!hidePaymentButton && PaymentButton()
|
|
361
|
+
] }) }),
|
|
362
|
+
showQRCodeModal && /* @__PURE__ */ u(
|
|
363
|
+
QRCodeModal,
|
|
364
|
+
{
|
|
365
|
+
title: i18n.get("qrCode.scanByVietqr"),
|
|
366
|
+
qrCode: qrCodeInfo.qrCode,
|
|
367
|
+
icon: /* @__PURE__ */ u(IconVietqrComplete, { size: 22 }),
|
|
368
|
+
amount: (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount,
|
|
369
|
+
expiredTime: qrCodeInfo.expiredTime,
|
|
370
|
+
borderColor: "#DC2626",
|
|
371
|
+
onClose: handleCloseQRCodeModal
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
] })
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
});
|
|
378
|
+
export {
|
|
379
|
+
Vietqr
|
|
380
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./Vietqr.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -4,7 +4,7 @@ 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
9
|
import { processPaymentStatus } from "../../../utils/payment.js";
|
|
10
10
|
import { isTimeoutError } from "../../../api/http.js";
|
|
@@ -30,7 +30,7 @@ import "./zalopay2.js";
|
|
|
30
30
|
const { bem } = useBEM("zalopay");
|
|
31
31
|
const fieldClassNames = bem("field");
|
|
32
32
|
const Zalopay = w((props, ref) => {
|
|
33
|
-
var _a
|
|
33
|
+
var _a;
|
|
34
34
|
const {
|
|
35
35
|
session,
|
|
36
36
|
showEmail = false,
|
|
@@ -173,12 +173,12 @@ const Zalopay = w((props, ref) => {
|
|
|
173
173
|
};
|
|
174
174
|
};
|
|
175
175
|
const pay = async (search = false, timeout) => {
|
|
176
|
-
var _a2,
|
|
176
|
+
var _a2, _b, _c, _d, _e;
|
|
177
177
|
try {
|
|
178
178
|
const requestOptions = { locale: i18n.locale, timeout };
|
|
179
179
|
let res = null;
|
|
180
180
|
if (search) {
|
|
181
|
-
const extraParams = (
|
|
181
|
+
const extraParams = (_b = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b.call(_a2, "query", PaymentMethod.ZALOPAY);
|
|
182
182
|
res = await getZalopayPayInfo(
|
|
183
183
|
{
|
|
184
184
|
sessionId: session.sessionId,
|
|
@@ -189,10 +189,10 @@ const Zalopay = w((props, ref) => {
|
|
|
189
189
|
requestOptions
|
|
190
190
|
);
|
|
191
191
|
} else {
|
|
192
|
-
const extraParams = (
|
|
192
|
+
const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", PaymentMethod.ZALOPAY);
|
|
193
193
|
res = await zalopayPay(await getPaymentParams(), extraParams, requestOptions);
|
|
194
194
|
}
|
|
195
|
-
!search && ((
|
|
195
|
+
!search && ((_e = props.onSubmitResponse) == null ? void 0 : _e.call(props, res));
|
|
196
196
|
const { errorMessage, errorCode, payInfo = {}, sessionId } = res;
|
|
197
197
|
sessionId && (session.sessionId = sessionId);
|
|
198
198
|
const { paymentExpiredAt } = payInfo;
|
|
@@ -328,24 +328,17 @@ const Zalopay = w((props, ref) => {
|
|
|
328
328
|
}
|
|
329
329
|
) }) });
|
|
330
330
|
};
|
|
331
|
-
const formStyle = {
|
|
332
|
-
[cssVarPrefix("button-bg-color")]: (_a = session == null ? void 0 : session.colors) == null ? void 0 : _a.primary,
|
|
333
|
-
[cssVarPrefix("button-bg-color-hover")]: (_b = session == null ? void 0 : session.colors) == null ? void 0 : _b.primaryHover,
|
|
334
|
-
[cssVarPrefix("button-bg-color-active")]: (_c = session == null ? void 0 : session.colors) == null ? void 0 : _c.primaryActive,
|
|
335
|
-
[cssVarPrefix("button-text-color")]: (_e = (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.theme) == null ? void 0 : _e.payButtonTextColor,
|
|
336
|
-
[cssVarPrefix("input-color")]: (_f = session == null ? void 0 : session.colors) == null ? void 0 : _f.primary
|
|
337
|
-
};
|
|
338
331
|
const ErrorMessage = () => {
|
|
339
|
-
return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg
|
|
332
|
+
return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg }) });
|
|
340
333
|
};
|
|
341
334
|
const Address = () => {
|
|
342
|
-
var _a2,
|
|
335
|
+
var _a2, _b;
|
|
343
336
|
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
|
|
344
337
|
AddressField,
|
|
345
338
|
{
|
|
346
339
|
ref: addressFieldRef,
|
|
347
340
|
value: form.address,
|
|
348
|
-
country: ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.country) || ((
|
|
341
|
+
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),
|
|
349
342
|
onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
350
343
|
}
|
|
351
344
|
) }) });
|
|
@@ -358,13 +351,15 @@ const Zalopay = w((props, ref) => {
|
|
|
358
351
|
session,
|
|
359
352
|
core
|
|
360
353
|
},
|
|
361
|
-
children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(
|
|
354
|
+
children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u("div", { className: core.theme.className, children: [
|
|
362
355
|
showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.ZALOPAY }),
|
|
363
|
-
/* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()),
|
|
356
|
+
/* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
364
357
|
Email(),
|
|
365
358
|
Address(),
|
|
366
|
-
|
|
367
|
-
|
|
359
|
+
/* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
|
|
360
|
+
ErrorMessage(),
|
|
361
|
+
!hidePaymentButton && PaymentButton()
|
|
362
|
+
] })
|
|
368
363
|
] }) }),
|
|
369
364
|
showQRCodeModal && /* @__PURE__ */ u(
|
|
370
365
|
QRCodeModal,
|
|
@@ -372,8 +367,9 @@ const Zalopay = w((props, ref) => {
|
|
|
372
367
|
title: i18n.get("qrCode.scanByZalopay"),
|
|
373
368
|
qrCode: qrCodeInfo.qrCode,
|
|
374
369
|
icon: /* @__PURE__ */ u(IconZalopayComplete, { size: 22 }),
|
|
375
|
-
amount: (
|
|
370
|
+
amount: (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount,
|
|
376
371
|
expiredTime: qrCodeInfo.expiredTime,
|
|
372
|
+
borderColor: "#00CF6A",
|
|
377
373
|
onClose: handleCloseQRCodeModal
|
|
378
374
|
}
|
|
379
375
|
)
|
package/dist/es/constant.js
CHANGED
|
@@ -25,6 +25,11 @@ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
|
25
25
|
PaymentMethod2["GCASH"] = "G_CASH";
|
|
26
26
|
PaymentMethod2["PAYMAYA"] = "PAYMAYA";
|
|
27
27
|
PaymentMethod2["ZALOPAY"] = "ZALOPAY";
|
|
28
|
+
PaymentMethod2["VIETQR"] = "VIETQR";
|
|
29
|
+
PaymentMethod2["PIX"] = "PIX";
|
|
30
|
+
PaymentMethod2["PIC_PAY"] = "PIC_PAY";
|
|
31
|
+
PaymentMethod2["OPAY_WALLET"] = "OPAY_WALLET";
|
|
32
|
+
PaymentMethod2["PAGA_WALLET"] = "PAGA_WALLET";
|
|
28
33
|
PaymentMethod2["SEPA_DEBIT"] = "SEPA_DEBIT";
|
|
29
34
|
return PaymentMethod2;
|
|
30
35
|
})(PaymentMethod || {});
|
|
@@ -44,7 +49,12 @@ var PaymentCategory = /* @__PURE__ */ ((PaymentCategory2) => {
|
|
|
44
49
|
PaymentCategory2["NINE_PAY"] = "ninePay";
|
|
45
50
|
PaymentCategory2["GCASH"] = "gcash";
|
|
46
51
|
PaymentCategory2["PAYMAYA"] = "paymaya";
|
|
52
|
+
PaymentCategory2["VIETQR"] = "vietqr";
|
|
47
53
|
PaymentCategory2["ZALOPAY"] = "zalopay";
|
|
54
|
+
PaymentCategory2["PIX"] = "pix";
|
|
55
|
+
PaymentCategory2["PIC_PAY"] = "picPay";
|
|
56
|
+
PaymentCategory2["OPAY_WALLET"] = "opayWallet";
|
|
57
|
+
PaymentCategory2["PAGA_WALLET"] = "pagaWallet";
|
|
48
58
|
return PaymentCategory2;
|
|
49
59
|
})(PaymentCategory || {});
|
|
50
60
|
const PaymentMethod2CategoryMap = {
|
|
@@ -107,8 +117,28 @@ const PaymentMethod2CategoryMap = {
|
|
|
107
117
|
[
|
|
108
118
|
"ZALOPAY"
|
|
109
119
|
/* ZALOPAY */
|
|
110
|
-
]: "zalopay"
|
|
111
|
-
|
|
120
|
+
]: "zalopay",
|
|
121
|
+
[
|
|
122
|
+
"VIETQR"
|
|
123
|
+
/* VIETQR */
|
|
124
|
+
]: "vietqr",
|
|
125
|
+
[
|
|
126
|
+
"PIX"
|
|
127
|
+
/* PIX */
|
|
128
|
+
]: "pix",
|
|
129
|
+
[
|
|
130
|
+
"PIC_PAY"
|
|
131
|
+
/* PIC_PAY */
|
|
132
|
+
]: "picPay",
|
|
133
|
+
[
|
|
134
|
+
"OPAY_WALLET"
|
|
135
|
+
/* OPAY_WALLET */
|
|
136
|
+
]: "opayWallet",
|
|
137
|
+
[
|
|
138
|
+
"PAGA_WALLET"
|
|
139
|
+
/* PAGA_WALLET */
|
|
140
|
+
]: "pagaWallet"
|
|
141
|
+
/* PAGA_WALLET */
|
|
112
142
|
};
|
|
113
143
|
const CardPaymentMethods = [
|
|
114
144
|
"VISA",
|
package/dist/es/core/checkout.js
CHANGED
|
@@ -26,7 +26,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
26
26
|
__accessCheck(obj, member, "access private method");
|
|
27
27
|
return method;
|
|
28
28
|
};
|
|
29
|
-
var _config, _envConfig, _session, _componentInsts, _addressCore, _initPromise, _doInit, doInit_fn;
|
|
29
|
+
var _id, _config, _envConfig, _session, _theme, _componentInsts, _addressCore, _initPromise, _doInit, doInit_fn;
|
|
30
30
|
import { create } from "./create.js";
|
|
31
31
|
import { Session } from "./session.js";
|
|
32
32
|
import { setApiPrefix, setApiUrl, setCDNUrl, setFraudDetectionEnv, setCustomLocale } from "../config.js";
|
|
@@ -38,8 +38,10 @@ import "../utils/card-brand/brands.js";
|
|
|
38
38
|
import "../utils/system-info/get-browser-info.js";
|
|
39
39
|
import { getUrlParam } from "../utils/location.js";
|
|
40
40
|
import { deepMerge } from "../utils/object.js";
|
|
41
|
+
import { genShortId } from "../utils/string.js";
|
|
41
42
|
import { d } from "../core.js";
|
|
42
43
|
import { AddressCore } from "./address.js";
|
|
44
|
+
import { PayKKaTheme } from "./theme.js";
|
|
43
45
|
const PROCESSING_PARAM_NAME = "m";
|
|
44
46
|
const DEFAULT_CHECKOUT_CONFIG = {
|
|
45
47
|
enableInitValidation: true,
|
|
@@ -49,9 +51,15 @@ const DEFAULT_CHECKOUT_CONFIG = {
|
|
|
49
51
|
class PayKKaCheckout {
|
|
50
52
|
constructor(config) {
|
|
51
53
|
__privateAdd(this, _doInit);
|
|
54
|
+
/**
|
|
55
|
+
* 收银台实例 ID
|
|
56
|
+
* 用于标识收银台实例,防止主题样式、iframe 通信数据等在不同收银台之间相互影响
|
|
57
|
+
*/
|
|
58
|
+
__privateAdd(this, _id, void 0);
|
|
52
59
|
__privateAdd(this, _config, void 0);
|
|
53
60
|
__privateAdd(this, _envConfig, void 0);
|
|
54
61
|
__privateAdd(this, _session, void 0);
|
|
62
|
+
__privateAdd(this, _theme, void 0);
|
|
55
63
|
__privateAdd(this, _componentInsts, []);
|
|
56
64
|
/**
|
|
57
65
|
* 地址处理
|
|
@@ -68,6 +76,7 @@ class PayKKaCheckout {
|
|
|
68
76
|
* 在 DropIn 且有正在处理的支付方式时,会设置为当前支付方式,并把其他支付方式设为禁用
|
|
69
77
|
*/
|
|
70
78
|
__publicField(this, "enablePaymentMethod", d(null));
|
|
79
|
+
__privateSet(this, _id, genShortId(6));
|
|
71
80
|
__privateSet(this, _config, config);
|
|
72
81
|
this.init();
|
|
73
82
|
}
|
|
@@ -138,6 +147,11 @@ class PayKKaCheckout {
|
|
|
138
147
|
const { locale } = __privateGet(this, _config);
|
|
139
148
|
locale && setCustomLocale(locale);
|
|
140
149
|
}
|
|
150
|
+
initTheme() {
|
|
151
|
+
var _a;
|
|
152
|
+
__privateSet(this, _theme, new PayKKaTheme(__privateGet(this, _id)));
|
|
153
|
+
__privateGet(this, _theme).init((_a = __privateGet(this, _session).checkout) == null ? void 0 : _a.theme);
|
|
154
|
+
}
|
|
141
155
|
initOtherData() {
|
|
142
156
|
const res = getUrlParam(PROCESSING_PARAM_NAME);
|
|
143
157
|
if (res) {
|
|
@@ -147,12 +161,18 @@ class PayKKaCheckout {
|
|
|
147
161
|
get session() {
|
|
148
162
|
return __privateGet(this, _session);
|
|
149
163
|
}
|
|
164
|
+
get theme() {
|
|
165
|
+
return __privateGet(this, _theme);
|
|
166
|
+
}
|
|
150
167
|
get envConfig() {
|
|
151
168
|
return __privateGet(this, _envConfig);
|
|
152
169
|
}
|
|
153
170
|
get config() {
|
|
154
171
|
return __privateGet(this, _config);
|
|
155
172
|
}
|
|
173
|
+
get id() {
|
|
174
|
+
return __privateGet(this, _id);
|
|
175
|
+
}
|
|
156
176
|
/** 创建组件,把 session 作为组件的 props 传递 */
|
|
157
177
|
create(component, props) {
|
|
158
178
|
var _a;
|
|
@@ -188,9 +208,11 @@ class PayKKaCheckout {
|
|
|
188
208
|
return __privateGet(this, _addressCore);
|
|
189
209
|
}
|
|
190
210
|
}
|
|
211
|
+
_id = new WeakMap();
|
|
191
212
|
_config = new WeakMap();
|
|
192
213
|
_envConfig = new WeakMap();
|
|
193
214
|
_session = new WeakMap();
|
|
215
|
+
_theme = new WeakMap();
|
|
194
216
|
_componentInsts = new WeakMap();
|
|
195
217
|
_addressCore = new WeakMap();
|
|
196
218
|
_initPromise = new WeakMap();
|
|
@@ -200,6 +222,7 @@ doInit_fn = async function() {
|
|
|
200
222
|
this.initEnv();
|
|
201
223
|
this.initLocale();
|
|
202
224
|
await this.initSession();
|
|
225
|
+
this.initTheme();
|
|
203
226
|
this.initOtherData();
|
|
204
227
|
};
|
|
205
228
|
export {
|
package/dist/es/core/create.js
CHANGED
|
@@ -2,7 +2,7 @@ import { _, B } from "../core.js";
|
|
|
2
2
|
import { isString } from "../utils/is.js";
|
|
3
3
|
import "../utils/card-brand/brands.js";
|
|
4
4
|
import "../utils/system-info/get-browser-info.js";
|
|
5
|
-
import { deepFreeze } from "../utils/
|
|
5
|
+
import { deepFreeze } from "../utils/object.js";
|
|
6
6
|
const internalInstMap = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
const setInternalInst = (inst, internalInst) => {
|
|
8
8
|
const _internalInst = Object.assign(
|