ordering-ui-react-native 0.15.13 → 0.15.14-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 (153) hide show
  1. package/package.json +5 -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/LanguageSelector/index.tsx +1 -0
  8. package/src/components/OrderDetails/index.tsx +26 -5
  9. package/src/components/PaymentOptions/index.tsx +9 -16
  10. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  11. package/src/components/ProductForm/index.tsx +1 -1
  12. package/src/components/ProductForm/styles.tsx +1 -0
  13. package/src/components/StripeElementsForm/index.tsx +27 -48
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/config.json +0 -2
  16. package/src/navigators/HomeNavigator.tsx +6 -0
  17. package/src/pages/BusinessProductsList.tsx +1 -0
  18. package/src/pages/BusinessesListing.tsx +1 -1
  19. package/src/pages/Checkout.tsx +1 -1
  20. package/src/pages/Sessions.tsx +22 -0
  21. package/src/types/index.tsx +1 -9
  22. package/src/utils/index.tsx +68 -1
  23. package/themes/business/index.tsx +2 -0
  24. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
  25. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
  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 +2 -1
  30. package/themes/business/src/components/OrderDetails/Delivery.tsx +9 -9
  31. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +150 -89
  32. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
  33. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  34. package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
  35. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  36. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  37. package/themes/business/src/components/OrdersOption/index.tsx +70 -116
  38. package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
  39. package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
  40. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  41. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  42. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  43. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  44. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  45. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
  46. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  47. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  48. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  49. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  50. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  51. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  52. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
  53. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  54. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  55. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  56. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  57. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  58. package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
  59. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  60. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  62. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  63. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  64. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  65. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  66. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  67. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  68. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  69. package/themes/kiosk/src/types/index.d.ts +2 -0
  70. package/themes/original/index.tsx +179 -0
  71. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  72. package/themes/original/src/components/AddressList/index.tsx +56 -18
  73. package/themes/original/src/components/AppleLogin/index.tsx +119 -78
  74. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  75. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  76. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  77. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  78. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  79. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
  81. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +129 -22
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  86. package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
  87. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  88. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  89. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  90. package/themes/original/src/components/BusinessesListing/index.tsx +49 -58
  91. package/themes/original/src/components/Cart/index.tsx +58 -21
  92. package/themes/original/src/components/CartContent/index.tsx +2 -2
  93. package/themes/original/src/components/Checkout/index.tsx +24 -28
  94. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  95. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  96. package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
  97. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  98. package/themes/original/src/components/Home/index.tsx +1 -1
  99. package/themes/original/src/components/LoginForm/index.tsx +156 -70
  100. package/themes/original/src/components/LoginForm/styles.tsx +6 -1
  101. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  102. package/themes/original/src/components/Messages/index.tsx +50 -45
  103. package/themes/original/src/components/Messages/styles.tsx +1 -3
  104. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  105. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  106. package/themes/original/src/components/OrderDetails/index.tsx +105 -127
  107. package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
  108. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  109. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  110. package/themes/original/src/components/OrderSummary/index.tsx +35 -2
  111. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  112. package/themes/original/src/components/OrdersOption/index.tsx +25 -33
  113. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  114. package/themes/original/src/components/PaymentOptionWallet/index.tsx +9 -4
  115. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  116. package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
  117. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
  118. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  119. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  120. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  121. package/themes/original/src/components/ProductForm/index.tsx +47 -36
  122. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  123. package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
  124. package/themes/original/src/components/Promotions/index.tsx +234 -0
  125. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  126. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  127. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  128. package/themes/original/src/components/Sessions/index.tsx +160 -0
  129. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  130. package/themes/original/src/components/SignupForm/index.tsx +173 -154
  131. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  132. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  133. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  134. package/themes/original/src/components/TaxInformation/index.tsx +17 -7
  135. package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
  136. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  137. package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
  138. package/themes/original/src/components/UserProfile/index.tsx +70 -20
  139. package/themes/original/src/components/UserProfileForm/index.tsx +28 -24
  140. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  141. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  142. package/themes/original/src/components/Wallets/index.tsx +75 -8
  143. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  144. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  145. package/themes/original/src/components/shared/index.tsx +2 -0
  146. package/themes/original/src/config/constants.tsx +6 -6
  147. package/themes/original/src/types/index.tsx +79 -25
  148. package/themes/original/src/utils/index.tsx +12 -2
  149. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  150. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  151. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  152. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  153. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import {
3
- BusinessList as BusinessesListingController,
3
+ BusinessList as BusinessesListingController,
4
4
  useLanguage,
5
- useOrder
5
+ useOrder
6
6
  } from 'ordering-components/native';
7
7
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
8
8
  import { View, ScrollView, Platform, Dimensions } from 'react-native';
@@ -24,117 +24,125 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
24
24
  } = props;
25
25
 
26
26
  const [, t] = useLanguage()
27
- const [orderState] = useOrder();
27
+ const [orderState] = useOrder()
28
28
 
29
29
  const windowWidth = Dimensions.get('window').width;
30
30
 
31
31
  useEffect(() => {
32
- if (businessesList?.loading || !isLoading) return
32
+ if (businessesList?.loading || !isLoading) return
33
33
  getBusinesses(true)
34
34
  }, [isLoading])
35
35
 
36
36
  return (
37
37
  <>
38
- <ListWrapper>
39
- <OText size={16} mBottom={5} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('HIGHEST_RATED', 'Highest rated')}</OText>
40
- <OText size={12}>{t('TOP_RATINGS_AND_GREAT_SERVICE', 'Top ratings and great service')}</OText>
41
- <ScrollView
42
- showsHorizontalScrollIndicator={false}
43
- nestedScrollEnabled
44
- horizontal
45
- style={{ height: 300 }}
46
- >
47
- {businessesList.loading ? (
48
- <>
49
- {[
50
- ...Array(10).keys()
51
- ].map((item, i) => (
52
- <Placeholder
53
- Animation={Fade}
54
- key={i}
55
- style={{
56
- marginTop: 20,
57
- width: windowWidth - 100,
58
- paddingHorizontal: 5,
59
- height: '100%'
60
- }}>
61
- <View style={{ width: '100%' }}>
62
- <PlaceholderLine
63
- height={150}
64
- style={{ marginBottom: 20, borderRadius: 8 }}
65
- />
66
- <View style={{ paddingHorizontal: 10 }}>
67
- <View
68
- style={{
69
- flexDirection: 'row',
70
- justifyContent: 'space-between',
71
- }}>
72
- <PlaceholderLine
73
- height={15}
74
- width={40}
75
- style={{ marginBottom: 15 }}
76
- />
77
- <PlaceholderLine
78
- height={15}
79
- width={20}
80
- style={{ marginBottom: 15 }}
81
- />
82
- </View>
38
+
39
+ {businessesList.loading ? (
40
+ <>
41
+ <ScrollView
42
+ showsHorizontalScrollIndicator={false}
43
+ nestedScrollEnabled
44
+ horizontal
45
+ style={{ height: 300, paddingHorizontal: 40 }}
46
+ >
47
+ {[
48
+ ...Array(10).keys()
49
+ ].map((item, i) => (
50
+ <Placeholder
51
+ Animation={Fade}
52
+ key={i}
53
+ style={{
54
+ marginTop: 20,
55
+ width: windowWidth - 100,
56
+ paddingHorizontal: 5,
57
+ height: '100%'
58
+ }}>
59
+ <View style={{ width: '100%' }}>
60
+ <PlaceholderLine
61
+ height={150}
62
+ style={{ marginBottom: 20, borderRadius: 8 }}
63
+ />
64
+ <View style={{ paddingHorizontal: 10 }}>
65
+ <View
66
+ style={{
67
+ flexDirection: 'row',
68
+ justifyContent: 'space-between',
69
+ }}>
83
70
  <PlaceholderLine
84
71
  height={15}
85
- width={30}
86
- style={{ marginBottom: 10 }}
72
+ width={40}
73
+ style={{ marginBottom: 15 }}
87
74
  />
88
75
  <PlaceholderLine
89
76
  height={15}
90
- width={80}
91
- style={{ marginBottom: 10 }}
77
+ width={20}
78
+ style={{ marginBottom: 15 }}
92
79
  />
93
80
  </View>
81
+ <PlaceholderLine
82
+ height={15}
83
+ width={30}
84
+ style={{ marginBottom: 10 }}
85
+ />
86
+ <PlaceholderLine
87
+ height={15}
88
+ width={80}
89
+ style={{ marginBottom: 10 }}
90
+ />
94
91
  </View>
95
- </Placeholder>
96
- ))}
97
- </>
98
- ) : (
99
- <>
100
- {businessesList.businesses.length > 0 ? (
101
- businessesList.businesses?.map(
102
- (business: any) => (
103
- <View
104
- key={business.id}
105
- style={{
106
- width: windowWidth - 100,
107
- paddingHorizontal: 5,
108
- height: '100%'
109
- }}
110
- >
111
- <BusinessController
112
- business={business}
113
- isBusinessOpen={business?.open}
114
- handleCustomClick={onBusinessClick}
115
- orderType={orderState?.options?.type}
116
- navigation={navigation}
117
- />
118
- </View>
92
+ </View>
93
+ </Placeholder>
94
+ ))}
95
+ </ScrollView>
96
+ </>
97
+ ) : (
98
+ <>
99
+ {businessesList.businesses.length > 0 && (
100
+ <ListWrapper>
101
+ <OText size={16} mBottom={5} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('HIGHEST_RATED', 'Highest rated')}</OText>
102
+ <OText size={12}>{t('TOP_RATINGS_AND_GREAT_SERVICE', 'Top ratings and great service')}</OText>
103
+ <ScrollView
104
+ showsHorizontalScrollIndicator={false}
105
+ nestedScrollEnabled
106
+ horizontal
107
+ style={{ height: 300 }}
108
+ >
109
+ {
110
+ businessesList.businesses?.map(
111
+ (business: any) => (
112
+ <View
113
+ key={business.id}
114
+ style={{
115
+ width: windowWidth - 100,
116
+ paddingHorizontal: 5,
117
+ height: '100%'
118
+ }}
119
+ >
120
+ <BusinessController
121
+ business={business}
122
+ isBusinessOpen={business?.open}
123
+ handleCustomClick={onBusinessClick}
124
+ orderType={orderState?.options?.type}
125
+ navigation={navigation}
126
+ />
127
+ </View>
128
+ )
119
129
  )
120
- )
121
- ) : (
122
- <NotFoundSource />
123
- )}
124
- </>
130
+ }
131
+ </ScrollView>
132
+ </ListWrapper>
125
133
  )}
126
- </ScrollView>
127
- </ListWrapper>
134
+ </>
135
+ )}
128
136
  </>
129
137
  )
130
138
  }
131
139
 
132
140
  export const HighestRatedBusinesses = (props: any) => {
133
- const highestRatedBusinessesProps = {
134
- ...props,
135
- UIComponent: HighestRatedBusinessesUI,
141
+ const highestRatedBusinessesProps = {
142
+ ...props,
143
+ UIComponent: HighestRatedBusinessesUI,
136
144
  initialOrderByValue: 'rating'
137
- };
145
+ };
138
146
 
139
- return <BusinessesListingController {...highestRatedBusinessesProps} />;
147
+ return <BusinessesListingController {...highestRatedBusinessesProps} />;
140
148
  };
@@ -36,7 +36,7 @@ export const Home = (props: any) => {
36
36
  {t('WELCOME', 'Welcome!')}
37
37
  </OText>
38
38
  <OText color={theme.colors.white} size={14} style={{ marginBottom: 46 }}>
39
- {t('LETS_START_ORDER', "Let's start to order now")}
39
+ {t('SUBTITLE_HOME', "Let's start to order now")}
40
40
  </OText>
41
41
  <OButton
42
42
  text={t('LOGIN_NOW', 'Login now')}
@@ -4,6 +4,7 @@ import Spinner from 'react-native-loading-spinner-overlay';
4
4
  import { useForm, Controller } from 'react-hook-form';
5
5
  import { PhoneInputNumber } from '../PhoneInputNumber';
6
6
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
7
+ import Recaptcha from 'react-native-recaptcha-that-works'
7
8
 
8
9
  import {
9
10
  LoginForm as LoginFormController,
@@ -18,7 +19,6 @@ import { FacebookLogin } from '../FacebookLogin';
18
19
  import { VerifyPhone } from '../../../../../src/components/VerifyPhone';
19
20
  import { OModal } from '../../../../../src/components/shared';
20
21
 
21
-
22
22
  import {
23
23
  Container,
24
24
  ButtonsWrapper,
@@ -32,6 +32,7 @@ import {
32
32
  LineSeparator,
33
33
  SkeletonWrapper,
34
34
  TabBtn,
35
+ RecaptchaButton
35
36
  } from './styles';
36
37
 
37
38
  import NavBar from '../NavBar';
@@ -60,14 +61,16 @@ const LoginFormUI = (props: LoginParams) => {
60
61
  handleSendVerifyCode,
61
62
  handleCheckPhoneCode,
62
63
  onNavigationRedirect,
63
- notificationState
64
+ notificationState,
65
+ handleReCaptcha,
66
+ enableReCaptcha
64
67
  } = props;
65
68
 
66
69
  const [, { showToast }] = useToast();
67
70
  const [, t] = useLanguage();
68
71
  const [{ configs }] = useConfig();
69
72
  const [, { login }] = useSession();
70
- const { control, handleSubmit, errors } = useForm();
73
+ const { control, handleSubmit, errors, reset, register, setValue } = useForm();
71
74
  const [passwordSee, setPasswordSee] = useState(false);
72
75
  const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
73
76
  const [isModalVisible, setIsModalVisible] = useState(false);
@@ -79,6 +82,8 @@ const LoginFormUI = (props: LoginParams) => {
79
82
  cellphone: null,
80
83
  },
81
84
  });
85
+ const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
86
+ const [recaptchaVerified, setRecaptchaVerified] = useState(false)
82
87
 
83
88
  const theme = useTheme();
84
89
 
@@ -91,7 +96,7 @@ const LoginFormUI = (props: LoginParams) => {
91
96
  inputStyle: {
92
97
  marginBottom: 28,
93
98
  borderWidth: 1,
94
- borderColor: theme.colors.border,
99
+ // borderColor: theme.colors.border,
95
100
  borderRadius: 7.6,
96
101
  },
97
102
  line: {
@@ -100,10 +105,15 @@ const LoginFormUI = (props: LoginParams) => {
100
105
  flexGrow: 1,
101
106
  marginBottom: 7,
102
107
  },
108
+ recaptchaIcon: {
109
+ width: 100,
110
+ height: 100,
111
+ }
103
112
  });
104
113
 
105
114
  const emailRef = useRef<any>({});
106
115
  const passwordRef = useRef<any>({});
116
+ const recaptchaRef = useRef<any>({});
107
117
 
108
118
  const handleChangeTab = (val: string) => {
109
119
  props.handleChangeTab(val);
@@ -156,6 +166,33 @@ const LoginFormUI = (props: LoginParams) => {
156
166
  onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
157
167
  };
158
168
 
169
+ const handleOpenRecaptcha = () => {
170
+ setRecaptchaVerified(false)
171
+ if (!recaptchaConfig?.siteKey) {
172
+ showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
173
+ return
174
+ }
175
+ if (!recaptchaConfig?.baseUrl) {
176
+ showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
177
+ return
178
+ }
179
+ recaptchaRef.current.open()
180
+ }
181
+
182
+ const onRecaptchaVerify = (token: any) => {
183
+ setRecaptchaVerified(true)
184
+ handleReCaptcha(token)
185
+ }
186
+
187
+ useEffect(() => {
188
+ if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
189
+ setRecaptchaConfig({
190
+ siteKey: configs?.security_recaptcha_site_key?.value || null,
191
+ baseUrl: configs?.security_recaptcha_base_url?.value || null
192
+ })
193
+ }
194
+ }, [configs, enableReCaptcha])
195
+
159
196
  useEffect(() => {
160
197
  if (!formState.loading && formState.result?.error) {
161
198
  formState.result?.result &&
@@ -189,33 +226,21 @@ const LoginFormUI = (props: LoginParams) => {
189
226
  }, [verifyPhoneState]);
190
227
 
191
228
  useEffect(() => {
192
- if (Object.keys(errors).length > 0) {
193
- // Convert all errors in one string to show in toast provider
194
- const list = Object.values(errors);
195
- let stringError = '';
196
- if (phoneInputData.error) {
197
- list.unshift({ message: phoneInputData.error });
198
- }
199
- if (
200
- loginTab === 'cellphone' &&
201
- !phoneInputData.error &&
202
- !phoneInputData.phone.country_phone_code &&
203
- !phoneInputData.phone.cellphone
204
- ) {
205
- list.unshift({
206
- message: t(
207
- 'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
208
- 'The field Mobile phone is required.',
209
- ),
210
- });
211
- }
212
- list.map((item: any, i: number) => {
213
- stringError +=
214
- i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
215
- });
216
- showToast(ToastType.Error, stringError);
217
- }
218
- }, [errors]);
229
+ if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
230
+ else setValue('cellphone', '')
231
+ }, [phoneInputData?.phone?.cellphone])
232
+
233
+ useEffect(() => {
234
+ register('cellphone', {
235
+ required: loginTab === 'cellphone'
236
+ ? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
237
+ : null
238
+ })
239
+ }, [register])
240
+
241
+ useEffect(() => {
242
+ reset()
243
+ }, [loginTab])
219
244
 
220
245
  return (
221
246
  <Container>
@@ -284,43 +309,58 @@ const LoginFormUI = (props: LoginParams) => {
284
309
  {(useLoginByCellphone || useLoginByEmail) && (
285
310
  <FormInput>
286
311
  {useLoginByEmail && loginTab === 'email' && (
287
- <Controller
288
- control={control}
289
- render={({ onChange, value }: any) => (
290
- <OInput
291
- placeholder={t('EMAIL', 'Email')}
292
- style={loginStyle.inputStyle}
293
- icon={theme.images.general.email}
294
- onChange={(e: any) => {
295
- handleChangeInputEmail(e, onChange);
296
- }}
297
- value={value}
298
- autoCapitalize="none"
299
- autoCorrect={false}
300
- type="email-address"
301
- autoCompleteType="email"
302
- returnKeyType="next"
303
- onSubmitEditing={() => passwordRef.current?.focus()}
304
- blurOnSubmit={false}
305
- forwardRef={emailRef}
306
- />
312
+ <>
313
+ {errors?.email && (
314
+ <OText
315
+ size={14}
316
+ color={theme.colors.danger5}
317
+ weight={'normal'}>
318
+ {errors?.email?.message}{errors?.email?.type === 'required' && '*'}
319
+ </OText>
307
320
  )}
308
- name="email"
309
- rules={{
310
- required: t(
311
- 'VALIDATION_ERROR_EMAIL_REQUIRED',
312
- 'The field Email is required',
313
- ).replace('_attribute_', t('EMAIL', 'Email')),
314
- pattern: {
315
- value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
316
- message: t(
317
- 'INVALID_ERROR_EMAIL',
318
- 'Invalid email address',
319
- ).replace('_attribute_', t('EMAIL', 'Email')),
320
- },
321
- }}
322
- defaultValue=""
323
- />
321
+ <Controller
322
+ control={control}
323
+ render={({ onChange, value }: any) => (
324
+ <OInput
325
+ placeholder={t('EMAIL', 'Email')}
326
+ style={loginStyle.inputStyle}
327
+ icon={theme.images.general.email}
328
+ onChange={(e: any) => {
329
+ handleChangeInputEmail(e, onChange);
330
+ }}
331
+ value={value}
332
+ autoCapitalize="none"
333
+ autoCorrect={false}
334
+ type="email-address"
335
+ autoCompleteType="email"
336
+ returnKeyType="next"
337
+ onSubmitEditing={() => passwordRef.current?.focus()}
338
+ blurOnSubmit={false}
339
+ forwardRef={emailRef}
340
+ borderColor={errors?.email ? theme.colors.danger5 : theme.colors.border}
341
+ />
342
+ )}
343
+ name="email"
344
+ rules={{
345
+ required: {
346
+ value: true,
347
+ message: t(
348
+ 'VALIDATION_ERROR_EMAIL_REQUIRED',
349
+ 'The field Email is required',
350
+ ).replace('_attribute_', t('EMAIL', 'Email'))
351
+ },
352
+ pattern: {
353
+ value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
354
+ message: t(
355
+ 'INVALID_ERROR_EMAIL',
356
+ 'Invalid email address',
357
+ ).replace('_attribute_', t('EMAIL', 'Email')),
358
+ }
359
+ }}
360
+ defaultValue=""
361
+ />
362
+ </>
363
+
324
364
  )}
325
365
  {useLoginByCellphone && loginTab === 'cellphone' && (
326
366
  <View style={{ marginBottom: 28 }}>
@@ -331,10 +371,18 @@ const LoginFormUI = (props: LoginParams) => {
331
371
  returnKeyType: 'next',
332
372
  onSubmitEditing: () => passwordRef?.current?.focus?.(),
333
373
  }}
374
+ isStartValidation={errors?.cellphone}
334
375
  />
335
376
  </View>
336
377
  )}
337
-
378
+ {errors?.password && (
379
+ <OText
380
+ size={14}
381
+ color={theme.colors.danger5}
382
+ weight={'normal'}>
383
+ {errors?.password?.message}{errors?.password?.type === 'required' && '*'}
384
+ </OText>
385
+ )}
338
386
  <Controller
339
387
  control={control}
340
388
  render={({ onChange, value }: any) => (
@@ -366,14 +414,18 @@ const LoginFormUI = (props: LoginParams) => {
366
414
  returnKeyType="done"
367
415
  onSubmitEditing={handleSubmit(onSubmit)}
368
416
  blurOnSubmit
417
+ borderColor={errors?.password ? theme.colors.danger5 : theme.colors.border}
369
418
  />
370
419
  )}
371
420
  name="password"
372
421
  rules={{
373
- required: t(
422
+ required: {
423
+ value: true,
424
+ message: t(
374
425
  'VALIDATION_ERROR_PASSWORD_REQUIRED',
375
426
  'The field Password is required',
376
- ).replace('_attribute_', t('PASSWORD', 'Password')),
427
+ ).replace('_attribute_', t('PASSWORD', 'Password'))
428
+ }
377
429
  }}
378
430
  defaultValue=""
379
431
  />
@@ -384,6 +436,39 @@ const LoginFormUI = (props: LoginParams) => {
384
436
  </OText>
385
437
  </TouchableOpacity>
386
438
  )}
439
+
440
+ {enableReCaptcha && (
441
+ <>
442
+ <TouchableOpacity
443
+ onPress={handleOpenRecaptcha}
444
+ >
445
+ <RecaptchaButton>
446
+ {recaptchaVerified ? (
447
+ <MaterialCommunityIcons
448
+ name="checkbox-marked"
449
+ size={26}
450
+ color={theme.colors.primary}
451
+ />
452
+ ) : (
453
+ <MaterialCommunityIcons
454
+ name="checkbox-blank-outline"
455
+ size={26}
456
+ color={theme.colors.mediumGray}
457
+ />
458
+ )}
459
+ <OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
460
+ </RecaptchaButton>
461
+ </TouchableOpacity>
462
+ <Recaptcha
463
+ ref={recaptchaRef}
464
+ siteKey={recaptchaConfig?.siteKey}
465
+ baseUrl={recaptchaConfig?.baseUrl}
466
+ onVerify={onRecaptchaVerify}
467
+ onExpire={() => setRecaptchaVerified(false)}
468
+ />
469
+ </>
470
+ )}
471
+
387
472
  <OButton
388
473
  onClick={handleSubmit(onSubmit)}
389
474
  text={loginButtonText}
@@ -544,6 +629,7 @@ const LoginFormUI = (props: LoginParams) => {
544
629
  export const LoginForm = (props: any) => {
545
630
  const loginProps = {
546
631
  ...props,
632
+ isRecaptchaEnable: true,
547
633
  UIComponent: LoginFormUI,
548
634
  };
549
635
  return <LoginFormController {...loginProps} />;
@@ -36,7 +36,7 @@ export const LoginWith = styled.View`
36
36
  width: 100%;
37
37
  align-items: flex-start;
38
38
  border-bottom-width: 1px;
39
- border-bottom-color: ${(props: any) => props.theme.colors.border}
39
+ border-bottom-color: ${(props: any) => props.theme.colors.border};
40
40
  `;
41
41
 
42
42
  export const FormInput = styled.View`
@@ -80,3 +80,8 @@ export const LineSeparator = styled.View`
80
80
  export const SkeletonWrapper = styled.View`
81
81
  width: 90%;
82
82
  `
83
+ export const RecaptchaButton = styled.View`
84
+ flex-direction: row;
85
+ align-items: center;
86
+ margin-bottom: 10px;
87
+ `
@@ -36,7 +36,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
36
36
  loadOrders,
37
37
  setSelectedOrderId,
38
38
  setOrderList,
39
- setOpenMessges
39
+ setOpenMessges,
40
+ setRefreshOrders,
41
+ refreshOrders
40
42
  } = props
41
43
 
42
44
  const theme = useTheme();
@@ -99,6 +101,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
99
101
  setOrderList(orderList)
100
102
  }, [orderList, loading])
101
103
 
104
+ useEffect(() => {
105
+ if(refreshOrders){
106
+ loadOrders(false, false, false, true)
107
+ setRefreshOrders && setRefreshOrders(false)
108
+ }
109
+ }, [refreshOrders])
110
+
102
111
  return (
103
112
  <>
104
113
  {!loading && orders.length === 0 && (