ordering-ui-react-native 0.15.31 → 0.15.33-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 (178) hide show
  1. package/package.json +4 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessController/index.tsx +8 -2
  4. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +23 -3
  7. package/src/components/DriverTips/index.tsx +11 -6
  8. package/src/components/LanguageSelector/index.tsx +7 -2
  9. package/src/components/LoginForm/index.tsx +3 -1
  10. package/src/components/OrderDetails/index.tsx +2 -2
  11. package/src/components/PaymentOptions/index.tsx +9 -16
  12. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  13. package/src/components/SignupForm/index.tsx +3 -1
  14. package/src/components/SingleProductCard/index.tsx +16 -4
  15. package/src/components/StripeElementsForm/index.tsx +27 -48
  16. package/src/components/UpsellingProducts/index.tsx +1 -1
  17. package/src/components/UserProfileForm/index.tsx +63 -6
  18. package/src/components/UserProfileForm/styles.tsx +8 -0
  19. package/src/components/VerifyPhone/styles.tsx +1 -2
  20. package/src/components/shared/OModal.tsx +1 -1
  21. package/src/config.json +0 -2
  22. package/src/hooks/useCountdownTimer.tsx +26 -0
  23. package/src/navigators/HomeNavigator.tsx +6 -0
  24. package/src/pages/BusinessProductsList.tsx +1 -0
  25. package/src/pages/BusinessesListing.tsx +1 -1
  26. package/src/pages/Checkout.tsx +1 -1
  27. package/src/pages/Sessions.tsx +22 -0
  28. package/src/types/index.tsx +5 -11
  29. package/src/utils/index.tsx +68 -1
  30. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  31. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  32. package/themes/business/src/components/Chat/index.tsx +38 -86
  33. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  34. package/themes/business/src/components/Home/index.tsx +128 -55
  35. package/themes/business/src/components/Home/styles.tsx +8 -1
  36. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  37. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  38. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  39. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  40. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  41. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  42. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  43. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  44. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  45. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  46. package/themes/business/src/components/OrdersOption/index.tsx +57 -50
  47. package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
  48. package/themes/business/src/components/shared/OModal.tsx +1 -1
  49. package/themes/business/src/types/index.tsx +5 -1
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  54. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  55. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  56. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  57. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  58. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  59. package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
  60. package/themes/kiosk/src/components/CustomerName/index.tsx +7 -8
  61. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  62. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  63. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  64. package/themes/kiosk/src/components/OrderDetails/index.tsx +167 -67
  65. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  66. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  67. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  68. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  69. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  70. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  71. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  72. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  73. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  74. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  75. package/themes/kiosk/src/types/index.d.ts +2 -0
  76. package/themes/original/index.tsx +184 -1
  77. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  78. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  79. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  80. package/themes/original/src/components/AddressList/index.tsx +56 -18
  81. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  82. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  83. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  84. package/themes/original/src/components/BusinessController/index.tsx +77 -29
  85. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  86. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  87. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  88. package/themes/original/src/components/BusinessListingSearch/index.tsx +125 -7
  89. package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
  90. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  91. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  92. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  93. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +140 -37
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +112 -14
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  98. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  99. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  100. package/themes/original/src/components/BusinessesListing/index.tsx +98 -72
  101. package/themes/original/src/components/Cart/index.tsx +21 -17
  102. package/themes/original/src/components/CartContent/index.tsx +2 -2
  103. package/themes/original/src/components/Checkout/index.tsx +59 -48
  104. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  105. package/themes/original/src/components/Favorite/index.tsx +91 -0
  106. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  107. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  108. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  109. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  110. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  111. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  112. package/themes/original/src/components/Help/index.tsx +21 -4
  113. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +115 -90
  114. package/themes/original/src/components/Home/index.tsx +1 -1
  115. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  116. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  117. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  118. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  119. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  120. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  121. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  122. package/themes/original/src/components/Messages/index.tsx +34 -25
  123. package/themes/original/src/components/Messages/styles.tsx +1 -3
  124. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  125. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  126. package/themes/original/src/components/OrderDetails/index.tsx +56 -33
  127. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  128. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  129. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  130. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  131. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  132. package/themes/original/src/components/OrdersOption/index.tsx +59 -58
  133. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  134. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  135. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  136. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  137. package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
  138. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  139. package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
  140. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  141. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  142. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  143. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  144. package/themes/original/src/components/Promotions/index.tsx +250 -0
  145. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  146. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  147. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  148. package/themes/original/src/components/SearchBar/index.tsx +4 -1
  149. package/themes/original/src/components/Sessions/index.tsx +160 -0
  150. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  151. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  152. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  153. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  154. package/themes/original/src/components/SingleProductCard/index.tsx +82 -30
  155. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  156. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -74
  157. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  158. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  159. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  160. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  161. package/themes/original/src/components/UserProfile/index.tsx +66 -14
  162. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  163. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  164. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  165. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  166. package/themes/original/src/components/Wallets/index.tsx +76 -9
  167. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  168. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  169. package/themes/original/src/components/shared/OModal.tsx +4 -2
  170. package/themes/original/src/components/shared/index.tsx +2 -0
  171. package/themes/original/src/config/constants.tsx +6 -6
  172. package/themes/original/src/types/index.tsx +115 -9
  173. package/themes/original/src/utils/index.tsx +28 -2
  174. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  175. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  176. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  177. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  178. package/src/components/StripeMethodForm/index.tsx +0 -174
@@ -0,0 +1,287 @@
1
+ import React, { useEffect } from 'react';
2
+ import { View } from 'react-native';
3
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
4
+ import { FavoriteParams } from '../../types';
5
+ import { SingleOrderCard } from '../SingleOrderCard';
6
+ import {
7
+ FavoriteList as FavoriteListController,
8
+ useOrder,
9
+ useLanguage
10
+ } from 'ordering-components/native';
11
+ import { useTheme } from 'styled-components/native';
12
+ import { _setStoreData } from '../../providers/StoreUtil';
13
+ import { Container, WrappButton } from './styles'
14
+ import { OButton } from '../shared';
15
+ import { BusinessController } from '../BusinessController';
16
+ import { SingleProductCard } from '../SingleProductCard';
17
+ import moment from 'moment';
18
+
19
+
20
+ const FavoriteListUI = (props: FavoriteParams) => {
21
+ const {
22
+ favoriteList,
23
+ handleUpdateFavoriteList,
24
+ pagination,
25
+ getFavoriteList,
26
+ navigation,
27
+ onNavigationRedirect,
28
+ reorderState,
29
+ handleReorder,
30
+ isBusiness,
31
+ isOrder,
32
+ isProduct
33
+ } = props
34
+
35
+ const theme = useTheme();
36
+ const [, t] = useLanguage()
37
+ const [orderState] = useOrder();
38
+ const [{ carts }] = useOrder()
39
+
40
+ const pastOrders = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
41
+
42
+ const getOrderStatus = (s: any) => {
43
+ const status = parseInt(s)
44
+ const orderStatus = [
45
+ { key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending') },
46
+ { key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed') },
47
+ { key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected') },
48
+ { key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business') },
49
+ { key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed') },
50
+ { key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business') },
51
+ { key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver') },
52
+ { key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business') },
53
+ { key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver') },
54
+ { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver') },
55
+ { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver') },
56
+ { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver') },
57
+ { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver') },
58
+ { key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder') },
59
+ { key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready') },
60
+ { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer') },
61
+ { key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer') },
62
+ { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer') },
63
+ { key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business') },
64
+ { key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer') },
65
+ { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business') },
66
+ { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business') },
67
+ { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver') },
68
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way') }
69
+ ]
70
+
71
+ const objectStatus = orderStatus.find((o) => o.key === status)
72
+
73
+ return objectStatus && objectStatus
74
+ }
75
+
76
+ useEffect(() => {
77
+ const _businessId = 'businessId:' + reorderState?.result?.business_id
78
+ if (reorderState?.error) {
79
+ if (reorderState?.result?.business_id) {
80
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
81
+ onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
82
+ }
83
+ }
84
+ if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
85
+ const cartProducts = carts?.[_businessId]?.products
86
+ const available = cartProducts.every((product: any) => product.valid === true)
87
+ const orderProducts = favoriteList?.favorites.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
88
+
89
+ if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
90
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
91
+ } else {
92
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
93
+ cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
94
+ onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
95
+ }
96
+ }
97
+ }, [reorderState])
98
+
99
+ const handleBusinessClick = (business: any) => {
100
+ onNavigationRedirect && onNavigationRedirect('Business', {
101
+ store: business.slug,
102
+ header: business.header,
103
+ logo: business.logo,
104
+ });
105
+ }
106
+
107
+ const BusinessSkeleton = () => {
108
+ return (
109
+ <Placeholder
110
+ Animation={Fade}
111
+ style={{ marginBottom: 20 }}>
112
+ <View style={{ width: '100%' }}>
113
+ <PlaceholderLine
114
+ height={200}
115
+ style={{ marginBottom: 20, borderRadius: 25 }}
116
+ />
117
+ <View style={{ paddingHorizontal: 10 }}>
118
+ <View
119
+ style={{
120
+ flexDirection: 'row',
121
+ justifyContent: 'space-between',
122
+ }}>
123
+ <PlaceholderLine
124
+ height={25}
125
+ width={40}
126
+ style={{ marginBottom: 10 }}
127
+ />
128
+ <PlaceholderLine
129
+ height={25}
130
+ width={20}
131
+ style={{ marginBottom: 10 }}
132
+ />
133
+ </View>
134
+ <PlaceholderLine
135
+ height={20}
136
+ width={30}
137
+ style={{ marginBottom: 10 }}
138
+ />
139
+ <PlaceholderLine
140
+ height={20}
141
+ width={80}
142
+ style={{ marginBottom: 10 }}
143
+ />
144
+ </View>
145
+ </View>
146
+ </Placeholder>
147
+ )
148
+ }
149
+
150
+ const ProductSkeleton = () => {
151
+ return (
152
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
153
+ <View style={{ flexDirection: 'row' }}>
154
+ <PlaceholderLine
155
+ width={24}
156
+ height={70}
157
+ style={{ marginRight: 10, marginBottom: 10 }}
158
+ />
159
+ <Placeholder style={{ paddingVertical: 10 }}>
160
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
161
+ <PlaceholderLine width={20} />
162
+ </Placeholder>
163
+ </View>
164
+ </Placeholder>
165
+ )
166
+ }
167
+
168
+ const OrderSkeleton = () => {
169
+ return (
170
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
171
+ <View style={{ flexDirection: 'row' }}>
172
+ <PlaceholderLine
173
+ width={24}
174
+ height={70}
175
+ style={{ marginRight: 10, marginBottom: 10 }}
176
+ />
177
+ <Placeholder style={{ paddingVertical: 10 }}>
178
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
179
+ <PlaceholderLine width={20} />
180
+ </Placeholder>
181
+ </View>
182
+ </Placeholder>
183
+ )
184
+ }
185
+
186
+ return (
187
+ <Container>
188
+ {isBusiness && (
189
+ <>
190
+ {favoriteList?.favorites?.length > 0 && (
191
+ favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((business: any, i:number) => (
192
+ <BusinessController
193
+ key={`${business.id}_` + i}
194
+ business={business}
195
+ isBusinessOpen={business.open}
196
+ handleCustomClick={handleBusinessClick}
197
+ orderType={orderState?.options?.type}
198
+ navigation={navigation}
199
+ businessHeader={business?.header}
200
+ businessFeatured={business?.featured}
201
+ businessLogo={business?.logo}
202
+ businessReviews={business?.reviews}
203
+ businessDeliveryPrice={business?.delivery_price}
204
+ businessDeliveryTime={business?.delivery_time}
205
+ businessPickupTime={business?.pickup_time}
206
+ businessDistance={business?.distance}
207
+ handleUpdateBusinessList={handleUpdateFavoriteList}
208
+ />
209
+ ))
210
+ )}
211
+ {favoriteList?.loading && (
212
+ [...Array(5).keys()].map(i => (
213
+ <BusinessSkeleton key={i} />
214
+ ))
215
+ )}
216
+ </>
217
+ )}
218
+
219
+ {isOrder && (
220
+ <>
221
+ {favoriteList?.favorites?.length > 0 && (
222
+ favoriteList.favorites?.sort((a: any, b:any) => moment(a?.delivery_datetime_utc).valueOf() - moment(b?.delivery_datetime_utc).valueOf())
223
+ .map((order: any, i: number) => (
224
+ <SingleOrderCard
225
+ key={`${order?.id}_${i}`}
226
+ order={order}
227
+ getOrderStatus={getOrderStatus}
228
+ onNavigationRedirect={onNavigationRedirect}
229
+ pastOrders={pastOrders.includes(order?.status)}
230
+ handleUpdateOrderList={handleUpdateFavoriteList}
231
+ handleUpdateFavoriteList={handleUpdateFavoriteList}
232
+ handleReorder={handleReorder}
233
+ reorderLoading={reorderState?.loading}
234
+ />
235
+ ))
236
+ )}
237
+ {favoriteList?.loading && (
238
+ [...Array(5).keys()].map(i => (
239
+ <OrderSkeleton key={i} />
240
+ ))
241
+ )}
242
+ </>
243
+ )}
244
+
245
+ {isProduct && (
246
+ <>
247
+ {favoriteList?.favorites?.length > 0 && (
248
+ favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((product: any, i: number) => (
249
+ <SingleProductCard
250
+ key={`${product?.id}_${i}`}
251
+ isSoldOut={product.inventoried && !product.quantity}
252
+ product={product}
253
+ onProductClick={() => {}}
254
+ handleUpdateProducts={handleUpdateFavoriteList}
255
+ />
256
+ ))
257
+ )}
258
+ {favoriteList?.loading && (
259
+ [...Array(5).keys()].map(i => (
260
+ <ProductSkeleton key={i} />
261
+ ))
262
+ )}
263
+ </>
264
+ )}
265
+
266
+ {!favoriteList?.loading && pagination.totalPages && pagination.currentPage < pagination.totalPages && (
267
+ <WrappButton>
268
+ <OButton
269
+ onClick={() => getFavoriteList(pagination?.currentPage + 1)}
270
+ text={t('LOAD_MORE_ITEMS', 'Load more items')}
271
+ imgRightSrc={null}
272
+ textStyle={{ color: theme.colors.white }}
273
+ style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
274
+ />
275
+ </WrappButton>
276
+ )}
277
+ </Container>
278
+ )
279
+ }
280
+
281
+ export const FavoriteList = (props: any) => {
282
+ const favoriteBusinessesProps = {
283
+ ...props,
284
+ UIComponent: FavoriteListUI
285
+ }
286
+ return <FavoriteListController {...favoriteBusinessesProps} />
287
+ }
@@ -0,0 +1,5 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.View``
4
+
5
+ export const WrappButton = styled.View``
@@ -1,16 +1,20 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect, useState, useRef } from 'react';
2
2
  import { StyleSheet } from 'react-native';
3
3
  import { useForm, Controller } from 'react-hook-form';
4
+ import Recaptcha from 'react-native-recaptcha-that-works'
5
+ import { TouchableOpacity } from 'react-native-gesture-handler';
6
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
4
7
 
5
8
  import {
6
9
  ForgotPasswordForm as ForgotPasswordController,
7
10
  useLanguage,
8
11
  useToast,
9
12
  ToastType,
13
+ useConfig
10
14
  } from 'ordering-components/native';
11
15
  import { useTheme } from 'styled-components/native';
12
16
  import NavBar from '../NavBar';
13
- import { FormInput, FormSide } from '../LoginForm/styles'
17
+ import { FormInput, FormSide, RecaptchaButton } from '../LoginForm/styles'
14
18
  import { Container } from './styles'
15
19
 
16
20
  import { OButton, OInput, OText } from '../shared';
@@ -20,10 +24,16 @@ const ForgotPasswordUI = (props: any) => {
20
24
  navigation,
21
25
  formState,
22
26
  handleButtonForgotPasswordClick,
27
+ handleReCaptcha,
28
+ enableReCaptcha,
29
+ reCaptchaValue
23
30
  } = props;
24
31
  const [, t] = useLanguage();
25
32
  const [, { showToast }] = useToast();
33
+ const [{ configs }] = useConfig();
26
34
  const { control, handleSubmit, errors } = useForm();
35
+ const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
36
+ const [recaptchaVerified, setRecaptchaVerified] = useState(false)
27
37
 
28
38
  const theme = useTheme();
29
39
 
@@ -38,6 +48,7 @@ const ForgotPasswordUI = (props: any) => {
38
48
  });
39
49
 
40
50
  const [emailSent, setEmailSent] = useState(null);
51
+ const recaptchaRef = useRef<any>({});
41
52
 
42
53
  const onSubmit = (values: any) => {
43
54
  setEmailSent(values.email)
@@ -48,23 +59,60 @@ const ForgotPasswordUI = (props: any) => {
48
59
  onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''))
49
60
  }
50
61
 
62
+ const handleOpenRecaptcha = () => {
63
+ setRecaptchaVerified(false)
64
+ handleReCaptcha(null)
65
+ if (reCaptchaValue) return
66
+
67
+ if (!recaptchaConfig?.siteKey) {
68
+ showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
69
+ return
70
+ }
71
+ if (!recaptchaConfig?.baseUrl) {
72
+ showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
73
+ return
74
+ }
75
+ recaptchaRef.current.open()
76
+ }
77
+
78
+ const onRecaptchaVerify = (token: any) => {
79
+ setRecaptchaVerified(true)
80
+ handleReCaptcha(token)
81
+ }
82
+
83
+ const handleRecaptchaExpire = () => {
84
+ setRecaptchaVerified(false)
85
+ handleReCaptcha(null)
86
+ }
87
+
51
88
  useEffect(() => {
52
89
  if (!formState.loading && emailSent) {
53
90
  if (formState.result?.error) {
54
91
  setEmailSent(null)
55
92
  formState.result?.result && showToast(
56
93
  ToastType.Error,
57
- formState.result?.result[0]
94
+ typeof formState.result?.result === 'string'
95
+ ? formState.result?.result
96
+ : formState.result?.result[0]
58
97
  )
59
98
  return
60
99
  }
61
100
  showToast(
62
101
  ToastType.Success,
63
- `${t('SUCCESS_SEND_FORGOT_PASSWORD', 'Your link has been sent to the email')}: ${emailSent}`
102
+ t('IF_ACCOUNT_EXIST_EMAIL_SEND_PASSWORD', 'If an account exists with this email a password will be sent')
64
103
  )
65
104
  }
66
105
  }, [formState])
67
106
 
107
+ useEffect(() => {
108
+ if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
109
+ setRecaptchaConfig({
110
+ siteKey: configs?.security_recaptcha_site_key?.value || null,
111
+ baseUrl: configs?.security_recaptcha_base_url?.value || null
112
+ })
113
+ }
114
+ }, [configs, enableReCaptcha])
115
+
68
116
  return (
69
117
  <Container>
70
118
  <NavBar
@@ -126,6 +174,37 @@ const ForgotPasswordUI = (props: any) => {
126
174
  }}
127
175
  defaultValue=""
128
176
  />
177
+ {enableReCaptcha && (
178
+ <>
179
+ <TouchableOpacity
180
+ onPress={handleOpenRecaptcha}
181
+ >
182
+ <RecaptchaButton>
183
+ {recaptchaVerified ? (
184
+ <MaterialCommunityIcons
185
+ name="checkbox-marked"
186
+ size={26}
187
+ color={theme.colors.primary}
188
+ />
189
+ ) : (
190
+ <MaterialCommunityIcons
191
+ name="checkbox-blank-outline"
192
+ size={26}
193
+ color={theme.colors.mediumGray}
194
+ />
195
+ )}
196
+ <OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
197
+ </RecaptchaButton>
198
+ </TouchableOpacity>
199
+ <Recaptcha
200
+ ref={recaptchaRef}
201
+ siteKey={recaptchaConfig?.siteKey}
202
+ baseUrl={recaptchaConfig?.baseUrl}
203
+ onVerify={onRecaptchaVerify}
204
+ onExpire={handleRecaptchaExpire}
205
+ />
206
+ </>
207
+ )}
129
208
 
130
209
  <OButton
131
210
  text={emailSent && !formState.result?.error ? t('LINK_SEND_FORGOT_PASSWORD', 'Link Sent') : t('FRONT_RECOVER_PASSWORD', 'Recover Password')}
@@ -146,6 +225,7 @@ const ForgotPasswordUI = (props: any) => {
146
225
  export const ForgotPasswordForm = (props: any) => {
147
226
  const ForgotPasswordProps = {
148
227
  ...props,
228
+ isRecaptchaEnable: true,
149
229
  UIComponent: ForgotPasswordUI
150
230
  }
151
231
  return <ForgotPasswordController {...ForgotPasswordProps} />
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react'
2
+ import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
2
3
  import Geolocation from '@react-native-community/geolocation'
3
4
  import Geocoder from 'react-native-geocoding'
4
5
  import { GpsButtonStyle } from './styles'
@@ -55,14 +56,20 @@ export const GPSButton = (props: any) => {
55
56
  })
56
57
  }
57
58
 
58
- const getCurrentPosition = () => {
59
- setLoading(true);
60
- Geolocation.getCurrentPosition((pos) => {
61
- geoCodePosition(pos.coords);
62
- }, (err) => {
63
- setLoading(false);
64
- console.log(err);
65
- });
59
+ const getCurrentPosition = async () => {
60
+ let trackingStatus = await getTrackingStatus()
61
+ if (trackingStatus === 'not-determined') {
62
+ trackingStatus = await requestTrackingPermission()
63
+ }
64
+ if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
65
+ setLoading(true);
66
+ Geolocation.getCurrentPosition((pos) => {
67
+ geoCodePosition(pos.coords);
68
+ }, (err) => {
69
+ setLoading(false);
70
+ console.log(err);
71
+ });
72
+ }
66
73
  }
67
74
 
68
75
  useEffect(() => {
@@ -193,6 +193,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
193
193
  <React.Fragment key={i}>
194
194
  {
195
195
  <Marker
196
+ zIndex={i}
196
197
  coordinate={location}
197
198
  title={locations[i]?.title}
198
199
  >
@@ -1,9 +1,11 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
+ import { RefreshControl } from 'react-native'
2
3
  import { HelpParams } from '../../types'
3
4
  import { useLanguage } from 'ordering-components/native'
4
5
  import NavBar from '../NavBar'
5
6
  import { OText } from '../shared'
6
7
  import { LastOrders } from '../LastOrders'
8
+ import { Container } from '../../layouts/Container'
7
9
 
8
10
  import {
9
11
  HelpSubItem,
@@ -15,13 +17,28 @@ export const Help = (props: HelpParams) => {
15
17
  navigation
16
18
  } = props
17
19
  const [, t] = useLanguage()
20
+ const [refreshing] = useState(false);
21
+ const [refresh, setRefresh] = useState(false)
18
22
 
19
23
  const goToBack = () => navigation?.canGoBack() && navigation.goBack()
20
24
  const onRedirect = (route: string, params?: any) => {
21
25
  navigation.navigate(route, params)
22
26
  }
27
+
28
+ const handleOnRefresh = () => {
29
+ setRefresh(true)
30
+ }
31
+
23
32
  return (
24
- <>
33
+ <Container
34
+ noPadding
35
+ refreshControl={
36
+ <RefreshControl
37
+ refreshing={refreshing}
38
+ onRefresh={() => handleOnRefresh()}
39
+ />
40
+ }
41
+ >
25
42
  <NavBar
26
43
  title={t('HELP', 'Help')}
27
44
  titleAlign={'center'}
@@ -48,8 +65,8 @@ export const Help = (props: HelpParams) => {
48
65
 
49
66
  <LastOrdersContainer>
50
67
  <OText size={18} weight={600}>{t('LAST_ORDERS', 'Last Orders')}</OText>
51
- <LastOrders {...props} onRedirect={onRedirect} />
68
+ <LastOrders {...props} onRedirect={onRedirect} refresh={refresh} setRefresh={setRefresh} />
52
69
  </LastOrdersContainer>
53
- </>
70
+ </Container>
54
71
  )
55
72
  }