@paykka/card-checkout-ui 0.13.17 → 0.14.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 +53 -25
- package/dist/card-checkout-ui.umd.cjs +53 -25
- package/dist/es/api/modules/boost/index.js +5 -16
- package/dist/es/api/modules/gcash/index.js +5 -16
- package/dist/es/api/modules/get-browser-params.js +1 -4
- package/dist/es/api/modules/grab-pay/index.js +5 -16
- package/dist/es/api/modules/line-pay/index.js +5 -16
- package/dist/es/api/modules/may-bank-qr-pay/index.js +5 -16
- package/dist/es/api/modules/nine-pay/index.js +5 -16
- package/dist/es/api/modules/opay-wallet/index.js +5 -16
- package/dist/es/api/modules/paga-wallet/index.js +5 -16
- package/dist/es/api/modules/paymaya/index.js +5 -16
- package/dist/es/api/modules/shopee-pay/index.js +5 -16
- package/dist/es/api/modules/threeDS/index.js +16 -2
- package/dist/es/api/modules/tng-wallet/index.js +5 -16
- package/dist/es/api/modules/zalopay/index.js +5 -16
- package/dist/es/components/AccordionItem/AccordionItem.js +0 -2
- package/dist/es/components/AddressField/index.js +13 -3
- package/dist/es/components/AliPay/index.js +64 -62
- package/dist/es/components/ApplePay/index.js +42 -39
- package/dist/es/components/CPFField/index.js +2 -1
- package/dist/es/components/Card/index.js +160 -133
- package/dist/es/components/CardExpireDateField/index.js +2 -1
- package/dist/es/components/CardNo/index.js +2 -2
- package/dist/es/components/CardNumberField/index.js +2 -1
- package/dist/es/components/CardSecurityCodeField/index.js +2 -1
- package/dist/es/components/CardSelector/index.js +3 -2
- package/dist/es/components/DropIn/index.js +24 -21
- package/dist/es/components/GooglePay/index.js +97 -88
- package/dist/es/components/PaymentButton/index.js +1 -1
- package/dist/es/components/SecuredFieldsProvider/index.js +31 -9
- package/dist/es/components/SecuredIframe/index.js +40 -23
- package/dist/es/components/SubmitButton/index.js +1 -1
- package/dist/es/components/ThreeDS/index.js +29 -12
- package/dist/es/components/WechatPay/index.js +70 -69
- package/dist/es/components/business/PhoneField/PhoneField.js +1 -0
- package/dist/es/components/index.js +7 -7
- package/dist/es/components/internal/CheckBox/CheckBox.js +2 -2
- package/dist/es/components/internal/Input/Input.js +1 -1
- package/dist/es/components/internal/Select/Select.js +4 -1
- package/dist/es/components/internal/icons/IconArrowDown.js +4 -4
- package/dist/es/components/internal/icons/IconBancontact.js +69 -14
- package/dist/es/components/internal/icons/IconBlik.js +541 -21
- package/dist/es/components/internal/icons/IconIdeal.js +61 -29
- package/dist/es/components/internal/icons/IconSkrill.js +14 -7
- package/dist/es/components/internal/icons/IconTrustly.js +11 -44
- package/dist/es/components/wallets/Bancontact/Bancontact.js +11 -8
- package/dist/es/components/wallets/Blik/Blik.js +12 -9
- package/dist/es/components/wallets/Boost/Boost.js +183 -0
- package/dist/es/components/wallets/Boost/boost2.js +1 -0
- package/dist/es/components/wallets/Boost/index.js +1 -0
- package/dist/es/components/wallets/Boost/type.js +1 -0
- package/dist/es/components/wallets/GCash/GCash.js +62 -252
- package/dist/es/components/wallets/GrabPay/GrabPay.js +183 -0
- package/dist/es/components/wallets/GrabPay/grab-pay.js +1 -0
- package/dist/es/components/wallets/GrabPay/index.js +1 -0
- package/dist/es/components/wallets/GrabPay/type.js +1 -0
- package/dist/es/components/wallets/IDeal/IDeal.js +11 -8
- package/dist/es/components/wallets/LinePay/LinePay.js +183 -0
- package/dist/es/components/wallets/LinePay/index.js +1 -0
- package/dist/es/components/wallets/LinePay/line-pay.js +1 -0
- package/dist/es/components/wallets/LinePay/type.js +1 -0
- package/dist/es/components/wallets/MayBankQRPay/MayBankQRPay.js +187 -0
- package/dist/es/components/wallets/MayBankQRPay/index.js +1 -0
- package/dist/es/components/wallets/MayBankQRPay/may-bank-qr-pay.js +1 -0
- package/dist/es/components/wallets/MayBankQRPay/type.js +1 -0
- package/dist/es/components/wallets/NinePay/NinePay.js +185 -0
- package/dist/es/components/wallets/NinePay/index.js +1 -0
- package/dist/es/components/wallets/NinePay/nine-pay.js +1 -0
- package/dist/es/components/wallets/NinePay/type.js +1 -0
- package/dist/es/components/wallets/OVO/OVO.js +7 -5
- package/dist/es/components/wallets/OpayWallet/OpayWallet.js +56 -218
- package/dist/es/components/wallets/P24/P24.js +11 -8
- package/dist/es/components/wallets/PagaWallet/PagaWallet.js +56 -218
- package/dist/es/components/wallets/Paymaya/Paymaya.js +56 -221
- package/dist/es/components/wallets/PicPay/PicPay.js +50 -47
- package/dist/es/components/wallets/Pix/Pix.js +44 -48
- package/dist/es/components/wallets/ShopeePay/ShopeePay.js +185 -0
- package/dist/es/components/wallets/ShopeePay/index.js +1 -0
- package/dist/es/components/wallets/ShopeePay/shopee-pay.js +1 -0
- package/dist/es/components/wallets/ShopeePay/type.js +1 -0
- package/dist/es/components/wallets/Skrill/Skrill.js +28 -26
- package/dist/es/components/wallets/TNGWallet/TNGWallet.js +185 -0
- package/dist/es/components/wallets/TNGWallet/index.js +1 -0
- package/dist/es/components/wallets/TNGWallet/tng-wallet.js +1 -0
- package/dist/es/components/wallets/TNGWallet/type.js +1 -0
- package/dist/es/components/wallets/Trustly/Trustly.js +15 -15
- package/dist/es/components/wallets/Vietqr/Vietqr.js +60 -248
- package/dist/es/components/wallets/Zalopay/Zalopay.js +61 -249
- package/dist/es/components/wallets/index.js +7 -0
- package/dist/es/core/checkout.js +19 -45
- package/dist/es/core/logger.js +1 -1
- package/dist/es/core/payment.js +65 -0
- package/dist/es/hooks/useBaseWallet.js +20 -18
- package/dist/es/hooks/usePayState.js +37 -25
- package/dist/es/hooks/usePayment.js +1 -14
- package/dist/es/hooks/useRetry.js +50 -26
- package/dist/es/index.js +7 -7
- package/dist/es/out/base-fraud-detection.js +4 -1
- package/dist/es/out/fraud-detection.js +12 -13
- package/dist/es/out/worldpay-ddc-manager.js +7 -14
- package/dist/es/out/worldpay-ddc.js +7 -5
- package/dist/es/style.css +1 -1
- package/dist/es/types/event.js +1 -0
- package/dist/es/types/message.js +2 -0
- package/dist/es/utils/payment.js +12 -12
- package/dist/es/utils/system-info/is-ua-webview.js +1 -20
- package/dist/style.css +1 -1
- package/dist/types/api/modules/threeDS/index.d.ts +7 -0
- package/dist/types/components/AddressField/type.d.ts +2 -2
- package/dist/types/components/CPFField/type.d.ts +1 -1
- package/dist/types/components/CardExpireDateField/type.d.ts +1 -1
- package/dist/types/components/CardNo/type.d.ts +3 -2
- package/dist/types/components/CardNumberField/type.d.ts +1 -1
- package/dist/types/components/CardSecurityCodeField/type.d.ts +1 -1
- package/dist/types/components/CardSelector/type.d.ts +4 -4
- package/dist/types/components/GooglePay/createGooglePay.d.ts +1 -1
- package/dist/types/components/GooglePay/type.d.ts +6 -0
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +2 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +0 -6
- package/dist/types/components/index.d.ts +0 -7
- package/dist/types/components/internal/CheckBox/type.d.ts +2 -1
- package/dist/types/components/internal/Select/type.d.ts +1 -1
- package/dist/types/components/internal/icons/IconArrowDown.d.ts +1 -1
- package/dist/types/components/{Boost → wallets/Boost}/Boost.d.ts +9 -4
- package/dist/types/components/{Boost → wallets/Boost}/type.d.ts +2 -2
- package/dist/types/components/wallets/GCash/GCash.d.ts +5 -0
- package/dist/types/components/{GrabPay → wallets/GrabPay}/GrabPay.d.ts +4 -4
- package/dist/types/components/wallets/GrabPay/type.d.ts +17 -0
- package/dist/types/components/{LinePay → wallets/LinePay}/LinePay.d.ts +9 -4
- package/dist/types/components/{LinePay → wallets/LinePay}/type.d.ts +2 -2
- package/dist/types/components/wallets/MayBankQRPay/MayBankQRPay.d.ts +15 -0
- package/dist/types/components/{MayBankQRPay → wallets/MayBankQRPay}/type.d.ts +2 -2
- package/dist/types/components/wallets/NinePay/NinePay.d.ts +15 -0
- package/dist/types/components/{NinePay → wallets/NinePay}/type.d.ts +2 -2
- package/dist/types/components/wallets/OpayWallet/OpayWallet.d.ts +5 -0
- package/dist/types/components/wallets/PagaWallet/PagaWallet.d.ts +5 -0
- package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +5 -0
- package/dist/types/components/{ShopeePay → wallets/ShopeePay}/ShopeePay.d.ts +9 -4
- package/dist/types/components/{ShopeePay → wallets/ShopeePay}/type.d.ts +2 -2
- package/dist/types/components/wallets/Skrill/type.d.ts +0 -12
- package/dist/types/components/{TNGWallet → wallets/TNGWallet}/TNGWallet.d.ts +9 -4
- package/dist/types/components/{TNGWallet → wallets/TNGWallet}/type.d.ts +2 -2
- package/dist/types/components/wallets/Vietqr/Vietqr.d.ts +5 -0
- package/dist/types/components/wallets/Zalopay/Zalopay.d.ts +5 -0
- package/dist/types/components/wallets/index.d.ts +7 -0
- package/dist/types/core/checkout.d.ts +2 -9
- package/dist/types/core/payment.d.ts +21 -0
- package/dist/types/hooks/useBaseWallet.d.ts +2 -2
- package/dist/types/hooks/usePayState.d.ts +3 -1
- package/dist/types/hooks/useRetry.console-tests.d.ts +41 -0
- package/dist/types/hooks/useRetry.d.ts +22 -3
- package/dist/types/out/base-fraud-detection.d.ts +1 -0
- package/dist/types/out/config.d.ts +1 -1
- package/dist/types/out/fraud-detection.d.ts +2 -8
- package/dist/types/out/types.d.ts +3 -1
- package/dist/types/out/worldpay-ddc-manager.d.ts +6 -7
- package/dist/types/types/event.d.ts +6 -1
- package/dist/types/types/message.d.ts +24 -3
- package/dist/types/types/payment.d.ts +4 -0
- package/dist/types/utils/iframe.d.ts +1 -1
- package/dist/types/utils/payment.d.ts +10 -10
- package/package.json +9 -5
- package/dist/es/components/Boost/index.js +0 -349
- package/dist/es/components/GrabPay/index.js +0 -349
- package/dist/es/components/LinePay/index.js +0 -349
- package/dist/es/components/MayBankQRPay/index.js +0 -355
- package/dist/es/components/NinePay/index.js +0 -349
- package/dist/es/components/ShopeePay/index.js +0 -349
- package/dist/es/components/TNGWallet/index.js +0 -349
- package/dist/types/components/GrabPay/type.d.ts +0 -28
- package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +0 -10
- package/dist/types/components/NinePay/NinePay.d.ts +0 -10
- /package/dist/types/components/{Boost → wallets/Boost}/index.d.ts +0 -0
- /package/dist/types/components/{GrabPay → wallets/GrabPay}/index.d.ts +0 -0
- /package/dist/types/components/{LinePay → wallets/LinePay}/index.d.ts +0 -0
- /package/dist/types/components/{MayBankQRPay → wallets/MayBankQRPay}/index.d.ts +0 -0
- /package/dist/types/components/{NinePay → wallets/NinePay}/index.d.ts +0 -0
- /package/dist/types/components/{ShopeePay → wallets/ShopeePay}/index.d.ts +0 -0
- /package/dist/types/components/{TNGWallet → wallets/TNGWallet}/index.d.ts +0 -0
|
@@ -12,7 +12,7 @@ import { createPromise } from "../../utils/create-promise.js";
|
|
|
12
12
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
13
13
|
import { usePayState } from "../../hooks/usePayState.js";
|
|
14
14
|
import { useRetry } from "../../hooks/useRetry.js";
|
|
15
|
-
import { AddressField } from "../AddressField/index.js";
|
|
15
|
+
import { DEFAULT_ADDRESS, AddressField } from "../AddressField/index.js";
|
|
16
16
|
import { CardBrands } from "../CardBrands/index.js";
|
|
17
17
|
import { CardExpireDateField } from "../CardExpireDateField/index.js";
|
|
18
18
|
import { CardHolderNameField } from "../CardHolderNameField/index.js";
|
|
@@ -35,11 +35,11 @@ import { CombinedCardInfo } from "../CombinedCardInfo/index.js";
|
|
|
35
35
|
import { cardBrandCodes } from "../../utils/card-brand/brands.js";
|
|
36
36
|
import { findCardBrand } from "../../utils/card-brand/index.js";
|
|
37
37
|
import { separateInputStyle } from "../../utils/style.js";
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
const CURR_PAYMENT_METHOD = PaymentMethod.BANKCARD;
|
|
38
|
+
import { normalizedClass, trimAll, limitedToNumber, formatAmount } from "../../utils/format.js";
|
|
39
|
+
import { formatPaymentResult, processPaymentStatus } from "../../utils/payment.js";
|
|
41
40
|
const { bem } = useBEM("card");
|
|
42
41
|
const fieldClassNames = bem("field");
|
|
42
|
+
const CURR_PAYMENT_METHOD = PaymentMethod.BANKCARD;
|
|
43
43
|
const Card = w((props, ref) => {
|
|
44
44
|
var _a, _b;
|
|
45
45
|
const {
|
|
@@ -56,10 +56,9 @@ const Card = w((props, ref) => {
|
|
|
56
56
|
core,
|
|
57
57
|
hidePaymentButton = false
|
|
58
58
|
} = props;
|
|
59
|
-
console.log(props);
|
|
60
59
|
const addressCore = core.getAddressCore();
|
|
61
60
|
const emailState = createEmailCore();
|
|
62
|
-
const { i18n, fraudDetection, sessionReady } = usePayState(session, core);
|
|
61
|
+
const { i18n, fraudDetection, sessionReady, disabled } = usePayState(session, core);
|
|
63
62
|
const addressFieldRef = A(null);
|
|
64
63
|
const emailFieldRef = A(null);
|
|
65
64
|
const combinedCardInfoRef = A(null);
|
|
@@ -71,15 +70,7 @@ const Card = w((props, ref) => {
|
|
|
71
70
|
securityCode: "",
|
|
72
71
|
holderName: "",
|
|
73
72
|
cardInfo: "",
|
|
74
|
-
address: {
|
|
75
|
-
country: void 0,
|
|
76
|
-
province: void 0,
|
|
77
|
-
city: void 0,
|
|
78
|
-
area: void 0,
|
|
79
|
-
postCode: void 0,
|
|
80
|
-
address1: void 0,
|
|
81
|
-
address2: void 0
|
|
82
|
-
}
|
|
73
|
+
address: { ...DEFAULT_ADDRESS }
|
|
83
74
|
});
|
|
84
75
|
const [validated, setValidated] = h(false);
|
|
85
76
|
const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
|
|
@@ -96,25 +87,27 @@ const Card = w((props, ref) => {
|
|
|
96
87
|
const [inputStyle, setInputStyle] = h({});
|
|
97
88
|
const [splitCardInfo] = h(cardInfoLayout === "split");
|
|
98
89
|
const currentBin = A("");
|
|
90
|
+
const [hiddenIframeName, setHiddenIframeName] = h("");
|
|
99
91
|
F(ref, () => ({
|
|
100
92
|
checkThreeDS,
|
|
101
93
|
updateAddress: () => {
|
|
102
94
|
var _a2;
|
|
103
95
|
if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
|
|
104
96
|
return;
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
(
|
|
108
|
-
|
|
97
|
+
const address = addressCore.getAddressState();
|
|
98
|
+
form.address = address;
|
|
99
|
+
setForm(form);
|
|
100
|
+
(_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(address);
|
|
101
|
+
validateFormSilently();
|
|
109
102
|
},
|
|
110
103
|
updateEmail: () => {
|
|
111
104
|
var _a2;
|
|
112
105
|
if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
|
|
113
106
|
return;
|
|
114
|
-
|
|
115
|
-
setForm(
|
|
107
|
+
form.email = emailState.email;
|
|
108
|
+
setForm(form);
|
|
116
109
|
(_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
|
|
117
|
-
|
|
110
|
+
validateFormSilently();
|
|
118
111
|
},
|
|
119
112
|
payment: () => {
|
|
120
113
|
hidePaymentButton && onSubmit();
|
|
@@ -138,9 +131,8 @@ const Card = w((props, ref) => {
|
|
|
138
131
|
setFieldStatus({ ...field });
|
|
139
132
|
};
|
|
140
133
|
const initElementStyles = () => {
|
|
141
|
-
if (!styles)
|
|
134
|
+
if (!styles)
|
|
142
135
|
return;
|
|
143
|
-
}
|
|
144
136
|
const { input } = separateInputStyle(styles);
|
|
145
137
|
input && setInputStyle(input);
|
|
146
138
|
};
|
|
@@ -151,9 +143,8 @@ const Card = w((props, ref) => {
|
|
|
151
143
|
};
|
|
152
144
|
y(() => {
|
|
153
145
|
var _a2, _b2;
|
|
154
|
-
if (!sessionReady)
|
|
146
|
+
if (!sessionReady)
|
|
155
147
|
return;
|
|
156
|
-
}
|
|
157
148
|
const { status, supportMethods = [], bill = {}, sessionMode, country } = (session == null ? void 0 : session.checkout) || {};
|
|
158
149
|
if (sessionMode === SessionMode.DROP_IN && !isDropIn) {
|
|
159
150
|
(_b2 = (_a2 = props.core.config).onInitError) == null ? void 0 : _b2.call(
|
|
@@ -162,9 +153,8 @@ const Card = w((props, ref) => {
|
|
|
162
153
|
);
|
|
163
154
|
return;
|
|
164
155
|
}
|
|
165
|
-
if (!intersection(supportMethods, CardPaymentMethods).length)
|
|
156
|
+
if (!intersection(supportMethods, CardPaymentMethods).length)
|
|
166
157
|
return;
|
|
167
|
-
}
|
|
168
158
|
initFieldStatus();
|
|
169
159
|
initElementStyles();
|
|
170
160
|
setSecurity(sessionMode !== SessionMode.HOSTED);
|
|
@@ -183,7 +173,7 @@ const Card = w((props, ref) => {
|
|
|
183
173
|
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
184
174
|
setSubmitButtonStatus("unSubmit");
|
|
185
175
|
(_a2 = props.onTimeout) == null ? void 0 : _a2.call(props, "retry", getPaymentMethodContext());
|
|
186
|
-
core.
|
|
176
|
+
core.payment.resetCurrPaymentMethod();
|
|
187
177
|
},
|
|
188
178
|
[i18n, props.onTimeout]
|
|
189
179
|
);
|
|
@@ -199,18 +189,19 @@ const Card = w((props, ref) => {
|
|
|
199
189
|
const processOnError = (error) => {
|
|
200
190
|
var _a2;
|
|
201
191
|
(_a2 = props.onError) == null ? void 0 : _a2.call(props, error, getPaymentMethodContext());
|
|
202
|
-
core.
|
|
192
|
+
core.payment.resetCurrPaymentMethod();
|
|
203
193
|
};
|
|
204
|
-
const { start: startReFetchPayInfo } = useRetry(
|
|
205
|
-
|
|
206
|
-
|
|
194
|
+
const { start: startReFetchPayInfo } = useRetry(
|
|
195
|
+
(timeout) => pay(true, timeout),
|
|
196
|
+
{
|
|
197
|
+
onTimeout: () => onTimeout(i18n.get("common.queryTimeout"))
|
|
198
|
+
}
|
|
199
|
+
);
|
|
207
200
|
const validatePromise = A(createPromise());
|
|
208
201
|
const onValidated = (data) => {
|
|
209
202
|
fieldValidStatusMap.current[data.fieldType].status = data.status;
|
|
210
203
|
const results = Object.values(fieldValidStatusMap.current);
|
|
211
|
-
if (results.includes(null)) {
|
|
212
|
-
return;
|
|
213
|
-
} else {
|
|
204
|
+
if (!results.includes(null)) {
|
|
214
205
|
const validateResult = results.every((result) => result.status === "success");
|
|
215
206
|
if (validateResult) {
|
|
216
207
|
validatePromise.current.resolve(true);
|
|
@@ -219,6 +210,9 @@ const Card = w((props, ref) => {
|
|
|
219
210
|
}
|
|
220
211
|
}
|
|
221
212
|
};
|
|
213
|
+
const onHiddenIframeReady = (data) => {
|
|
214
|
+
setHiddenIframeName(data.name);
|
|
215
|
+
};
|
|
222
216
|
const validateCombineCardInfo = async () => {
|
|
223
217
|
var _a2;
|
|
224
218
|
validatePromise.current = createPromise();
|
|
@@ -253,7 +247,7 @@ const Card = w((props, ref) => {
|
|
|
253
247
|
});
|
|
254
248
|
}
|
|
255
249
|
const getPaymentParams = async () => {
|
|
256
|
-
var _a2
|
|
250
|
+
var _a2;
|
|
257
251
|
const cardNo = trimAll(form.number);
|
|
258
252
|
const cardBrand = findCardBrand(cardNo);
|
|
259
253
|
const [expMonth, expYear] = form.expireDate.split("/");
|
|
@@ -269,10 +263,6 @@ const Card = w((props, ref) => {
|
|
|
269
263
|
paymentMethod = cardBrand.code;
|
|
270
264
|
}
|
|
271
265
|
}
|
|
272
|
-
let cardBin;
|
|
273
|
-
if (security) {
|
|
274
|
-
cardBin = splitCardInfo ? (_b2 = cardNumberFieldRef.current) == null ? void 0 : _b2.binValue() : (_c = combinedCardInfoRef.current) == null ? void 0 : _c.binValue();
|
|
275
|
-
}
|
|
276
266
|
return {
|
|
277
267
|
sessionId: session.sessionId,
|
|
278
268
|
clientKey: session.clientKey,
|
|
@@ -303,7 +293,9 @@ const Card = w((props, ref) => {
|
|
|
303
293
|
},
|
|
304
294
|
browser: await getBrowserParams({
|
|
305
295
|
fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId({
|
|
306
|
-
bin:
|
|
296
|
+
bin: limitedToNumber(form.number).slice(0, 9),
|
|
297
|
+
// 快捷支付场景没有 bin,不需要传 hiddenIframeName
|
|
298
|
+
hiddenIframeName: isFastPayment ? "" : hiddenIframeName
|
|
307
299
|
}))
|
|
308
300
|
})
|
|
309
301
|
};
|
|
@@ -311,6 +303,7 @@ const Card = w((props, ref) => {
|
|
|
311
303
|
async function pay(search = false, timeout) {
|
|
312
304
|
var _a2, _b2, _c, _d, _e;
|
|
313
305
|
try {
|
|
306
|
+
core.payment.currPaymentMethod.value = CURR_PAYMENT_METHOD;
|
|
314
307
|
const requestOptions = { locale: i18n.locale, timeout };
|
|
315
308
|
let res = null;
|
|
316
309
|
if (search) {
|
|
@@ -370,43 +363,62 @@ const Card = w((props, ref) => {
|
|
|
370
363
|
setThreeDSInfo(void 0);
|
|
371
364
|
checkThreeDS();
|
|
372
365
|
};
|
|
373
|
-
const processAfterPayment = (res, search = false) => {
|
|
374
|
-
var _a2
|
|
375
|
-
const {
|
|
366
|
+
const processAfterPayment = async (res, search = false) => {
|
|
367
|
+
var _a2;
|
|
368
|
+
const { errorMessage, errorCode, payInfo = {}, sessionId } = res;
|
|
376
369
|
const { threeDSUrl } = payInfo;
|
|
377
370
|
sessionId && (session.sessionId = sessionId);
|
|
378
|
-
!search
|
|
379
|
-
|
|
380
|
-
|
|
371
|
+
if (!search) {
|
|
372
|
+
(_a2 = props.onSubmitResponse) == null ? void 0 : _a2.call(props, res, {
|
|
373
|
+
...getPaymentMethodContext(),
|
|
374
|
+
orderId: res.orderId,
|
|
375
|
+
sessionId: session.sessionId
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
let end = true;
|
|
379
|
+
await processPaymentStatus(res, {
|
|
380
|
+
onProcessing: () => {
|
|
381
|
+
!search && startReFetchPayInfo();
|
|
382
|
+
end = false;
|
|
383
|
+
},
|
|
384
|
+
onAuthorized: () => {
|
|
385
|
+
var _a3;
|
|
381
386
|
setSubmitButtonStatus("unSubmit");
|
|
382
|
-
|
|
387
|
+
(_a3 = props.onAuthorized) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
388
|
+
},
|
|
389
|
+
onInThreeDS: () => {
|
|
390
|
+
if (threeDSUrl) {
|
|
391
|
+
processThreeDS(threeDSUrl, false);
|
|
392
|
+
} else {
|
|
393
|
+
end = false;
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
onInPreviousThreeDS: () => {
|
|
397
|
+
if (threeDSUrl) {
|
|
398
|
+
processThreeDS(threeDSUrl, true);
|
|
399
|
+
} else {
|
|
400
|
+
end = false;
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
onSuccess: () => {
|
|
383
404
|
processOnSuccess(res);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
405
|
+
},
|
|
406
|
+
onExpired: () => {
|
|
407
|
+
var _a3;
|
|
408
|
+
setSubmitButtonStatus("unSubmit");
|
|
409
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
410
|
+
},
|
|
411
|
+
onFailure: () => {
|
|
388
412
|
errorMessage && setErrorMsg(errorMessage);
|
|
389
413
|
setSubmitButtonStatus("unSubmit");
|
|
390
414
|
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
391
|
-
}
|
|
415
|
+
},
|
|
416
|
+
onDefault: () => {
|
|
417
|
+
core.payment.resetCurrPaymentMethod();
|
|
392
418
|
setSubmitButtonStatus("unSubmit");
|
|
393
|
-
(_b2 = props.onAuthorized) == null ? void 0 : _b2.call(props, getPaymentMethodContext());
|
|
394
|
-
} else if (orderStatus === "IN_THREED") {
|
|
395
|
-
threeDSUrl && processThreeDS(threeDSUrl, false);
|
|
396
|
-
} else if (orderStatus === "IN_PREVIOUS_THREED") {
|
|
397
|
-
threeDSUrl && processThreeDS(threeDSUrl, true);
|
|
398
419
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
processOnSuccess(res);
|
|
402
|
-
return { end: true };
|
|
403
|
-
} else if (status === "EXPIRED") {
|
|
404
|
-
setSubmitButtonStatus("unSubmit");
|
|
405
|
-
(_c = props.onExpired) == null ? void 0 : _c.call(props, getPaymentMethodContext());
|
|
406
|
-
return { end: true };
|
|
407
|
-
}
|
|
408
|
-
setSubmitButtonStatus("unSubmit");
|
|
409
|
-
return { end: true };
|
|
420
|
+
});
|
|
421
|
+
return { end };
|
|
410
422
|
};
|
|
411
423
|
const processPaymentError = (error) => {
|
|
412
424
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
@@ -414,16 +426,12 @@ const Card = w((props, ref) => {
|
|
|
414
426
|
setSubmitButtonStatus("unSubmit");
|
|
415
427
|
processOnError(new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
|
|
416
428
|
};
|
|
417
|
-
const
|
|
429
|
+
const validateFormSilently = () => {
|
|
418
430
|
var _a2;
|
|
419
|
-
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() =>
|
|
420
|
-
setValidated(true);
|
|
421
|
-
}).catch(() => {
|
|
422
|
-
setValidated(false);
|
|
423
|
-
});
|
|
431
|
+
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => setValidated(true)).catch(() => setValidated(false));
|
|
424
432
|
};
|
|
425
433
|
y(() => {
|
|
426
|
-
|
|
434
|
+
validateFormSilently();
|
|
427
435
|
}, [form]);
|
|
428
436
|
const Button = () => {
|
|
429
437
|
var _a2;
|
|
@@ -435,6 +443,7 @@ const Card = w((props, ref) => {
|
|
|
435
443
|
{
|
|
436
444
|
className: bem("button"),
|
|
437
445
|
status: submitButtonStatus,
|
|
446
|
+
disabled,
|
|
438
447
|
text,
|
|
439
448
|
loadingText: i18n.get("common.payProcessing"),
|
|
440
449
|
successText: i18n.get("common.paySuccess"),
|
|
@@ -451,7 +460,7 @@ const Card = w((props, ref) => {
|
|
|
451
460
|
}
|
|
452
461
|
);
|
|
453
462
|
async function checkThreeDS(search = false, timeout = 2e4) {
|
|
454
|
-
var _a2, _b2
|
|
463
|
+
var _a2, _b2;
|
|
455
464
|
if (!session)
|
|
456
465
|
return { end: true };
|
|
457
466
|
try {
|
|
@@ -467,42 +476,48 @@ const Card = w((props, ref) => {
|
|
|
467
476
|
timeout
|
|
468
477
|
}
|
|
469
478
|
);
|
|
470
|
-
const {
|
|
471
|
-
|
|
472
|
-
|
|
479
|
+
const { errorMessage, errorCode } = res;
|
|
480
|
+
let end = true;
|
|
481
|
+
await processPaymentStatus(res, {
|
|
482
|
+
onProcessing: () => {
|
|
473
483
|
startReFetchPayInfo();
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
478
|
-
} else if (orderStatus === "AUTHORIZED") {
|
|
484
|
+
},
|
|
485
|
+
onAuthorized: () => {
|
|
486
|
+
var _a3;
|
|
479
487
|
setSubmitButtonStatus("unSubmit");
|
|
480
|
-
(
|
|
481
|
-
}
|
|
488
|
+
(_a3 = props.onAuthorized) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
489
|
+
},
|
|
490
|
+
onInThreeDS: () => {
|
|
482
491
|
setSubmitButtonStatus("loading");
|
|
483
492
|
!search && startReFetchCardPay3DSInfo();
|
|
484
|
-
|
|
485
|
-
}
|
|
493
|
+
end = false;
|
|
494
|
+
},
|
|
495
|
+
onInPreviousThreeDS: () => {
|
|
496
|
+
setSubmitButtonStatus("unSubmit");
|
|
486
497
|
setErrorMsg(i18n.get("common.pay3DSIncomplete"));
|
|
498
|
+
},
|
|
499
|
+
onSuccess: () => {
|
|
500
|
+
processOnSuccess(res);
|
|
501
|
+
stopReFetchCardPay3DSInfo();
|
|
502
|
+
},
|
|
503
|
+
onExpired: () => {
|
|
504
|
+
var _a3;
|
|
505
|
+
setSubmitButtonStatus("unSubmit");
|
|
506
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
507
|
+
stopReFetchCardPay3DSInfo();
|
|
508
|
+
},
|
|
509
|
+
onFailure: () => {
|
|
510
|
+
errorMessage && setErrorMsg(errorMessage);
|
|
487
511
|
setSubmitButtonStatus("unSubmit");
|
|
488
|
-
|
|
512
|
+
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
513
|
+
},
|
|
514
|
+
onDefault: () => {
|
|
515
|
+
core.payment.resetCurrPaymentMethod();
|
|
489
516
|
setSubmitButtonStatus("unSubmit");
|
|
517
|
+
stopReFetchCardPay3DSInfo();
|
|
490
518
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
} else if (status === "SUCCESS") {
|
|
494
|
-
processOnSuccess(res);
|
|
495
|
-
stopReFetchCardPay3DSInfo();
|
|
496
|
-
return { end: true };
|
|
497
|
-
} else if (status === "EXPIRED") {
|
|
498
|
-
setSubmitButtonStatus("unSubmit");
|
|
499
|
-
(_d = props.onExpired) == null ? void 0 : _d.call(props, getPaymentMethodContext());
|
|
500
|
-
stopReFetchCardPay3DSInfo();
|
|
501
|
-
return { end: true };
|
|
502
|
-
}
|
|
503
|
-
setSubmitButtonStatus("unSubmit");
|
|
504
|
-
stopReFetchCardPay3DSInfo();
|
|
505
|
-
return { end: true };
|
|
519
|
+
});
|
|
520
|
+
return { end };
|
|
506
521
|
} catch (error) {
|
|
507
522
|
if (isTimeoutError(error)) {
|
|
508
523
|
if (search) {
|
|
@@ -520,17 +535,15 @@ const Card = w((props, ref) => {
|
|
|
520
535
|
}
|
|
521
536
|
const isFastPayment = T(() => {
|
|
522
537
|
var _a2;
|
|
523
|
-
if (!(session == null ? void 0 : session.checkout))
|
|
538
|
+
if (!(session == null ? void 0 : session.checkout))
|
|
524
539
|
return;
|
|
525
|
-
}
|
|
526
540
|
const isPurchase = (session == null ? void 0 : session.checkout.paymentType) === PaymentType.PURCHASE;
|
|
527
541
|
const hasCardTokens = !!((_a2 = session == null ? void 0 : session.checkout.tokens) == null ? void 0 : _a2.length);
|
|
528
542
|
return isPurchase && hasCardTokens;
|
|
529
543
|
}, [session == null ? void 0 : session.checkout]);
|
|
530
544
|
const isShowStoreCheckBox = T(() => {
|
|
531
|
-
if (!(session == null ? void 0 : session.checkout))
|
|
545
|
+
if (!(session == null ? void 0 : session.checkout))
|
|
532
546
|
return;
|
|
533
|
-
}
|
|
534
547
|
return (session == null ? void 0 : session.checkout.paymentType) === PaymentType.PURCHASE && (session == null ? void 0 : session.checkout.storePaymentMethod);
|
|
535
548
|
}, [session == null ? void 0 : session.checkout]);
|
|
536
549
|
const StoreCheckBox = () => {
|
|
@@ -541,6 +554,7 @@ const Card = w((props, ref) => {
|
|
|
541
554
|
CheckBox,
|
|
542
555
|
{
|
|
543
556
|
label: i18n.get("card.storeInfo"),
|
|
557
|
+
disabled,
|
|
544
558
|
checked: storePaymentMethod,
|
|
545
559
|
onChange: onCheck
|
|
546
560
|
}
|
|
@@ -555,7 +569,7 @@ const Card = w((props, ref) => {
|
|
|
555
569
|
(_a3 = formRef.current) == null ? void 0 : _a3.resetValidation();
|
|
556
570
|
setIsEditOtherCard(false);
|
|
557
571
|
};
|
|
558
|
-
return isPurchase && hasCardTokens && /* @__PURE__ */ u("div", { className: bem("change-box"), onClick, children: [
|
|
572
|
+
return isPurchase && hasCardTokens && /* @__PURE__ */ u("div", { className: bem("change-box", { disabled }), onClick, children: [
|
|
559
573
|
/* @__PURE__ */ u(IconSwitch, {}),
|
|
560
574
|
/* @__PURE__ */ u("span", { style: { marginLeft: "2px" }, children: i18n.get("card.cardSelector.change") })
|
|
561
575
|
] });
|
|
@@ -568,9 +582,8 @@ const Card = w((props, ref) => {
|
|
|
568
582
|
const onClickChangeCard = () => {
|
|
569
583
|
var _a2;
|
|
570
584
|
const tokens = ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.tokens) || [];
|
|
571
|
-
if (tokens.length > 1)
|
|
585
|
+
if (tokens.length > 1)
|
|
572
586
|
return;
|
|
573
|
-
}
|
|
574
587
|
onEditOtherCard();
|
|
575
588
|
};
|
|
576
589
|
const onCardChange = (option) => {
|
|
@@ -579,7 +592,7 @@ const Card = w((props, ref) => {
|
|
|
579
592
|
};
|
|
580
593
|
const setFormRef = (dom) => {
|
|
581
594
|
formRef.current = dom;
|
|
582
|
-
dom &&
|
|
595
|
+
dom && validateFormSilently();
|
|
583
596
|
};
|
|
584
597
|
const cardNumberFieldRef = A(null);
|
|
585
598
|
const cardExpireDateFieldRef = A(null);
|
|
@@ -640,7 +653,7 @@ const Card = w((props, ref) => {
|
|
|
640
653
|
(_d = fieldRef.current) == null ? void 0 : _d.resetValidation(data.status, error);
|
|
641
654
|
}
|
|
642
655
|
setTimeout(() => {
|
|
643
|
-
|
|
656
|
+
validateFormSilently();
|
|
644
657
|
}, 100);
|
|
645
658
|
};
|
|
646
659
|
const onBrand = (data) => {
|
|
@@ -672,16 +685,20 @@ const Card = w((props, ref) => {
|
|
|
672
685
|
{
|
|
673
686
|
ref: emailFieldRef,
|
|
674
687
|
value: form.email,
|
|
675
|
-
disabled: fieldStatus == null ? void 0 : fieldStatus.email.disabled
|
|
688
|
+
disabled: (fieldStatus == null ? void 0 : fieldStatus.email.disabled) || disabled
|
|
676
689
|
}
|
|
677
690
|
) }) });
|
|
678
691
|
};
|
|
692
|
+
const CardHolderName = () => {
|
|
693
|
+
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.holderName.show) && /* @__PURE__ */ u("div", { className: bem("holder-name"), children: /* @__PURE__ */ u(CardHolderNameField, { disabled: (fieldStatus == null ? void 0 : fieldStatus.holderName.disabled) || disabled }) }) });
|
|
694
|
+
};
|
|
679
695
|
const Address = () => {
|
|
680
696
|
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: bem("address"), children: /* @__PURE__ */ u(
|
|
681
697
|
AddressField,
|
|
682
698
|
{
|
|
683
699
|
ref: addressFieldRef,
|
|
684
700
|
value: form.address,
|
|
701
|
+
disabled,
|
|
685
702
|
onChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
686
703
|
}
|
|
687
704
|
) }) });
|
|
@@ -689,9 +706,20 @@ const Card = w((props, ref) => {
|
|
|
689
706
|
const ErrorMessage = () => {
|
|
690
707
|
return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg }) });
|
|
691
708
|
};
|
|
692
|
-
const
|
|
709
|
+
const CardCombineInfo = () => {
|
|
710
|
+
return /* @__PURE__ */ u("div", { className: bem("card-info"), children: /* @__PURE__ */ u(
|
|
711
|
+
CombinedCardInfo,
|
|
712
|
+
{
|
|
713
|
+
ref: combinedCardInfoRef,
|
|
714
|
+
supportedCardBrands,
|
|
715
|
+
showLabel: true,
|
|
716
|
+
security
|
|
717
|
+
}
|
|
718
|
+
) });
|
|
719
|
+
};
|
|
720
|
+
const CardSplitInfo = () => {
|
|
693
721
|
var _a2, _b2, _c, _d;
|
|
694
|
-
return
|
|
722
|
+
return /* @__PURE__ */ u(b, { children: [
|
|
695
723
|
/* @__PURE__ */ u("div", { className: fieldClassNames, children: [
|
|
696
724
|
/* @__PURE__ */ u("div", { className: bem("card-number-wrapper"), children: [
|
|
697
725
|
/* @__PURE__ */ u(
|
|
@@ -700,6 +728,7 @@ const Card = w((props, ref) => {
|
|
|
700
728
|
supportedCardBrands: (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.supportMethods) == null ? void 0 : _b2.filter(Boolean),
|
|
701
729
|
security,
|
|
702
730
|
ref: cardNumberFieldRef,
|
|
731
|
+
disabled,
|
|
703
732
|
onBinValue: onBinValueChanged
|
|
704
733
|
}
|
|
705
734
|
),
|
|
@@ -719,6 +748,7 @@ const Card = w((props, ref) => {
|
|
|
719
748
|
{
|
|
720
749
|
security,
|
|
721
750
|
className: fieldClassNames,
|
|
751
|
+
disabled,
|
|
722
752
|
ref: cardExpireDateFieldRef
|
|
723
753
|
}
|
|
724
754
|
),
|
|
@@ -727,26 +757,19 @@ const Card = w((props, ref) => {
|
|
|
727
757
|
{
|
|
728
758
|
security,
|
|
729
759
|
className: fieldClassNames,
|
|
760
|
+
disabled,
|
|
730
761
|
ref: cardSecurityCodeFieldRef
|
|
731
762
|
}
|
|
732
763
|
)
|
|
733
764
|
] })
|
|
734
|
-
] })
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
ref: combinedCardInfoRef,
|
|
738
|
-
supportedCardBrands,
|
|
739
|
-
showLabel: true,
|
|
740
|
-
security
|
|
741
|
-
}
|
|
742
|
-
) });
|
|
743
|
-
}, [splitCardInfo, security]);
|
|
744
|
-
const cardForm = () => {
|
|
765
|
+
] });
|
|
766
|
+
};
|
|
767
|
+
const PaymentForm = () => {
|
|
745
768
|
var _a2;
|
|
746
769
|
return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
747
770
|
Email(),
|
|
748
|
-
|
|
749
|
-
(
|
|
771
|
+
splitCardInfo ? CardSplitInfo() : CardCombineInfo(),
|
|
772
|
+
CardHolderName(),
|
|
750
773
|
Address(),
|
|
751
774
|
((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentType) === PaymentType.RECURRING && RecurringTip(),
|
|
752
775
|
/* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
|
|
@@ -756,7 +779,7 @@ const Card = w((props, ref) => {
|
|
|
756
779
|
] })
|
|
757
780
|
] }) });
|
|
758
781
|
};
|
|
759
|
-
const
|
|
782
|
+
const FastPaymentForm = () => {
|
|
760
783
|
var _a2, _b2, _c, _d;
|
|
761
784
|
return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
762
785
|
Email(),
|
|
@@ -766,6 +789,7 @@ const Card = w((props, ref) => {
|
|
|
766
789
|
{
|
|
767
790
|
value: (_c = (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.tokens) == null ? void 0 : _b2[0]) == null ? void 0 : _c.token,
|
|
768
791
|
cardList: (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.tokens,
|
|
792
|
+
disabled,
|
|
769
793
|
onClickEdit: onEditOtherCard,
|
|
770
794
|
onClickChange: onClickChangeCard,
|
|
771
795
|
onCardChange,
|
|
@@ -778,6 +802,7 @@ const Card = w((props, ref) => {
|
|
|
778
802
|
{
|
|
779
803
|
className: bem("card-security-code", fieldClassNames),
|
|
780
804
|
style: { flex: 1 },
|
|
805
|
+
disabled,
|
|
781
806
|
security,
|
|
782
807
|
ref: cardSecurityCodeFieldRef
|
|
783
808
|
}
|
|
@@ -796,6 +821,7 @@ const Card = w((props, ref) => {
|
|
|
796
821
|
{
|
|
797
822
|
ref: SFPRef,
|
|
798
823
|
i18n,
|
|
824
|
+
disabled,
|
|
799
825
|
checkoutId: core.id,
|
|
800
826
|
sessionMode: (_a = session.checkout) == null ? void 0 : _a.sessionMode,
|
|
801
827
|
supportedCardBrands,
|
|
@@ -809,11 +835,12 @@ const Card = w((props, ref) => {
|
|
|
809
835
|
onPaymentTimeout: ({ message }) => onTimeout(i18n.get(message)),
|
|
810
836
|
onValidStatusChanged: onFieldValidStatusChanged,
|
|
811
837
|
onValidated,
|
|
838
|
+
onHiddenIframeReady: (data) => onHiddenIframeReady(data),
|
|
812
839
|
onEvent: (type, data) => {
|
|
813
840
|
var _a2, _b2;
|
|
814
841
|
return (_b2 = (_a2 = core.config).onEvent) == null ? void 0 : _b2.call(_a2, type, data);
|
|
815
842
|
},
|
|
816
|
-
children: showFastPaymentForm ?
|
|
843
|
+
children: showFastPaymentForm ? FastPaymentForm() : PaymentForm()
|
|
817
844
|
}
|
|
818
845
|
),
|
|
819
846
|
/* @__PURE__ */ u(
|
|
@@ -14,7 +14,7 @@ import { formatExpireDateOnInsert, formatExpireDateOnPaste } from "../../utils/e
|
|
|
14
14
|
import { limitedToNumber } from "../../utils/format.js";
|
|
15
15
|
import { isUndefined } from "../../utils/is.js";
|
|
16
16
|
const CardExpireDateField = w((props, ref) => {
|
|
17
|
-
const { className, style, security, showLabel } = props;
|
|
17
|
+
const { className, style, security, showLabel, disabled } = props;
|
|
18
18
|
const inputRef = A(null);
|
|
19
19
|
const formItemRef = A(null);
|
|
20
20
|
F(ref, () => ({
|
|
@@ -120,6 +120,7 @@ const CardExpireDateField = w((props, ref) => {
|
|
|
120
120
|
ref: inputRef,
|
|
121
121
|
maxLength: 5,
|
|
122
122
|
value,
|
|
123
|
+
disabled,
|
|
123
124
|
onInput,
|
|
124
125
|
placeholder: i18n.get("card.cardExpireDate.placeholder"),
|
|
125
126
|
children: security && /* @__PURE__ */ u("div", { style: "width:100%;height:100%", "data-sf": EFieldType.EXPIRE_DATE })
|
|
@@ -8,7 +8,7 @@ import { normalizedClass } from "../../utils/format.js";
|
|
|
8
8
|
import "../../out/worldpay-jsc-origin.js";
|
|
9
9
|
const { bem } = useBEM("card-no");
|
|
10
10
|
const CardNo = (props) => {
|
|
11
|
-
const { value, className, style } = props;
|
|
11
|
+
const { value, className, style, disabled } = props;
|
|
12
12
|
return /* @__PURE__ */ u(
|
|
13
13
|
"div",
|
|
14
14
|
{
|
|
@@ -18,7 +18,7 @@ const CardNo = (props) => {
|
|
|
18
18
|
Array.from({ length: 4 }, (_, i) => i).map(() => {
|
|
19
19
|
return /* @__PURE__ */ u("span", { className: bem("dot") });
|
|
20
20
|
}),
|
|
21
|
-
/* @__PURE__ */ u("span", { className: bem("card-no"), children: value })
|
|
21
|
+
/* @__PURE__ */ u("span", { className: bem("card-no"), disabled, children: value })
|
|
22
22
|
]
|
|
23
23
|
}
|
|
24
24
|
);
|
|
@@ -15,7 +15,7 @@ import { getSupportedCardBrands, getSupportedCardBrandsLengths, finCardBrandInfo
|
|
|
15
15
|
import { trimAll, limitedToNumber } from "../../utils/format.js";
|
|
16
16
|
const CardNumberField = w(
|
|
17
17
|
(props, ref) => {
|
|
18
|
-
const { supportedCardBrands = [], className, security, showLabel, onBinValue } = props;
|
|
18
|
+
const { supportedCardBrands = [], className, security, showLabel, onBinValue, disabled } = props;
|
|
19
19
|
const inputRef = A(null);
|
|
20
20
|
const formItemRef = A(null);
|
|
21
21
|
F(ref, () => ({
|
|
@@ -132,6 +132,7 @@ const CardNumberField = w(
|
|
|
132
132
|
ref: inputRef,
|
|
133
133
|
maxLength: 23,
|
|
134
134
|
value,
|
|
135
|
+
disabled,
|
|
135
136
|
onInput,
|
|
136
137
|
rightIcon: RightIcon(),
|
|
137
138
|
placeholder: i18n.get("card.cardNumber.placeholder"),
|
|
@@ -14,7 +14,7 @@ import "../internal/Form/Form.js";
|
|
|
14
14
|
import { Input } from "../internal/Input/Input.js";
|
|
15
15
|
import "../internal/Input/type.js";
|
|
16
16
|
const CardSecurityCodeField = w((props, ref) => {
|
|
17
|
-
const { className, style, security, showLabel } = props;
|
|
17
|
+
const { className, style, security, showLabel, disabled } = props;
|
|
18
18
|
const inputRef = A(null);
|
|
19
19
|
const formItemRef = A(null);
|
|
20
20
|
F(ref, () => ({
|
|
@@ -75,6 +75,7 @@ const CardSecurityCodeField = w((props, ref) => {
|
|
|
75
75
|
ref: inputRef,
|
|
76
76
|
maxLength: 4,
|
|
77
77
|
value,
|
|
78
|
+
disabled,
|
|
78
79
|
onInput,
|
|
79
80
|
placeholder: i18n.get("card.cardSecurityCode.placeholder"),
|
|
80
81
|
children: security && /* @__PURE__ */ u("div", { style: "width:100%;height:100%", "data-sf": EFieldType.CVV })
|