@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
|
@@ -3,8 +3,6 @@ import { COMMON_CLASS_NAME } from "../../constant.js";
|
|
|
3
3
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
4
4
|
import "../../core/context.js";
|
|
5
5
|
import { clamp } from "../../utils/index.js";
|
|
6
|
-
import "../../i18n/util.js";
|
|
7
|
-
import "../../i18n/locales/index.js";
|
|
8
6
|
import { getSupportedCardBrands, getCardBrandInfo } from "../../utils/card-brand/index.js";
|
|
9
7
|
import { normalizedClass } from "../../utils/format.js";
|
|
10
8
|
const { bem } = useBEM("card-brands");
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { w, A, F, h, u } from "../../core.js";
|
|
2
2
|
import { isExpired } from "../../utils/index.js";
|
|
3
3
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
4
|
-
import "
|
|
5
|
-
import "../../i18n/util.js";
|
|
6
|
-
import "../../i18n/locales/index.js";
|
|
4
|
+
import "../internal/Form/type.js";
|
|
7
5
|
import "../internal/Form/context.js";
|
|
8
6
|
import { FormItem } from "../internal/Form/FormItem.js";
|
|
9
7
|
import "../internal/Form/Form.js";
|
|
10
8
|
import { Input } from "../internal/Input/Input.js";
|
|
11
|
-
import
|
|
9
|
+
import "../internal/Input/type.js";
|
|
10
|
+
import { EFieldType } from "../SecuredFieldsProvider/index.js";
|
|
12
11
|
import { limitedToNumber } from "../../utils/format.js";
|
|
13
12
|
import { isUndefined } from "../../utils/is.js";
|
|
14
13
|
const CardExpireDateField = w((props, ref) => {
|
|
15
|
-
const { className, style, security } = props;
|
|
14
|
+
const { className, style, security, showLabel } = props;
|
|
16
15
|
const inputRef = A(null);
|
|
17
16
|
const formItemRef = A(null);
|
|
18
17
|
F(ref, () => ({
|
|
@@ -117,6 +116,7 @@ const CardExpireDateField = w((props, ref) => {
|
|
|
117
116
|
FormItem,
|
|
118
117
|
{
|
|
119
118
|
label: i18n.get("card.cardExpireDate.label"),
|
|
119
|
+
showLabel,
|
|
120
120
|
path: "expireDate",
|
|
121
121
|
ref: formItemRef,
|
|
122
122
|
rule,
|
|
@@ -132,7 +132,7 @@ const CardExpireDateField = w((props, ref) => {
|
|
|
132
132
|
value,
|
|
133
133
|
onInput,
|
|
134
134
|
placeholder: i18n.get("card.cardExpireDate.placeholder"),
|
|
135
|
-
children: security && /* @__PURE__ */ u("div", { style: "width:100%;height:100%", "data-sf":
|
|
135
|
+
children: security && /* @__PURE__ */ u("div", { style: "width:100%;height:100%", "data-sf": EFieldType.EXPIRE_DATE })
|
|
136
136
|
}
|
|
137
137
|
)
|
|
138
138
|
}
|
|
@@ -2,15 +2,14 @@ import { u } from "../../core.js";
|
|
|
2
2
|
import "../../utils/card-brand/brands.js";
|
|
3
3
|
import "../../utils/system-info/get-browser-info.js";
|
|
4
4
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
5
|
-
import "
|
|
6
|
-
import "../../i18n/util.js";
|
|
7
|
-
import "../../i18n/locales/index.js";
|
|
5
|
+
import "../internal/Form/type.js";
|
|
8
6
|
import "../internal/Form/context.js";
|
|
9
7
|
import { FormItem } from "../internal/Form/FormItem.js";
|
|
10
8
|
import "../internal/Form/Form.js";
|
|
11
9
|
import { Input } from "../internal/Input/Input.js";
|
|
10
|
+
import "../internal/Input/type.js";
|
|
12
11
|
function CardHolderNameField(props) {
|
|
13
|
-
const { className, style } = props;
|
|
12
|
+
const { className, style, disabled } = props;
|
|
14
13
|
const { i18n } = useI18n();
|
|
15
14
|
const rule = {
|
|
16
15
|
trigger: ["blur", "submit"],
|
|
@@ -38,7 +37,8 @@ function CardHolderNameField(props) {
|
|
|
38
37
|
{
|
|
39
38
|
maxLength: 100,
|
|
40
39
|
placeholder: i18n.get("card.cardHolderName.placeholder"),
|
|
41
|
-
onInput
|
|
40
|
+
onInput,
|
|
41
|
+
disabled
|
|
42
42
|
}
|
|
43
43
|
)
|
|
44
44
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { A, h, u } from "../../core.js";
|
|
2
2
|
import { clamp } from "../../utils/index.js";
|
|
3
3
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
4
|
-
import "
|
|
5
|
-
import "../../i18n/util.js";
|
|
6
|
-
import "../../i18n/locales/index.js";
|
|
4
|
+
import "../internal/Form/type.js";
|
|
7
5
|
import "../internal/Form/context.js";
|
|
8
6
|
import { FormItem } from "../internal/Form/FormItem.js";
|
|
9
7
|
import "../internal/Form/Form.js";
|
|
10
8
|
import { Input } from "../internal/Input/Input.js";
|
|
9
|
+
import "../internal/Input/type.js";
|
|
11
10
|
import { validateIBAN } from "../../utils/iban.js";
|
|
12
11
|
import { trimAll, limitedToNumber } from "../../utils/format.js";
|
|
13
12
|
function IBANField(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
|
const { bem } = useBEM("card-no");
|
|
11
9
|
const CardNo = (props) => {
|
|
12
10
|
const { value, className, style } = props;
|
|
@@ -1,39 +1,45 @@
|
|
|
1
|
-
import { w, A, F, h, u } from "../../core.js";
|
|
1
|
+
import { w, A, F, h, y, u } from "../../core.js";
|
|
2
2
|
import { clamp } from "../../utils/index.js";
|
|
3
3
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
4
|
-
import "
|
|
5
|
-
import "../../i18n/util.js";
|
|
6
|
-
import "../../i18n/locales/index.js";
|
|
4
|
+
import "../internal/Form/type.js";
|
|
7
5
|
import "../internal/Form/context.js";
|
|
8
6
|
import { FormItem } from "../internal/Form/FormItem.js";
|
|
9
7
|
import "../internal/Form/Form.js";
|
|
10
8
|
import { IconCardNo } from "../internal/icons/IconCardNo.js";
|
|
11
9
|
import { Input } from "../internal/Input/Input.js";
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
10
|
+
import "../internal/Input/type.js";
|
|
11
|
+
import { EFieldType } from "../SecuredFieldsProvider/index.js";
|
|
12
|
+
import { getSupportedCardBrands, getSupportedCardBrandsLengths, finCardBrandInfoByCode, findCardBrandInfo } from "../../utils/card-brand/index.js";
|
|
14
13
|
import { trimAll, limitedToNumber } from "../../utils/format.js";
|
|
15
14
|
const CardNumberField = w((props, ref) => {
|
|
16
|
-
|
|
17
|
-
const { supportedCardBrands = [], className, style, security } = props;
|
|
15
|
+
const { supportedCardBrands = [], className, security, showLabel } = props;
|
|
18
16
|
const inputRef = A(null);
|
|
19
17
|
const formItemRef = A(null);
|
|
20
18
|
F(ref, () => ({
|
|
21
19
|
input: inputRef.current,
|
|
22
20
|
focus: () => {
|
|
23
|
-
var
|
|
24
|
-
(
|
|
21
|
+
var _a;
|
|
22
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
25
23
|
},
|
|
26
24
|
blur: () => {
|
|
27
|
-
var
|
|
28
|
-
(
|
|
25
|
+
var _a;
|
|
26
|
+
(_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
29
27
|
},
|
|
30
28
|
resetValidation: (status, errorTip) => {
|
|
31
|
-
var
|
|
32
|
-
(
|
|
29
|
+
var _a;
|
|
30
|
+
(_a = formItemRef.current) == null ? void 0 : _a.resetValidation(status, [{ message: errorTip }]);
|
|
33
31
|
},
|
|
34
32
|
binValueChanged: (binValue) => {
|
|
35
33
|
setValue(binValue);
|
|
36
34
|
},
|
|
35
|
+
brandChanged: (brand) => {
|
|
36
|
+
if (brand) {
|
|
37
|
+
const brandInfo = finCardBrandInfoByCode(brand);
|
|
38
|
+
setBrandIcon(() => brandInfo == null ? void 0 : brandInfo.icon);
|
|
39
|
+
} else {
|
|
40
|
+
setBrandIcon(void 0);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
37
43
|
getCardBrand: () => findCardBrandInfo(trimAll(value), brands) || {}
|
|
38
44
|
}));
|
|
39
45
|
const { i18n } = useI18n();
|
|
@@ -41,7 +47,13 @@ const CardNumberField = w((props, ref) => {
|
|
|
41
47
|
const [validationStatus, setValidationStatus] = h("");
|
|
42
48
|
const brands = getSupportedCardBrands(supportedCardBrands);
|
|
43
49
|
const brandLengths = getSupportedCardBrandsLengths(brands);
|
|
44
|
-
const
|
|
50
|
+
const [brandIcon, setBrandIcon] = h(void 0);
|
|
51
|
+
y(() => {
|
|
52
|
+
setBrandIcon(value ? () => {
|
|
53
|
+
var _a;
|
|
54
|
+
return (_a = findCardBrandInfo(trimAll(value), brands)) == null ? void 0 : _a.icon;
|
|
55
|
+
} : void 0);
|
|
56
|
+
}, [value]);
|
|
45
57
|
const rule = {
|
|
46
58
|
trigger: ["blur", "submit"],
|
|
47
59
|
validator(value2) {
|
|
@@ -65,7 +77,7 @@ const CardNumberField = w((props, ref) => {
|
|
|
65
77
|
}
|
|
66
78
|
};
|
|
67
79
|
function onInput(event) {
|
|
68
|
-
var
|
|
80
|
+
var _a;
|
|
69
81
|
const { currentTarget, inputType } = event;
|
|
70
82
|
const selectionStart = currentTarget.selectionStart;
|
|
71
83
|
let val = limitedToNumber(currentTarget.value);
|
|
@@ -76,11 +88,11 @@ const CardNumberField = w((props, ref) => {
|
|
|
76
88
|
}
|
|
77
89
|
setValue(currentTarget.value = val);
|
|
78
90
|
currentTarget.setSelectionRange(pos, pos);
|
|
79
|
-
(
|
|
91
|
+
(_a = props.onInput) == null ? void 0 : _a.call(props, event);
|
|
80
92
|
}
|
|
81
93
|
const RightIcon = () => {
|
|
82
94
|
if (validationStatus !== "error") {
|
|
83
|
-
const Icon =
|
|
95
|
+
const Icon = brandIcon ?? IconCardNo;
|
|
84
96
|
return /* @__PURE__ */ u(Icon, { size: 32 });
|
|
85
97
|
}
|
|
86
98
|
};
|
|
@@ -88,12 +100,12 @@ const CardNumberField = w((props, ref) => {
|
|
|
88
100
|
FormItem,
|
|
89
101
|
{
|
|
90
102
|
label: i18n.get("card.cardNumber.label"),
|
|
103
|
+
showLabel,
|
|
91
104
|
path: "number",
|
|
92
105
|
ref: formItemRef,
|
|
93
106
|
rule,
|
|
94
107
|
onValidationStatusChange: setValidationStatus,
|
|
95
108
|
className,
|
|
96
|
-
style,
|
|
97
109
|
children: /* @__PURE__ */ u(
|
|
98
110
|
Input,
|
|
99
111
|
{
|
|
@@ -105,7 +117,7 @@ const CardNumberField = w((props, ref) => {
|
|
|
105
117
|
onInput,
|
|
106
118
|
rightIcon: RightIcon(),
|
|
107
119
|
placeholder: i18n.get("card.cardNumber.placeholder"),
|
|
108
|
-
children: security && /* @__PURE__ */ u("div", { style: "width:100%;height:100%", "data-sf":
|
|
120
|
+
children: security && /* @__PURE__ */ u("div", { style: "width:100%;height:100%", "data-sf": EFieldType.CARD_NUMBER })
|
|
109
121
|
}
|
|
110
122
|
)
|
|
111
123
|
}
|
|
@@ -3,17 +3,16 @@ import { isUndefined } from "../../utils/is.js";
|
|
|
3
3
|
import "../../utils/card-brand/brands.js";
|
|
4
4
|
import "../../utils/system-info/get-browser-info.js";
|
|
5
5
|
import { limitedToNumber } from "../../utils/format.js";
|
|
6
|
+
import { EFieldType } from "../SecuredFieldsProvider/index.js";
|
|
6
7
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
7
|
-
import "
|
|
8
|
-
import "../../i18n/util.js";
|
|
9
|
-
import "../../i18n/locales/index.js";
|
|
8
|
+
import "../internal/Form/type.js";
|
|
10
9
|
import "../internal/Form/context.js";
|
|
11
10
|
import { FormItem } from "../internal/Form/FormItem.js";
|
|
12
11
|
import "../internal/Form/Form.js";
|
|
13
12
|
import { Input } from "../internal/Input/Input.js";
|
|
14
|
-
import
|
|
13
|
+
import "../internal/Input/type.js";
|
|
15
14
|
const CardSecurityCodeField = w((props, ref) => {
|
|
16
|
-
const { className, style, security } = props;
|
|
15
|
+
const { className, style, security, showLabel } = props;
|
|
17
16
|
const inputRef = A(null);
|
|
18
17
|
const formItemRef = A(null);
|
|
19
18
|
F(ref, () => ({
|
|
@@ -60,6 +59,7 @@ const CardSecurityCodeField = w((props, ref) => {
|
|
|
60
59
|
FormItem,
|
|
61
60
|
{
|
|
62
61
|
label: i18n.get("card.cardSecurityCode.label"),
|
|
62
|
+
showLabel,
|
|
63
63
|
path: "securityCode",
|
|
64
64
|
ref: formItemRef,
|
|
65
65
|
rule,
|
|
@@ -75,7 +75,7 @@ const CardSecurityCodeField = w((props, ref) => {
|
|
|
75
75
|
value,
|
|
76
76
|
onInput,
|
|
77
77
|
placeholder: i18n.get("card.cardSecurityCode.placeholder"),
|
|
78
|
-
children: security && /* @__PURE__ */ u("div", { style: "width:100%;height:100%", "data-sf":
|
|
78
|
+
children: security && /* @__PURE__ */ u("div", { style: "width:100%;height:100%", "data-sf": EFieldType.CVV })
|
|
79
79
|
}
|
|
80
80
|
)
|
|
81
81
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { A, h, y, u } from "../../core.js";
|
|
2
2
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
3
3
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
4
|
-
import "../../core/context.js";
|
|
5
4
|
import { finCardBrandInfoByCode } from "../../utils/card-brand/index.js";
|
|
6
5
|
import "../../utils/system-info/get-browser-info.js";
|
|
7
|
-
import "
|
|
8
|
-
import "../../i18n/locales/index.js";
|
|
6
|
+
import "../internal/Form/type.js";
|
|
9
7
|
import "../internal/Form/context.js";
|
|
10
8
|
import { FormItem } from "../internal/Form/FormItem.js";
|
|
11
9
|
import "../internal/Form/Form.js";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { w, A, F, h, u } from "../../core.js";
|
|
2
|
+
import "../internal/Form/type.js";
|
|
3
|
+
import "../internal/Form/context.js";
|
|
4
|
+
import { FormItem } from "../internal/Form/FormItem.js";
|
|
5
|
+
import "../internal/Form/Form.js";
|
|
6
|
+
import { Input } from "../internal/Input/Input.js";
|
|
7
|
+
import "../internal/Input/type.js";
|
|
8
|
+
import { EFieldType } from "../SecuredFieldsProvider/index.js";
|
|
9
|
+
import { finCardBrandInfoByCode, findCardBrandInfo, getSupportedCardBrands } from "../../utils/card-brand/index.js";
|
|
10
|
+
import "../../utils/system-info/get-browser-info.js";
|
|
11
|
+
import { trimAll } from "../../utils/format.js";
|
|
12
|
+
import { IconCardNo } from "../internal/icons/IconCardNo.js";
|
|
13
|
+
import { useBEM } from "../../hooks/useBEM.js";
|
|
14
|
+
import { useI18n } from "../../hooks/useI18n.js";
|
|
15
|
+
const { bem } = useBEM("combined-card-info");
|
|
16
|
+
const CombinedCardInfo = w(
|
|
17
|
+
(props, ref) => {
|
|
18
|
+
const { supportedCardBrands = [], className, showLabel = false, security } = props;
|
|
19
|
+
const inputRef = A(null);
|
|
20
|
+
const formItemRef = A(null);
|
|
21
|
+
const { i18n } = useI18n();
|
|
22
|
+
F(ref, () => ({
|
|
23
|
+
input: inputRef.current,
|
|
24
|
+
focus: () => {
|
|
25
|
+
var _a;
|
|
26
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
27
|
+
},
|
|
28
|
+
blur: () => {
|
|
29
|
+
var _a;
|
|
30
|
+
(_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
31
|
+
},
|
|
32
|
+
resetValidation: (status, errorTip) => {
|
|
33
|
+
var _a;
|
|
34
|
+
(_a = formItemRef.current) == null ? void 0 : _a.resetValidation(status, [{ message: errorTip }]);
|
|
35
|
+
},
|
|
36
|
+
binValueChanged: (binValue2) => {
|
|
37
|
+
setBinValue(binValue2);
|
|
38
|
+
},
|
|
39
|
+
brandChanged: (brand) => {
|
|
40
|
+
if (brand) {
|
|
41
|
+
const brandInfo = finCardBrandInfoByCode(brand);
|
|
42
|
+
setBrandIcon(() => brandInfo == null ? void 0 : brandInfo.icon);
|
|
43
|
+
} else {
|
|
44
|
+
setBrandIcon(void 0);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
getCardBrand: () => {
|
|
48
|
+
return findCardBrandInfo(trimAll(binValue), getSupportedCardBrands(supportedCardBrands)) || {};
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
const rule = {
|
|
52
|
+
trigger: ["submit"],
|
|
53
|
+
validator() {
|
|
54
|
+
if (security) {
|
|
55
|
+
const result = formItemRef.current.getValidateResult();
|
|
56
|
+
if (result.status === "error") {
|
|
57
|
+
throw new Error(result.errors[0].message);
|
|
58
|
+
} else if (result.status === "success") {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const [binValue, setBinValue] = h("");
|
|
66
|
+
const [brandIcon, setBrandIcon] = h(void 0);
|
|
67
|
+
const LeftIcon = () => {
|
|
68
|
+
const Icon = brandIcon ?? IconCardNo;
|
|
69
|
+
return /* @__PURE__ */ u(Icon, { size: 32 });
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ u(
|
|
72
|
+
FormItem,
|
|
73
|
+
{
|
|
74
|
+
showLabel,
|
|
75
|
+
ref: formItemRef,
|
|
76
|
+
label: i18n.get("card.info.label"),
|
|
77
|
+
className,
|
|
78
|
+
path: "cardInfo",
|
|
79
|
+
rule,
|
|
80
|
+
children: /* @__PURE__ */ u(
|
|
81
|
+
Input,
|
|
82
|
+
{
|
|
83
|
+
ref: inputRef,
|
|
84
|
+
leftIcon: LeftIcon(),
|
|
85
|
+
rightIcon: /* @__PURE__ */ u("div", { className: bem("blank-icon") }),
|
|
86
|
+
children: /* @__PURE__ */ u("div", { className: bem(), children: [
|
|
87
|
+
/* @__PURE__ */ u("div", { className: bem("card-number"), "data-sf": EFieldType.CARD_NUMBER }),
|
|
88
|
+
/* @__PURE__ */ u("div", { className: bem("expire-date"), "data-sf": EFieldType.EXPIRE_DATE }),
|
|
89
|
+
/* @__PURE__ */ u("div", { className: bem("cvv"), "data-sf": EFieldType.CVV })
|
|
90
|
+
] })
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
export {
|
|
98
|
+
CombinedCardInfo
|
|
99
|
+
};
|
|
@@ -9,13 +9,12 @@ import { isValuable } from "../../utils/is.js";
|
|
|
9
9
|
import "../../utils/card-brand/brands.js";
|
|
10
10
|
import "../../utils/system-info/get-browser-info.js";
|
|
11
11
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
12
|
-
import "
|
|
13
|
-
import "../../i18n/util.js";
|
|
14
|
-
import "../../i18n/locales/index.js";
|
|
12
|
+
import "../internal/Form/type.js";
|
|
15
13
|
import "../internal/Form/context.js";
|
|
16
14
|
import { FormItem } from "../internal/Form/FormItem.js";
|
|
17
15
|
import "../internal/Form/Form.js";
|
|
18
16
|
import { Input } from "../internal/Input/Input.js";
|
|
17
|
+
import "../internal/Input/type.js";
|
|
19
18
|
class EmailState {
|
|
20
19
|
constructor(email) {
|
|
21
20
|
__publicField(this, "_email");
|