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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.21.99",
3
+ "version": "0.22.00",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -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
- `VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`,
70
- `${field.name} is required`,
71
- ).replace('_attribute_', t(field.name, field.code))
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
- {sortInputFields({
265
- values: validationFields.fields?.checkout,
266
- }).map(
267
- (field: any) =>
268
- showField &&
269
- showField(field.code) &&
270
- !isAlsea
271
- && (
272
- <React.Fragment key={field.id}>
273
- <OText style={styles.label}>
274
- {t(field?.code.toUpperCase(), field?.name)}
275
- </OText>
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
- <Controller
278
- key={field.id}
279
- control={control}
280
- render={() => (
281
- <OInput
282
- name={field.code}
283
- placeholder={t(
284
- field.code.toUpperCase(),
285
- field?.name,
286
- )}
287
- placeholderTextColor={theme.colors.arrowColor}
288
- style={styles.inputStyle}
289
- icon={
290
- field.code === 'email'
291
- ? theme.images.general.email
292
- : theme.images.general.user
293
- }
294
- autoCapitalize={
295
- field.code === 'email' ? 'none' : 'sentences'
296
- }
297
- isDisabled={!isEdit}
298
- value={
299
- formState?.changes[field.code] ??
300
- (user && user[field.code]) ??
301
- ''
302
- }
303
- onChange={(val: any) => {
304
- field.code !== 'email'
305
- ? setValue(field.code, val.target.value)
306
- : setValue(
307
- field.code,
308
- val.target.value
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
- /[&,()%";:ç?<>{}\\[\]\s]/g,
321
- '',
322
- ),
323
- },
324
- });
325
- }}
326
- autoCorrect={field.code === 'email' && false}
327
- type={
328
- field.code === 'email'
329
- ? 'email-address'
330
- : 'default'
331
- }
332
- returnKeyType="done"
333
- autoCompleteType={
334
- field.code === 'email' ? 'email' : 'off'
335
- }
336
- selectionColor={theme.colors.primary}
337
- color={theme.colors.textGray}
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
- name={field.code}
341
- rules={getInputRules(field)}
342
- defaultValue={user && user[field.code]}
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
- <View style={{ flex: 1, marginLeft: 5 }}>
491
- <OButton
492
- text={
493
- formState.loading
494
- ? t('UPDATING', 'Updating')
495
- : t('UPDATE', 'Update')
496
- }
497
- bgColor={theme.colors.primary}
498
- textStyle={{
499
- ...styles.btnText,
500
- color: formState.loading
501
- ? theme.colors.textGray
502
- : theme.colors.white,
503
- }}
504
- borderColor={theme.colors.primary}
505
- isDisabled={formState.loading}
506
- imgRightSrc={null}
507
- style={styles.editButton}
508
- onClick={handleSubmit(onSubmit)}
509
- />
510
- </View>
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 && allowDriverUpdateData && (
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
- !isGiftCardCart &&
774
+ cart?.business_id &&
775
775
  (
776
776
  <ChSection>
777
777
  <ChDriverTips>