ordering-ui-react-native 0.15.3 → 0.15.5-release

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.
Files changed (131) hide show
  1. package/package.json +7 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessTypeFilter/index.tsx +12 -2
  4. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +0 -1
  7. package/src/components/Home/index.tsx +3 -5
  8. package/src/components/LanguageSelector/index.tsx +66 -97
  9. package/src/components/LanguageSelector/styles.tsx +4 -17
  10. package/src/components/Messages/index.tsx +38 -30
  11. package/src/components/MomentOption/index.tsx +3 -1
  12. package/src/components/OrderDetails/index.tsx +25 -4
  13. package/src/components/PaymentOptions/index.tsx +9 -16
  14. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  15. package/src/components/ProductForm/index.tsx +1 -1
  16. package/src/components/ProductForm/styles.tsx +1 -0
  17. package/src/components/StripeElementsForm/index.tsx +27 -48
  18. package/src/components/UserProfileForm/index.tsx +35 -1
  19. package/src/components/VerifyPhone/styles.tsx +1 -2
  20. package/src/config.json +0 -2
  21. package/src/pages/Checkout.tsx +1 -1
  22. package/src/types/index.tsx +2 -9
  23. package/src/utils/index.tsx +2 -1
  24. package/themes/business/index.tsx +2 -0
  25. package/themes/business/src/components/Chat/index.tsx +32 -31
  26. package/themes/business/src/components/Home/index.tsx +128 -55
  27. package/themes/business/src/components/Home/styles.tsx +8 -1
  28. package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
  29. package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
  30. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +27 -0
  31. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
  32. package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
  33. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  34. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  35. package/themes/business/src/components/OrdersOption/index.tsx +70 -116
  36. package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
  37. package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
  38. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  39. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  40. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  41. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  42. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  43. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
  44. package/themes/kiosk/src/components/Cart/index.tsx +1 -1
  45. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  46. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  47. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  48. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  49. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
  50. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  51. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  52. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  53. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  54. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  55. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  56. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  58. package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
  59. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  60. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  61. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  62. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  63. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  64. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  65. package/themes/original/index.tsx +179 -0
  66. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  67. package/themes/original/src/components/AddressList/index.tsx +28 -2
  68. package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
  69. package/themes/original/src/components/BusinessBasicInformation/index.tsx +100 -45
  70. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  71. package/themes/original/src/components/BusinessController/index.tsx +32 -21
  72. package/themes/original/src/components/BusinessListingSearch/index.tsx +7 -3
  73. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  74. package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
  75. package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
  76. package/themes/original/src/components/BusinessProductsList/index.tsx +6 -3
  77. package/themes/original/src/components/BusinessProductsListing/index.tsx +23 -30
  78. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  79. package/themes/original/src/components/BusinessesListing/index.tsx +40 -53
  80. package/themes/original/src/components/Cart/index.tsx +40 -9
  81. package/themes/original/src/components/CartContent/index.tsx +2 -2
  82. package/themes/original/src/components/Checkout/index.tsx +58 -33
  83. package/themes/original/src/components/Checkout/styles.tsx +7 -0
  84. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  85. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  86. package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
  87. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  88. package/themes/original/src/components/Home/index.tsx +1 -1
  89. package/themes/original/src/components/LoginForm/index.tsx +156 -70
  90. package/themes/original/src/components/LoginForm/styles.tsx +6 -1
  91. package/themes/original/src/components/Messages/index.tsx +52 -45
  92. package/themes/original/src/components/Messages/styles.tsx +1 -3
  93. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  94. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  95. package/themes/original/src/components/OrderDetails/index.tsx +104 -126
  96. package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
  97. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  98. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  99. package/themes/original/src/components/OrderSummary/index.tsx +34 -1
  100. package/themes/original/src/components/OrdersOption/index.tsx +15 -46
  101. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  102. package/themes/original/src/components/PaymentOptionWallet/index.tsx +6 -2
  103. package/themes/original/src/components/PaymentOptions/index.tsx +24 -25
  104. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
  105. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  106. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  107. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  108. package/themes/original/src/components/ProductForm/index.tsx +157 -108
  109. package/themes/original/src/components/ProductForm/styles.tsx +5 -3
  110. package/themes/original/src/components/ProductOptionSubOption/index.tsx +6 -1
  111. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  112. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  113. package/themes/original/src/components/SignupForm/index.tsx +173 -154
  114. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  115. package/themes/original/src/components/TaxInformation/index.tsx +17 -7
  116. package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
  117. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  118. package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
  119. package/themes/original/src/components/UserProfile/index.tsx +16 -16
  120. package/themes/original/src/components/UserProfileForm/index.tsx +8 -6
  121. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  122. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  123. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  124. package/themes/original/src/components/shared/index.tsx +2 -0
  125. package/themes/original/src/config/constants.tsx +6 -6
  126. package/themes/original/src/types/index.tsx +63 -23
  127. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  128. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
  129. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  130. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  131. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -68,7 +68,6 @@ const SignupFormUI = (props: SignupParams) => {
68
68
 
69
69
  const theme = useTheme();
70
70
 
71
-
72
71
  const style = StyleSheet.create({
73
72
  btnOutline: {
74
73
  backgroundColor: '#FFF',
@@ -77,7 +76,6 @@ const SignupFormUI = (props: SignupParams) => {
77
76
  inputStyle: {
78
77
  marginBottom: 20,
79
78
  borderWidth: 1,
80
- borderColor: theme.colors.border,
81
79
  borderRadius: 7.6,
82
80
  },
83
81
  wrappText: {
@@ -102,7 +100,7 @@ const SignupFormUI = (props: SignupParams) => {
102
100
  const [, t] = useLanguage();
103
101
  const [, { login }] = useSession();
104
102
  const [{ configs }] = useConfig();
105
- const { control, handleSubmit, errors } = useForm();
103
+ const { control, handleSubmit, errors, register, setValue } = useForm();
106
104
 
107
105
  const [passwordSee, setPasswordSee] = useState(false);
108
106
  const [formValues, setFormValues] = useState(null);
@@ -227,7 +225,7 @@ const SignupFormUI = (props: SignupParams) => {
227
225
  handleButtonSignupClick &&
228
226
  handleButtonSignupClick({
229
227
  ...values,
230
- ...phoneInputData.phone,
228
+ ...((phoneInputData.phone.cellphone !== null && phoneInputData.phone.country_phone_code !== null) && {...phoneInputData.phone}),
231
229
  });
232
230
  if (
233
231
  !formState.loading &&
@@ -298,36 +296,23 @@ const SignupFormUI = (props: SignupParams) => {
298
296
 
299
297
  useEffect(() => {
300
298
  if (Object.keys(errors).length > 0) {
301
- // Convert all errors in one string to show in toast provider
302
- const list = Object.values(errors);
303
- if (phoneInputData.error) {
304
- list.push({ message: phoneInputData.error });
305
- }
306
- if (
307
- !phoneInputData.error &&
308
- !phoneInputData.phone.country_phone_code &&
309
- !phoneInputData.phone.cellphone &&
310
- ((validationFields?.fields?.checkout?.cellphone?.enabled &&
311
- validationFields?.fields?.checkout?.cellphone?.required) ||
312
- configs?.verification_phone_required?.value === '1')
313
- ) {
314
- list.push({
315
- message: t(
316
- 'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
317
- 'The field Mobile phone is required.',
318
- ),
319
- });
320
- }
321
- let stringError = '';
322
- list.map((item: any, i: number) => {
323
- stringError +=
324
- i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
325
- });
326
- showToast(ToastType.Error, stringError);
327
299
  setIsLoadingVerifyModal(false);
328
300
  }
329
301
  }, [errors]);
330
302
 
303
+ useEffect(() => {
304
+ register('cellphone', {
305
+ required: isRequiredField('cellphone')
306
+ ? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
307
+ : null
308
+ })
309
+ }, [register])
310
+
311
+ useEffect(() => {
312
+ if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
313
+ else setValue('cellphone', '')
314
+ }, [phoneInputData?.phone?.cellphone])
315
+
331
316
  useEffect(() => {
332
317
  if (verifyPhoneState && !verifyPhoneState?.loading) {
333
318
  if (verifyPhoneState.result?.error) {
@@ -412,48 +397,58 @@ const SignupFormUI = (props: SignupParams) => {
412
397
  !notValidationFields.includes(field.code) &&
413
398
  showField &&
414
399
  showField(field.code) && (
415
- <Controller
416
- key={field.id}
417
- control={control}
418
- render={({ onChange, value }: any) => (
419
- <OInput
420
- placeholder={t(field.name)}
421
- style={style.inputStyle}
422
- icon={
423
- field.code === 'email'
424
- ? theme.images.general.email
425
- : theme.images.general.user
426
- }
427
- value={value}
428
- onChange={(val: any) =>
429
- field.code !== 'email'
430
- ? onChange(val)
431
- : handleChangeInputEmail(val, onChange)
432
- }
433
- autoCapitalize={
434
- field.code === 'email' ? 'none' : 'sentences'
435
- }
436
- autoCorrect={field.code === 'email' && false}
437
- type={
438
- field.code === 'email' ? 'email-address' : 'default'
439
- }
440
- autoCompleteType={
441
- field.code === 'email' ? 'email' : 'off'
442
- }
443
- returnKeyType="next"
444
- blurOnSubmit={false}
445
- forwardRef={(ref: any) => handleRefs(ref, field.code)}
446
- onSubmitEditing={() =>
447
- field.code === 'email'
448
- ? phoneRef?.current?.focus?.()
449
- : handleFocusRef(getNextFieldCode(i))
450
- }
451
- />
400
+ <React.Fragment key={field.id}>
401
+ {errors?.[`${field.code}`] && (
402
+ <OText
403
+ size={14}
404
+ color={theme.colors.danger5}
405
+ weight={'normal'}>
406
+ {errors?.[`${field.code}`]?.message} {errors?.[`${field.code}`]?.type === 'required' && '*'}
407
+ </OText>
452
408
  )}
453
- name={field.code}
454
- rules={getInputRules(field)}
455
- defaultValue=""
456
- />
409
+ <Controller
410
+ control={control}
411
+ render={({ onChange, value }: any) => (
412
+ <OInput
413
+ placeholder={t(field.name)}
414
+ style={style.inputStyle}
415
+ icon={
416
+ field.code === 'email'
417
+ ? theme.images.general.email
418
+ : theme.images.general.user
419
+ }
420
+ value={value}
421
+ onChange={(val: any) =>
422
+ field.code !== 'email'
423
+ ? onChange(val)
424
+ : handleChangeInputEmail(val, onChange)
425
+ }
426
+ autoCapitalize={
427
+ field.code === 'email' ? 'none' : 'sentences'
428
+ }
429
+ autoCorrect={field.code === 'email' && false}
430
+ type={
431
+ field.code === 'email' ? 'email-address' : 'default'
432
+ }
433
+ autoCompleteType={
434
+ field.code === 'email' ? 'email' : 'off'
435
+ }
436
+ returnKeyType="next"
437
+ blurOnSubmit={false}
438
+ forwardRef={(ref: any) => handleRefs(ref, field.code)}
439
+ onSubmitEditing={() =>
440
+ field.code === 'email'
441
+ ? phoneRef?.current?.focus?.()
442
+ : handleFocusRef(getNextFieldCode(i))
443
+ }
444
+ borderColor={errors?.[`${field.code}`] ? theme.colors.danger5 : theme.colors.border}
445
+ />
446
+ )}
447
+ name={field.code}
448
+ rules={getInputRules(field)}
449
+ defaultValue=""
450
+ />
451
+ </React.Fragment>
457
452
  ),
458
453
  )}
459
454
 
@@ -467,6 +462,7 @@ const SignupFormUI = (props: SignupParams) => {
467
462
  returnKeyType: 'next',
468
463
  onSubmitEditing: () => passwordRef?.current?.focus?.(),
469
464
  }}
465
+ isStartValidation={errors?.cellphone}
470
466
  />
471
467
  </View>
472
468
  )}
@@ -499,99 +495,122 @@ const SignupFormUI = (props: SignupParams) => {
499
495
  </View>
500
496
 
501
497
  {configs?.terms_and_conditions?.value === 'true' && (
502
- <View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20 }}>
498
+ <>
499
+ {errors?.termsAccept && (
500
+ <OText
501
+ size={14}
502
+ color={theme.colors.danger5}
503
+ weight={'normal'}>
504
+ {errors?.termsAccept?.message}*
505
+ </OText>
506
+ )}
507
+ <View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20 }}>
508
+ <Controller
509
+ control={control}
510
+ render={({ onChange, value }: any) => (
511
+ <CheckBox
512
+ value={value}
513
+ onValueChange={newValue => {
514
+ onChange(newValue)
515
+ }}
516
+ boxType={'square'}
517
+ tintColors={{
518
+ true: theme.colors.primary,
519
+ false: theme.colors.disabled
520
+ }}
521
+ tintColor={theme.colors.disabled}
522
+ onCheckColor={theme.colors.primary}
523
+ onTintColor={theme.colors.primary}
524
+ style={Platform.OS === 'ios' && style.checkBoxStyle}
525
+ />
526
+ )}
527
+ name='termsAccept'
528
+ rules={{
529
+ required: t('VALIDATION_ERROR_ACCEPTED', 'The _attribute_ must be accepted.').replace('_attribute_', t('TERMS_AND_CONDITIONS', 'Terms & Conditions'))
530
+ }}
531
+ defaultValue={false}
532
+ />
533
+ <OText style={{ fontSize: 14, paddingHorizontal: 5 }}>{t('TERMS_AND_CONDITIONS_TEXT', 'I agree with')}</OText>
534
+ <OButton
535
+ imgRightSrc={null}
536
+ text={t('TERMS_AND_CONDITIONS', 'Terms & Conditions')}
537
+ bgColor='#FFF'
538
+ borderColor='#FFF'
539
+ style={{ paddingLeft: 0, paddingRight: 0, height: 30, shadowColor: '#FFF' }}
540
+ textStyle={{ color: theme.colors.primary, marginLeft: 0, marginRight: 0 }}
541
+ onClick={() => handleOpenTermsUrl(configs?.terms_and_conditions_url?.value)}
542
+ />
543
+ </View>
544
+ </>
545
+
546
+ )}
547
+
548
+ {signupTab !== 'cellphone' && (
549
+ <>
550
+ {errors?.password && (
551
+ <OText
552
+ size={14}
553
+ color={theme.colors.danger5}
554
+ weight={'normal'}>
555
+ {errors?.password?.message} {errors?.password?.type === 'required' && '*'}
556
+ </OText>
557
+ )}
503
558
  <Controller
504
559
  control={control}
505
560
  render={({ onChange, value }: any) => (
506
- <CheckBox
561
+ <OInput
562
+ isSecured={!passwordSee ? true : false}
563
+ placeholder={t('PASSWORD', 'Password')}
564
+ style={style.inputStyle}
565
+ icon={theme.images.general.lock}
566
+ iconCustomRight={
567
+ !passwordSee ? (
568
+ <MaterialCommunityIcons
569
+ name="eye-outline"
570
+ color={theme.colors.disabled}
571
+ size={24}
572
+ onPress={() => setPasswordSee(!passwordSee)}
573
+ />
574
+ ) : (
575
+ <MaterialCommunityIcons
576
+ name="eye-off-outline"
577
+ color={theme.colors.disabled}
578
+ size={24}
579
+ onPress={() => setPasswordSee(!passwordSee)}
580
+ />
581
+ )
582
+ }
507
583
  value={value}
508
- onValueChange={newValue => {
509
- onChange(newValue)
510
- }}
511
- boxType={'square'}
512
- tintColors={{
513
- true: theme.colors.primary,
514
- false: theme.colors.disabled
515
- }}
516
- tintColor={theme.colors.disabled}
517
- onCheckColor={theme.colors.primary}
518
- onTintColor={theme.colors.primary}
519
- style={Platform.OS === 'ios' && style.checkBoxStyle}
584
+ onChange={(val: any) => onChange(val)}
585
+ returnKeyType="done"
586
+ onSubmitEditing={handleSubmit(onSubmit)}
587
+ blurOnSubmit
588
+ forwardRef={passwordRef}
589
+ borderColor={errors?.password ? theme.colors.danger5 : theme.colors.border}
520
590
  />
521
591
  )}
522
- name='termsAccept'
592
+ name="password"
523
593
  rules={{
524
- required: t('VALIDATION_ERROR_ACCEPTED', 'The _attribute_ must be accepted.').replace('_attribute_', t('TERMS_AND_CONDITIONS', 'Terms & Conditions'))
594
+ required: isRequiredField('password')
595
+ ? t(
596
+ 'VALIDATION_ERROR_PASSWORD_REQUIRED',
597
+ 'The field Password is required',
598
+ ).replace('_attribute_', t('PASSWORD', 'password'))
599
+ : null,
600
+ minLength: {
601
+ value: 8,
602
+ message: t(
603
+ 'VALIDATION_ERROR_PASSWORD_MIN_STRING',
604
+ 'The Password must be at least 8 characters.',
605
+ )
606
+ .replace('_attribute_', t('PASSWORD', 'Password'))
607
+ .replace('_min_', 8),
608
+ },
525
609
  }}
526
- defaultValue={false}
527
- />
528
- <OText style={{ fontSize: 14, paddingHorizontal: 5 }}>{t('TERMS_AND_CONDITIONS_TEXT', 'I agree with')}</OText>
529
- <OButton
530
- imgRightSrc={null}
531
- text={t('TERMS_AND_CONDITIONS', 'Terms & Conditions')}
532
- bgColor='#FFF'
533
- borderColor='#FFF'
534
- style={{ paddingLeft: 0, paddingRight: 0, height: 30, shadowColor: '#FFF' }}
535
- textStyle={{ color: theme.colors.primary, marginLeft: 0, marginRight: 0 }}
536
- onClick={() => handleOpenTermsUrl(configs?.terms_and_conditions_url?.value)}
610
+ defaultValue=""
537
611
  />
538
- </View>
539
- )}
612
+ </>
540
613
 
541
- {signupTab !== 'cellphone' && (
542
- <Controller
543
- control={control}
544
- render={({ onChange, value }: any) => (
545
- <OInput
546
- isSecured={!passwordSee ? true : false}
547
- placeholder={t('PASSWORD', 'Password')}
548
- style={style.inputStyle}
549
- icon={theme.images.general.lock}
550
- iconCustomRight={
551
- !passwordSee ? (
552
- <MaterialCommunityIcons
553
- name="eye-outline"
554
- color={theme.colors.disabled}
555
- size={24}
556
- onPress={() => setPasswordSee(!passwordSee)}
557
- />
558
- ) : (
559
- <MaterialCommunityIcons
560
- name="eye-off-outline"
561
- color={theme.colors.disabled}
562
- size={24}
563
- onPress={() => setPasswordSee(!passwordSee)}
564
- />
565
- )
566
- }
567
- value={value}
568
- onChange={(val: any) => onChange(val)}
569
- returnKeyType="done"
570
- onSubmitEditing={handleSubmit(onSubmit)}
571
- blurOnSubmit
572
- forwardRef={passwordRef}
573
- />
574
- )}
575
- name="password"
576
- rules={{
577
- required: isRequiredField('password')
578
- ? t(
579
- 'VALIDATION_ERROR_PASSWORD_REQUIRED',
580
- 'The field Password is required',
581
- ).replace('_attribute_', t('PASSWORD', 'password'))
582
- : null,
583
- minLength: {
584
- value: 8,
585
- message: t(
586
- 'VALIDATION_ERROR_PASSWORD_MIN_STRING',
587
- 'The Password must be at least 8 characters.',
588
- )
589
- .replace('_attribute_', t('PASSWORD', 'Password'))
590
- .replace('_min_', 8),
591
- },
592
- }}
593
- defaultValue=""
594
- />
595
614
  )}
596
615
  </>
597
616
  ) : (
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { View, StyleSheet, useWindowDimensions, Keyboard } from 'react-native';
3
- import { useLanguage, useSession, useConfig } from 'ordering-components/native';
3
+ import { useLanguage, useSession } from 'ordering-components/native';
4
4
  import {
5
5
  StripeProvider,
6
6
  CardField,
@@ -13,7 +13,6 @@ import { ErrorMessage } from './styles';
13
13
  import { StripeElementsForm as StripeFormController } from './naked';
14
14
  import { OButton, OText } from '../shared';
15
15
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
16
- import { StripeMethodForm } from '../../../../../src/components/StripeMethodForm';
17
16
 
18
17
  const StripeElementsFormUI = (props: any) => {
19
18
  const {
@@ -23,17 +22,12 @@ const StripeElementsFormUI = (props: any) => {
23
22
  businessId,
24
23
  requirements,
25
24
  stripeTokenHandler,
26
- methodsPay,
27
- paymethod,
28
- onCancel,
29
- cart,
30
25
  } = props;
31
26
 
32
27
  const theme = useTheme();
33
28
 
34
29
  const [, t] = useLanguage();
35
30
  const [{ user }] = useSession();
36
- const [{ configs }] = useConfig();
37
31
  const [card, setCard] = useState<any>(null);
38
32
  const [isCompleted, setIsCompleted] = useState(false);
39
33
  const [errors, setErrors] = useState('')
@@ -43,30 +37,30 @@ const StripeElementsFormUI = (props: any) => {
43
37
  const { top, bottom } = useSafeAreaInsets();
44
38
  const [isKeyboardShow, setIsKeyboardShow] = useState(false);
45
39
 
46
- let billingDetails: any = {}
40
+ let billingDetails: any = {}
47
41
 
48
- if (user?.name || user?.lastname) {
49
- if (user?.name) {
50
- billingDetails.name = user?.name
51
- }
52
- if (user?.lastname) {
53
- billingDetails.name = `${billingDetails?.name} ${user?.lastname}`
54
- }
55
- }
42
+ if (user?.name || user?.lastname) {
43
+ if (user?.name) {
44
+ billingDetails.name = user?.name
45
+ }
46
+ if (user?.lastname) {
47
+ billingDetails.name = `${billingDetails?.name} ${user?.lastname}`
48
+ }
49
+ }
56
50
 
57
- if (user?.email) {
58
- billingDetails.email = user?.email
59
- }
51
+ if (user?.email) {
52
+ billingDetails.email = user?.email
53
+ }
60
54
 
61
- if (user?.address) {
62
- billingDetails.addressLine1 = user?.address
63
- }
55
+ if (user?.address) {
56
+ billingDetails.addressLine1 = user?.address
57
+ }
64
58
 
65
59
  const createPayMethod = async () => {
66
- const params: any = { type: 'Card' }
67
- if (Object.keys(billingDetails).length > 0) {
68
- params.billingDetails = billingDetails
69
- }
60
+ const params: any = { type: 'Card' }
61
+ if (Object.keys(billingDetails).length > 0) {
62
+ params.billingDetails = billingDetails
63
+ }
70
64
  try {
71
65
  setCreatePmLoading(true)
72
66
  const { paymentMethod } = await createPaymentMethod(params);
@@ -99,10 +93,10 @@ const StripeElementsFormUI = (props: any) => {
99
93
  createPayMethod();
100
94
  return
101
95
  }
102
- const params: any = { type: 'Card' }
103
- if (Object.keys(billingDetails).length > 0) {
104
- params.billingDetails = billingDetails
105
- }
96
+ const params: any = { type: 'Card' }
97
+ if (Object.keys(billingDetails).length > 0) {
98
+ params.billingDetails = billingDetails
99
+ }
106
100
  try {
107
101
  const { setupIntent, error } = await confirmSetupIntent(requirements, params);
108
102
 
@@ -158,35 +152,27 @@ const StripeElementsFormUI = (props: any) => {
158
152
  <View style={{ ...styles.container, height: height - top - bottom - 60 - (isKeyboardShow ? 250 : 0) }}>
159
153
  {publicKey ? (
160
154
  <View style={{ flex: 1 }}>
161
- <StripeProvider
162
- publishableKey={publicKey}
163
- merchantIdentifier={`merchant.${configs.apple_app_id}`}
164
- >
165
- {methodsPay?.includes(paymethod) ? (
166
- <StripeMethodForm
167
- handleSource={handleSource}
168
- onCancel={onCancel}
169
- cart={cart}
170
- setErrors={setErrors}
171
- paymethod={paymethod}
172
- devMode={publicKey?.includes('test')}
173
- />
174
- ) : (
175
- <CardField
176
- postalCodeEnabled={true}
177
- cardStyle={{
178
- backgroundColor: '#FFFFFF',
179
- textColor: '#000000',
180
- }}
181
- style={{
182
- width: '100%',
183
- height: 50,
184
- marginVertical: 30,
185
- zIndex: 9999,
186
- }}
187
- onCardChange={(cardDetails: any) => setCard(cardDetails)}
188
- />
189
- )}
155
+ <StripeProvider publishableKey={publicKey}>
156
+ <CardField
157
+ postalCodeEnabled={false}
158
+ cardStyle={{
159
+ backgroundColor: '#FFFFFF',
160
+ textColor: '#000000',
161
+ fontSize: 17,
162
+ styles: {
163
+
164
+ }
165
+ }}
166
+ style={{
167
+ width: '100%',
168
+ height: 50,
169
+ marginVertical: 50,
170
+ borderWidth: 1,
171
+ borderColor: theme.colors.border,
172
+ borderRadius: 7.6,
173
+ }}
174
+ onCardChange={(cardDetails: any) => setCard(cardDetails)}
175
+ />
190
176
  </StripeProvider>
191
177
  {!!errors && (
192
178
  <ErrorMessage>
@@ -211,19 +197,16 @@ const StripeElementsFormUI = (props: any) => {
211
197
  </OText>
212
198
  </ErrorMessage>
213
199
  )}
214
- {!methodsPay?.includes(paymethod) && (
215
- <OButton
216
- text={t('SAVE_CARD', 'Save card')}
217
- bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
218
- borderColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
219
- style={styles.btnAddStyle}
220
- textStyle={{ color: 'white' }}
221
- imgRightSrc={null}
222
- onClick={() => handleSaveCard()}
223
- isDisabled={!isCompleted}
224
- isLoading={confirmSetupLoading || values.loadingAdd || createPmLoading}
225
- />
226
- )}
200
+ <OButton
201
+ text={t('SAVE_CARD', 'Save card')}
202
+ bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
203
+ borderColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
204
+ style={styles.btnAddStyle}
205
+ textStyle={{ color: 'white', fontSize: 14 }}
206
+ imgRightSrc={null}
207
+ onClick={isCompleted ? () => handleSaveCard() : () => { }}
208
+ isLoading={confirmSetupLoading || values.loadingAdd || createPmLoading}
209
+ />
227
210
  </View>
228
211
  )
229
212
  }
@@ -1,5 +1,5 @@
1
- import React, { Mixin } from 'react'
2
- import { useLanguage } from 'ordering-components/native'
1
+ import React from 'react'
2
+ import { useLanguage, useUtils } from 'ordering-components/native'
3
3
  import { SingleProductCard } from '../SingleProductCard'
4
4
  import { TaxInformationContainer, ProductContainer } from './styles'
5
5
  import { OText } from '../shared'
@@ -9,12 +9,13 @@ interface taxInformationParams {
9
9
  name: string,
10
10
  description?: string,
11
11
  rate: string | number,
12
- type: number,
12
+ type: string | number,
13
13
  fixed?: number,
14
14
  percentage?: number,
15
15
  id: number,
16
- discounts?: any
17
- } | null,
16
+ discounts?: any,
17
+ rate_type?: number
18
+ },
18
19
  products: Array<any>,
19
20
  type: string
20
21
  }
@@ -27,8 +28,13 @@ export const TaxInformation = (props: taxInformationParams) => {
27
28
  } = props
28
29
 
29
30
  const [, t] = useLanguage()
31
+ const [{ parsePrice }] = useUtils()
30
32
 
31
33
  const includedOnPriceString = data?.type === 1 ? `(${t('INCLUDED_ON_PRICE', 'Included on price')})` : `(${t('NOT_INCLUDED_ON_PRICE', 'Not included on price')})`
34
+ const offersHideArray = ['offer_target_2', 'offer_target_3']
35
+ const hideProductsSectionOffers = offersHideArray.includes(type)
36
+ const dataHideArray : Array<string | number> = ['platform', 'business']
37
+ const hideProductsSectionData = dataHideArray.includes(data.type)
32
38
 
33
39
  const getFilterValidation = (product: any) => {
34
40
  return (
@@ -52,8 +58,12 @@ export const TaxInformation = (props: taxInformationParams) => {
52
58
 
53
59
  return (
54
60
  <TaxInformationContainer>
61
+ <OText size={24} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
62
+ {`${data?.name ||
63
+ t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${data?.rate_type !== 2 ? `(${typeof data?.rate === 'number' ? `${data?.rate}%` : `${parsePrice(data?.fixed ?? 0)} + ${data?.percentage}%`})` : ''} `}
64
+ </OText>
55
65
  {!!data?.description ? (
56
- <OText size={24} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
66
+ <OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
57
67
  {t('DESCRIPTION', 'Description')}: {data?.description} {data?.type && !type?.includes('offer') && includedOnPriceString}
58
68
  </OText>
59
69
  ) : (
@@ -61,7 +71,7 @@ export const TaxInformation = (props: taxInformationParams) => {
61
71
  {t('WITHOUT_DESCRIPTION', 'Without description')}
62
72
  </OText>
63
73
  )}
64
- {!(type === 'offer_target_2' || type === 'offer_target_3') && (
74
+ {!hideProductsSectionOffers && !hideProductsSectionData && (
65
75
  <>
66
76
  <OText>{t('OTHER_PRODUCTS_WITH_THIS', 'Other products with this')} {getTypeString()}:</OText>
67
77
  <ProductContainer>
@@ -157,6 +157,12 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
157
157
  </TopActions>
158
158
  </TopBar>
159
159
  <ScrollView style={{ marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
160
+ {productsList.length > 0 &&
161
+ <View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
162
+ <OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
163
+ <UpsellingLayout />
164
+ </View>
165
+ }
160
166
  <View style={{ paddingHorizontal: 40 }}>
161
167
  <OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
162
168
  <OrderSummary
@@ -165,12 +171,6 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
165
171
  onNavigationRedirect={onNavigationRedirect}
166
172
  />
167
173
  </View>
168
- {productsList.length > 0 &&
169
- <View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
170
- <OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
171
- <UpsellingLayout />
172
- </View>
173
- }
174
174
  </ScrollView>
175
175
  <View
176
176
  style={{