@paykka/card-checkout-ui 0.5.17 → 0.7.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 +22 -0
- package/dist/card-checkout-ui.umd.cjs +19 -5
- package/dist/es/api/index.js +0 -2
- package/dist/es/api/modules/checkout/index.js +1 -15
- package/dist/es/api/modules/checkout/map.js +22 -4
- package/dist/es/api/modules/encrypted-card/index.js +54 -0
- package/dist/es/api/modules/get-browser-params.js +2 -2
- package/dist/es/api/modules/index.js +0 -2
- package/dist/es/components/AccountNameField/index.js +2 -3
- package/dist/es/components/AddressField/index.js +4 -7
- package/dist/es/components/AliPay/index.js +13 -12
- package/dist/es/components/ApplePay/index.js +75 -19
- package/dist/es/components/Card/index.js +335 -143
- package/dist/es/components/CardBrands/index.js +0 -2
- package/dist/es/components/CardExpireDateField/index.js +6 -6
- package/dist/es/components/CardHolderNameField/index.js +5 -5
- package/dist/es/components/CardIBANField/index.js +2 -3
- package/dist/es/components/CardNo/index.js +0 -2
- package/dist/es/components/CardNumberField/index.js +32 -20
- package/dist/es/components/CardSecurityCodeField/index.js +6 -6
- package/dist/es/components/CardSelector/index.js +1 -3
- package/dist/es/components/CombinedCardInfo/index.js +99 -0
- package/dist/es/components/EmailField/EmailField.js +2 -3
- package/dist/es/components/EncryptedCard/index.js +408 -0
- package/dist/es/components/GooglePay/index.js +108 -36
- package/dist/es/components/RecurringTip/index.js +0 -2
- package/dist/es/components/SecuredFieldsProvider/index.js +230 -1
- package/dist/es/components/SecuredIframe/index.js +192 -22
- package/dist/es/components/Sepa/index.js +36 -32
- package/dist/es/components/SubmitButton/index.js +0 -2
- package/dist/es/components/ThreeDS/index.js +94 -0
- package/dist/es/components/WechatPay/index.js +31 -30
- package/dist/es/components/index.js +4 -2
- package/dist/es/components/internal/Button/Button.js +0 -2
- package/dist/es/components/internal/Button/index.js +0 -2
- package/dist/es/components/internal/CheckBox/CheckBox.js +0 -2
- package/dist/es/components/internal/CheckBox/index.js +0 -2
- package/dist/es/components/internal/Form/FormItem.js +28 -24
- package/dist/es/components/internal/Form/index.js +1 -0
- package/dist/es/components/internal/Form/type.js +13 -1
- package/dist/es/components/internal/Info/Info.js +0 -2
- package/dist/es/components/internal/Info/index.js +0 -2
- package/dist/es/components/internal/Input/Input.js +11 -13
- package/dist/es/components/internal/Input/index.js +1 -0
- package/dist/es/components/internal/Input/type.js +11 -1
- package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +0 -2
- package/dist/es/components/internal/LoadingCheck/index.js +0 -2
- package/dist/es/components/internal/Modal/Modal.js +40 -0
- package/dist/es/components/internal/Modal/modal2.js +1 -0
- package/dist/es/components/internal/Select/Select.js +2 -2
- package/dist/es/components/internal/Select/SelectMenu.js +0 -2
- package/dist/es/components/internal/Select/SelectMenuItem.js +0 -2
- package/dist/es/components/internal/icons/Icon3DSFail.js +3 -0
- package/dist/es/components/internal/icons/Icon3DSInfo.js +62 -0
- package/dist/es/components/internal/icons/Icon3DSSuccess.js +3 -0
- package/dist/es/config.js +12 -8
- package/dist/es/constant.js +13 -2
- package/dist/es/core/PayKKaCheckout.js +116 -0
- package/dist/es/core/Session.js +7 -6
- package/dist/es/core/environment.js +26 -0
- package/dist/es/core/error.js +21 -0
- package/dist/es/core/index.js +0 -2
- package/dist/es/core/query.js +1 -8
- package/dist/es/hooks/index.js +0 -2
- package/dist/es/hooks/useBreakpoints.js +57 -0
- package/dist/es/hooks/useI18n.js +0 -1
- package/dist/es/hooks/usePayState.js +20 -33
- package/dist/es/i18n/index.js +0 -2
- package/dist/es/i18n/locales/de-DE.js +11 -1
- package/dist/es/i18n/locales/en-GB.js +11 -1
- package/dist/es/i18n/locales/es-ES.js +11 -1
- package/dist/es/i18n/locales/fr-FR.js +11 -1
- package/dist/es/i18n/locales/index.js +8 -6
- package/dist/es/i18n/locales/ja-JP.js +11 -1
- package/dist/es/i18n/locales/ko-KR.js +11 -1
- package/dist/es/i18n/locales/pt-PT.js +11 -1
- package/dist/es/i18n/locales/ru-RU.js +11 -1
- package/dist/es/i18n/locales/zh-CN.js +11 -1
- package/dist/es/i18n/locales/zh-HK.js +11 -1
- package/dist/es/i18n/locales/zh-TW.js +11 -1
- package/dist/es/i18n/util.js +11 -8
- package/dist/es/index.js +15 -2
- package/dist/es/out/fraud-detection.js +99 -0
- package/dist/es/style.css +194 -4
- package/dist/es/types/{radar.js → fraud-detection.js} +1 -1
- package/dist/es/types/index.js +49 -1
- package/dist/es/types/message.js +28 -0
- package/dist/es/utils/card-brand/brands.js +21 -45
- package/dist/es/utils/card-brand/index.js +3 -2
- package/dist/es/utils/iframe.js +23 -0
- package/dist/es/utils/index.js +11 -1
- package/dist/es/utils/load.js +14 -0
- package/dist/es/utils/style.js +84 -0
- package/dist/style.css +1 -1
- package/dist/types/api/modules/checkout/map.d.ts +1 -0
- package/dist/types/api/modules/checkout/type.d.ts +14 -1
- package/dist/types/api/modules/encrypted-card/index.d.ts +6 -0
- package/dist/types/api/modules/encrypted-card/type.d.ts +31 -0
- package/dist/types/api/modules/get-browser-params.d.ts +3 -3
- package/dist/types/components/AddressField/type.d.ts +1 -0
- package/dist/types/components/AliPay/type.d.ts +4 -4
- package/dist/types/components/ApplePay/type.d.ts +19 -7
- package/dist/types/components/ApplePay/utils.d.ts +3 -0
- package/dist/types/components/Card/type.d.ts +64 -6
- package/dist/types/components/CardExpireDateField/type.d.ts +1 -0
- package/dist/types/components/CardHolderNameField/type.d.ts +1 -1
- package/dist/types/components/CardNumberField/type.d.ts +3 -0
- package/dist/types/components/CardSecurityCodeField/type.d.ts +1 -0
- package/dist/types/components/CombinedCardInfo/CombinedCardInfo.d.ts +5 -0
- package/dist/types/components/CombinedCardInfo/index.d.ts +2 -0
- package/dist/types/components/CombinedCardInfo/type.d.ts +16 -0
- package/dist/types/components/EncryptedCard/EncryptedCard.d.ts +4 -0
- package/dist/types/components/EncryptedCard/index.d.ts +4 -0
- package/dist/types/components/EncryptedCard/output.d.ts +9 -0
- package/dist/types/components/EncryptedCard/type.d.ts +85 -0
- package/dist/types/components/GooglePay/type.d.ts +20 -8
- package/dist/types/components/GooglePay/utils.d.ts +2 -0
- package/dist/types/components/SecuredFieldsProvider/index.d.ts +1 -0
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +29 -100
- package/dist/types/components/SecuredFieldsProvider/utils/index.d.ts +1 -1
- package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +7 -2
- package/dist/types/components/Sepa/type.d.ts +4 -4
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/ThreeDSAuth.d.ts +3 -0
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/index.d.ts +2 -0
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +17 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +2 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/index.d.ts +1 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/output.d.ts +1 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +5 -0
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/ThreeDSStatus.d.ts +3 -0
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/output.d.ts +1 -0
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/type.d.ts +6 -0
- package/dist/types/components/ThreeDS/index.d.ts +1 -0
- package/dist/types/components/WechatPay/type.d.ts +4 -4
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/internal/Form/FormItem.d.ts +1 -1
- package/dist/types/components/internal/Form/type.d.ts +7 -0
- package/dist/types/components/internal/Input/Input.d.ts +1 -1
- package/dist/types/components/internal/Input/type.d.ts +7 -0
- package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
- package/dist/types/components/internal/Loading/index.d.ts +1 -0
- package/dist/types/components/internal/Modal/Modal.d.ts +5 -0
- package/dist/types/components/internal/Modal/index.d.ts +0 -0
- package/dist/types/components/internal/Modal/type.d.ts +20 -0
- package/dist/types/components/internal/icons/Icon3DSFail.d.ts +2 -0
- package/dist/types/components/internal/icons/Icon3DSInfo.d.ts +2 -0
- package/dist/types/components/internal/icons/Icon3DSSuccess.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +3 -0
- package/dist/types/config.d.ts +7 -3
- package/dist/types/constant.d.ts +7 -2
- package/dist/types/core/PayKKaCheckout.d.ts +28 -0
- package/dist/types/core/Session.d.ts +1 -1
- package/dist/types/core/context.d.ts +1 -0
- package/dist/types/core/environment.d.ts +4 -0
- package/dist/types/core/error.d.ts +16 -0
- package/dist/types/core/index.d.ts +2 -0
- package/dist/types/core/query.d.ts +2 -2
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useBreakpoints.d.ts +15 -0
- package/dist/types/hooks/usePayState.d.ts +6 -25
- package/dist/types/i18n/locales/de-DE.d.ts +8 -0
- package/dist/types/i18n/locales/en-GB.d.ts +8 -0
- package/dist/types/i18n/locales/es-ES.d.ts +8 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +8 -0
- package/dist/types/i18n/locales/index.d.ts +2 -2
- package/dist/types/i18n/locales/ja-JP.d.ts +8 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +8 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +8 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +8 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +8 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +8 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +8 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/out/fraud-detection.d.ts +9 -0
- package/dist/types/types/{radar.d.ts → fraud-detection.d.ts} +3 -2
- package/dist/types/types/index.d.ts +100 -1
- package/dist/types/types/message.d.ts +170 -0
- package/dist/types/utils/card-brand/brands.d.ts +4 -18
- package/dist/types/utils/card-brand/index.d.ts +10 -9
- package/dist/types/utils/format.d.ts +0 -1
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/load.d.ts +7 -0
- package/dist/types/utils/style.d.ts +29 -0
- package/package.json +63 -63
- package/dist/card-checkout-ui.iife.js +0 -8
- package/dist/es/components/SecuredFieldsProvider/SecuredFieldsProvider.js +0 -222
- package/dist/es/out/radar.js +0 -123
- package/dist/types/out/radar.d.ts +0 -14
- /package/dist/types/{components/SecuredFieldsProvider/utils → utils}/iframe.d.ts +0 -0
|
@@ -7,14 +7,14 @@ import "../../utils/system-info/get-browser-info.js";
|
|
|
7
7
|
import { 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
|
+
import { PayKKaError } from "../../core/error.js";
|
|
10
11
|
import { createAddressCore } from "../../core/Address.js";
|
|
11
12
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
12
|
-
import "../../i18n/util.js";
|
|
13
|
-
import "../../i18n/locales/index.js";
|
|
14
13
|
import { usePayState } from "../../hooks/usePayState.js";
|
|
15
14
|
import { useRetry } from "../../hooks/useRetry.js";
|
|
16
15
|
import { AddressField } from "../AddressField/index.js";
|
|
17
16
|
import { EmailField, createEmailCore } from "../EmailField/EmailField.js";
|
|
17
|
+
import "../internal/Form/type.js";
|
|
18
18
|
import "../internal/Form/context.js";
|
|
19
19
|
import "../internal/Form/FormItem.js";
|
|
20
20
|
import { Form } from "../internal/Form/Form.js";
|
|
@@ -23,7 +23,8 @@ 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
|
-
|
|
26
|
+
var _a;
|
|
27
|
+
const { session } = props;
|
|
27
28
|
let addressState = createAddressCore();
|
|
28
29
|
let emailState = createEmailCore();
|
|
29
30
|
const emailFieldRef = A(null);
|
|
@@ -39,25 +40,24 @@ const WechatPay = w((props, ref) => {
|
|
|
39
40
|
});
|
|
40
41
|
},
|
|
41
42
|
updateAddress: () => {
|
|
42
|
-
var
|
|
43
|
+
var _a2;
|
|
43
44
|
setForm(Object.assign(form, { address: addressState.getAddressState() }));
|
|
44
|
-
(
|
|
45
|
+
(_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressState.getAddressState());
|
|
45
46
|
},
|
|
46
47
|
updateEmail: () => {
|
|
47
|
-
var
|
|
48
|
+
var _a2;
|
|
48
49
|
setForm(Object.assign(form, { email: emailState.email }));
|
|
49
|
-
(
|
|
50
|
+
(_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
|
|
50
51
|
}
|
|
51
52
|
}));
|
|
52
53
|
const {
|
|
53
54
|
setErrorMsg,
|
|
54
55
|
setSubmitButtonStatus,
|
|
55
56
|
i18n,
|
|
56
|
-
session,
|
|
57
57
|
submitButtonStatus,
|
|
58
58
|
errorMsg,
|
|
59
59
|
sessionReady
|
|
60
|
-
} = usePayState(
|
|
60
|
+
} = usePayState(session);
|
|
61
61
|
const formRef = A(null);
|
|
62
62
|
const [form, setForm] = h({
|
|
63
63
|
email: "",
|
|
@@ -76,8 +76,8 @@ const WechatPay = w((props, ref) => {
|
|
|
76
76
|
const [requiredBill, setRequiredBill] = h(false);
|
|
77
77
|
const addressFieldRef = A(null);
|
|
78
78
|
function validateForm() {
|
|
79
|
-
var
|
|
80
|
-
(
|
|
79
|
+
var _a2;
|
|
80
|
+
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => {
|
|
81
81
|
setValidated(true);
|
|
82
82
|
}).catch(() => {
|
|
83
83
|
setValidated(false);
|
|
@@ -87,11 +87,11 @@ const WechatPay = w((props, ref) => {
|
|
|
87
87
|
validateForm();
|
|
88
88
|
}, [form]);
|
|
89
89
|
y(() => {
|
|
90
|
-
var
|
|
90
|
+
var _a2;
|
|
91
91
|
if (sessionReady) {
|
|
92
92
|
if ((session == null ? void 0 : session.checkout.status) === "SUCCESS") {
|
|
93
93
|
setSubmitButtonStatus("success");
|
|
94
|
-
(
|
|
94
|
+
(_a2 = props.onSuccess) == null ? void 0 : _a2.call(props);
|
|
95
95
|
}
|
|
96
96
|
form.email = (session == null ? void 0 : session.checkout.bill.email) ?? "";
|
|
97
97
|
disabledEmail.current = !!(session == null ? void 0 : session.checkout.bill.email);
|
|
@@ -102,10 +102,10 @@ const WechatPay = w((props, ref) => {
|
|
|
102
102
|
}
|
|
103
103
|
}, [sessionReady]);
|
|
104
104
|
const onTimeout = q((message) => {
|
|
105
|
-
var
|
|
105
|
+
var _a2;
|
|
106
106
|
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
107
107
|
setSubmitButtonStatus("unSubmit");
|
|
108
|
-
(
|
|
108
|
+
(_a2 = props.onTimeout) == null ? void 0 : _a2.call(props, "retry");
|
|
109
109
|
}, [i18n, props.onTimeout]);
|
|
110
110
|
const { start: startReFetchPayInfo, stop: stopReFetchPayInfo } = useRetry(
|
|
111
111
|
(timeout) => pay(true, timeout),
|
|
@@ -115,18 +115,18 @@ const WechatPay = w((props, ref) => {
|
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
117
|
async function pay(search = false, timeout) {
|
|
118
|
-
var
|
|
118
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
119
119
|
try {
|
|
120
120
|
const res = search ? await getWechatPayInfo(
|
|
121
121
|
{
|
|
122
|
-
sessionId,
|
|
123
|
-
clientKey
|
|
122
|
+
sessionId: session.sessionId,
|
|
123
|
+
clientKey: session.clientKey
|
|
124
124
|
},
|
|
125
125
|
{ locale: i18n.locale, timeout }
|
|
126
126
|
) : await wechatPay(
|
|
127
127
|
{
|
|
128
|
-
sessionId,
|
|
129
|
-
clientKey,
|
|
128
|
+
sessionId: session.sessionId,
|
|
129
|
+
clientKey: session.clientKey,
|
|
130
130
|
bill: requiredBill ? {
|
|
131
131
|
email: form.email,
|
|
132
132
|
...form.address,
|
|
@@ -138,11 +138,11 @@ const WechatPay = w((props, ref) => {
|
|
|
138
138
|
} : {
|
|
139
139
|
email: form.email
|
|
140
140
|
},
|
|
141
|
-
channelUserId: await ((
|
|
141
|
+
channelUserId: await ((_a2 = props.onGetOpenId) == null ? void 0 : _a2.call(props))
|
|
142
142
|
},
|
|
143
143
|
{ locale: i18n.locale, timeout }
|
|
144
144
|
);
|
|
145
|
-
const { status, orderStatus, errorMessage, payInfo } = res;
|
|
145
|
+
const { status, orderStatus, errorMessage, payInfo, errorCode } = res;
|
|
146
146
|
!search && ((_b = props.onSubmitResponse) == null ? void 0 : _b.call(props, res));
|
|
147
147
|
if (status === "PROCESSING") {
|
|
148
148
|
if (!orderStatus) {
|
|
@@ -156,7 +156,7 @@ const WechatPay = w((props, ref) => {
|
|
|
156
156
|
} else if (orderStatus === "FAILURE") {
|
|
157
157
|
setErrorMsg(errorMessage);
|
|
158
158
|
setSubmitButtonStatus("unSubmit");
|
|
159
|
-
(_d = props.onError) == null ? void 0 : _d.call(props, "
|
|
159
|
+
(_d = props.onError) == null ? void 0 : _d.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
160
160
|
return {
|
|
161
161
|
end: true
|
|
162
162
|
};
|
|
@@ -202,20 +202,21 @@ const WechatPay = w((props, ref) => {
|
|
|
202
202
|
return { end: true };
|
|
203
203
|
}
|
|
204
204
|
} else {
|
|
205
|
-
|
|
206
|
-
(
|
|
205
|
+
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
206
|
+
setErrorMsg(message);
|
|
207
|
+
(_j = props.onError) == null ? void 0 : _j.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
|
|
207
208
|
setSubmitButtonStatus("unSubmit");
|
|
208
209
|
return { end: true };
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
async function onSubmit() {
|
|
213
|
-
var
|
|
214
|
+
var _a2;
|
|
214
215
|
setErrorMsg("");
|
|
215
|
-
(
|
|
216
|
-
var
|
|
216
|
+
(_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
|
|
217
|
+
var _a3;
|
|
217
218
|
requiredBill && addressState.setValidateAllFields(true);
|
|
218
|
-
(
|
|
219
|
+
(_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
|
|
219
220
|
if (errors) {
|
|
220
221
|
setSubmitButtonStatus("unSubmit");
|
|
221
222
|
return;
|
|
@@ -274,7 +275,7 @@ const WechatPay = w((props, ref) => {
|
|
|
274
275
|
onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
275
276
|
}
|
|
276
277
|
),
|
|
277
|
-
(session == null ? void 0 : session.checkout.paymentType) === PaymentType.RECURRING && RecurringTip(),
|
|
278
|
+
((_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.paymentType) === PaymentType.RECURRING && RecurringTip(),
|
|
278
279
|
!!errorMsg && /* @__PURE__ */ u(Info, { className: bem("error"), content: errorMsg }),
|
|
279
280
|
Button()
|
|
280
281
|
] })
|
|
@@ -6,13 +6,13 @@ import "./CardBrands/index.js";
|
|
|
6
6
|
import "../utils/card-brand/brands.js";
|
|
7
7
|
import "../utils/system-info/get-browser-info.js";
|
|
8
8
|
import "../core/context.js";
|
|
9
|
-
import "../i18n/util.js";
|
|
10
|
-
import "../i18n/locales/index.js";
|
|
11
9
|
import "./CardExpireDateField/index.js";
|
|
10
|
+
import "./internal/Form/type.js";
|
|
12
11
|
import "./internal/Form/context.js";
|
|
13
12
|
import "./internal/Form/FormItem.js";
|
|
14
13
|
import "./internal/Form/Form.js";
|
|
15
14
|
import "./internal/Input/Input.js";
|
|
15
|
+
import "./internal/Input/type.js";
|
|
16
16
|
import "./CardNumberField/index.js";
|
|
17
17
|
import "./CardSecurityCodeField/index.js";
|
|
18
18
|
import "./CardSelector/index.js";
|
|
@@ -25,3 +25,5 @@ import "./WechatPay/index.js";
|
|
|
25
25
|
import "./ApplePay/index.js";
|
|
26
26
|
import "./GooglePay/index.js";
|
|
27
27
|
import "./Sepa/index.js";
|
|
28
|
+
import "./EncryptedCard/index.js";
|
|
29
|
+
import "./CombinedCardInfo/index.js";
|
|
@@ -6,8 +6,6 @@ import "../../../core/context.js";
|
|
|
6
6
|
import "../../../utils/card-brand/brands.js";
|
|
7
7
|
import "../../../utils/system-info/get-browser-info.js";
|
|
8
8
|
import { normalizedClass } from "../../../utils/format.js";
|
|
9
|
-
import "../../../i18n/util.js";
|
|
10
|
-
import "../../../i18n/locales/index.js";
|
|
11
9
|
const { bem } = useBEM("button");
|
|
12
10
|
function Button(props) {
|
|
13
11
|
const { style, className, children, icon, loading, disabled, dashed } = props;
|
|
@@ -5,8 +5,6 @@ import "../../../core/context.js";
|
|
|
5
5
|
import "../../../utils/card-brand/brands.js";
|
|
6
6
|
import "../../../utils/system-info/get-browser-info.js";
|
|
7
7
|
import { normalizedClass } from "../../../utils/format.js";
|
|
8
|
-
import "../../../i18n/util.js";
|
|
9
|
-
import "../../../i18n/locales/index.js";
|
|
10
8
|
import { COMMON_CLASS_NAME } from "../../../constant.js";
|
|
11
9
|
import { IconChecked } from "../icons/iconChecked.js";
|
|
12
10
|
const { bem } = useBEM("check-box");
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { w, F, x, h, y, u } from "../../../core.js";
|
|
2
2
|
import "./form-item.js";
|
|
3
3
|
import { COMMON_CLASS_NAME } from "../../../constant.js";
|
|
4
|
-
import { useBEM } from "../../../hooks/useBEM.js";
|
|
5
|
-
import "../../../core/context.js";
|
|
6
4
|
import { isNil } from "../../../utils/is.js";
|
|
7
5
|
import "../../../utils/card-brand/brands.js";
|
|
8
6
|
import "../../../utils/system-info/get-browser-info.js";
|
|
9
7
|
import { normalizedClass } from "../../../utils/format.js";
|
|
10
8
|
import { set } from "../../../utils/obj.js";
|
|
11
|
-
import "../../../i18n/util.js";
|
|
12
|
-
import "../../../i18n/locales/index.js";
|
|
13
9
|
import { FormItemContext, FormContext } from "./context.js";
|
|
10
|
+
import { formItemBEM, formItemLabelClassName, formItemErrorMessageClassName } from "./type.js";
|
|
14
11
|
import { getActiveRules } from "./util.js";
|
|
15
|
-
const { bem } = useBEM("form-item");
|
|
16
12
|
const isEmpty = (value) => isNil(value) || value === "";
|
|
17
13
|
const FormItem = w((props, ref) => {
|
|
18
14
|
const {
|
|
@@ -23,7 +19,8 @@ const FormItem = w((props, ref) => {
|
|
|
23
19
|
onValidationStatusChange,
|
|
24
20
|
className,
|
|
25
21
|
style,
|
|
26
|
-
showErrorMessage = true
|
|
22
|
+
showErrorMessage = true,
|
|
23
|
+
showLabel = true
|
|
27
24
|
} = props;
|
|
28
25
|
F(ref, () => ({
|
|
29
26
|
validate: internalValidate,
|
|
@@ -136,24 +133,31 @@ const FormItem = w((props, ref) => {
|
|
|
136
133
|
path && (formContext == null ? void 0 : formContext.setFormItems((prev) => prev.filter((item) => item !== internalRef)));
|
|
137
134
|
};
|
|
138
135
|
}, []);
|
|
139
|
-
return /* @__PURE__ */ u(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
136
|
+
return /* @__PURE__ */ u(
|
|
137
|
+
"div",
|
|
138
|
+
{
|
|
139
|
+
className: normalizedClass(COMMON_CLASS_NAME, formItemBEM.bem(), className),
|
|
140
|
+
style,
|
|
141
|
+
children: [
|
|
142
|
+
showLabel && !isNil(label) && /* @__PURE__ */ u("div", { className: formItemLabelClassName, children: label }),
|
|
143
|
+
/* @__PURE__ */ u(
|
|
144
|
+
FormItemContext.Provider,
|
|
145
|
+
{
|
|
146
|
+
value: {
|
|
147
|
+
rule: props.rule,
|
|
148
|
+
validateBlur,
|
|
149
|
+
validateChange,
|
|
150
|
+
resetValidation,
|
|
151
|
+
validationResult,
|
|
152
|
+
setValue
|
|
153
|
+
},
|
|
154
|
+
children
|
|
155
|
+
}
|
|
156
|
+
),
|
|
157
|
+
showErrorMessage && validationResult.status === "error" && /* @__PURE__ */ u("div", { className: formItemErrorMessageClassName, children: getFirstError().message })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
);
|
|
157
161
|
});
|
|
158
162
|
export {
|
|
159
163
|
FormItem
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { useBEM } from "../../../hooks/useBEM.js";
|
|
2
|
+
import "../../../core.js";
|
|
3
|
+
import "../../../core/context.js";
|
|
4
|
+
import "../../../utils/card-brand/brands.js";
|
|
5
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
6
|
+
const formItemBEM = useBEM("form-item");
|
|
7
|
+
const formItemLabelClassName = formItemBEM.bem("label");
|
|
8
|
+
const formItemErrorMessageClassName = formItemBEM.bem("error-text");
|
|
9
|
+
export {
|
|
10
|
+
formItemBEM,
|
|
11
|
+
formItemErrorMessageClassName,
|
|
12
|
+
formItemLabelClassName
|
|
13
|
+
};
|
|
@@ -6,8 +6,6 @@ import "../../../core/context.js";
|
|
|
6
6
|
import "../../../utils/card-brand/brands.js";
|
|
7
7
|
import "../../../utils/system-info/get-browser-info.js";
|
|
8
8
|
import { normalizedClass } from "../../../utils/format.js";
|
|
9
|
-
import "../../../i18n/util.js";
|
|
10
|
-
import "../../../i18n/locales/index.js";
|
|
11
9
|
import { IconError } from "../icons/IconError.js";
|
|
12
10
|
const { bem } = useBEM("info");
|
|
13
11
|
const iconMap = {
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { w, F, x, h, A, w$1, u } from "../../../core.js";
|
|
2
2
|
import "./input2.js";
|
|
3
3
|
import { COMMON_CLASS_NAME } from "../../../constant.js";
|
|
4
|
-
import { useBEM } from "../../../hooks/useBEM.js";
|
|
5
|
-
import "../../../core/context.js";
|
|
6
4
|
import "../../../utils/card-brand/brands.js";
|
|
7
5
|
import "../../../utils/system-info/get-browser-info.js";
|
|
8
6
|
import { normalizedClass } from "../../../utils/format.js";
|
|
9
|
-
import "
|
|
10
|
-
import "../../../i18n/locales/index.js";
|
|
7
|
+
import "../Form/type.js";
|
|
11
8
|
import { FormItemContext } from "../Form/context.js";
|
|
12
9
|
import "../Form/FormItem.js";
|
|
13
10
|
import "../Form/Form.js";
|
|
14
11
|
import { IconError } from "../icons/IconError.js";
|
|
15
12
|
import { IconSuccess } from "../icons/IconSuccess.js";
|
|
16
|
-
|
|
13
|
+
import { inputBEM } from "./type.js";
|
|
17
14
|
const statusIconMap = {
|
|
18
15
|
error: IconError,
|
|
19
16
|
success: IconSuccess
|
|
20
17
|
};
|
|
21
18
|
const Input = w((props, ref) => {
|
|
22
|
-
const { inputClassName, style, disabled, children } = props;
|
|
19
|
+
const { inputClassName, style, disabled, children, showStatus = true } = props;
|
|
23
20
|
F(ref, () => ({
|
|
24
21
|
input: inputRef.current,
|
|
25
22
|
focus: () => {
|
|
@@ -43,7 +40,7 @@ const Input = w((props, ref) => {
|
|
|
43
40
|
if (status === "unValidate")
|
|
44
41
|
status = void 0;
|
|
45
42
|
let { rightIcon } = props;
|
|
46
|
-
if (
|
|
43
|
+
if (showStatus && status) {
|
|
47
44
|
const StatusIcon = statusIconMap[status];
|
|
48
45
|
rightIcon = /* @__PURE__ */ u(StatusIcon, { size: 16 });
|
|
49
46
|
}
|
|
@@ -74,13 +71,13 @@ const Input = w((props, ref) => {
|
|
|
74
71
|
formItemContext == null ? void 0 : formItemContext.validateChange(value);
|
|
75
72
|
}
|
|
76
73
|
const inputWrapperClass = w$1(() => {
|
|
77
|
-
const inputWrapper = bem("input-wrapper", [
|
|
74
|
+
const inputWrapper = inputBEM.bem("input-wrapper", [
|
|
78
75
|
status,
|
|
79
76
|
{
|
|
80
77
|
focus: isFocus
|
|
81
78
|
}
|
|
82
79
|
]);
|
|
83
|
-
const inputWrapperDisabled = bem("input-wrapper-disabled");
|
|
80
|
+
const inputWrapperDisabled = inputBEM.bem("input-wrapper-disabled");
|
|
84
81
|
return disabled ? `${inputWrapper} ${inputWrapperDisabled}` : `${inputWrapper}`;
|
|
85
82
|
});
|
|
86
83
|
function onCompositionStart(e) {
|
|
@@ -92,16 +89,17 @@ const Input = w((props, ref) => {
|
|
|
92
89
|
isComposing = false;
|
|
93
90
|
onInput(e);
|
|
94
91
|
}
|
|
95
|
-
return /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem(), inputClassName),
|
|
92
|
+
return /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, inputBEM.bem(), inputClassName), onClick: () => {
|
|
96
93
|
var _a;
|
|
97
94
|
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
98
|
-
}, children: /* @__PURE__ */ u("div", { className: inputWrapperClass, children: [
|
|
95
|
+
}, children: /* @__PURE__ */ u("div", { className: `${inputWrapperClass}`, style, children: [
|
|
96
|
+
!!props.leftIcon && /* @__PURE__ */ u("div", { class: inputBEM.bem("left-icon"), children: props.leftIcon }),
|
|
99
97
|
children ? children : /* @__PURE__ */ u(
|
|
100
98
|
"input",
|
|
101
99
|
{
|
|
102
100
|
ref: inputRef,
|
|
103
101
|
...props,
|
|
104
|
-
class: bem("input"),
|
|
102
|
+
class: inputBEM.bem("input"),
|
|
105
103
|
onFocus,
|
|
106
104
|
onBlur,
|
|
107
105
|
onInput,
|
|
@@ -110,7 +108,7 @@ const Input = w((props, ref) => {
|
|
|
110
108
|
autocomplete: "off"
|
|
111
109
|
}
|
|
112
110
|
),
|
|
113
|
-
!!rightIcon && /* @__PURE__ */ u("div", { class: bem("right-icon"), children: rightIcon })
|
|
111
|
+
!!rightIcon && /* @__PURE__ */ u("div", { class: inputBEM.bem("right-icon"), children: rightIcon })
|
|
114
112
|
] }) });
|
|
115
113
|
});
|
|
116
114
|
export {
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { useBEM } from "../../../hooks/useBEM.js";
|
|
2
|
+
import "../../../core.js";
|
|
3
|
+
import "../../../core/context.js";
|
|
4
|
+
import "../../../utils/card-brand/brands.js";
|
|
5
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
6
|
+
const inputBEM = useBEM("input");
|
|
7
|
+
const inputWrapperClassName = inputBEM.bem("input-wrapper");
|
|
8
|
+
export {
|
|
9
|
+
inputBEM,
|
|
10
|
+
inputWrapperClassName
|
|
11
|
+
};
|
|
@@ -7,8 +7,6 @@ import { isUndefined } from "../../../utils/is.js";
|
|
|
7
7
|
import "../../../utils/card-brand/brands.js";
|
|
8
8
|
import "../../../utils/system-info/get-browser-info.js";
|
|
9
9
|
import { normalizedClass, normalizedStyle } from "../../../utils/format.js";
|
|
10
|
-
import "../../../i18n/util.js";
|
|
11
|
-
import "../../../i18n/locales/index.js";
|
|
12
10
|
const SIZE = 40;
|
|
13
11
|
const SVG_VIEW_BOX = `0 0 ${SIZE} ${SIZE}`;
|
|
14
12
|
const CIRCLE_STROKE_WIDTH = 3.3;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { w, h, T, u, b } from "../../../core.js";
|
|
2
|
+
import { useBEM } from "../../../hooks/useBEM.js";
|
|
3
|
+
import { useI18n } from "../../../hooks/useI18n.js";
|
|
4
|
+
import "../../../utils/card-brand/brands.js";
|
|
5
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
6
|
+
import "./modal2.js";
|
|
7
|
+
const { bem } = useBEM("modal");
|
|
8
|
+
const Modal = w((props) => {
|
|
9
|
+
const { show, width, height, maskClosable, header, children, onChange, style } = props;
|
|
10
|
+
const [modalWidth, setModalWidth] = h();
|
|
11
|
+
const [modalHeight, setModalHeight] = h();
|
|
12
|
+
const { i18n } = useI18n();
|
|
13
|
+
T(() => {
|
|
14
|
+
setModalWidth(typeof width === "number" ? `${width}px` : width);
|
|
15
|
+
setModalHeight(typeof height === "number" ? `${height}px` : height);
|
|
16
|
+
}, [width, height]);
|
|
17
|
+
const handleClickMask = () => {
|
|
18
|
+
maskClosable && (onChange == null ? void 0 : onChange(false));
|
|
19
|
+
};
|
|
20
|
+
const handleClickClose = () => {
|
|
21
|
+
onChange == null ? void 0 : onChange(false);
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ u(b, { children: show && /* @__PURE__ */ u("div", { className: bem(), children: [
|
|
24
|
+
/* @__PURE__ */ u("div", { className: bem("mask"), onClick: handleClickMask }),
|
|
25
|
+
/* @__PURE__ */ u(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: bem("content"),
|
|
29
|
+
style: { width: modalWidth, height: modalHeight, ...style },
|
|
30
|
+
children: [
|
|
31
|
+
header || /* @__PURE__ */ u("div", { className: bem("header"), children: /* @__PURE__ */ u("div", { className: bem("close"), onClick: handleClickClose, children: i18n.get("common.cancel") }) }),
|
|
32
|
+
/* @__PURE__ */ u("div", { className: bem("body"), children })
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
] }) });
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
Modal
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -4,13 +4,13 @@ import "../../../core/context.js";
|
|
|
4
4
|
import { isNil } from "../../../utils/is.js";
|
|
5
5
|
import "../../../utils/card-brand/brands.js";
|
|
6
6
|
import "../../../utils/system-info/get-browser-info.js";
|
|
7
|
-
import "
|
|
8
|
-
import "../../../i18n/locales/index.js";
|
|
7
|
+
import "../Form/type.js";
|
|
9
8
|
import { FormItemContext } from "../Form/context.js";
|
|
10
9
|
import "../Form/FormItem.js";
|
|
11
10
|
import "../Form/Form.js";
|
|
12
11
|
import { IconArrowDown } from "../icons/IconArrowDown.js";
|
|
13
12
|
import { Input } from "../Input/Input.js";
|
|
13
|
+
import "../Input/type.js";
|
|
14
14
|
import { SelectMenu } from "./SelectMenu.js";
|
|
15
15
|
import { SelectMenuItem } from "./SelectMenuItem.js";
|
|
16
16
|
const { bem } = useBEM("select");
|
|
@@ -4,8 +4,6 @@ import { useBEM } from "../../../hooks/useBEM.js";
|
|
|
4
4
|
import "../../../core/context.js";
|
|
5
5
|
import "../../../utils/card-brand/brands.js";
|
|
6
6
|
import "../../../utils/system-info/get-browser-info.js";
|
|
7
|
-
import "../../../i18n/util.js";
|
|
8
|
-
import "../../../i18n/locales/index.js";
|
|
9
7
|
const { bem } = useBEM("select");
|
|
10
8
|
function SelectMenu(props) {
|
|
11
9
|
const { style, children } = props;
|
|
@@ -5,8 +5,6 @@ import "../../../core/context.js";
|
|
|
5
5
|
import { isFunction } from "../../../utils/is.js";
|
|
6
6
|
import "../../../utils/card-brand/brands.js";
|
|
7
7
|
import "../../../utils/system-info/get-browser-info.js";
|
|
8
|
-
import "../../../i18n/util.js";
|
|
9
|
-
import "../../../i18n/locales/index.js";
|
|
10
8
|
import { IconTick } from "../icons/IconTick.js";
|
|
11
9
|
const { bem } = useBEM("select");
|
|
12
10
|
function SelectMenuItem(props) {
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
function Icon3DSInfo({ 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 64 64",
|
|
15
|
+
style,
|
|
16
|
+
fill: "none",
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
className: normalizedClass(COMMON_CLASS_NAME, className),
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ u("g", { id: "icon-warning", "clip-path": "url(#clip0_25_1509)", children: [
|
|
21
|
+
/* @__PURE__ */ u(
|
|
22
|
+
"path",
|
|
23
|
+
{
|
|
24
|
+
id: "Vector",
|
|
25
|
+
d: "M32 0.5C14.3437 0.5 0 14.8437 0 32.5C0 50.1563 14.3437 64.5 32 64.5C49.6563 64.5 64 50.1563 64 32.5C64 14.8437 49.6563 0.5 32 0.5ZM32 3.28261C48.1524 3.28261 61.2174 16.3476 61.2174 32.5C61.2174 48.6524 48.1524 61.7174 32 61.7174C15.8476 61.7174 2.78261 48.6524 2.78261 32.5C2.78261 16.3476 15.8476 3.28261 32 3.28261Z",
|
|
26
|
+
fill: "#FCA605"
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ u(
|
|
30
|
+
"path",
|
|
31
|
+
{
|
|
32
|
+
id: "Vector_2",
|
|
33
|
+
d: "M32 15.5V39.5",
|
|
34
|
+
stroke: "#FCA605",
|
|
35
|
+
"stroke-width": "2.8",
|
|
36
|
+
"stroke-linecap": "round",
|
|
37
|
+
"stroke-linejoin": "round"
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ u(
|
|
41
|
+
"circle",
|
|
42
|
+
{
|
|
43
|
+
id: "Ellipse 642",
|
|
44
|
+
cx: "32",
|
|
45
|
+
cy: "47.5",
|
|
46
|
+
r: "1",
|
|
47
|
+
fill: "#FCA605",
|
|
48
|
+
stroke: "#FCA605",
|
|
49
|
+
"stroke-width": "2.8",
|
|
50
|
+
"stroke-linecap": "round",
|
|
51
|
+
"stroke-linejoin": "round"
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ u("defs", { children: /* @__PURE__ */ u("clipPath", { id: "clip0_25_1509", children: /* @__PURE__ */ u("rect", { width: "64", height: "64", fill: "white", transform: "translate(0 0.5)" }) }) })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
Icon3DSInfo
|
|
62
|
+
};
|