ordering-ui-react-native 0.21.99 → 0.22.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/package.json
CHANGED
|
@@ -36,7 +36,8 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
36
36
|
handleCancelEdit,
|
|
37
37
|
toggleIsEdit,
|
|
38
38
|
isCheckout,
|
|
39
|
-
isAlsea
|
|
39
|
+
isAlsea,
|
|
40
|
+
allowDriverUpdateData
|
|
40
41
|
} = props;
|
|
41
42
|
|
|
42
43
|
const theme = useTheme();
|
|
@@ -66,9 +67,9 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
66
67
|
const rules: any = {
|
|
67
68
|
required: isRequiredField(field.code)
|
|
68
69
|
? t(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
`VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`,
|
|
71
|
+
`${field.name} is required`,
|
|
72
|
+
).replace('_attribute_', t(field.name, field.code))
|
|
72
73
|
: null,
|
|
73
74
|
};
|
|
74
75
|
if (field.code && field.code === 'email') {
|
|
@@ -261,90 +262,93 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
261
262
|
sortInputFields({ values: validationFields?.fields?.checkout })
|
|
262
263
|
.length > 0 && (
|
|
263
264
|
<UDWrapper>
|
|
264
|
-
{
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
{
|
|
275
|
-
|
|
265
|
+
{allowDriverUpdateData && (
|
|
266
|
+
<>
|
|
267
|
+
{sortInputFields({
|
|
268
|
+
values: validationFields.fields?.checkout,
|
|
269
|
+
}).map(
|
|
270
|
+
(field: any) =>
|
|
271
|
+
showField &&
|
|
272
|
+
showField(field.code) &&
|
|
273
|
+
!isAlsea
|
|
274
|
+
&& (
|
|
275
|
+
<React.Fragment key={field.id}>
|
|
276
|
+
<OText style={styles.label}>
|
|
277
|
+
{t(field?.code.toUpperCase(), field?.name)}
|
|
278
|
+
</OText>
|
|
276
279
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
.toLowerCase()
|
|
310
|
-
.replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''),
|
|
311
|
-
);
|
|
312
|
-
field.code !== 'email'
|
|
313
|
-
? handleChangeInput(val)
|
|
314
|
-
: handleChangeInput({
|
|
315
|
-
target: {
|
|
316
|
-
name: 'email',
|
|
317
|
-
value: val.target.value
|
|
280
|
+
<Controller
|
|
281
|
+
key={field.id}
|
|
282
|
+
control={control}
|
|
283
|
+
render={() => (
|
|
284
|
+
<OInput
|
|
285
|
+
name={field.code}
|
|
286
|
+
placeholder={t(
|
|
287
|
+
field.code.toUpperCase(),
|
|
288
|
+
field?.name,
|
|
289
|
+
)}
|
|
290
|
+
placeholderTextColor={theme.colors.arrowColor}
|
|
291
|
+
style={styles.inputStyle}
|
|
292
|
+
icon={
|
|
293
|
+
field.code === 'email'
|
|
294
|
+
? theme.images.general.email
|
|
295
|
+
: theme.images.general.user
|
|
296
|
+
}
|
|
297
|
+
autoCapitalize={
|
|
298
|
+
field.code === 'email' ? 'none' : 'sentences'
|
|
299
|
+
}
|
|
300
|
+
isDisabled={!isEdit}
|
|
301
|
+
value={
|
|
302
|
+
formState?.changes[field.code] ??
|
|
303
|
+
(user && user[field.code]) ??
|
|
304
|
+
''
|
|
305
|
+
}
|
|
306
|
+
onChange={(val: any) => {
|
|
307
|
+
field.code !== 'email'
|
|
308
|
+
? setValue(field.code, val.target.value)
|
|
309
|
+
: setValue(
|
|
310
|
+
field.code,
|
|
311
|
+
val.target.value
|
|
318
312
|
.toLowerCase()
|
|
319
|
-
.replace(
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
313
|
+
.replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''),
|
|
314
|
+
);
|
|
315
|
+
field.code !== 'email'
|
|
316
|
+
? handleChangeInput(val)
|
|
317
|
+
: handleChangeInput({
|
|
318
|
+
target: {
|
|
319
|
+
name: 'email',
|
|
320
|
+
value: val.target.value
|
|
321
|
+
.toLowerCase()
|
|
322
|
+
.replace(
|
|
323
|
+
/[&,()%";:ç?<>{}\\[\]\s]/g,
|
|
324
|
+
'',
|
|
325
|
+
),
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
}}
|
|
329
|
+
autoCorrect={field.code === 'email' && false}
|
|
330
|
+
type={
|
|
331
|
+
field.code === 'email'
|
|
332
|
+
? 'email-address'
|
|
333
|
+
: 'default'
|
|
334
|
+
}
|
|
335
|
+
returnKeyType="done"
|
|
336
|
+
autoCompleteType={
|
|
337
|
+
field.code === 'email' ? 'email' : 'off'
|
|
338
|
+
}
|
|
339
|
+
selectionColor={theme.colors.primary}
|
|
340
|
+
color={theme.colors.textGray}
|
|
341
|
+
/>
|
|
342
|
+
)}
|
|
343
|
+
name={field.code}
|
|
344
|
+
rules={getInputRules(field)}
|
|
345
|
+
defaultValue={user && user[field.code]}
|
|
338
346
|
/>
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
/>
|
|
344
|
-
</React.Fragment>
|
|
345
|
-
),
|
|
347
|
+
</React.Fragment>
|
|
348
|
+
),
|
|
349
|
+
)}
|
|
350
|
+
</>
|
|
346
351
|
)}
|
|
347
|
-
|
|
348
352
|
<OText style={styles.label}>{t('PASSWORD', 'Password')}</OText>
|
|
349
353
|
|
|
350
354
|
<Controller
|
|
@@ -445,7 +449,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
445
449
|
</OText>
|
|
446
450
|
)}
|
|
447
451
|
|
|
448
|
-
{!!showInputPhoneNumber && !isAlsea && (
|
|
452
|
+
{!!showInputPhoneNumber && !isAlsea && allowDriverUpdateData && (
|
|
449
453
|
<WrapperPhone>
|
|
450
454
|
<PhoneInputNumber
|
|
451
455
|
data={phoneInputData}
|
|
@@ -487,28 +491,28 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
487
491
|
isEdit) ||
|
|
488
492
|
(watchPassword?.length > 0 && watchConfirmPassword?.length > 0) ||
|
|
489
493
|
formState?.loading) && (
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
494
|
+
<View style={{ flex: 1, marginLeft: 5 }}>
|
|
495
|
+
<OButton
|
|
496
|
+
text={
|
|
497
|
+
formState.loading
|
|
498
|
+
? t('UPDATING', 'Updating')
|
|
499
|
+
: t('UPDATE', 'Update')
|
|
500
|
+
}
|
|
501
|
+
bgColor={theme.colors.primary}
|
|
502
|
+
textStyle={{
|
|
503
|
+
...styles.btnText,
|
|
504
|
+
color: formState.loading
|
|
505
|
+
? theme.colors.textGray
|
|
506
|
+
: theme.colors.white,
|
|
507
|
+
}}
|
|
508
|
+
borderColor={theme.colors.primary}
|
|
509
|
+
isDisabled={formState.loading}
|
|
510
|
+
imgRightSrc={null}
|
|
511
|
+
style={styles.editButton}
|
|
512
|
+
onClick={handleSubmit(onSubmit)}
|
|
513
|
+
/>
|
|
514
|
+
</View>
|
|
515
|
+
)}
|
|
512
516
|
</EditButton>
|
|
513
517
|
)}
|
|
514
518
|
</>
|
|
@@ -485,10 +485,11 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
485
485
|
handleCancelEdit={handleCancelEdit}
|
|
486
486
|
toggleIsEdit={toggleIsEdit}
|
|
487
487
|
isAlsea={isAlsea}
|
|
488
|
+
allowDriverUpdateData={allowDriverUpdateData}
|
|
488
489
|
/>
|
|
489
490
|
</View>
|
|
490
491
|
)}
|
|
491
|
-
{!validationFields.loading && !isEdit &&
|
|
492
|
+
{!validationFields.loading && !isEdit && (
|
|
492
493
|
<EditButton>
|
|
493
494
|
<OButton
|
|
494
495
|
text={t('EDIT', 'Edit')}
|
|
@@ -771,7 +771,7 @@ const CheckoutUI = (props: any) => {
|
|
|
771
771
|
cart?.status !== 2 &&
|
|
772
772
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
773
773
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
774
|
-
|
|
774
|
+
cart?.business_id &&
|
|
775
775
|
(
|
|
776
776
|
<ChSection>
|
|
777
777
|
<ChDriverTips>
|