ordering-ui-react-native 0.16.9 → 0.16.10-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 (219) hide show
  1. package/package.json +8 -4
  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/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +10 -8
  8. package/src/components/BusinessInformation/index.tsx +22 -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 +2 -1
  12. package/src/components/LanguageSelector/index.tsx +21 -16
  13. package/src/components/LoginForm/index.tsx +118 -30
  14. package/src/components/LoginForm/styles.tsx +6 -0
  15. package/src/components/Messages/index.tsx +2 -2
  16. package/src/components/NotificationSetting/index.tsx +85 -0
  17. package/src/components/OrderDetails/index.tsx +7 -21
  18. package/src/components/OrdersOption/index.tsx +54 -56
  19. package/src/components/PaymentOptions/index.tsx +335 -365
  20. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  21. package/src/components/ReviewDriver/index.tsx +1 -1
  22. package/src/components/ReviewOrder/index.tsx +2 -1
  23. package/src/components/ReviewProducts/index.tsx +11 -0
  24. package/src/components/SignupForm/index.tsx +143 -61
  25. package/src/components/SingleProductReview/index.tsx +8 -5
  26. package/src/components/StripeElementsForm/index.tsx +25 -16
  27. package/src/components/StripeMethodForm/index.tsx +1 -2
  28. package/src/components/VerifyPhone/styles.tsx +1 -2
  29. package/src/components/shared/OBottomPopup.tsx +6 -2
  30. package/src/index.tsx +2 -0
  31. package/src/navigators/CheckoutNavigator.tsx +6 -0
  32. package/src/navigators/HomeNavigator.tsx +6 -0
  33. package/src/pages/BusinessesListing.tsx +7 -6
  34. package/src/pages/MultiCheckout.tsx +31 -0
  35. package/src/pages/MultiOrdersDetails.tsx +27 -0
  36. package/src/pages/OrderDetails.tsx +1 -1
  37. package/src/pages/ReviewDriver.tsx +2 -2
  38. package/src/pages/ReviewOrder.tsx +2 -2
  39. package/src/theme.json +0 -1
  40. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  41. package/src/types/index.tsx +13 -9
  42. package/src/utils/index.tsx +0 -1
  43. package/themes/business/index.tsx +4 -0
  44. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  45. package/themes/business/src/components/Chat/index.tsx +42 -34
  46. package/themes/business/src/components/DriverMap/index.tsx +13 -10
  47. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  48. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  49. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  50. package/themes/business/src/components/MapView/index.tsx +1 -1
  51. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  52. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  53. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  54. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +19 -18
  55. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  56. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  57. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  58. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  59. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  61. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  62. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  63. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  64. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  65. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  66. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  67. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  68. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  69. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  70. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  71. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  72. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  73. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  74. package/themes/business/src/components/shared/OModal.tsx +40 -37
  75. package/themes/business/src/types/index.tsx +14 -9
  76. package/themes/business/src/utils/index.tsx +10 -0
  77. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  78. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  79. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  80. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  81. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  82. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  83. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  84. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  85. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  86. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  87. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  88. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  89. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  90. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  91. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  92. package/themes/kiosk/src/types/index.d.ts +2 -0
  93. package/themes/original/index.tsx +22 -0
  94. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  95. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  96. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  97. package/themes/original/src/components/AddressList/index.tsx +1 -1
  98. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  99. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  100. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  101. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  102. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  103. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  104. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  105. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  106. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  107. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  108. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  109. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  110. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  111. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  112. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  113. package/themes/original/src/components/BusinessProductsList/index.tsx +65 -72
  114. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  115. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -178
  116. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  117. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  118. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  119. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  120. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  121. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  122. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  123. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  124. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  125. package/themes/original/src/components/Cart/index.tsx +81 -36
  126. package/themes/original/src/components/Cart/styles.tsx +4 -0
  127. package/themes/original/src/components/CartContent/index.tsx +22 -16
  128. package/themes/original/src/components/Checkout/index.tsx +106 -66
  129. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  130. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  131. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  132. package/themes/original/src/components/Favorite/index.tsx +92 -0
  133. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  134. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  135. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  136. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  137. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  138. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  139. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  140. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  141. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  142. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  143. package/themes/original/src/components/LoginForm/index.tsx +79 -42
  144. package/themes/original/src/components/Messages/index.tsx +17 -17
  145. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  146. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  147. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  148. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  149. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  150. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  151. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  152. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  153. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  154. package/themes/original/src/components/MyOrders/index.tsx +177 -27
  155. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  156. package/themes/original/src/components/NavBar/index.tsx +11 -5
  157. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  158. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  159. package/themes/original/src/components/OrderDetails/index.tsx +125 -40
  160. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  161. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  162. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  163. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  164. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  165. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  166. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
  168. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  170. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  171. package/themes/original/src/components/OrdersOption/index.tsx +130 -37
  172. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  173. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  174. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  175. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  176. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  177. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  178. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  179. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  180. package/themes/original/src/components/ProductItemAccordion/index.tsx +37 -24
  181. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  182. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  183. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  184. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  185. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  186. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  187. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  188. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  189. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  190. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  191. package/themes/original/src/components/SearchBar/index.tsx +10 -5
  192. package/themes/original/src/components/ServiceForm/index.tsx +608 -0
  193. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  194. package/themes/original/src/components/SignupForm/index.tsx +301 -158
  195. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  196. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  197. package/themes/original/src/components/SingleProductCard/index.tsx +215 -95
  198. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  199. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  200. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  201. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  202. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  203. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  204. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  205. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  206. package/themes/original/src/components/UserProfile/index.tsx +12 -1
  207. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  208. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  209. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  210. package/themes/original/src/components/Wallets/index.tsx +176 -162
  211. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  212. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  213. package/themes/original/src/components/shared/OButton.tsx +10 -3
  214. package/themes/original/src/components/shared/OInput.tsx +3 -2
  215. package/themes/original/src/components/shared/OModal.tsx +3 -1
  216. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  217. package/themes/original/src/types/index.tsx +200 -46
  218. package/themes/original/src/utils/index.tsx +77 -0
  219. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,92 @@
1
+ import React, { useState } from 'react'
2
+ import { useLanguage, useOrder } from 'ordering-components/native'
3
+ import { useTheme } from 'styled-components/native'
4
+ import { FavoriteList } from '../FavoriteList'
5
+ import NavBar from '../NavBar'
6
+ import { OText } from '../shared'
7
+
8
+ import {
9
+ TabContainer,
10
+ Tab,
11
+ Container
12
+ } from './styles'
13
+
14
+ export const Favorite = (props: any) => {
15
+ const {
16
+ navigation
17
+ } = props
18
+ const [, t] = useLanguage()
19
+ const theme = useTheme()
20
+ const [orderState] = useOrder()
21
+ const [tabSelected, setTabSelected] = useState('businesses')
22
+
23
+ const tabList = [
24
+ { key: 'businesses', name: t('BUSINESSES', 'Businesses') },
25
+ { key: 'products', name: t('PRODUCTS', 'Products') },
26
+ { key: 'orders', name: t('ORDERS', 'Orders') }
27
+ ]
28
+
29
+ const goToBack = () => navigation?.canGoBack() && navigation.goBack()
30
+
31
+ const onRedirect = (route: string, params?: any) => {
32
+ navigation.navigate(route, params)
33
+ }
34
+
35
+ return (
36
+ <Container>
37
+ <NavBar
38
+ title={t('FAVORITE', 'Favorite')}
39
+ titleAlign={'center'}
40
+ onActionLeft={goToBack}
41
+ showCall={false}
42
+ paddingTop={10}
43
+ btnStyle={{ paddingLeft: 0 }}
44
+ />
45
+ <TabContainer>
46
+ {tabList.map((menu, i) => (
47
+ <Tab
48
+ key={i}
49
+ active={menu.key === tabSelected}
50
+ onPress={() => setTabSelected(menu.key)}
51
+ >
52
+ <OText
53
+ color={menu.key === tabSelected ? theme.colors.textNormal : theme.colors.disabled}
54
+ size={14}
55
+ weight={menu.key === tabSelected ? '500' : '400'}
56
+ style={{ marginBottom: 12 }}
57
+ >
58
+ {menu.name}
59
+ </OText>
60
+ </Tab>
61
+ ))}
62
+ </TabContainer>
63
+ {tabSelected === 'businesses' && (
64
+ <FavoriteList
65
+ navigation={navigation}
66
+ onNavigationRedirect={onRedirect}
67
+ isBusiness
68
+ favoriteURL='favorite_businesses'
69
+ originalURL='business'
70
+ location={`${orderState.options?.address?.location?.lat},${orderState.options?.address?.location?.lng}`}
71
+ propsToFetch={['id', 'name', 'header', 'logo', 'location', 'address', 'ribbon', 'timezone', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug']}
72
+ />
73
+ )}
74
+ {tabSelected === 'products' && (
75
+ <FavoriteList
76
+ favoriteURL='favorite_products'
77
+ originalURL='products'
78
+ onNavigationRedirect={onRedirect}
79
+ isProduct
80
+ />
81
+ )}
82
+ {tabSelected === 'orders' && (
83
+ <FavoriteList
84
+ onNavigationRedirect={onRedirect}
85
+ favoriteURL='favorite_orders'
86
+ originalURL='orders'
87
+ isOrder
88
+ />
89
+ )}
90
+ </Container>
91
+ )
92
+ }
@@ -0,0 +1,22 @@
1
+ import styled, { css } from 'styled-components/native'
2
+
3
+ export const TabContainer = styled.View`
4
+ flex-direction: row;
5
+ border-bottom-color: ${(props: any) => props.theme.colors.border};
6
+ border-bottom-width: 1px;
7
+ margin-bottom: 25px;
8
+ `
9
+
10
+ export const Tab = styled.TouchableOpacity`
11
+ margin-right: 32px;
12
+ ${(props: any) => props.active && css`
13
+ border-bottom-color: ${(props: any) => props.theme.colors.textNormal};
14
+ border-bottom-width: 1px;
15
+ `}
16
+ `
17
+
18
+ export const Container = styled.View`
19
+ padding-horizontal: 40px;
20
+ padding-bottom: 20px;
21
+ padding-top: 30px;
22
+ `
@@ -0,0 +1,317 @@
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 { NotFoundSource } from '../NotFoundSource';
18
+ import moment from 'moment';
19
+
20
+
21
+ const FavoriteListUI = (props: FavoriteParams) => {
22
+ const {
23
+ favoriteList,
24
+ handleUpdateFavoriteList,
25
+ pagination,
26
+ getFavoriteList,
27
+ navigation,
28
+ onNavigationRedirect,
29
+ reorderState,
30
+ handleReorder,
31
+ isBusiness,
32
+ isOrder,
33
+ isProduct
34
+ } = props
35
+
36
+ const theme = useTheme();
37
+ const [, t] = useLanguage()
38
+ const [orderState] = useOrder();
39
+ const [{ carts }] = useOrder()
40
+
41
+ const pastOrders = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
42
+
43
+ const getOrderStatus = (s: any) => {
44
+ const status = parseInt(s)
45
+ const orderStatus = [
46
+ { key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending') },
47
+ { key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed') },
48
+ { key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected') },
49
+ { key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business') },
50
+ { key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed') },
51
+ { key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business') },
52
+ { key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver') },
53
+ { key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business') },
54
+ { key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver') },
55
+ { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver') },
56
+ { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver') },
57
+ { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver') },
58
+ { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver') },
59
+ { key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder') },
60
+ { key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready') },
61
+ { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer') },
62
+ { key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer') },
63
+ { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer') },
64
+ { key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business') },
65
+ { key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer') },
66
+ { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business') },
67
+ { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business') },
68
+ { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver') },
69
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way') }
70
+ ]
71
+
72
+ const objectStatus = orderStatus.find((o) => o.key === status)
73
+
74
+ return objectStatus && objectStatus
75
+ }
76
+
77
+ const onProductClick = (product: any) => {
78
+ const categoryId = product?.category?.id
79
+ const businessId = product?.category?.business?.id
80
+ if (!categoryId || !businessId) return
81
+ onNavigationRedirect && onNavigationRedirect('ProductDetails', {
82
+ productId: product?.id,
83
+ categoryId: categoryId,
84
+ businessId: businessId
85
+ })
86
+ }
87
+
88
+ useEffect(() => {
89
+ const _businessId = 'businessId:' + reorderState?.result?.business_id
90
+ if (reorderState?.error) {
91
+ if (reorderState?.result?.business_id) {
92
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
93
+ onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
94
+ }
95
+ }
96
+ if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
97
+ const cartProducts = carts?.[_businessId]?.products
98
+ const available = cartProducts.every((product: any) => product.valid === true)
99
+ const orderProducts = favoriteList?.favorites.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
100
+
101
+ if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
102
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
103
+ } else {
104
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
105
+ cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
106
+ onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
107
+ }
108
+ }
109
+ }, [reorderState])
110
+
111
+ const handleBusinessClick = (business: any) => {
112
+ onNavigationRedirect && onNavigationRedirect('Business', {
113
+ store: business.slug,
114
+ header: business.header,
115
+ logo: business.logo,
116
+ });
117
+ }
118
+
119
+ const BusinessSkeleton = () => {
120
+ return (
121
+ <Placeholder
122
+ Animation={Fade}
123
+ style={{ marginBottom: 20 }}>
124
+ <View style={{ width: '100%' }}>
125
+ <PlaceholderLine
126
+ height={200}
127
+ style={{ marginBottom: 20, borderRadius: 25 }}
128
+ />
129
+ <View style={{ paddingHorizontal: 10 }}>
130
+ <View
131
+ style={{
132
+ flexDirection: 'row',
133
+ justifyContent: 'space-between',
134
+ }}>
135
+ <PlaceholderLine
136
+ height={25}
137
+ width={40}
138
+ style={{ marginBottom: 10 }}
139
+ />
140
+ <PlaceholderLine
141
+ height={25}
142
+ width={20}
143
+ style={{ marginBottom: 10 }}
144
+ />
145
+ </View>
146
+ <PlaceholderLine
147
+ height={20}
148
+ width={30}
149
+ style={{ marginBottom: 10 }}
150
+ />
151
+ <PlaceholderLine
152
+ height={20}
153
+ width={80}
154
+ style={{ marginBottom: 10 }}
155
+ />
156
+ </View>
157
+ </View>
158
+ </Placeholder>
159
+ )
160
+ }
161
+
162
+ const ProductSkeleton = () => {
163
+ return (
164
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
165
+ <View style={{ flexDirection: 'row' }}>
166
+ <PlaceholderLine
167
+ width={24}
168
+ height={70}
169
+ style={{ marginRight: 10, marginBottom: 10 }}
170
+ />
171
+ <Placeholder style={{ paddingVertical: 10 }}>
172
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
173
+ <PlaceholderLine width={20} />
174
+ </Placeholder>
175
+ </View>
176
+ </Placeholder>
177
+ )
178
+ }
179
+
180
+ const OrderSkeleton = () => {
181
+ return (
182
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
183
+ <View style={{ flexDirection: 'row' }}>
184
+ <PlaceholderLine
185
+ width={24}
186
+ height={70}
187
+ style={{ marginRight: 10, marginBottom: 10 }}
188
+ />
189
+ <Placeholder style={{ paddingVertical: 10 }}>
190
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
191
+ <PlaceholderLine width={20} />
192
+ </Placeholder>
193
+ </View>
194
+ </Placeholder>
195
+ )
196
+ }
197
+
198
+ return (
199
+ <Container>
200
+ {isBusiness && (
201
+ <>
202
+ {favoriteList?.favorites?.length > 0 && (
203
+ favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((business: any, i:number) => (
204
+ <BusinessController
205
+ key={`${business.id}_` + i}
206
+ business={business}
207
+ isBusinessOpen={business.open}
208
+ handleCustomClick={handleBusinessClick}
209
+ orderType={orderState?.options?.type}
210
+ navigation={navigation}
211
+ businessHeader={business?.header}
212
+ businessFeatured={business?.featured}
213
+ businessLogo={business?.logo}
214
+ businessReviews={business?.reviews}
215
+ businessDeliveryPrice={business?.delivery_price}
216
+ businessDeliveryTime={business?.delivery_time}
217
+ businessPickupTime={business?.pickup_time}
218
+ businessDistance={business?.distance}
219
+ handleUpdateBusinessList={handleUpdateFavoriteList}
220
+ />
221
+ ))
222
+ )}
223
+ {favoriteList?.loading && (
224
+ [...Array(5).keys()].map(i => (
225
+ <BusinessSkeleton key={i} />
226
+ ))
227
+ )}
228
+ {!favoriteList?.loading && !favoriteList?.favorites?.length && (
229
+ <NotFoundSource
230
+ content={t('NOT_FOUND_FAVORITES_LIST', 'No favorites to show at this time.')
231
+ }
232
+ />
233
+ )}
234
+ </>
235
+ )}
236
+
237
+ {isOrder && (
238
+ <>
239
+ {favoriteList?.favorites?.length > 0 && (
240
+ favoriteList.favorites?.sort((a: any, b:any) => moment(a?.delivery_datetime_utc).valueOf() - moment(b?.delivery_datetime_utc).valueOf())
241
+ .map((order: any, i: number) => (
242
+ <SingleOrderCard
243
+ key={`${order?.id}_${i}`}
244
+ order={order}
245
+ getOrderStatus={getOrderStatus}
246
+ onNavigationRedirect={onNavigationRedirect}
247
+ pastOrders={pastOrders.includes(order?.status)}
248
+ handleUpdateOrderList={handleUpdateFavoriteList}
249
+ handleUpdateFavoriteList={handleUpdateFavoriteList}
250
+ handleReorder={handleReorder}
251
+ reorderLoading={reorderState?.loading}
252
+ />
253
+ ))
254
+ )}
255
+ {favoriteList?.loading && (
256
+ [...Array(5).keys()].map(i => (
257
+ <OrderSkeleton key={i} />
258
+ ))
259
+ )}
260
+ {!favoriteList?.loading && !favoriteList?.favorites?.length && (
261
+ <NotFoundSource
262
+ content={t('NOT_FOUND_FAVORITES_LIST', 'No favorites to show at this time.')
263
+ }
264
+ />
265
+ )}
266
+ </>
267
+ )}
268
+
269
+ {isProduct && (
270
+ <>
271
+ {favoriteList?.favorites?.length > 0 && (
272
+ favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((product: any, i: number) => (
273
+ <SingleProductCard
274
+ key={`${product?.id}_${i}`}
275
+ isSoldOut={product?.inventoried && !product?.quantity}
276
+ product={product}
277
+ onProductClick={onProductClick}
278
+ handleUpdateProducts={handleUpdateFavoriteList}
279
+ />
280
+ ))
281
+ )}
282
+ {favoriteList?.loading && (
283
+ [...Array(5).keys()].map(i => (
284
+ <ProductSkeleton key={i} />
285
+ ))
286
+ )}
287
+ {!favoriteList?.loading && !favoriteList?.favorites?.length && (
288
+ <NotFoundSource
289
+ content={t('NOT_FOUND_FAVORITES_LIST', 'No favorites to show at this time.')
290
+ }
291
+ />
292
+ )}
293
+ </>
294
+ )}
295
+
296
+ {!favoriteList?.loading && pagination.totalPages && pagination.currentPage < pagination.totalPages && (
297
+ <WrappButton>
298
+ <OButton
299
+ onClick={() => getFavoriteList(pagination?.currentPage + 1)}
300
+ text={t('LOAD_MORE_ITEMS', 'Load more items')}
301
+ imgRightSrc={null}
302
+ textStyle={{ color: theme.colors.white }}
303
+ style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
304
+ />
305
+ </WrappButton>
306
+ )}
307
+ </Container>
308
+ )
309
+ }
310
+
311
+ export const FavoriteList = (props: any) => {
312
+ const favoriteBusinessesProps = {
313
+ ...props,
314
+ UIComponent: FavoriteListUI
315
+ }
316
+ return <FavoriteListController {...favoriteBusinessesProps} />
317
+ }
@@ -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,16 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import Geolocation from '@react-native-community/geolocation'
3
2
  import Geocoder from 'react-native-geocoding'
4
- import { GpsButtonStyle } from './styles'
5
- import { View } from 'react-native'
6
- import { OText } from '../shared'
7
3
  import { ActivityIndicator } from 'react-native-paper'
4
+ import Geolocation from '@react-native-community/geolocation'
5
+ import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
6
+
7
+ import { OText } from '../shared'
8
+ import { GpsButtonStyle } from './styles'
8
9
 
9
10
  export const GPSButton = (props: any) => {
10
11
  const {
11
12
  handleGPS,
12
13
  apiKey,
13
- googleReady,
14
14
  IconButton,
15
15
  IconLoadingButton
16
16
  } = props
@@ -55,19 +55,27 @@ export const GPSButton = (props: any) => {
55
55
  })
56
56
  }
57
57
 
58
- const getCurrentPosition = () => {
59
- setLoading(true);
60
- Geolocation.getCurrentPosition((pos) => {
61
- geoCodePosition(pos.coords);
62
- }, (err) => {
63
- setLoading(false);
64
- console.log(err);
65
- });
66
- }
58
+ const getCurrentPosition = async () => {
59
+ let trackingStatus = await getTrackingStatus()
60
+ if (trackingStatus === 'not-determined') {
61
+ trackingStatus = await requestTrackingPermission()
62
+ }
63
+ if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
64
+ setLoading(true)
65
+ Geolocation.getCurrentPosition((pos) => {
66
+ geoCodePosition(pos.coords)
67
+ }, (err) => {
68
+ setLoading(false);
69
+ console.log(`ERROR(${err.code}): ${err.message}`)
70
+ }, {
71
+ enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
72
+ })
73
+ }
74
+ }
67
75
 
68
- useEffect(() => {
69
- Geocoder.init(apiKey);
70
- }, [])
76
+ useEffect(() => {
77
+ Geocoder.init(apiKey);
78
+ }, [])
71
79
 
72
80
  return (
73
81
  <GpsButtonStyle
@@ -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,
@@ -93,7 +89,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
93
89
  return
94
90
  }
95
91
 
96
- if (distance <= maxLimitLocation) {
92
+ const _maxLimitLocation = typeof maxLimitLocation === 'string' ? parseInt(maxLimitLocation, 10) : maxLimitLocation
93
+
94
+ if (distance <= _maxLimitLocation) {
97
95
  setMarkerPosition(curPos)
98
96
  setRegion({ ...region, longitude: curPos.longitude, latitude: curPos.latitude })
99
97
  } else {
@@ -147,7 +145,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
147
145
  }
148
146
 
149
147
  const fitAllMarkers = () => {
150
- mapRef.current.fitToCoordinates(MARKERS, {
148
+ mapRef.current.fitToCoordinates(MARKERS?.map(location => ({ latitude: location.lat, longitude: location.lng })), {
151
149
  edgePadding: { top: 80, right: 80, bottom: 80, left: 80 },
152
150
  animated: true,
153
151
  });
@@ -157,6 +155,13 @@ export const GoogleMap = (props: GoogleMapsParams) => {
157
155
  Geocoder.init(googleMapsApiKey)
158
156
  }, [])
159
157
 
158
+ useEffect(() => {
159
+ mapRef.current.animateToRegion({
160
+ ...region,
161
+ latitude: location?.lat,
162
+ longitude: location?.lng,
163
+ })
164
+ }, [location])
160
165
 
161
166
  useEffect(() => {
162
167
  if (saveLocation) {
@@ -170,6 +175,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
170
175
  fitAllMarkers()
171
176
  }
172
177
  }, 1000)
178
+ if (locations) {
179
+ SETMARKERS(locations)
180
+ }
173
181
  return () => clearInterval(interval)
174
182
  }, [locations])
175
183
 
@@ -189,16 +197,16 @@ export const GoogleMap = (props: GoogleMapsParams) => {
189
197
  >
190
198
  {locations ? (
191
199
  <>
192
- {MARKERS && MARKERS.map((location: { latitude: number, longitude: number }, i: number) => (
200
+ {MARKERS && MARKERS.map((location: { lat: number, lng: number }, i: number) => (
193
201
  <React.Fragment key={i}>
194
202
  {
195
203
  <Marker
196
204
  zIndex={i}
197
- coordinate={location}
198
- title={locations[i]?.title}
205
+ coordinate={{ latitude: location.lat ?? 0, longitude: location.lng ?? 0 }}
206
+ title={MARKERS[i]?.title}
199
207
  >
200
208
  <View>
201
- <OIcon url={locations[i].icon} width={50} height={50} />
209
+ <OIcon url={MARKERS[i].icon} width={50} height={50} />
202
210
  </View>
203
211
  </Marker>
204
212
  }
@@ -3,7 +3,8 @@ import { useLanguage } from 'ordering-components/native'
3
3
  import { HelpAccountAndPaymentParams } from '../../types'
4
4
  import { OText, OButton, OIcon } from '../shared'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { StyleSheet } from 'react-native'
6
+ import { StyleSheet, TouchableOpacity } from 'react-native'
7
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
7
8
 
8
9
  import {
9
10
  Content
@@ -38,10 +39,14 @@ export const HelpAccountAndPayment = (props: HelpAccountAndPaymentParams) => {
38
39
  return (
39
40
  <>
40
41
  <OButton
41
- imgLeftSrc={theme.images.general.arrow_left}
42
42
  imgRightSrc={null}
43
43
  style={styles.btnBackArrow}
44
44
  onClick={() => goToBack()}
45
+ icon={AntDesignIcon}
46
+ iconProps={{
47
+ name: 'arrowleft',
48
+ size: 26
49
+ }}
45
50
  />
46
51
  <OText size={22} weight={600}>{t('ACCOUNT_PAYMENT_OPTIONS', 'Account and Payment Options')}</OText>
47
52
  <Content>
@@ -65,4 +70,4 @@ export const HelpAccountAndPayment = (props: HelpAccountAndPaymentParams) => {
65
70
  </Content>
66
71
  </>
67
72
  )
68
- }
73
+ }
@@ -3,10 +3,11 @@ import { useLanguage } from 'ordering-components/native'
3
3
  import { HelpGuideParams } from '../../types'
4
4
  import { OText, OButton, OIcon } from '../shared'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { StyleSheet } from 'react-native'
6
+ import { StyleSheet, TouchableOpacity } from 'react-native'
7
7
  import {
8
8
  Content
9
9
  } from './styles'
10
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
10
11
 
11
12
  export const HelpGuide = (props: HelpGuideParams) => {
12
13
  const {
@@ -37,10 +38,14 @@ export const HelpGuide = (props: HelpGuideParams) => {
37
38
  return (
38
39
  <>
39
40
  <OButton
40
- imgLeftSrc={theme.images.general.arrow_left}
41
41
  imgRightSrc={null}
42
42
  style={styles.btnBackArrow}
43
43
  onClick={() => goToBack()}
44
+ icon={AntDesignIcon}
45
+ iconProps={{
46
+ name: 'arrowleft',
47
+ size: 26
48
+ }}
44
49
  />
45
50
  <OText size={22} weight={600}>{t('GUIDE_TO_ORDERING', 'Guide to Ordering')}</OText>
46
51
  <Content>
@@ -64,4 +69,4 @@ export const HelpGuide = (props: HelpGuideParams) => {
64
69
  </Content>
65
70
  </>
66
71
  )
67
- }
72
+ }
@@ -3,8 +3,9 @@ import { useLanguage } from 'ordering-components/native'
3
3
  import { HelpOrderParams } from '../../types'
4
4
  import { OText, OButton, OIcon } from '../shared'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { StyleSheet } from 'react-native'
6
+ import { StyleSheet, TouchableOpacity } from 'react-native'
7
7
  import { WebView } from 'react-native-webview'
8
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
8
9
 
9
10
  import {
10
11
  Content
@@ -42,10 +43,14 @@ export const HelpOrder = (props: HelpOrderParams) => {
42
43
  return (
43
44
  <>
44
45
  <OButton
45
- imgLeftSrc={theme.images.general.arrow_left}
46
46
  imgRightSrc={null}
47
47
  style={styles.btnBackArrow}
48
48
  onClick={() => goToBack()}
49
+ icon={AntDesignIcon}
50
+ iconProps={{
51
+ name: 'arrowleft',
52
+ size: 26
53
+ }}
49
54
  />
50
55
  <OText size={22} weight={600}>{t('HELP_WITH_ORDER', 'Help with an order')}</OText>
51
56
  <Content>
@@ -76,4 +81,4 @@ export const HelpOrder = (props: HelpOrderParams) => {
76
81
  </Content>
77
82
  </>
78
83
  )
79
- }
84
+ }