@open-tender/utils 0.4.37 → 0.4.38
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.
|
@@ -25,7 +25,7 @@ const useSignUpGuestForm = (email, guest, loading, error, guestErrors, signUp, s
|
|
|
25
25
|
const guestDisabled = guestIncomplete || isLoading;
|
|
26
26
|
const toRemove = [];
|
|
27
27
|
if (!hasPunchh)
|
|
28
|
-
toRemove.push('
|
|
28
|
+
toRemove.push('birth_date');
|
|
29
29
|
if (hasThanx)
|
|
30
30
|
toRemove.push('password');
|
|
31
31
|
const allFields = [
|
|
@@ -51,7 +51,7 @@ const useSignUpGuestForm = (email, guest, loading, error, guestErrors, signUp, s
|
|
|
51
51
|
{ label: 'Phone', name: 'phone', type: 'tel', required: true },
|
|
52
52
|
{
|
|
53
53
|
label: 'Birth Date (mm/dd/yyyy)',
|
|
54
|
-
name: '
|
|
54
|
+
name: 'birth_date',
|
|
55
55
|
type: 'tel',
|
|
56
56
|
required: false
|
|
57
57
|
},
|
|
@@ -64,7 +64,11 @@ const useSignUpGuestForm = (email, guest, loading, error, guestErrors, signUp, s
|
|
|
64
64
|
];
|
|
65
65
|
const fields = allFields.filter(i => !toRemove.includes(i.name));
|
|
66
66
|
const handleChange = (name, value) => {
|
|
67
|
-
const val = name === 'phone'
|
|
67
|
+
const val = name === 'phone'
|
|
68
|
+
? (0, utils_1.makePhone)(value)
|
|
69
|
+
: name === 'birth_date'
|
|
70
|
+
? (0, utils_1.makeBirthDate)(value)
|
|
71
|
+
: value;
|
|
68
72
|
setData(Object.assign(Object.assign({}, data), { [name]: val }));
|
|
69
73
|
};
|
|
70
74
|
const handleSubmit = (evt) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRef, useState, useEffect } from 'react';
|
|
2
|
-
import { checkEmpty, checkGuestData, makeFormErrors, makePhone } from '../utils';
|
|
2
|
+
import { checkEmpty, checkGuestData, makeBirthDate, makeFormErrors, makePhone } from '../utils';
|
|
3
3
|
const initialData = {
|
|
4
4
|
first_name: '',
|
|
5
5
|
last_name: '',
|
|
@@ -22,7 +22,7 @@ export const useSignUpGuestForm = (email, guest, loading, error, guestErrors, si
|
|
|
22
22
|
const guestDisabled = guestIncomplete || isLoading;
|
|
23
23
|
const toRemove = [];
|
|
24
24
|
if (!hasPunchh)
|
|
25
|
-
toRemove.push('
|
|
25
|
+
toRemove.push('birth_date');
|
|
26
26
|
if (hasThanx)
|
|
27
27
|
toRemove.push('password');
|
|
28
28
|
const allFields = [
|
|
@@ -48,7 +48,7 @@ export const useSignUpGuestForm = (email, guest, loading, error, guestErrors, si
|
|
|
48
48
|
{ label: 'Phone', name: 'phone', type: 'tel', required: true },
|
|
49
49
|
{
|
|
50
50
|
label: 'Birth Date (mm/dd/yyyy)',
|
|
51
|
-
name: '
|
|
51
|
+
name: 'birth_date',
|
|
52
52
|
type: 'tel',
|
|
53
53
|
required: false
|
|
54
54
|
},
|
|
@@ -61,7 +61,11 @@ export const useSignUpGuestForm = (email, guest, loading, error, guestErrors, si
|
|
|
61
61
|
];
|
|
62
62
|
const fields = allFields.filter(i => !toRemove.includes(i.name));
|
|
63
63
|
const handleChange = (name, value) => {
|
|
64
|
-
const val = name === 'phone'
|
|
64
|
+
const val = name === 'phone'
|
|
65
|
+
? makePhone(value)
|
|
66
|
+
: name === 'birth_date'
|
|
67
|
+
? makeBirthDate(value)
|
|
68
|
+
: value;
|
|
65
69
|
setData(Object.assign(Object.assign({}, data), { [name]: val }));
|
|
66
70
|
};
|
|
67
71
|
const handleSubmit = (evt) => {
|
package/package.json
CHANGED