ordering-ui-react-native 0.16.31 → 0.16.34
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/package.json +1 -1
- package/src/components/AddressForm/index.tsx +4 -1
- package/themes/business/src/components/Chat/index.tsx +4 -4
- package/themes/original/src/components/UserDetails/index.tsx +20 -15
- package/themes/original/src/components/UserFormDetails/index.tsx +10 -7
- package/themes/original/src/components/UserProfileForm/index.tsx +14 -9
package/package.json
CHANGED
|
@@ -220,9 +220,12 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
220
220
|
|
|
221
221
|
if (isObjet) {
|
|
222
222
|
setValue('address', address)
|
|
223
|
-
handleChangeInput({ target: { name: 'address', value: address } })
|
|
224
223
|
googleInput?.current?.setAddressText(address)
|
|
225
224
|
setLoadingLocation(false)
|
|
225
|
+
updateChanges({
|
|
226
|
+
address: address,
|
|
227
|
+
location: json.results[0].geometry.location
|
|
228
|
+
})
|
|
226
229
|
return
|
|
227
230
|
}
|
|
228
231
|
|
|
@@ -484,12 +484,12 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
484
484
|
image: message.source,
|
|
485
485
|
system: message.type === 1,
|
|
486
486
|
user: {
|
|
487
|
-
_id: message.author
|
|
488
|
-
name: message.author
|
|
487
|
+
_id: message.author?.id,
|
|
488
|
+
name: message.author?.name,
|
|
489
489
|
can_see: message?.can_see,
|
|
490
|
-
level: message.author
|
|
490
|
+
level: message.author?.level,
|
|
491
491
|
avatar:
|
|
492
|
-
message.author
|
|
492
|
+
message.author?.id !== user?.id && type === USER_TYPE.DRIVER
|
|
493
493
|
? order?.driver?.photo
|
|
494
494
|
: order?.business?.logo,
|
|
495
495
|
},
|
|
@@ -30,12 +30,9 @@ const UserDetailsUI = (props: any) => {
|
|
|
30
30
|
phoneUpdate,
|
|
31
31
|
togglePhoneUpdate,
|
|
32
32
|
isCheckout,
|
|
33
|
-
checkPhoneCodeState,
|
|
34
33
|
handleSendVerifyCode,
|
|
35
|
-
handleCheckPhoneCode,
|
|
36
34
|
verifyPhoneState,
|
|
37
|
-
|
|
38
|
-
setCheckPhoneCodeState
|
|
35
|
+
setFormState
|
|
39
36
|
} = props
|
|
40
37
|
|
|
41
38
|
const theme = useTheme();
|
|
@@ -48,6 +45,7 @@ const UserDetailsUI = (props: any) => {
|
|
|
48
45
|
|
|
49
46
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
50
47
|
const [willVerifyOtpState, setWillVerifyOtpState] = useState(false);
|
|
48
|
+
const [checkPhoneCodeState, setCheckPhoneCodeState] = useState({ loading: false, result: { error: false } })
|
|
51
49
|
const [phoneInputData, setPhoneInputData] = useState({
|
|
52
50
|
error: '',
|
|
53
51
|
phone: {
|
|
@@ -94,6 +92,18 @@ const UserDetailsUI = (props: any) => {
|
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
94
|
|
|
95
|
+
const handleSendPhoneCode = (values: any) => {
|
|
96
|
+
setWillVerifyOtpState(false)
|
|
97
|
+
setIsModalVisible(false)
|
|
98
|
+
setFormState({
|
|
99
|
+
...formState,
|
|
100
|
+
changes: {
|
|
101
|
+
...formState?.changes,
|
|
102
|
+
verification_code: values?.code
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
97
107
|
useEffect(() => {
|
|
98
108
|
if (willVerifyOtpState) handleVerifyCodeClick()
|
|
99
109
|
}, [willVerifyOtpState])
|
|
@@ -120,10 +130,6 @@ const UserDetailsUI = (props: any) => {
|
|
|
120
130
|
}
|
|
121
131
|
}, [verifyPhoneState])
|
|
122
132
|
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
if (isVerifiedPhone) setIsModalVisible(false)
|
|
125
|
-
}, [isVerifiedPhone])
|
|
126
|
-
|
|
127
133
|
return (
|
|
128
134
|
<>
|
|
129
135
|
{(validationFields.loading || formState.loading) && (
|
|
@@ -202,13 +208,12 @@ const UserDetailsUI = (props: any) => {
|
|
|
202
208
|
entireModal
|
|
203
209
|
>
|
|
204
210
|
<VerifyPhone
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
onClose={() => setIsModalVisible(false)}
|
|
211
|
+
phone={phoneInputData.phone}
|
|
212
|
+
verifyPhoneState={verifyPhoneState}
|
|
213
|
+
checkPhoneCodeState={checkPhoneCodeState}
|
|
214
|
+
handleCheckPhoneCode={handleSendPhoneCode}
|
|
215
|
+
handleVerifyCodeClick={handleVerifyCodeClick}
|
|
216
|
+
onClose={() => setIsModalVisible(false)}
|
|
212
217
|
/>
|
|
213
218
|
</OModal>
|
|
214
219
|
<Spinner visible={verifyPhoneState?.loading} />
|
|
@@ -26,7 +26,6 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
26
26
|
phoneUpdate,
|
|
27
27
|
hideUpdateButton,
|
|
28
28
|
setWillVerifyOtpState,
|
|
29
|
-
isVerifiedPhone,
|
|
30
29
|
handleChangePromotions,
|
|
31
30
|
} = props;
|
|
32
31
|
|
|
@@ -76,6 +75,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
76
75
|
|
|
77
76
|
const [{ user }] = useSession();
|
|
78
77
|
const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
|
|
78
|
+
const [isChanged, setIsChanged] = useState(false)
|
|
79
79
|
const [phoneInputData, setPhoneInputData] = useState({
|
|
80
80
|
error: '',
|
|
81
81
|
phone: {
|
|
@@ -153,9 +153,6 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
153
153
|
);
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
if (formState?.changes?.cellphone && !isVerifiedPhone) {
|
|
157
|
-
showToast(ToastType.Error, t('VERIFY_ERROR_PHONE_NUMBER', 'The Phone Number field is not verified'))
|
|
158
|
-
}
|
|
159
156
|
let changes = null;
|
|
160
157
|
if (user?.cellphone && !userPhoneNumber) {
|
|
161
158
|
changes = {
|
|
@@ -169,6 +166,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
169
166
|
|
|
170
167
|
const handleChangePhoneNumber = (number: any) => {
|
|
171
168
|
setPhoneInputData(number);
|
|
169
|
+
setIsChanged(true)
|
|
172
170
|
let phoneNumber = {
|
|
173
171
|
country_phone_code: {
|
|
174
172
|
name: 'country_phone_code',
|
|
@@ -228,11 +226,16 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
228
226
|
}, [user, isEdit]);
|
|
229
227
|
|
|
230
228
|
useEffect(() => {
|
|
231
|
-
if (!phoneInputData.error &&
|
|
229
|
+
if (!phoneInputData.error &&
|
|
230
|
+
phoneInputData?.phone?.country_phone_code &&
|
|
231
|
+
phoneInputData?.phone?.cellphone &&
|
|
232
|
+
configs?.verification_phone_required?.value === '1' &&
|
|
233
|
+
formState?.changes?.cellphone &&
|
|
234
|
+
isChanged) {
|
|
232
235
|
setWillVerifyOtpState?.(true)
|
|
233
236
|
}
|
|
234
|
-
}, [phoneInputData])
|
|
235
|
-
|
|
237
|
+
}, [phoneInputData, configs?.verification_phone_required?.value, isChanged])
|
|
238
|
+
|
|
236
239
|
return (
|
|
237
240
|
<>
|
|
238
241
|
<UDForm>
|
|
@@ -35,12 +35,9 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
35
35
|
cleanFormState,
|
|
36
36
|
handleChangeInput,
|
|
37
37
|
handleButtonUpdateClick,
|
|
38
|
-
checkPhoneCodeState,
|
|
39
38
|
handleSendVerifyCode,
|
|
40
|
-
handleCheckPhoneCode,
|
|
41
39
|
verifyPhoneState,
|
|
42
|
-
|
|
43
|
-
setCheckPhoneCodeState
|
|
40
|
+
setFormState
|
|
44
41
|
} = props;
|
|
45
42
|
|
|
46
43
|
const theme = useTheme();
|
|
@@ -73,6 +70,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
73
70
|
const { handleSubmit, errors, setValue, control } = useForm();
|
|
74
71
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
75
72
|
const [willVerifyOtpState, setWillVerifyOtpState] = useState(false);
|
|
73
|
+
const [checkPhoneCodeState, setCheckPhoneCodeState] = useState({ loading: false, result: { error: false } })
|
|
76
74
|
|
|
77
75
|
const [phoneInputData, setPhoneInputData] = useState({
|
|
78
76
|
error: '',
|
|
@@ -272,9 +270,17 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
272
270
|
}
|
|
273
271
|
}, [verifyPhoneState])
|
|
274
272
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
const handleSendPhoneCode = (values: any) => {
|
|
274
|
+
setWillVerifyOtpState(false)
|
|
275
|
+
setIsModalVisible(false)
|
|
276
|
+
setFormState({
|
|
277
|
+
...formState,
|
|
278
|
+
changes: {
|
|
279
|
+
...formState?.changes,
|
|
280
|
+
verification_code: values?.code
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
}
|
|
278
284
|
|
|
279
285
|
return (
|
|
280
286
|
<>
|
|
@@ -331,8 +337,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
331
337
|
phone={phoneInputData.phone}
|
|
332
338
|
verifyPhoneState={verifyPhoneState}
|
|
333
339
|
checkPhoneCodeState={checkPhoneCodeState}
|
|
334
|
-
handleCheckPhoneCode={
|
|
335
|
-
setCheckPhoneCodeState={setCheckPhoneCodeState}
|
|
340
|
+
handleCheckPhoneCode={handleSendPhoneCode}
|
|
336
341
|
handleVerifyCodeClick={handleVerifyCodeClick}
|
|
337
342
|
onClose={() => setIsModalVisible(false)}
|
|
338
343
|
/>
|