payment-kit 1.13.20 → 1.13.21
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/blocklet.yml +1 -1
- package/package.json +3 -3
- package/src/components/checkout/form/index.tsx +2 -2
- package/src/components/checkout/form/phone.tsx +3 -1
- package/src/components/customer/edit.tsx +6 -5
- package/src/components/customer/form.tsx +21 -7
- package/src/components/metadata/editor.tsx +6 -4
- package/src/components/payment-link/rename.tsx +7 -4
- package/src/components/product/add-price.tsx +6 -4
- package/src/components/product/create.tsx +6 -4
- package/src/components/product/edit-price.tsx +6 -4
- package/src/components/product/edit.tsx +6 -4
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.21",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@arcblock/eslint-config": "^0.2.4",
|
|
102
102
|
"@arcblock/eslint-config-ts": "^0.2.4",
|
|
103
|
-
"@did-pay/types": "1.13.
|
|
103
|
+
"@did-pay/types": "1.13.21",
|
|
104
104
|
"@types/cookie-parser": "^1.4.4",
|
|
105
105
|
"@types/cors": "^2.8.14",
|
|
106
106
|
"@types/dotenv-flow": "^3.3.1",
|
|
@@ -137,5 +137,5 @@
|
|
|
137
137
|
"parser": "typescript"
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "9a767485dd2e712fdaf1e636d73556c90f20e2bd"
|
|
141
141
|
}
|
|
@@ -215,9 +215,9 @@ export default function PaymentForm({
|
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
217
|
|
|
218
|
-
const onAction =
|
|
218
|
+
const onAction = () => {
|
|
219
219
|
if (session.user) {
|
|
220
|
-
|
|
220
|
+
handleSubmit(onSubmit)();
|
|
221
221
|
} else {
|
|
222
222
|
session.login({
|
|
223
223
|
onSuccess: onUserLoggedIn,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
import { InputAdornment, MenuItem, Select, Typography } from '@mui/material';
|
|
3
|
+
import omit from 'lodash/omit';
|
|
3
4
|
import { useEffect } from 'react';
|
|
4
5
|
import { useFormContext, useWatch } from 'react-hook-form';
|
|
5
6
|
import { CountryIso2, FlagEmoji, defaultCountries, parseCountry, usePhoneInput } from 'react-international-phone';
|
|
@@ -13,6 +14,7 @@ export default function PhoneInput({ ...props }) {
|
|
|
13
14
|
|
|
14
15
|
const { control, getValues, setValue } = useFormContext();
|
|
15
16
|
const values = getValues();
|
|
17
|
+
|
|
16
18
|
const { phone, handlePhoneValueChange, inputRef, country, setCountry } = usePhoneInput({
|
|
17
19
|
defaultCountry: isValidCountry(values[countryFieldName]) ? values[countryFieldName] : 'us',
|
|
18
20
|
value: values[props.name] || '',
|
|
@@ -96,7 +98,7 @@ export default function PhoneInput({ ...props }) {
|
|
|
96
98
|
</InputAdornment>
|
|
97
99
|
),
|
|
98
100
|
}}
|
|
99
|
-
{...props}
|
|
101
|
+
{...omit(props, ['countryFieldName'])}
|
|
100
102
|
/>
|
|
101
103
|
);
|
|
102
104
|
}
|
|
@@ -39,11 +39,12 @@ export default function EditCustomer({
|
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
const onSubmit = () => {
|
|
43
|
+
methods.handleSubmit(async (formData: any) => {
|
|
44
|
+
await onSave(formData);
|
|
45
|
+
methods.reset();
|
|
46
|
+
onCancel(null);
|
|
47
|
+
})();
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
return (
|
|
@@ -3,6 +3,8 @@ import 'react-international-phone/style.css';
|
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
4
|
import { InputAdornment, Stack, Typography } from '@mui/material';
|
|
5
5
|
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
6
|
+
import { Controller, useFormContext } from 'react-hook-form';
|
|
7
|
+
import { CountrySelector } from 'react-international-phone';
|
|
6
8
|
import isEmail from 'validator/es/lib/isEmail';
|
|
7
9
|
|
|
8
10
|
import PhoneInput from '../checkout/form/phone';
|
|
@@ -12,9 +14,10 @@ const phoneUtil = PhoneNumberUtil.getInstance();
|
|
|
12
14
|
|
|
13
15
|
export default function CustomerForm() {
|
|
14
16
|
const { t } = useLocaleContext();
|
|
17
|
+
const { control, setValue } = useFormContext();
|
|
15
18
|
|
|
16
19
|
return (
|
|
17
|
-
<Stack direction="column" spacing={
|
|
20
|
+
<Stack direction="column" spacing={1}>
|
|
18
21
|
<Typography component="h6" sx={{ mb: 1, color: 'text.primary', fontWeight: 600 }}>
|
|
19
22
|
{t('checkout.contact')}
|
|
20
23
|
</Typography>
|
|
@@ -64,39 +67,50 @@ export default function CustomerForm() {
|
|
|
64
67
|
<Typography component="h6" sx={{ mb: 1, color: 'text.primary', fontWeight: 600 }}>
|
|
65
68
|
{t('checkout.billing.required')}
|
|
66
69
|
</Typography>
|
|
70
|
+
<Controller
|
|
71
|
+
name="address.country"
|
|
72
|
+
control={control}
|
|
73
|
+
render={({ field }) => (
|
|
74
|
+
<CountrySelector
|
|
75
|
+
selectedCountry={field.value}
|
|
76
|
+
onSelect={({ iso2 }) => setValue(field.name, iso2)}
|
|
77
|
+
buttonStyle={{}}
|
|
78
|
+
/>
|
|
79
|
+
)}
|
|
80
|
+
/>
|
|
67
81
|
<FormInput
|
|
68
82
|
name="address.state"
|
|
69
|
-
rules={{}}
|
|
70
83
|
variant="outlined"
|
|
71
84
|
errorPosition="right"
|
|
85
|
+
label={t('checkout.billing.state')}
|
|
72
86
|
placeholder={t('checkout.billing.state')}
|
|
73
87
|
/>
|
|
74
88
|
<FormInput
|
|
75
89
|
name="address.city"
|
|
76
|
-
rules={{}}
|
|
77
90
|
variant="outlined"
|
|
78
91
|
errorPosition="right"
|
|
92
|
+
label={t('checkout.billing.city')}
|
|
79
93
|
placeholder={t('checkout.billing.city')}
|
|
80
94
|
/>
|
|
81
95
|
<FormInput
|
|
82
96
|
name="address.line1"
|
|
83
|
-
rules={{}}
|
|
84
97
|
variant="outlined"
|
|
85
98
|
errorPosition="right"
|
|
99
|
+
label={t('checkout.billing.line1')}
|
|
86
100
|
placeholder={t('checkout.billing.line1')}
|
|
87
101
|
/>
|
|
88
102
|
<FormInput
|
|
89
103
|
name="address.line2"
|
|
90
|
-
rules={{}}
|
|
91
104
|
variant="outlined"
|
|
92
105
|
errorPosition="right"
|
|
106
|
+
label={t('checkout.billing.line2')}
|
|
93
107
|
placeholder={t('checkout.billing.line2')}
|
|
94
108
|
/>
|
|
95
109
|
<FormInput
|
|
96
110
|
name="address.postal_code"
|
|
97
|
-
errorPosition="right"
|
|
98
|
-
rules={{ required: t('checkout.required') }}
|
|
99
111
|
variant="outlined"
|
|
112
|
+
errorPosition="right"
|
|
113
|
+
label={t('checkout.billing.postal_code')}
|
|
100
114
|
placeholder={t('checkout.billing.postal_code')}
|
|
101
115
|
/>
|
|
102
116
|
</Stack>
|
|
@@ -31,10 +31,12 @@ export default function MetadataEditor({
|
|
|
31
31
|
reset();
|
|
32
32
|
onCancel(e);
|
|
33
33
|
};
|
|
34
|
-
const onSubmit =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const onSubmit = () => {
|
|
35
|
+
handleSubmit(async (formData: any) => {
|
|
36
|
+
await onSave(formData);
|
|
37
|
+
reset();
|
|
38
|
+
onCancel(null);
|
|
39
|
+
})();
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
return (
|
|
@@ -26,10 +26,12 @@ export default function RenamePaymentLink({
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const { handleSubmit, reset } = methods;
|
|
29
|
-
const onSubmit =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const onSubmit = () => {
|
|
30
|
+
handleSubmit(async (formData: any) => {
|
|
31
|
+
await onSave(formData);
|
|
32
|
+
reset();
|
|
33
|
+
onCancel(null);
|
|
34
|
+
})();
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
return (
|
|
@@ -54,6 +56,7 @@ export default function RenamePaymentLink({
|
|
|
54
56
|
<FormProvider {...methods}>
|
|
55
57
|
<TextInput
|
|
56
58
|
name="name"
|
|
59
|
+
rules={{ required: true }}
|
|
57
60
|
label={t('admin.paymentLink.name.label')}
|
|
58
61
|
placeholder={t('admin.paymentLink.name.placeholder')}
|
|
59
62
|
autoFocus
|
|
@@ -26,10 +26,12 @@ export default function AddPrice({
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const { handleSubmit, reset } = methods;
|
|
29
|
-
const onSubmit =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const onSubmit = () => {
|
|
30
|
+
handleSubmit(async (formData: any) => {
|
|
31
|
+
await onSave(formData);
|
|
32
|
+
reset();
|
|
33
|
+
onCancel(null);
|
|
34
|
+
})();
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
return (
|
|
@@ -57,10 +57,12 @@ export default function CreateProduct({
|
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
const onSubmit =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
const onSubmit = () => {
|
|
61
|
+
handleSubmit(async (formData: any) => {
|
|
62
|
+
await onCreate(formData);
|
|
63
|
+
await reset();
|
|
64
|
+
await onSave(null);
|
|
65
|
+
})();
|
|
64
66
|
};
|
|
65
67
|
|
|
66
68
|
return (
|
|
@@ -46,10 +46,12 @@ export default function EditPrice({
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
const { handleSubmit, reset } = methods;
|
|
49
|
-
const onSubmit =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const onSubmit = () => {
|
|
50
|
+
handleSubmit(async (formData: any) => {
|
|
51
|
+
await onSave(formData);
|
|
52
|
+
reset();
|
|
53
|
+
onCancel(null);
|
|
54
|
+
})();
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
return (
|
|
@@ -34,10 +34,12 @@ export default function EditProduct({
|
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
const { handleSubmit, reset } = methods;
|
|
37
|
-
const onSubmit =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const onSubmit = () => {
|
|
38
|
+
handleSubmit(async (formData: any) => {
|
|
39
|
+
await onSave(formData);
|
|
40
|
+
reset();
|
|
41
|
+
onCancel(null);
|
|
42
|
+
})();
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
return (
|