ordering-ui-react-native 0.16.46 → 0.16.47-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 (199) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/Messages/index.tsx +2 -2
  13. package/src/components/NotificationSetting/index.tsx +85 -0
  14. package/src/components/OrdersOption/index.tsx +54 -56
  15. package/src/components/PaymentOptions/index.tsx +298 -345
  16. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  17. package/src/components/ReviewDriver/index.tsx +1 -1
  18. package/src/components/ReviewOrder/index.tsx +2 -2
  19. package/src/components/ReviewProducts/index.tsx +11 -0
  20. package/src/components/SingleProductReview/index.tsx +8 -5
  21. package/src/components/StripeElementsForm/index.tsx +25 -16
  22. package/src/components/VerifyPhone/styles.tsx +1 -2
  23. package/src/components/shared/OBottomPopup.tsx +6 -2
  24. package/src/components/shared/OToast.tsx +3 -3
  25. package/src/index.tsx +2 -0
  26. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  27. package/src/utils/index.tsx +2 -1
  28. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  29. package/themes/business/src/components/Chat/index.tsx +40 -32
  30. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  31. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  32. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  33. package/themes/business/src/components/MapView/index.tsx +12 -1
  34. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  35. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  36. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  37. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +33 -23
  38. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  39. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  40. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  41. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  44. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  45. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  46. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  47. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  48. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  49. package/themes/business/src/components/PreviousOrders/index.tsx +18 -20
  50. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  51. package/themes/business/src/components/ReviewCustomer/index.tsx +27 -13
  52. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  53. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  54. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  55. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  56. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  57. package/themes/business/src/components/shared/OLink.tsx +24 -12
  58. package/themes/business/src/types/index.tsx +15 -9
  59. package/themes/business/src/utils/index.tsx +10 -0
  60. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  61. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  62. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  63. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  64. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  65. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  66. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  67. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  68. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  69. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  70. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  71. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  72. package/themes/kiosk/src/types/index.d.ts +2 -0
  73. package/themes/original/index.tsx +4 -0
  74. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  75. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  76. package/themes/original/src/components/AddressList/index.tsx +1 -1
  77. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  78. package/themes/original/src/components/BusinessBasicInformation/index.tsx +218 -147
  79. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  80. package/themes/original/src/components/BusinessController/index.tsx +231 -114
  81. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  82. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  83. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  84. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  85. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  86. package/themes/original/src/components/BusinessListingSearch/index.tsx +109 -139
  87. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  88. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  89. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  90. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -60
  91. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  92. package/themes/original/src/components/BusinessProductsListing/index.tsx +175 -80
  93. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  94. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  95. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +35 -23
  96. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +275 -120
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  99. package/themes/original/src/components/BusinessesListing/index.tsx +80 -25
  100. package/themes/original/src/components/Cart/index.tsx +82 -15
  101. package/themes/original/src/components/Cart/styles.tsx +4 -0
  102. package/themes/original/src/components/CartContent/index.tsx +22 -16
  103. package/themes/original/src/components/Checkout/index.tsx +113 -117
  104. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  105. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  106. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  107. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  108. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  109. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  110. package/themes/original/src/components/FloatingButton/index.tsx +13 -11
  111. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  112. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  113. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  114. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  115. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  116. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  117. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  118. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  119. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  120. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  121. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  122. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  123. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  124. package/themes/original/src/components/Messages/index.tsx +35 -20
  125. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  126. package/themes/original/src/components/MultiCart/index.tsx +63 -0
  127. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  128. package/themes/original/src/components/MultiCheckout/index.tsx +10 -2
  129. package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
  130. package/themes/original/src/components/MyOrders/index.tsx +88 -22
  131. package/themes/original/src/components/NavBar/index.tsx +11 -5
  132. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  133. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  134. package/themes/original/src/components/Notifications/index.tsx +148 -0
  135. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  136. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  137. package/themes/original/src/components/OrderDetails/index.tsx +200 -39
  138. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  139. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  140. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  141. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  142. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  143. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  144. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  145. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  146. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  147. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  148. package/themes/original/src/components/OrdersOption/index.tsx +102 -56
  149. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  150. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  151. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  152. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  153. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  154. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  155. package/themes/original/src/components/ProductForm/index.tsx +639 -664
  156. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  157. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  158. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  159. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  160. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  161. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  162. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  163. package/themes/original/src/components/Promotions/index.tsx +232 -219
  164. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  165. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  166. package/themes/original/src/components/ReviewOrder/index.tsx +120 -108
  167. package/themes/original/src/components/ReviewOrder/styles.tsx +5 -7
  168. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  169. package/themes/original/src/components/ReviewTrigger/index.tsx +136 -0
  170. package/themes/original/src/components/ReviewTrigger/styles.tsx +41 -0
  171. package/themes/original/src/components/ServiceForm/index.tsx +332 -264
  172. package/themes/original/src/components/SignupForm/index.tsx +160 -113
  173. package/themes/original/src/components/SingleOrderCard/index.tsx +266 -183
  174. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  175. package/themes/original/src/components/SingleProductCard/index.tsx +198 -112
  176. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  177. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  178. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  179. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  180. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  181. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  182. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  183. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  184. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  185. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  186. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  187. package/themes/original/src/components/Wallets/index.tsx +176 -164
  188. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  189. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  190. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  191. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  192. package/themes/original/src/components/shared/OButton.tsx +10 -3
  193. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  194. package/themes/original/src/components/shared/OInput.tsx +10 -1
  195. package/themes/original/src/layouts/Container.tsx +13 -9
  196. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  197. package/themes/original/src/types/index.tsx +83 -28
  198. package/themes/original/src/utils/index.tsx +103 -58
  199. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from 'react'
1
+ import React, { useState, useEffect, useRef } from 'react'
2
2
  import styled, { css, useTheme } from 'styled-components/native'
3
3
  import { useLanguage } from 'ordering-components/native';
4
4
  import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler'
@@ -24,6 +24,10 @@ interface Props {
24
24
  handleChangeDate?: any,
25
25
  rangeDate?: any,
26
26
  isCalendarAlwaysVisible?: boolean
27
+ handleClear?: any;
28
+ handleOpenSelect?: any,
29
+ openedSelect?: string,
30
+ selectType?: string
27
31
  }
28
32
 
29
33
  const Wrapper = styled.View`
@@ -96,7 +100,11 @@ const ODropDownCalendar = (props: Props) => {
96
100
  isCalendar,
97
101
  handleChangeDate,
98
102
  rangeDate,
99
- isCalendarAlwaysVisible
103
+ isCalendarAlwaysVisible,
104
+ handleClear,
105
+ handleOpenSelect,
106
+ openedSelect,
107
+ selectType
100
108
  } = props
101
109
 
102
110
  const theme = useTheme();
@@ -110,6 +118,7 @@ const ODropDownCalendar = (props: Props) => {
110
118
 
111
119
  const onToggle = () => {
112
120
  setIsOpen(!isOpen)
121
+ if (!isOpen) handleOpenSelect?.()
113
122
  }
114
123
 
115
124
  const onSelectOption = (option: any) => {
@@ -122,7 +131,7 @@ const ODropDownCalendar = (props: Props) => {
122
131
  const onDateChange = (date: any, type: any) => {
123
132
  if (!date) return
124
133
  if (type === 'END_DATE') {
125
- handleChangeDate(rangeDate.from, date.format('MM/DD/YY'))
134
+ handleChangeDate(rangeDate.from, new Date(date.format('MM/DD/YY')) === rangeDate.from ? '' : date.format('MM/DD/YY'))
126
135
  } else {
127
136
  handleChangeDate(date.format('MM/DD/YY'), '')
128
137
  }
@@ -142,12 +151,31 @@ const ODropDownCalendar = (props: Props) => {
142
151
  return (from || to) ? (from + (to ? end : '')) : placeholder
143
152
  }
144
153
 
154
+ const handleClearCalendar = () => {
155
+ handleClear && handleClear()
156
+ if (isOpen) {
157
+ onToggle()
158
+ }
159
+ }
160
+
145
161
  useEffect(() => {
146
162
  const _defaultOption = options?.find((option: any) => option.value === defaultValue)
147
163
  setSelectedOption(_defaultOption)
148
164
  setValue(defaultValue)
149
165
  }, [defaultValue, options])
150
166
 
167
+ useEffect(() => {
168
+ if (openedSelect !== selectType && typeof openedSelect === 'string') {
169
+ setIsOpen(false)
170
+ }
171
+ }, [openedSelect])
172
+
173
+ useEffect(() => {
174
+ if (rangeDate.to && rangeDate.from) {
175
+ onSelect('calendar')
176
+ }
177
+ }, [rangeDate.to, rangeDate.from])
178
+
151
179
  return (
152
180
  <Wrapper style={props.style}>
153
181
  <Selected
@@ -165,10 +193,11 @@ const ODropDownCalendar = (props: Props) => {
165
193
  : `${selectedOption?.content || selectedOption?.name || placeholder}`
166
194
  }
167
195
  </SelectedLabel>
168
- <FeatherIcon
169
- name='calendar'
170
- color={theme.colors.backArrow}
171
- size={24}
196
+ <AntDesign
197
+ name={selectedOption && handleClear ? 'close' : 'calendar'}
198
+ size={20}
199
+ onPress={() => handleClearCalendar()}
200
+ style={{ position: 'absolute', right: 12, top: 13 }}
172
201
  />
173
202
  </Selected>
174
203
  {isOpen && options && (
@@ -29,8 +29,19 @@ const OLink = (props: Props): React.ReactElement => {
29
29
  ],
30
30
  );
31
31
 
32
+ const handleInvalidNumberAlert = () =>
33
+ Alert.alert(
34
+ t('ERROR_OPENING_THE_LINK', 'Error opening the link'),
35
+ t('INVALID_NUMBER', 'Invalid number'),
36
+ [
37
+ {
38
+ text: t('OK', 'Ok'),
39
+ },
40
+ ],
41
+ );
42
+
32
43
  const handleOpenUrl = async (breakFunction = false) => {
33
- if(breakFunction) {
44
+ if (breakFunction) {
34
45
  return
35
46
  }
36
47
  if (!url) {
@@ -40,8 +51,9 @@ const OLink = (props: Props): React.ReactElement => {
40
51
 
41
52
  try {
42
53
  const supported = await Linking.canOpenURL(url);
43
-
44
- if (supported) {
54
+ if (url && url?.includes('tel:')) {
55
+ url?.includes('invalid') ? handleInvalidNumberAlert() : await Linking.openURL(url)
56
+ } else if (supported) {
45
57
  await Linking.openURL(url);
46
58
  } else {
47
59
  handleAlert();
@@ -57,17 +69,17 @@ const OLink = (props: Props): React.ReactElement => {
57
69
  <OButton
58
70
  onClick={() => handleOpenUrl()}
59
71
  text={shorcut} imgRightSrc=''
60
- textStyle={{color: 'white'}}
61
- style={{width: '100%', alignSelf: 'center', borderRadius: 10}}
72
+ textStyle={{ color: 'white' }}
73
+ style={{ width: '100%', alignSelf: 'center', borderRadius: 10 }}
62
74
  />
63
75
  ) : (
64
- <OText
65
- style={TextStyle}
66
- numberOfLines={1}
67
- ellipsizeMode="tail"
68
- color={color}>
69
- {shorcut}
70
- </OText>
76
+ <OText
77
+ style={TextStyle}
78
+ numberOfLines={1}
79
+ ellipsizeMode="tail"
80
+ color={color}>
81
+ {shorcut}
82
+ </OText>
71
83
  )}
72
84
  </Pressable>
73
85
  );
@@ -21,8 +21,8 @@ export interface LoginParams {
21
21
  allowedLevels?: any;
22
22
  useRootPoint?: any;
23
23
  notificationState?: any;
24
- handleReCaptcha?: any;
25
- enableReCaptcha?: any;
24
+ handleReCaptcha?: any;
25
+ enableReCaptcha?: any;
26
26
  }
27
27
  export interface ProfileParams {
28
28
  navigation?: any;
@@ -41,6 +41,7 @@ export interface ProfileParams {
41
41
  validationFields?: any;
42
42
  showField?: any;
43
43
  isRequiredField?: any;
44
+ isAlsea?: boolean;
44
45
  }
45
46
 
46
47
  export interface AddressListParams {
@@ -255,6 +256,7 @@ export interface MessagesOptionParams {
255
256
  messagesReadList?: any;
256
257
  onNavigationRedirect?: any;
257
258
  setSortBy?: any;
259
+ getOrders: any
258
260
  }
259
261
  export interface OrdersOptionParams {
260
262
  orderList?: any;
@@ -265,7 +267,7 @@ export interface OrdersOptionParams {
265
267
  titleContent?: string;
266
268
  customArray?: Array<any>;
267
269
  loadMoreOrders?: () => {};
268
- loadOrders?: ({}: any) => {};
270
+ loadOrders?: ({ }: any) => {};
269
271
  messages?: any;
270
272
  setMessages?: () => {};
271
273
  loadMessages?: () => {};
@@ -279,7 +281,7 @@ export interface OrdersOptionParams {
279
281
  ordersGroup?: any;
280
282
  setOrdersGroup?: any;
281
283
  setCurrentFilters?: any;
282
- onFiltered?: ({}: any) => {};
284
+ onFiltered?: ({ }: any) => {};
283
285
  filtered?: any;
284
286
  handleClickOrder?: any;
285
287
  orderGroupStatusCustom?: {
@@ -290,9 +292,11 @@ export interface OrdersOptionParams {
290
292
  };
291
293
  isBusinessApp?: boolean;
292
294
  handleClickLogisticOrder: (status: number, orderId: number) => void,
293
- logisticOrders: {orders: Array<any>, loading: boolean, error: Array<string> | string},
295
+ logisticOrders: { orders: Array<any>, loading: boolean, error: Array<string> | string },
294
296
  loadLogisticOrders: () => void;
295
- isLogisticActivated?: boolean
297
+ isLogisticActivated?: boolean;
298
+ isAlsea?: boolean;
299
+ checkNotification?: boolean;
296
300
  }
297
301
  export interface ActiveOrdersParams {
298
302
  orders?: any;
@@ -390,6 +394,7 @@ export interface ProductItemAccordionParams {
390
394
  offsetDisabled?: any;
391
395
  isFromCheckout?: any;
392
396
  isClickableEvent?: any;
397
+ currency?: any;
393
398
  }
394
399
  export interface ReviewOrderParams {
395
400
  order?: { orderId: number; businessId: number; logo: string };
@@ -405,7 +410,7 @@ export interface MessagesParams {
405
410
  order?: any;
406
411
  orderId?: number;
407
412
  messages?: any;
408
- message?: string;
413
+ message: string;
409
414
  image?: string;
410
415
  messagesToShow?: any;
411
416
  sendMessage?: any;
@@ -561,13 +566,14 @@ export interface AcceptOrRejectOrderParams {
561
566
  }
562
567
 
563
568
  export interface MapViewParams {
564
- onNavigationRedirect: (page : string, params ?: any) => void,
569
+ onNavigationRedirect: (page: string, params?: any) => void,
565
570
  getBusinessLocations: () => void,
571
+ setDriverLocation: (location: any) => void,
566
572
  isLoadingBusinessMarkers?: boolean,
567
573
  markerGroups: Array<any>,
568
574
  customerMarkerGroups: Array<any>,
569
575
  alertState: { open: boolean, content: Array<string>, key?: string | null },
570
- setAlertState: ({open, content, key} : { open: boolean, content: Array<string>, key?: string | null }) => void
576
+ setAlertState: ({ open, content, key }: { open: boolean, content: Array<string>, key?: string | null }) => void
571
577
  }
572
578
 
573
579
  export interface ReviewCustomerParams {
@@ -38,6 +38,8 @@ export const getTraduction = (key: string, t: any) => {
38
38
  ERROR_PRODUCT_NOT_FOUND: 'Error with the product',
39
39
  ERROR_USER_UPDATE_YOU_HAVE_ASSIGNED_ORDERS:
40
40
  "You can't because you have assigned orders",
41
+ ERROR_INVALID_OFFER: 'The offer doesn\'t exist',
42
+ ERROR_AUTH_DRIVER_LOGIN_VALIDATION: 'Error auth driver login validation'
41
43
  };
42
44
 
43
45
  return keyList[key] ? t(key, keyList[key]) : t(key);
@@ -343,3 +345,11 @@ export const getOrderStatus = (s: string, t: any) => {
343
345
 
344
346
  return objectStatus && objectStatus;
345
347
  };
348
+
349
+ export const transformDistance = (value : number, distanceUnit?: string) => {
350
+ return distanceUnit === 'mi'
351
+ ? (value / 1.609).toFixed(2)
352
+ : distanceUnit === 'ft'
353
+ ? (value * 3280.84).toFixed(0)
354
+ : (value).toFixed(2)
355
+ }
@@ -197,7 +197,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
197
197
  {isFarAway && (
198
198
  <FarAwayMessage style={styles.farAwayMsg}>
199
199
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
200
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
200
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
201
201
  </FarAwayMessage>
202
202
  )}
203
203
  {!auth && (
@@ -410,8 +410,7 @@ const LoginFormUI = (props: LoginParams) => {
410
410
  textInputProps={{
411
411
  returnKeyType: 'next',
412
412
  onSubmitEditing: () => inputRef?.current?.focus?.(),
413
- style: { borderWidth: 0, fontSize: 12 },
414
- maxLength: 10
413
+ style: { borderWidth: 0, fontSize: 12 }
415
414
  }}
416
415
  textWrapStyle={{ borderColor: theme.colors.clear, borderWidth: 0, height: 40, paddingStart: 0 }}
417
416
  />
@@ -155,7 +155,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
155
155
  {isFarAway && (
156
156
  <FarAwayMessage style={styles.farAwayMsg}>
157
157
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
158
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
158
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
159
159
  </FarAwayMessage>
160
160
  )}
161
161
  <View style={styles.wrapperOrderOptions}>
@@ -20,6 +20,7 @@ const BusinessesListingUI = (props: any) => {
20
20
  const {
21
21
  navigation,
22
22
  businessesList,
23
+ paginationProps,
23
24
  handleBusinessClick,
24
25
  } = props;
25
26
 
@@ -78,7 +79,7 @@ const BusinessesListingUI = (props: any) => {
78
79
  </CardsContainer>
79
80
 
80
81
 
81
- {!businessesList.loading && businessesList.businesses.length === 0 && (
82
+ {!businessesList.loading && businessesList.businesses.length === 0 && paginationProps.totalPages !== null && (
82
83
  <NotFoundSource
83
84
  content={t(
84
85
  'NOT_FOUND_BUSINESSES',
@@ -50,6 +50,12 @@ const CheckoutUI = (props: any) => {
50
50
  }
51
51
  }, [cart])
52
52
 
53
+ useEffect(() => {
54
+ if (!cartState.loading && cart && !cart?.valid && cart?.status === 2) {
55
+ navigation?.canGoBack() && navigation.goBack()
56
+ }
57
+ }, [cart])
58
+
53
59
  return (
54
60
  <>
55
61
  <PaymentOptions
@@ -1,10 +1,15 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect, useState, useRef } from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
3
  import { useForm, Controller } from 'react-hook-form';
4
4
  import { useTheme } from 'styled-components/native';
5
+ import { TouchableOpacity } from 'react-native-gesture-handler';
6
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
7
+ import Recaptcha from 'react-native-recaptcha-that-works'
8
+ import ReCaptcha from '@fatnlazycat/react-native-recaptcha-v3'
5
9
 
6
10
  import {
7
11
  LoginForm as LoginFormController,
12
+ useConfig,
8
13
  useLanguage,
9
14
  ToastType,
10
15
  useToast,
@@ -13,7 +18,8 @@ import {
13
18
 
14
19
  import {
15
20
  WelcomeTextContainer,
16
- LogoWrapper
21
+ LogoWrapper,
22
+ RecaptchaButton
17
23
  } from './styles';
18
24
 
19
25
  import { OText, OButton, OInput, OIcon } from '../shared';
@@ -26,14 +32,20 @@ const LoginFormUI = (props: LoginParams) => {
26
32
  loginButtonText,
27
33
  formState,
28
34
  handleButtonLoginClick,
29
- useRootPoint
35
+ useRootPoint,
36
+ handleReCaptcha,
37
+ enableReCaptcha
30
38
  } = props;
31
39
 
32
40
  const theme = useTheme()
41
+ const [{ configs }] = useConfig()
33
42
  const [ordering, { setOrdering }] = useApi();
34
43
  const [, { showToast }] = useToast();
35
44
  const [, t] = useLanguage();
36
- const {control, handleSubmit, formState: {errors}} = useForm();
45
+ const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
46
+ const [recaptchaVerified, setRecaptchaVerified] = useState(false)
47
+ const recaptchaRef = useRef<any>({});
48
+ const { control, handleSubmit, formState: { errors } } = useForm();
37
49
  const [orientationState] = useDeviceOrientation();
38
50
 
39
51
  const [formsStateValues, setFormsStateValues] = useState<any>({ isSubmitted: false })
@@ -60,6 +72,25 @@ const LoginFormUI = (props: LoginParams) => {
60
72
  onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
61
73
  };
62
74
 
75
+ const handleOpenRecaptcha = () => {
76
+ setRecaptchaVerified(false)
77
+ if (!recaptchaConfig?.siteKey) {
78
+ showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
79
+ return
80
+ }
81
+ if (!recaptchaConfig?.baseUrl) {
82
+ showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
83
+ return
84
+ }
85
+
86
+ recaptchaRef.current.open()
87
+ }
88
+
89
+ const onRecaptchaVerify = (token: any) => {
90
+ setRecaptchaVerified(true)
91
+ handleReCaptcha && handleReCaptcha({ code: token, version: recaptchaConfig?.version })
92
+ }
93
+
63
94
  const styles = StyleSheet.create({
64
95
  logo: {
65
96
  height: 80,
@@ -87,6 +118,20 @@ const LoginFormUI = (props: LoginParams) => {
87
118
 
88
119
  useEffect(() => {
89
120
  if (!formState.loading && formState.result?.error) {
121
+ if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
122
+ setRecaptchaVerified(false)
123
+ setRecaptchaConfig({
124
+ version: 'v2',
125
+ siteKey: configs?.security_recaptcha_site_key?.value || null,
126
+ baseUrl: configs?.security_recaptcha_base_url?.value || null
127
+ })
128
+ showToast(ToastType.Info, t('TRY_AGAIN', 'Please try again'))
129
+ setFormsStateValues({
130
+ ...formsStateValues,
131
+ isSubmitted: false,
132
+ })
133
+ return
134
+ }
90
135
  formState.result?.result && showToast(
91
136
  ToastType.Error,
92
137
  typeof formState.result?.result === 'string'
@@ -122,9 +167,32 @@ const LoginFormUI = (props: LoginParams) => {
122
167
  }
123
168
  }, [errors]);
124
169
 
170
+ useEffect(() => {
171
+ if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
172
+ if (configs?.security_recaptcha_type?.value === 'v3' &&
173
+ configs?.security_recaptcha_score_v3?.value > 0 &&
174
+ configs?.security_recaptcha_site_key_v3?.value
175
+ ) {
176
+ setRecaptchaConfig({
177
+ version: 'v3',
178
+ siteKey: configs?.security_recaptcha_site_key_v3?.value || null,
179
+ baseUrl: configs?.security_recaptcha_base_url?.value || null
180
+ })
181
+ return
182
+ }
183
+ if (configs?.security_recaptcha_site_key?.value) {
184
+ setRecaptchaConfig({
185
+ version: 'v2',
186
+ siteKey: configs?.security_recaptcha_site_key?.value || null,
187
+ baseUrl: configs?.security_recaptcha_base_url?.value || null
188
+ })
189
+ }
190
+ }
191
+ }, [configs, enableReCaptcha])
192
+
125
193
  const logo = (
126
194
  <LogoWrapper>
127
- <OIcon src={theme.images.logos.logotype} style={styles.logo}/>
195
+ <OIcon src={theme.images.logos.logotype} style={styles.logo} />
128
196
  </LogoWrapper>
129
197
  );
130
198
 
@@ -144,7 +212,7 @@ const LoginFormUI = (props: LoginParams) => {
144
212
  value={value}
145
213
  autoCapitalize='none'
146
214
  autoCorrect={false}
147
- inputStyle={{textAlign: 'center'}}
215
+ inputStyle={{ textAlign: 'center' }}
148
216
  onChange={(e: any) => {
149
217
  onChange(e?.target?.value);
150
218
  setFormsStateValues({
@@ -167,7 +235,7 @@ const LoginFormUI = (props: LoginParams) => {
167
235
  autoCapitalize="none"
168
236
  autoCorrect={false}
169
237
  type="email-address"
170
- inputStyle={{textAlign: 'center'}}
238
+ inputStyle={{ textAlign: 'center' }}
171
239
  onChange={(e: any) => {
172
240
  handleChangeInputEmail(e, onChange);
173
241
  }}
@@ -199,7 +267,7 @@ const LoginFormUI = (props: LoginParams) => {
199
267
  style={styles.inputStyle}
200
268
  value={value}
201
269
  onChange={(val: any) => onChange(val)}
202
- inputStyle={{textAlign: 'center'}}
270
+ inputStyle={{ textAlign: 'center' }}
203
271
  />
204
272
  )}
205
273
  name="password"
@@ -211,7 +279,49 @@ const LoginFormUI = (props: LoginParams) => {
211
279
  }}
212
280
  defaultValue=""
213
281
  />
214
-
282
+ {(recaptchaConfig?.version) && (
283
+ <>
284
+ {recaptchaConfig?.version === 'v3' ? (
285
+ <ReCaptcha
286
+ url={recaptchaConfig?.baseUrl}
287
+ siteKey={recaptchaConfig?.siteKey}
288
+ containerStyle={{ height: 40 }}
289
+ onExecute={onRecaptchaVerify}
290
+ reCaptchaType={1}
291
+ />
292
+ ) : (
293
+ <>
294
+ <TouchableOpacity
295
+ onPress={handleOpenRecaptcha}
296
+ >
297
+ <RecaptchaButton>
298
+ {recaptchaVerified ? (
299
+ <MaterialCommunityIcons
300
+ name="checkbox-marked"
301
+ size={26}
302
+ color={theme.colors.primary}
303
+ />
304
+ ) : (
305
+ <MaterialCommunityIcons
306
+ name="checkbox-blank-outline"
307
+ size={26}
308
+ color={theme.colors.mediumGray}
309
+ />
310
+ )}
311
+ <OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
312
+ </RecaptchaButton>
313
+ </TouchableOpacity>
314
+ <Recaptcha
315
+ ref={recaptchaRef}
316
+ siteKey={recaptchaConfig?.siteKey}
317
+ baseUrl={recaptchaConfig?.baseUrl}
318
+ onVerify={onRecaptchaVerify}
319
+ onExpire={() => setRecaptchaVerified(false)}
320
+ />
321
+ </>)
322
+ }
323
+ </>
324
+ )}
215
325
  <OButton
216
326
  onClick={handleSubmit(onSubmit)}
217
327
  text={loginButtonText}
@@ -280,7 +390,7 @@ const LoginFormUI = (props: LoginParams) => {
280
390
  ? 0 : 0,
281
391
  }}
282
392
  >
283
- { welcome }
393
+ {welcome}
284
394
  {orientationState?.orientation === LANDSCAPE && (
285
395
  <View style={{
286
396
  justifyContent: 'flex-end',
@@ -327,6 +437,7 @@ export const LoginForm = (props: any) => {
327
437
  const loginProps = {
328
438
  ...props,
329
439
  UIComponent: LoginFormUI,
440
+ isRecaptchaEnable: true
330
441
  };
331
442
  return <LoginFormController {...loginProps} />;
332
443
  };
@@ -7,3 +7,8 @@ export const LogoWrapper = styled.View`
7
7
  export const WelcomeTextContainer = styled.View`
8
8
  margin-bottom: 30px;
9
9
  `;
10
+ export const RecaptchaButton = styled.View`
11
+ flex-direction: row;
12
+ align-items: center;
13
+ margin-bottom: 10px;
14
+ `
@@ -4,6 +4,7 @@ import { OIcon, OButton, OText } from '../shared'
4
4
  import { ImageStyle, TextStyle, View, Platform, TouchableOpacity } from 'react-native'
5
5
  import { useConfig, useLanguage, useOrder } from 'ordering-components/native'
6
6
  import { useTheme } from 'styled-components/native'
7
+
7
8
  const Wrapper = styled.View`
8
9
  background-color: ${(props: any) => props.theme.colors.white};
9
10
  padding: 10px 0px 20px 0px;
@@ -65,28 +66,27 @@ const NavBar = (props: Props) => {
65
66
 
66
67
  return (
67
68
  <Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
68
- {(props?.onActionLeft) && (
69
+ {(props?.onActionLeft || props?.leftImg) && (
69
70
  <OButton
70
- imgLeftSrc={props.leftImg}
71
+ imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
71
72
  imgRightSrc={null}
72
73
  style={{ ...btnBackArrow, ...props.btnStyle }}
73
74
  onClick={props.onActionLeft}
74
- imgLeftStyle={props.imgLeftStyle}
75
- {...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
75
+ imgLeftStyle= {props.imgLeftStyle}
76
76
  />)
77
77
  }
78
78
  <TitleTopWrapper>
79
79
  {props.withIcon
80
80
  ? (
81
- <OIcon
82
- url={props.icon}
83
- style={{
84
- borderColor: theme.colors.lightGray,
85
- borderRadius: 20,
86
- }}
87
- width={60}
88
- height={60}
89
- />
81
+ <OIcon
82
+ url={props.icon}
83
+ style={{
84
+ borderColor: theme.colors.lightGray,
85
+ borderRadius: 20,
86
+ }}
87
+ width={60}
88
+ height={60}
89
+ />
90
90
  )
91
91
  : null
92
92
  }
@@ -134,7 +134,7 @@ const NavBar = (props: Props) => {
134
134
  </View>
135
135
  )}
136
136
 
137
- {props.rightComponent}
137
+ { props.rightComponent }
138
138
  </Wrapper>
139
139
  )
140
140
  }
@@ -95,7 +95,7 @@ interface Props {
95
95
  style?: ViewStyle;
96
96
  bgImage: ImageSourcePropType;
97
97
  innerStyle?: ViewStyle;
98
- icon?: ImageSourcePropType;
98
+ icon: ImageSourcePropType;
99
99
  iconStyle?: ImageStyle;
100
100
  callToActionText: string;
101
101
  callToActionTextStyle?: TextStyle;