@blocklet/payment-react 1.21.14 → 1.21.16
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.
|
@@ -96,6 +96,20 @@ export default function AddressForm({ mode, sx = {}, fieldValidation = {}, error
|
|
|
96
96
|
] }) }) });
|
|
97
97
|
}
|
|
98
98
|
return /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsx(Stack, { className: "cko-payment-address cko-payment-form", sx, children: /* @__PURE__ */ jsxs(Stack, { direction: "column", className: "cko-payment-form", spacing: 0, children: [
|
|
99
|
+
/* @__PURE__ */ jsx(FormLabel, { className: "base-label", children: t("payment.checkout.billing.state") }),
|
|
100
|
+
/* @__PURE__ */ jsx(
|
|
101
|
+
FormInput,
|
|
102
|
+
{
|
|
103
|
+
name: "billing_address.state",
|
|
104
|
+
rules: {
|
|
105
|
+
required: t("payment.checkout.required"),
|
|
106
|
+
...getFieldValidation("billing_address.state", fieldValidation, locale)
|
|
107
|
+
},
|
|
108
|
+
errorPosition,
|
|
109
|
+
variant: "outlined",
|
|
110
|
+
placeholder: t("payment.checkout.billing.state")
|
|
111
|
+
}
|
|
112
|
+
),
|
|
99
113
|
/* @__PURE__ */ jsx(FormLabel, { className: "base-label", children: t("payment.checkout.billing.postal_code") }),
|
|
100
114
|
/* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 0, children: /* @__PURE__ */ jsx(
|
|
101
115
|
FormInput,
|
package/es/payment/form/index.js
CHANGED
|
@@ -284,6 +284,16 @@ export default function PaymentForm({
|
|
|
284
284
|
return false;
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
+
if (!address.province) {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
const stateValidation = getFieldValidation("billing_address.state", fieldValidation, locale);
|
|
291
|
+
if (stateValidation.pattern) {
|
|
292
|
+
const pattern = stateValidation.pattern.value;
|
|
293
|
+
if (!pattern.test(address.province)) {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
287
297
|
if (checkoutSession.phone_number_collection?.enabled) {
|
|
288
298
|
if (!phone || phone.trim() === "") {
|
|
289
299
|
return false;
|
|
@@ -315,13 +325,6 @@ export default function PaymentForm({
|
|
|
315
325
|
return false;
|
|
316
326
|
}
|
|
317
327
|
}
|
|
318
|
-
const stateValidation = getFieldValidation("billing_address.state", fieldValidation, locale);
|
|
319
|
-
if (stateValidation.pattern) {
|
|
320
|
-
const pattern = stateValidation.pattern.value;
|
|
321
|
-
if (!pattern.test(address.province)) {
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
328
|
}
|
|
326
329
|
return true;
|
|
327
330
|
};
|
|
@@ -131,6 +131,18 @@ function AddressForm({
|
|
|
131
131
|
className: "cko-payment-form",
|
|
132
132
|
spacing: 0,
|
|
133
133
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_label.default, {
|
|
134
|
+
className: "base-label",
|
|
135
|
+
children: t("payment.checkout.billing.state")
|
|
136
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_input.default, {
|
|
137
|
+
name: "billing_address.state",
|
|
138
|
+
rules: {
|
|
139
|
+
required: t("payment.checkout.required"),
|
|
140
|
+
...(0, _validator.getFieldValidation)("billing_address.state", fieldValidation, locale)
|
|
141
|
+
},
|
|
142
|
+
errorPosition,
|
|
143
|
+
variant: "outlined",
|
|
144
|
+
placeholder: t("payment.checkout.billing.state")
|
|
145
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_label.default, {
|
|
134
146
|
className: "base-label",
|
|
135
147
|
children: t("payment.checkout.billing.postal_code")
|
|
136
148
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
@@ -323,6 +323,16 @@ function PaymentForm({
|
|
|
323
323
|
return false;
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
+
if (!address.province) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
const stateValidation = (0, _validator.getFieldValidation)("billing_address.state", fieldValidation, locale);
|
|
330
|
+
if (stateValidation.pattern) {
|
|
331
|
+
const pattern = stateValidation.pattern.value;
|
|
332
|
+
if (!pattern.test(address.province)) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
326
336
|
if (checkoutSession.phone_number_collection?.enabled) {
|
|
327
337
|
if (!phone || phone.trim() === "") {
|
|
328
338
|
return false;
|
|
@@ -354,13 +364,6 @@ function PaymentForm({
|
|
|
354
364
|
return false;
|
|
355
365
|
}
|
|
356
366
|
}
|
|
357
|
-
const stateValidation = (0, _validator.getFieldValidation)("billing_address.state", fieldValidation, locale);
|
|
358
|
-
if (stateValidation.pattern) {
|
|
359
|
-
const pattern = stateValidation.pattern.value;
|
|
360
|
-
if (!pattern.test(address.province)) {
|
|
361
|
-
return false;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
367
|
}
|
|
365
368
|
return true;
|
|
366
369
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.16",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@babel/core": "^7.27.4",
|
|
95
95
|
"@babel/preset-env": "^7.27.2",
|
|
96
96
|
"@babel/preset-react": "^7.27.1",
|
|
97
|
-
"@blocklet/payment-types": "1.21.
|
|
97
|
+
"@blocklet/payment-types": "1.21.16",
|
|
98
98
|
"@storybook/addon-essentials": "^7.6.20",
|
|
99
99
|
"@storybook/addon-interactions": "^7.6.20",
|
|
100
100
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"vite-plugin-babel": "^1.3.1",
|
|
126
126
|
"vite-plugin-node-polyfills": "^0.23.0"
|
|
127
127
|
},
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "16509d9abd2da2f52587972c863c79ba9e4cd49d"
|
|
129
129
|
}
|
|
@@ -102,6 +102,17 @@ export default function AddressForm({ mode, sx = {}, fieldValidation = {}, error
|
|
|
102
102
|
<Fade in>
|
|
103
103
|
<Stack className="cko-payment-address cko-payment-form" sx={sx}>
|
|
104
104
|
<Stack direction="column" className="cko-payment-form" spacing={0}>
|
|
105
|
+
<FormLabel className="base-label">{t('payment.checkout.billing.state')}</FormLabel>
|
|
106
|
+
<FormInput
|
|
107
|
+
name="billing_address.state"
|
|
108
|
+
rules={{
|
|
109
|
+
required: t('payment.checkout.required'),
|
|
110
|
+
...getFieldValidation('billing_address.state', fieldValidation, locale),
|
|
111
|
+
}}
|
|
112
|
+
errorPosition={errorPosition}
|
|
113
|
+
variant="outlined"
|
|
114
|
+
placeholder={t('payment.checkout.billing.state')}
|
|
115
|
+
/>
|
|
105
116
|
<FormLabel className="base-label">{t('payment.checkout.billing.postal_code')}</FormLabel>
|
|
106
117
|
<Stack direction="row" spacing={0}>
|
|
107
118
|
<FormInput
|
|
@@ -418,6 +418,17 @@ export default function PaymentForm({
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
+
if (!address.province) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
const stateValidation = getFieldValidation('billing_address.state', fieldValidation, locale);
|
|
425
|
+
if (stateValidation.pattern) {
|
|
426
|
+
const pattern = stateValidation.pattern.value;
|
|
427
|
+
if (!pattern.test(address.province)) {
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
421
432
|
if (checkoutSession.phone_number_collection?.enabled) {
|
|
422
433
|
if (!phone || phone.trim() === '') {
|
|
423
434
|
return false;
|
|
@@ -452,14 +463,6 @@ export default function PaymentForm({
|
|
|
452
463
|
return false;
|
|
453
464
|
}
|
|
454
465
|
}
|
|
455
|
-
|
|
456
|
-
const stateValidation = getFieldValidation('billing_address.state', fieldValidation, locale);
|
|
457
|
-
if (stateValidation.pattern) {
|
|
458
|
-
const pattern = stateValidation.pattern.value;
|
|
459
|
-
if (!pattern.test(address.province)) {
|
|
460
|
-
return false;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
466
|
}
|
|
464
467
|
|
|
465
468
|
return true;
|