ordering-ui-react-native 0.15.67 → 0.15.68-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 (216) hide show
  1. package/package.json +7 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +1 -1
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +16 -8
  8. package/src/components/BusinessInformation/index.tsx +14 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +23 -2
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +6 -2
  14. package/src/components/LoginForm/index.tsx +120 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/OrderDetails/index.tsx +7 -21
  17. package/src/components/PaymentOptions/index.tsx +67 -50
  18. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  19. package/src/components/ReviewDriver/index.tsx +1 -1
  20. package/src/components/ReviewOrder/index.tsx +2 -1
  21. package/src/components/ReviewProducts/index.tsx +11 -0
  22. package/src/components/SignupForm/index.tsx +145 -61
  23. package/src/components/SingleProductCard/index.tsx +16 -4
  24. package/src/components/SingleProductReview/index.tsx +1 -1
  25. package/src/components/StripeMethodForm/index.tsx +22 -24
  26. package/src/components/UpsellingProducts/index.tsx +1 -1
  27. package/src/components/UserProfileForm/index.tsx +63 -6
  28. package/src/components/UserProfileForm/styles.tsx +8 -0
  29. package/src/components/VerifyPhone/styles.tsx +1 -2
  30. package/src/components/shared/OModal.tsx +1 -1
  31. package/src/hooks/useCountdownTimer.tsx +26 -0
  32. package/src/navigators/CheckoutNavigator.tsx +6 -0
  33. package/src/navigators/HomeNavigator.tsx +12 -0
  34. package/src/pages/BusinessesListing.tsx +7 -6
  35. package/src/pages/MultiCheckout.tsx +31 -0
  36. package/src/pages/MultiOrdersDetails.tsx +27 -0
  37. package/src/pages/OrderDetails.tsx +1 -1
  38. package/src/pages/ReviewDriver.tsx +2 -2
  39. package/src/pages/ReviewOrder.tsx +2 -2
  40. package/src/pages/Sessions.tsx +22 -0
  41. package/src/theme.json +0 -1
  42. package/src/types/index.tsx +18 -11
  43. package/src/utils/index.tsx +68 -2
  44. package/themes/business/index.tsx +4 -0
  45. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  46. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  47. package/themes/business/src/components/Chat/index.tsx +42 -90
  48. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  49. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  50. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  51. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  52. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  53. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  54. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  55. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  56. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  57. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
  58. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  59. package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
  60. package/themes/business/src/components/OrdersOption/index.tsx +8 -4
  61. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  62. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  63. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  64. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  65. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  66. package/themes/business/src/components/shared/OModal.tsx +41 -38
  67. package/themes/business/src/types/index.tsx +8 -2
  68. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  69. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  70. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  71. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  72. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  73. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  74. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  75. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  76. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  77. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  78. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  79. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  80. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  81. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  82. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  83. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  84. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  85. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  86. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  87. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  88. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  89. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  90. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  91. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  92. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  93. package/themes/kiosk/src/types/index.d.ts +1 -0
  94. package/themes/original/index.tsx +30 -8
  95. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  96. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  97. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  98. package/themes/original/src/components/AddressList/index.tsx +30 -18
  99. package/themes/original/src/components/AppleLogin/index.tsx +6 -8
  100. package/themes/original/src/components/BusinessBasicInformation/index.tsx +304 -158
  101. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  102. package/themes/original/src/components/BusinessController/index.tsx +195 -96
  103. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  104. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  105. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  106. package/themes/original/src/components/BusinessListingSearch/index.tsx +231 -63
  107. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  108. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  109. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  110. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  111. package/themes/original/src/components/BusinessProductsList/index.tsx +53 -52
  112. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  113. package/themes/original/src/components/BusinessProductsListing/index.tsx +318 -155
  114. package/themes/original/src/components/BusinessProductsListing/styles.tsx +32 -0
  115. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  116. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
  117. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  118. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
  119. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  120. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +679 -0
  121. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  122. package/themes/original/src/components/BusinessesListing/index.tsx +99 -458
  123. package/themes/original/src/components/Cart/index.tsx +61 -42
  124. package/themes/original/src/components/Checkout/index.tsx +90 -39
  125. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  126. package/themes/original/src/components/Favorite/index.tsx +92 -0
  127. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  128. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  129. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  130. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  131. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  132. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  133. package/themes/original/src/components/Help/index.tsx +21 -4
  134. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  135. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  136. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  137. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  138. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  139. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  140. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  141. package/themes/original/src/components/Messages/index.tsx +1 -1
  142. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  143. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  144. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  145. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  146. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  147. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  148. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  149. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  150. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  151. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  152. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  153. package/themes/original/src/components/NavBar/index.tsx +4 -4
  154. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  155. package/themes/original/src/components/OrderDetails/index.tsx +148 -63
  156. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  157. package/themes/original/src/components/OrderSummary/index.tsx +6 -6
  158. package/themes/original/src/components/OrderTypeSelector/index.tsx +79 -35
  159. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  160. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  161. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  162. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  163. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  164. package/themes/original/src/components/OrdersOption/index.tsx +137 -38
  165. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  166. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  167. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  168. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  169. package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
  170. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  171. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  172. package/themes/original/src/components/ProductForm/index.tsx +718 -679
  173. package/themes/original/src/components/ProductForm/styles.tsx +6 -2
  174. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  175. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  176. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  177. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  178. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  179. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  180. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  181. package/themes/original/src/components/Promotions/index.tsx +151 -133
  182. package/themes/original/src/components/Promotions/styles.tsx +3 -23
  183. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  184. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  185. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  186. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  187. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  188. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  189. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  190. package/themes/original/src/components/Sessions/index.tsx +160 -0
  191. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  192. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  193. package/themes/original/src/components/SingleOrderCard/index.tsx +275 -0
  194. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  195. package/themes/original/src/components/SingleProductCard/index.tsx +215 -90
  196. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  197. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  198. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  199. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  200. package/themes/original/src/components/UserDetails/index.tsx +15 -81
  201. package/themes/original/src/components/UserFormDetails/index.tsx +98 -66
  202. package/themes/original/src/components/UserProfile/index.tsx +11 -2
  203. package/themes/original/src/components/UserProfileForm/index.tsx +33 -22
  204. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  205. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  206. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  207. package/themes/original/src/components/Wallets/index.tsx +25 -12
  208. package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
  209. package/themes/original/src/components/shared/OButton.tsx +2 -0
  210. package/themes/original/src/components/shared/OInput.tsx +3 -2
  211. package/themes/original/src/components/shared/OModal.tsx +4 -2
  212. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  213. package/themes/original/src/types/index.tsx +187 -35
  214. package/themes/original/src/utils/index.tsx +94 -1
  215. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  216. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,298 @@
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
+ const onProductClick = (product: any) => {
77
+ const categoryId = product?.category?.id
78
+ const businessId = product?.category?.business?.id
79
+ if (!categoryId || !businessId) return
80
+ onNavigationRedirect && onNavigationRedirect('ProductDetails', {
81
+ productId: product?.id,
82
+ categoryId: categoryId,
83
+ businessId: businessId
84
+ })
85
+ }
86
+
87
+ useEffect(() => {
88
+ const _businessId = 'businessId:' + reorderState?.result?.business_id
89
+ if (reorderState?.error) {
90
+ if (reorderState?.result?.business_id) {
91
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
92
+ onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
93
+ }
94
+ }
95
+ if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
96
+ const cartProducts = carts?.[_businessId]?.products
97
+ const available = cartProducts.every((product: any) => product.valid === true)
98
+ const orderProducts = favoriteList?.favorites.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
99
+
100
+ if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
101
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
102
+ } else {
103
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
104
+ cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
105
+ onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
106
+ }
107
+ }
108
+ }, [reorderState])
109
+
110
+ const handleBusinessClick = (business: any) => {
111
+ onNavigationRedirect && onNavigationRedirect('Business', {
112
+ store: business.slug,
113
+ header: business.header,
114
+ logo: business.logo,
115
+ });
116
+ }
117
+
118
+ const BusinessSkeleton = () => {
119
+ return (
120
+ <Placeholder
121
+ Animation={Fade}
122
+ style={{ marginBottom: 20 }}>
123
+ <View style={{ width: '100%' }}>
124
+ <PlaceholderLine
125
+ height={200}
126
+ style={{ marginBottom: 20, borderRadius: 25 }}
127
+ />
128
+ <View style={{ paddingHorizontal: 10 }}>
129
+ <View
130
+ style={{
131
+ flexDirection: 'row',
132
+ justifyContent: 'space-between',
133
+ }}>
134
+ <PlaceholderLine
135
+ height={25}
136
+ width={40}
137
+ style={{ marginBottom: 10 }}
138
+ />
139
+ <PlaceholderLine
140
+ height={25}
141
+ width={20}
142
+ style={{ marginBottom: 10 }}
143
+ />
144
+ </View>
145
+ <PlaceholderLine
146
+ height={20}
147
+ width={30}
148
+ style={{ marginBottom: 10 }}
149
+ />
150
+ <PlaceholderLine
151
+ height={20}
152
+ width={80}
153
+ style={{ marginBottom: 10 }}
154
+ />
155
+ </View>
156
+ </View>
157
+ </Placeholder>
158
+ )
159
+ }
160
+
161
+ const ProductSkeleton = () => {
162
+ return (
163
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
164
+ <View style={{ flexDirection: 'row' }}>
165
+ <PlaceholderLine
166
+ width={24}
167
+ height={70}
168
+ style={{ marginRight: 10, marginBottom: 10 }}
169
+ />
170
+ <Placeholder style={{ paddingVertical: 10 }}>
171
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
172
+ <PlaceholderLine width={20} />
173
+ </Placeholder>
174
+ </View>
175
+ </Placeholder>
176
+ )
177
+ }
178
+
179
+ const OrderSkeleton = () => {
180
+ return (
181
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
182
+ <View style={{ flexDirection: 'row' }}>
183
+ <PlaceholderLine
184
+ width={24}
185
+ height={70}
186
+ style={{ marginRight: 10, marginBottom: 10 }}
187
+ />
188
+ <Placeholder style={{ paddingVertical: 10 }}>
189
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
190
+ <PlaceholderLine width={20} />
191
+ </Placeholder>
192
+ </View>
193
+ </Placeholder>
194
+ )
195
+ }
196
+
197
+ return (
198
+ <Container>
199
+ {isBusiness && (
200
+ <>
201
+ {favoriteList?.favorites?.length > 0 && (
202
+ favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((business: any, i:number) => (
203
+ <BusinessController
204
+ key={`${business.id}_` + i}
205
+ business={business}
206
+ isBusinessOpen={business.open}
207
+ handleCustomClick={handleBusinessClick}
208
+ orderType={orderState?.options?.type}
209
+ navigation={navigation}
210
+ businessHeader={business?.header}
211
+ businessFeatured={business?.featured}
212
+ businessLogo={business?.logo}
213
+ businessReviews={business?.reviews}
214
+ businessDeliveryPrice={business?.delivery_price}
215
+ businessDeliveryTime={business?.delivery_time}
216
+ businessPickupTime={business?.pickup_time}
217
+ businessDistance={business?.distance}
218
+ handleUpdateBusinessList={handleUpdateFavoriteList}
219
+ />
220
+ ))
221
+ )}
222
+ {favoriteList?.loading && (
223
+ [...Array(5).keys()].map(i => (
224
+ <BusinessSkeleton key={i} />
225
+ ))
226
+ )}
227
+ </>
228
+ )}
229
+
230
+ {isOrder && (
231
+ <>
232
+ {favoriteList?.favorites?.length > 0 && (
233
+ favoriteList.favorites?.sort((a: any, b:any) => moment(a?.delivery_datetime_utc).valueOf() - moment(b?.delivery_datetime_utc).valueOf())
234
+ .map((order: any, i: number) => (
235
+ <SingleOrderCard
236
+ key={`${order?.id}_${i}`}
237
+ order={order}
238
+ getOrderStatus={getOrderStatus}
239
+ onNavigationRedirect={onNavigationRedirect}
240
+ pastOrders={pastOrders.includes(order?.status)}
241
+ handleUpdateOrderList={handleUpdateFavoriteList}
242
+ handleUpdateFavoriteList={handleUpdateFavoriteList}
243
+ handleReorder={handleReorder}
244
+ reorderLoading={reorderState?.loading}
245
+ />
246
+ ))
247
+ )}
248
+ {favoriteList?.loading && (
249
+ [...Array(5).keys()].map(i => (
250
+ <OrderSkeleton key={i} />
251
+ ))
252
+ )}
253
+ </>
254
+ )}
255
+
256
+ {isProduct && (
257
+ <>
258
+ {favoriteList?.favorites?.length > 0 && (
259
+ favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((product: any, i: number) => (
260
+ <SingleProductCard
261
+ key={`${product?.id}_${i}`}
262
+ isSoldOut={product?.inventoried && !product?.quantity}
263
+ product={product}
264
+ onProductClick={onProductClick}
265
+ handleUpdateProducts={handleUpdateFavoriteList}
266
+ />
267
+ ))
268
+ )}
269
+ {favoriteList?.loading && (
270
+ [...Array(5).keys()].map(i => (
271
+ <ProductSkeleton key={i} />
272
+ ))
273
+ )}
274
+ </>
275
+ )}
276
+
277
+ {!favoriteList?.loading && pagination.totalPages && pagination.currentPage < pagination.totalPages && (
278
+ <WrappButton>
279
+ <OButton
280
+ onClick={() => getFavoriteList(pagination?.currentPage + 1)}
281
+ text={t('LOAD_MORE_ITEMS', 'Load more items')}
282
+ imgRightSrc={null}
283
+ textStyle={{ color: theme.colors.white }}
284
+ style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
285
+ />
286
+ </WrappButton>
287
+ )}
288
+ </Container>
289
+ )
290
+ }
291
+
292
+ export const FavoriteList = (props: any) => {
293
+ const favoriteBusinessesProps = {
294
+ ...props,
295
+ UIComponent: FavoriteListUI
296
+ }
297
+ return <FavoriteListController {...favoriteBusinessesProps} />
298
+ }
@@ -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(() => {
@@ -32,6 +32,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
32
32
  latitudeDelta: 0.0010,
33
33
  longitudeDelta: 0.0010 * ASPECT_RATIO
34
34
  })
35
+ const [MARKERS, SETMARKERS] = useState(locations)
35
36
  let mapRef = useRef<any>(null)
36
37
  const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
37
38
 
@@ -41,12 +42,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
41
42
  ERROR_NOT_FOUND_ADDRESS: 'Sorry, we couldn\'t find an address',
42
43
  ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
43
44
  }
44
- const MARKERS = locations && locations.map((location: { lat: number, lng: number }) => {
45
- return {
46
- latitude: location.lat,
47
- longitude: location.lng
48
- }
49
- })
45
+
50
46
  const geocodePosition = (pos: { latitude: number, longitude: number }) => {
51
47
  Geocoder.from({
52
48
  latitude: pos.latitude,
@@ -147,7 +143,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
147
143
  }
148
144
 
149
145
  const fitAllMarkers = () => {
150
- mapRef.current.fitToCoordinates(MARKERS, {
146
+ mapRef.current.fitToCoordinates(MARKERS?.map(location => ({ latitude: location.lat, longitude: location.lng })), {
151
147
  edgePadding: { top: 80, right: 80, bottom: 80, left: 80 },
152
148
  animated: true,
153
149
  });
@@ -170,6 +166,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
170
166
  fitAllMarkers()
171
167
  }
172
168
  }, 1000)
169
+ if (locations) {
170
+ SETMARKERS(locations)
171
+ }
173
172
  return () => clearInterval(interval)
174
173
  }, [locations])
175
174
 
@@ -189,15 +188,16 @@ export const GoogleMap = (props: GoogleMapsParams) => {
189
188
  >
190
189
  {locations ? (
191
190
  <>
192
- {MARKERS && MARKERS.map((location: { latitude: number, longitude: number }, i: number) => (
191
+ {MARKERS && MARKERS.map((location: { lat: number, lng: number }, i: number) => (
193
192
  <React.Fragment key={i}>
194
193
  {
195
194
  <Marker
196
- coordinate={location}
197
- title={locations[i]?.title}
195
+ zIndex={i}
196
+ coordinate={{ latitude: location.lat ?? 0, longitude: location.lng ?? 0 }}
197
+ title={MARKERS[i]?.title}
198
198
  >
199
199
  <View>
200
- <OIcon url={locations[i].icon} width={50} height={50} />
200
+ <OIcon url={MARKERS[i].icon} width={50} height={50} />
201
201
  </View>
202
202
  </Marker>
203
203
  }
@@ -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
  }
@@ -20,7 +20,10 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
20
20
  onBusinessClick,
21
21
  navigation,
22
22
  isLoading,
23
- getBusinesses
23
+ getBusinesses,
24
+ favoriteIds,
25
+ setFavoriteIds,
26
+ handleUpdateBusinessList
24
27
  } = props;
25
28
 
26
29
  const [, t] = useLanguage()
@@ -33,6 +36,17 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
33
36
  getBusinesses(true)
34
37
  }, [isLoading])
35
38
 
39
+ useEffect(() => {
40
+ if (!businessesList?.businesses?.length) return
41
+ const ids = [...favoriteIds]
42
+ businessesList.businesses.forEach(business => {
43
+ if (business?.favorite) {
44
+ ids.push(business.id)
45
+ }
46
+ })
47
+ setFavoriteIds([...new Set(ids)])
48
+ }, [businessesList?.businesses?.length])
49
+
36
50
  return (
37
51
  <>
38
52
 
@@ -123,6 +137,9 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
123
137
  handleCustomClick={onBusinessClick}
124
138
  orderType={orderState?.options?.type}
125
139
  navigation={navigation}
140
+ favoriteIds={favoriteIds}
141
+ setFavoriteIds={setFavoriteIds}
142
+ handleUpdateBusinessList={handleUpdateBusinessList}
126
143
  />
127
144
  </View>
128
145
  )
@@ -18,11 +18,15 @@ import {
18
18
  OrderContainer,
19
19
  OrderInfo
20
20
  } from './styles'
21
+ import { useEffect } from 'react'
21
22
 
22
23
  const LastOrdersUI = (props: LastOrdersParams) => {
23
24
  const {
24
25
  orderList,
25
- onRedirect
26
+ onRedirect,
27
+ loadOrders,
28
+ refresh,
29
+ setRefresh
26
30
  } = props
27
31
  const { loading, error, orders } = orderList
28
32
 
@@ -46,6 +50,13 @@ const LastOrdersUI = (props: LastOrdersParams) => {
46
50
  onRedirect && onRedirect('OrderDetails', { orderId: uuid })
47
51
  }
48
52
 
53
+ useEffect(() => {
54
+ if(refresh){
55
+ loadOrders(false, false, false, true)
56
+ setRefresh && setRefresh(false)
57
+ }
58
+ }, [refresh])
59
+
49
60
  return (
50
61
  <>
51
62
  {loading ? (