@paykka/card-checkout-ui 0.7.0 → 0.8.0
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/api/modules/checkout/map.js +11 -0
- package/dist/es/components/AliPay/index.js +39 -29
- package/dist/es/components/ApplePay/index.js +14 -7
- package/dist/es/components/Card/index.js +42 -39
- package/dist/es/components/DropIn/index.js +210 -0
- package/dist/es/components/GooglePay/index.js +11 -4
- package/dist/es/components/Sepa/index.js +5 -3
- package/dist/es/components/WechatPay/index.js +26 -17
- package/dist/es/components/index.js +1 -0
- package/dist/es/components/internal/Modal/Modal.js +1 -1
- package/dist/es/components/internal/icons/IconCard.js +42 -0
- package/dist/es/constant.js +10 -0
- package/dist/es/core/PayKKaCheckout.js +10 -0
- package/dist/es/hooks/usePayState.js +3 -1
- package/dist/es/i18n/locales/de-DE.js +3 -0
- package/dist/es/i18n/locales/en-GB.js +3 -0
- package/dist/es/i18n/locales/es-ES.js +3 -0
- package/dist/es/i18n/locales/fr-FR.js +3 -0
- package/dist/es/i18n/locales/ja-JP.js +3 -0
- package/dist/es/i18n/locales/ko-KR.js +3 -0
- package/dist/es/i18n/locales/pt-PT.js +3 -0
- package/dist/es/i18n/locales/ru-RU.js +3 -0
- package/dist/es/i18n/locales/zh-CN.js +3 -0
- package/dist/es/i18n/locales/zh-HK.js +3 -0
- package/dist/es/i18n/locales/zh-TW.js +3 -0
- package/dist/es/i18n/util.js +11 -0
- package/dist/es/index.js +4 -0
- package/dist/es/style.css +103 -7
- package/dist/style.css +1 -1
- package/dist/types/api/modules/checkout/map.d.ts +2 -1
- package/dist/types/api/modules/checkout/type.d.ts +11 -2
- package/dist/types/components/AliPay/AliPay.d.ts +2 -1
- package/dist/types/components/AliPay/type.d.ts +1 -2
- package/dist/types/components/ApplePay/ApplePay.d.ts +2 -1
- package/dist/types/components/ApplePay/type.d.ts +9 -6
- package/dist/types/components/Card/Card.d.ts +2 -1
- package/dist/types/components/Card/type.d.ts +2 -2
- package/dist/types/components/DropIn/DropIn.d.ts +6 -0
- package/dist/types/components/DropIn/components/PaymentTabs/PaymentTabs.d.ts +3 -0
- package/dist/types/components/DropIn/components/PaymentTabs/index.d.ts +2 -0
- package/dist/types/components/DropIn/components/PaymentTabs/type.d.ts +11 -0
- package/dist/types/components/DropIn/index.d.ts +2 -0
- package/dist/types/components/DropIn/type.d.ts +49 -0
- package/dist/types/components/GooglePay/GooglePay.d.ts +2 -1
- package/dist/types/components/GooglePay/type.d.ts +20 -9
- package/dist/types/components/Sepa/Sepa.d.ts +2 -1
- package/dist/types/components/Sepa/type.d.ts +1 -2
- package/dist/types/components/WechatPay/WechatPay.d.ts +2 -1
- package/dist/types/components/WechatPay/type.d.ts +1 -2
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/internal/Modal/index.d.ts +2 -0
- package/dist/types/components/internal/Modal/type.d.ts +1 -1
- package/dist/types/components/internal/icons/IconCard.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +1 -0
- package/dist/types/constant.d.ts +11 -0
- package/dist/types/core/PayKKaCheckout.d.ts +1 -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/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/i18n/util.d.ts +5 -0
- package/dist/types/types/index.d.ts +24 -4
- package/package.json +63 -63
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { w, F, h, q, y, A, u, b } from "../../core.js";
|
|
2
2
|
import { isTimeoutError } from "../../api/http.js";
|
|
3
|
-
import {
|
|
3
|
+
import { SessionMode, PaymentMethod } from "../../constant.js";
|
|
4
4
|
import { getBrowserParams } from "../../api/modules/get-browser-params.js";
|
|
5
5
|
import { getGooglePayInfo, googlePay } from "../../api/modules/google-pay/index.js";
|
|
6
6
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
@@ -176,7 +176,7 @@ const loadGooglePayJS = (onload, onerror) => {
|
|
|
176
176
|
const { bem } = useBEM("google-pay");
|
|
177
177
|
const GooglePay = w((props, ref) => {
|
|
178
178
|
var _a;
|
|
179
|
-
const { session, threeDSFrame } = props;
|
|
179
|
+
const { session, threeDSFrame, isDropIn } = props;
|
|
180
180
|
F(ref, () => ({
|
|
181
181
|
checkThreeDS
|
|
182
182
|
}));
|
|
@@ -198,11 +198,18 @@ const GooglePay = w((props, ref) => {
|
|
|
198
198
|
returnUrl: session == null ? void 0 : session.checkout.returnUrl
|
|
199
199
|
});
|
|
200
200
|
y(() => {
|
|
201
|
-
var _a2;
|
|
201
|
+
var _a2, _b, _c;
|
|
202
202
|
if (!sessionReady) {
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
205
|
const { status, paymentMethod = [], sessionMode } = (session == null ? void 0 : session.checkout) || {};
|
|
206
|
+
if (sessionMode === SessionMode.DROP_IN && !isDropIn) {
|
|
207
|
+
(_b = (_a2 = props.core.config).onInitError) == null ? void 0 : _b.call(
|
|
208
|
+
_a2,
|
|
209
|
+
new PayKKaError("ERROR", "Please send the correct mode when creating the checkout")
|
|
210
|
+
);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
206
213
|
if (!paymentMethod.includes(PaymentMethod.GOOGLE_PAY)) {
|
|
207
214
|
return;
|
|
208
215
|
}
|
|
@@ -220,7 +227,7 @@ const GooglePay = w((props, ref) => {
|
|
|
220
227
|
);
|
|
221
228
|
setHosted(sessionMode === SessionMode.HOSTED);
|
|
222
229
|
if (status === "SUCCESS") {
|
|
223
|
-
(
|
|
230
|
+
(_c = props.onSuccess) == null ? void 0 : _c.call(props, getPaymentSuccessData());
|
|
224
231
|
}
|
|
225
232
|
}, [sessionReady]);
|
|
226
233
|
const processThreeDS = (threeDSUrl, incomplete) => {
|
|
@@ -26,7 +26,7 @@ import { AccountNameField } from "../AccountNameField/index.js";
|
|
|
26
26
|
const { bem } = useBEM("sepa");
|
|
27
27
|
const fieldClassNames = bem("field");
|
|
28
28
|
const Sepa = w((props, ref) => {
|
|
29
|
-
var _a, _b, _c, _d, _e, _f;
|
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
30
30
|
const { session } = props;
|
|
31
31
|
let addressState = createAddressCore();
|
|
32
32
|
let emailState = createEmailCore();
|
|
@@ -91,9 +91,10 @@ const Sepa = w((props, ref) => {
|
|
|
91
91
|
const Button = () => {
|
|
92
92
|
const { transAmount } = (session == null ? void 0 : session.checkout) ?? {};
|
|
93
93
|
let { symbol = "", amount = "", digits } = transAmount ?? {};
|
|
94
|
+
let amountStr = "";
|
|
94
95
|
if (amount && !isUndefined(digits))
|
|
95
|
-
|
|
96
|
-
const text = i18n.get("common.pay") + (Number(amount) ? ` ${symbol}${
|
|
96
|
+
amountStr = formatAmount(+amount, digits);
|
|
97
|
+
const text = i18n.get("common.pay") + (Number(amount) ? ` ${symbol}${amountStr}` : "");
|
|
97
98
|
return /* @__PURE__ */ u(
|
|
98
99
|
SubmitButton,
|
|
99
100
|
{
|
|
@@ -262,6 +263,7 @@ const Sepa = w((props, ref) => {
|
|
|
262
263
|
{
|
|
263
264
|
ref: addressFieldRef,
|
|
264
265
|
value: form.address,
|
|
266
|
+
country: ((_g = session == null ? void 0 : session.checkout) == null ? void 0 : _g.country) || ((_h = session == null ? void 0 : session.checkout) == null ? void 0 : _h.bill.country),
|
|
265
267
|
onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
266
268
|
}
|
|
267
269
|
) }),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { w, A, F, h, y, q, u, b } from "../../core.js";
|
|
2
2
|
import { isTimeoutError } from "../../api/http.js";
|
|
3
|
-
import { PaymentType } from "../../constant.js";
|
|
3
|
+
import { COMMON_CLASS_NAME, PaymentType } from "../../constant.js";
|
|
4
4
|
import { isUndefined } from "../../utils/is.js";
|
|
5
5
|
import "../../utils/card-brand/brands.js";
|
|
6
6
|
import "../../utils/system-info/get-browser-info.js";
|
|
7
|
-
import { formatAmount } from "../../utils/format.js";
|
|
7
|
+
import { cssVarPrefix, normalizedClass, formatAmount } from "../../utils/format.js";
|
|
8
8
|
import { getWechatPayInfo, wechatPay } from "../../api/modules/wechat-pay/index.js";
|
|
9
9
|
import { CoreContext } from "../../core/context.js";
|
|
10
10
|
import { PayKKaError } from "../../core/error.js";
|
|
@@ -23,7 +23,7 @@ import { RecurringTip } from "../RecurringTip/index.js";
|
|
|
23
23
|
import { SubmitButton } from "../SubmitButton/index.js";
|
|
24
24
|
const { bem } = useBEM("wechat-pay");
|
|
25
25
|
const WechatPay = w((props, ref) => {
|
|
26
|
-
var _a;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
27
27
|
const { session } = props;
|
|
28
28
|
let addressState = createAddressCore();
|
|
29
29
|
let emailState = createEmailCore();
|
|
@@ -115,7 +115,7 @@ const WechatPay = w((props, ref) => {
|
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
117
|
async function pay(search = false, timeout) {
|
|
118
|
-
var _a2,
|
|
118
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j;
|
|
119
119
|
try {
|
|
120
120
|
const res = search ? await getWechatPayInfo(
|
|
121
121
|
{
|
|
@@ -143,26 +143,26 @@ const WechatPay = w((props, ref) => {
|
|
|
143
143
|
{ locale: i18n.locale, timeout }
|
|
144
144
|
);
|
|
145
145
|
const { status, orderStatus, errorMessage, payInfo, errorCode } = res;
|
|
146
|
-
!search && ((
|
|
146
|
+
!search && ((_b2 = props.onSubmitResponse) == null ? void 0 : _b2.call(props, res));
|
|
147
147
|
if (status === "PROCESSING") {
|
|
148
148
|
if (!orderStatus) {
|
|
149
149
|
setSubmitButtonStatus("unSubmit");
|
|
150
150
|
} else if (orderStatus === "SUCCESS") {
|
|
151
151
|
setSubmitButtonStatus("success");
|
|
152
|
-
(
|
|
152
|
+
(_c2 = props.onSuccess) == null ? void 0 : _c2.call(props);
|
|
153
153
|
return {
|
|
154
154
|
end: true
|
|
155
155
|
};
|
|
156
156
|
} else if (orderStatus === "FAILURE") {
|
|
157
157
|
setErrorMsg(errorMessage);
|
|
158
158
|
setSubmitButtonStatus("unSubmit");
|
|
159
|
-
(
|
|
159
|
+
(_d2 = props.onError) == null ? void 0 : _d2.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
160
160
|
return {
|
|
161
161
|
end: true
|
|
162
162
|
};
|
|
163
163
|
} else if (orderStatus === "PROCESSING") {
|
|
164
164
|
if (!search) {
|
|
165
|
-
await ((
|
|
165
|
+
await ((_e2 = props.onCallWxPayBox) == null ? void 0 : _e2.call(props, payInfo));
|
|
166
166
|
startReFetchPayInfo();
|
|
167
167
|
}
|
|
168
168
|
return {
|
|
@@ -170,26 +170,26 @@ const WechatPay = w((props, ref) => {
|
|
|
170
170
|
};
|
|
171
171
|
} else if (orderStatus === "CANCELED") {
|
|
172
172
|
setSubmitButtonStatus("unSubmit");
|
|
173
|
-
(
|
|
173
|
+
(_f2 = props.onTimeout) == null ? void 0 : _f2.call(props, "channel");
|
|
174
174
|
return {
|
|
175
175
|
end: true
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
} else if (status === "SUCCESS") {
|
|
179
179
|
setSubmitButtonStatus("success");
|
|
180
|
-
(
|
|
180
|
+
(_g2 = props.onSuccess) == null ? void 0 : _g2.call(props);
|
|
181
181
|
return {
|
|
182
182
|
end: true
|
|
183
183
|
};
|
|
184
184
|
} else if (status === "EXPIRED") {
|
|
185
185
|
setSubmitButtonStatus("unSubmit");
|
|
186
|
-
(
|
|
186
|
+
(_h2 = props.onExpired) == null ? void 0 : _h2.call(props);
|
|
187
187
|
return {
|
|
188
188
|
end: true
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
setSubmitButtonStatus("unSubmit");
|
|
192
|
-
(
|
|
192
|
+
(_i2 = props.onSuccess) == null ? void 0 : _i2.call(props);
|
|
193
193
|
return {
|
|
194
194
|
end: true
|
|
195
195
|
};
|
|
@@ -229,9 +229,10 @@ const WechatPay = w((props, ref) => {
|
|
|
229
229
|
const Button = () => {
|
|
230
230
|
const { transAmount } = (session == null ? void 0 : session.checkout) ?? {};
|
|
231
231
|
let { symbol = "", amount = "", digits } = transAmount ?? {};
|
|
232
|
+
let amountStr = "";
|
|
232
233
|
if (amount && !isUndefined(digits))
|
|
233
|
-
|
|
234
|
-
const text = i18n.get("common.pay") + (Number(amount) ? ` ${symbol}${
|
|
234
|
+
amountStr = formatAmount(+amount, digits);
|
|
235
|
+
const text = i18n.get("common.pay") + (Number(amount) ? ` ${symbol}${amountStr}` : "");
|
|
235
236
|
return /* @__PURE__ */ u(
|
|
236
237
|
SubmitButton,
|
|
237
238
|
{
|
|
@@ -250,6 +251,13 @@ const WechatPay = w((props, ref) => {
|
|
|
250
251
|
formRef.current = dom;
|
|
251
252
|
dom && validateForm();
|
|
252
253
|
};
|
|
254
|
+
const formStyle = {
|
|
255
|
+
[cssVarPrefix("button-bg-color")]: (_a = session == null ? void 0 : session.colors) == null ? void 0 : _a.primary,
|
|
256
|
+
[cssVarPrefix("button-bg-color-hover")]: (_b = session == null ? void 0 : session.colors) == null ? void 0 : _b.primaryHover,
|
|
257
|
+
[cssVarPrefix("button-bg-color-active")]: (_c = session == null ? void 0 : session.colors) == null ? void 0 : _c.primaryActive,
|
|
258
|
+
[cssVarPrefix("button-text-color")]: (_e = (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.theme) == null ? void 0 : _e.payButtonTextColor,
|
|
259
|
+
[cssVarPrefix("input-color")]: (_f = session == null ? void 0 : session.colors) == null ? void 0 : _f.primary
|
|
260
|
+
};
|
|
253
261
|
return /* @__PURE__ */ u(
|
|
254
262
|
CoreContext.Provider,
|
|
255
263
|
{
|
|
@@ -257,7 +265,7 @@ const WechatPay = w((props, ref) => {
|
|
|
257
265
|
i18n,
|
|
258
266
|
session
|
|
259
267
|
},
|
|
260
|
-
children: sessionReady && i18n.ready.value && /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: [
|
|
268
|
+
children: sessionReady && i18n.ready.value && /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: formStyle, children: [
|
|
261
269
|
/* @__PURE__ */ u(
|
|
262
270
|
EmailField,
|
|
263
271
|
{
|
|
@@ -272,13 +280,14 @@ const WechatPay = w((props, ref) => {
|
|
|
272
280
|
{
|
|
273
281
|
ref: addressFieldRef,
|
|
274
282
|
value: form.address,
|
|
283
|
+
country: ((_g = session == null ? void 0 : session.checkout) == null ? void 0 : _g.country) || ((_h = session == null ? void 0 : session.checkout) == null ? void 0 : _h.bill.country),
|
|
275
284
|
onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
276
285
|
}
|
|
277
286
|
),
|
|
278
|
-
((
|
|
287
|
+
((_i = session == null ? void 0 : session.checkout) == null ? void 0 : _i.paymentType) === PaymentType.RECURRING && RecurringTip(),
|
|
279
288
|
!!errorMsg && /* @__PURE__ */ u(Info, { className: bem("error"), content: errorMsg }),
|
|
280
289
|
Button()
|
|
281
|
-
] })
|
|
290
|
+
] }) })
|
|
282
291
|
}
|
|
283
292
|
);
|
|
284
293
|
});
|
|
@@ -6,7 +6,7 @@ import "../../../utils/system-info/get-browser-info.js";
|
|
|
6
6
|
import "./modal2.js";
|
|
7
7
|
const { bem } = useBEM("modal");
|
|
8
8
|
const Modal = w((props) => {
|
|
9
|
-
const { show, width, height, maskClosable, header, children, onChange, style } = props;
|
|
9
|
+
const { show = false, width, height, maskClosable, header, children, onChange, style } = props;
|
|
10
10
|
const [modalWidth, setModalWidth] = h();
|
|
11
11
|
const [modalHeight, setModalHeight] = h();
|
|
12
12
|
const { i18n } = useI18n();
|
|
@@ -0,0 +1,42 @@
|
|
|
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 IconCard = ({ size, style, className }) => {
|
|
8
|
+
const computedSize = !isUndefined(size) ? `${size}px` : "1em";
|
|
9
|
+
return /* @__PURE__ */ u(
|
|
10
|
+
"svg",
|
|
11
|
+
{
|
|
12
|
+
width: computedSize,
|
|
13
|
+
height: computedSize,
|
|
14
|
+
viewBox: "0 0 22 22",
|
|
15
|
+
fill: "none",
|
|
16
|
+
style,
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
className: normalizedClass(COMMON_CLASS_NAME, className),
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ u("g", { "clip-path": "url(#clip0_646_2366)", children: /* @__PURE__ */ u("g", { "clip-path": "url(#clip1_646_2366)", children: [
|
|
21
|
+
/* @__PURE__ */ u(
|
|
22
|
+
"path",
|
|
23
|
+
{
|
|
24
|
+
"fill-rule": "evenodd",
|
|
25
|
+
"clip-rule": "evenodd",
|
|
26
|
+
d: "M1.66667 8.33337C0.746192 8.33337 0 9.07957 0 10L0 11.6667H20V10C20 9.07957 19.2538 8.33337 18.3333 8.33337H1.66667ZM20 14.1667H0L0 20C0 20.9205 0.746192 21.6667 1.66667 21.6667H18.3333C19.2538 21.6667 20 20.9205 20 20V14.1667Z",
|
|
27
|
+
fill: "#1F1F1F"
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ u("rect", { x: "3.33203", y: "16.6667", width: "4.16667", height: "2.5", rx: "0.625", fill: "white" })
|
|
31
|
+
] }) }),
|
|
32
|
+
/* @__PURE__ */ u("defs", { children: [
|
|
33
|
+
/* @__PURE__ */ u("clipPath", { id: "clip0_646_2366", children: /* @__PURE__ */ u("rect", { width: "30", height: "30", rx: "3.2", fill: "white" }) }),
|
|
34
|
+
/* @__PURE__ */ u("clipPath", { id: "clip1_646_2366", children: /* @__PURE__ */ u("rect", { width: "20", height: "13.75", fill: "white", transform: "translate(0 8.125)" }) })
|
|
35
|
+
] })
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
IconCard
|
|
42
|
+
};
|
package/dist/es/constant.js
CHANGED
|
@@ -17,6 +17,15 @@ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
|
17
17
|
PaymentMethod2["SEPA_DEBIT"] = "SEPA_DEBIT";
|
|
18
18
|
return PaymentMethod2;
|
|
19
19
|
})(PaymentMethod || {});
|
|
20
|
+
var PaymentCategory = /* @__PURE__ */ ((PaymentCategory2) => {
|
|
21
|
+
PaymentCategory2["CARD"] = "card";
|
|
22
|
+
PaymentCategory2["APPLE_PAY"] = "applePay";
|
|
23
|
+
PaymentCategory2["GOOGLE_PAY"] = "googlePay";
|
|
24
|
+
PaymentCategory2["SEPA_DEBIT"] = "sepaDebit";
|
|
25
|
+
PaymentCategory2["WECHAT_PAY"] = "wechatPay";
|
|
26
|
+
PaymentCategory2["ALI_PAY"] = "aliPay";
|
|
27
|
+
return PaymentCategory2;
|
|
28
|
+
})(PaymentCategory || {});
|
|
20
29
|
const CardPaymentMethods = [
|
|
21
30
|
"VISA",
|
|
22
31
|
"MASTER_CARD",
|
|
@@ -53,6 +62,7 @@ export {
|
|
|
53
62
|
CardPaymentMethods,
|
|
54
63
|
EAddressType,
|
|
55
64
|
PREFIX,
|
|
65
|
+
PaymentCategory,
|
|
56
66
|
PaymentMethod,
|
|
57
67
|
PaymentType,
|
|
58
68
|
SessionMode
|
|
@@ -89,11 +89,20 @@ class PayKKaCheckout {
|
|
|
89
89
|
get envConfig() {
|
|
90
90
|
return __privateGet(this, _envConfig);
|
|
91
91
|
}
|
|
92
|
+
get config() {
|
|
93
|
+
return __privateGet(this, _config);
|
|
94
|
+
}
|
|
92
95
|
/** 创建组件,把 session 作为组件的 props 传递 */
|
|
93
96
|
create(component, props) {
|
|
94
97
|
var _a;
|
|
98
|
+
const { onSubmit, onSuccess, onError, onTimeout, onExpired } = __privateGet(this, _config);
|
|
95
99
|
const coreProps = this.getCoreProps();
|
|
96
100
|
const componentInst = create(component, {
|
|
101
|
+
onSubmit,
|
|
102
|
+
onSuccess,
|
|
103
|
+
onError,
|
|
104
|
+
onTimeout,
|
|
105
|
+
onExpired,
|
|
97
106
|
...props,
|
|
98
107
|
...coreProps
|
|
99
108
|
});
|
|
@@ -103,6 +112,7 @@ class PayKKaCheckout {
|
|
|
103
112
|
getCoreProps() {
|
|
104
113
|
return {
|
|
105
114
|
session: __privateGet(this, _session),
|
|
115
|
+
core: this,
|
|
106
116
|
threeDSFrame: __privateGet(this, _config).threeDSFrame
|
|
107
117
|
};
|
|
108
118
|
}
|
|
@@ -4,6 +4,7 @@ import { useI18n } from "./useI18n.js";
|
|
|
4
4
|
import { customLocale, fraudDetectionEnv } from "../config.js";
|
|
5
5
|
import "../utils/card-brand/brands.js";
|
|
6
6
|
import { getBrowserInfo } from "../utils/system-info/get-browser-info.js";
|
|
7
|
+
import { getRealLocale } from "../i18n/util.js";
|
|
7
8
|
function usePayState(session) {
|
|
8
9
|
const [validated, setValidated] = h(false);
|
|
9
10
|
const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
|
|
@@ -15,9 +16,10 @@ function usePayState(session) {
|
|
|
15
16
|
session.ready().then(() => {
|
|
16
17
|
var _a;
|
|
17
18
|
setSessionReady(true);
|
|
18
|
-
|
|
19
|
+
const locale = getRealLocale(
|
|
19
20
|
customLocale || ((_a = session.checkout) == null ? void 0 : _a.locale) || getBrowserInfo().language
|
|
20
21
|
);
|
|
22
|
+
i18n.load(locale);
|
|
21
23
|
const fraudDetection2 = getFraudDetectionInstance(fraudDetectionEnv);
|
|
22
24
|
setFraudDetection(fraudDetection2);
|
|
23
25
|
fraudDetection2 == null ? void 0 : fraudDetection2.createFraudDetection();
|
package/dist/es/i18n/util.js
CHANGED
|
@@ -33,6 +33,16 @@ function getTranslation(locale, customLocales) {
|
|
|
33
33
|
}
|
|
34
34
|
return translation;
|
|
35
35
|
}
|
|
36
|
+
const getRealLocale = (locale) => {
|
|
37
|
+
const localeList = Object.values(LocaleKey);
|
|
38
|
+
if (localeList.includes(locale)) {
|
|
39
|
+
return locale;
|
|
40
|
+
} else if (localeList.includes(getBrowserInfo().language)) {
|
|
41
|
+
return getBrowserInfo().language;
|
|
42
|
+
} else {
|
|
43
|
+
return LocaleKey.enGB;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
36
46
|
async function loadTranslation(locale, customLocales) {
|
|
37
47
|
let translation = getTranslation(locale);
|
|
38
48
|
if (!translation && locale !== getBrowserInfo().language) {
|
|
@@ -58,5 +68,6 @@ async function loadTranslation(locale, customLocales) {
|
|
|
58
68
|
};
|
|
59
69
|
}
|
|
60
70
|
export {
|
|
71
|
+
getRealLocale,
|
|
61
72
|
loadTranslation
|
|
62
73
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { Sepa } from "./components/Sepa/index.js";
|
|
|
17
17
|
import { IBANField } from "./components/CardIBANField/index.js";
|
|
18
18
|
import { EEncryptedCardType, ENCRYPTED_CARD_ITEM_ATTR, ENCRYPTED_CARD_WRAPPER_ID, EncryptedCard, PayKKaEncryptedCard } from "./components/EncryptedCard/index.js";
|
|
19
19
|
import { CombinedCardInfo } from "./components/CombinedCardInfo/index.js";
|
|
20
|
+
import { DropIn, PaymentComponentMap, dropInSupportedPaymentMethods } from "./components/DropIn/index.js";
|
|
20
21
|
import "./core/context.js";
|
|
21
22
|
import { create } from "./core/create.js";
|
|
22
23
|
import { Session } from "./core/Session.js";
|
|
@@ -41,6 +42,7 @@ export {
|
|
|
41
42
|
CardSecurityCodeField,
|
|
42
43
|
CardSelector,
|
|
43
44
|
CombinedCardInfo,
|
|
45
|
+
DropIn,
|
|
44
46
|
EEncryptedCardType,
|
|
45
47
|
ENCRYPTED_CARD_ITEM_ATTR,
|
|
46
48
|
ENCRYPTED_CARD_WRAPPER_ID,
|
|
@@ -52,12 +54,14 @@ export {
|
|
|
52
54
|
PayKKaCheckout,
|
|
53
55
|
PayKKaEncryptedCard,
|
|
54
56
|
PayKKaError,
|
|
57
|
+
PaymentComponentMap,
|
|
55
58
|
SecuredIframe,
|
|
56
59
|
Sepa,
|
|
57
60
|
Session,
|
|
58
61
|
SubmitButton,
|
|
59
62
|
WechatPay,
|
|
60
63
|
create,
|
|
64
|
+
dropInSupportedPaymentMethods,
|
|
61
65
|
getFingerprint,
|
|
62
66
|
querySession,
|
|
63
67
|
setApiUrl,
|
package/dist/es/style.css
CHANGED
|
@@ -68,17 +68,13 @@
|
|
|
68
68
|
border-radius: 8px;
|
|
69
69
|
border: 1px solid #E1E1E5;
|
|
70
70
|
transition: border 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
71
|
-
caret-color: var(--paykka-card-checkout-input-color, #4F43DF) .paykka-card-checkout-input__input-wrapper --
|
|
72
|
-
caret-color-border
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.paykka-card-checkout-input__input-wrapper--error {
|
|
76
|
-
border: 1px solid #F53F3F;
|
|
71
|
+
caret-color: var(--paykka-card-checkout-input-color, #4F43DF) .paykka-card-checkout-input__input-wrapper --error;
|
|
72
|
+
caret-color-border: 1px solid #F53F3F;
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
.paykka-card-checkout-input__input-wrapper:active, .paykka-card-checkout-input__input-wrapper--focus, .paykka-card-checkout-input__input-wrapper:focus {
|
|
80
76
|
border: 1px solid var(--paykka-card-checkout-input-color, #4F43DF);
|
|
81
|
-
box-shadow: 0 0 0
|
|
77
|
+
box-shadow: 0 0 0 1px var(--paykka-card-checkout-input-color, #4F43DF);
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
.paykka-card-checkout-input__input-wrapper-disabled {
|
|
@@ -107,6 +103,10 @@
|
|
|
107
103
|
color: #C2C2C2;
|
|
108
104
|
}
|
|
109
105
|
|
|
106
|
+
.paykka-card-checkout-input__input:-webkit-autofill, .paykka-card-checkout-input__input:-internal-autofill-selected {
|
|
107
|
+
background-color: transparent !important;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
110
|
.paykka-card-checkout-input__right-icon {
|
|
111
111
|
padding-right: 12px;
|
|
112
112
|
display: flex;
|
|
@@ -1001,6 +1001,102 @@
|
|
|
1001
1001
|
display: none !important;
|
|
1002
1002
|
}
|
|
1003
1003
|
|
|
1004
|
+
.paykka-card-checkout-payment-tabs {
|
|
1005
|
+
display: flex;
|
|
1006
|
+
flex-wrap: nowrap;
|
|
1007
|
+
justify-content: start;
|
|
1008
|
+
column-gap: 6px;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
.paykka-card-checkout-payment-tabs__tab {
|
|
1012
|
+
border: 2px solid #E1E1E5;
|
|
1013
|
+
padding: 12px;
|
|
1014
|
+
border-radius: 12px;
|
|
1015
|
+
width: calc((100% - 12px) / 3);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
@media (min-width: 480px) {
|
|
1019
|
+
.paykka-card-checkout-payment-tabs__tab {
|
|
1020
|
+
padding: 16px;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
.paykka-card-checkout-payment-tabs__name {
|
|
1025
|
+
color: #626266;
|
|
1026
|
+
}::-webkit-scrollbar {
|
|
1027
|
+
height: 6px;
|
|
1028
|
+
width: 6px;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
::-webkit-scrollbar-thumb {
|
|
1032
|
+
background-color: rgba(0, 0, 0, 0.25);
|
|
1033
|
+
border-radius: 4px;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
::-webkit-scrollbar-button {
|
|
1037
|
+
display: none !important;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
::-moz-scrollbar-button {
|
|
1041
|
+
display: none !important;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
.paykka-card-checkout-drop-in__header-payment {
|
|
1045
|
+
margin-bottom: 10px;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
.paykka-card-checkout-drop-in__other {
|
|
1049
|
+
display: flex;
|
|
1050
|
+
justify-content: center;
|
|
1051
|
+
align-items: center;
|
|
1052
|
+
margin-top: 14px;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
@media (min-width: 480px) {
|
|
1056
|
+
.paykka-card-checkout-drop-in__other {
|
|
1057
|
+
margin-top: 30px;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
.paykka-card-checkout-drop-in__other-text {
|
|
1062
|
+
margin: 0 14px;
|
|
1063
|
+
color: #6E6E7E;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
.paykka-card-checkout-drop-in__other-line {
|
|
1067
|
+
background-color: #DFDFE5;
|
|
1068
|
+
flex-grow: 0.5;
|
|
1069
|
+
height: 1px;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
.paykka-card-checkout-drop-in__tabs-wrapper {
|
|
1073
|
+
margin-top: 16px;
|
|
1074
|
+
margin-bottom: 16px;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
@media (min-width: 480px) {
|
|
1078
|
+
.paykka-card-checkout-drop-in__tabs-wrapper {
|
|
1079
|
+
margin-top: 24px;
|
|
1080
|
+
margin-bottom: 24px;
|
|
1081
|
+
}
|
|
1082
|
+
}::-webkit-scrollbar {
|
|
1083
|
+
height: 6px;
|
|
1084
|
+
width: 6px;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
::-webkit-scrollbar-thumb {
|
|
1088
|
+
background-color: rgba(0, 0, 0, 0.25);
|
|
1089
|
+
border-radius: 4px;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
::-webkit-scrollbar-button {
|
|
1093
|
+
display: none !important;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
::-moz-scrollbar-button {
|
|
1097
|
+
display: none !important;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1004
1100
|
.paykka-card-checkout-sepa {
|
|
1005
1101
|
min-width: 280px;
|
|
1006
1102
|
}
|