ordering-ui-react-native 0.16.12 → 0.16.13-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 (213) 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/BusinessProductsList/index.tsx +10 -10
  10. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  11. package/src/components/BusinessesListing/index.tsx +1 -1
  12. package/src/components/Checkout/index.tsx +2 -1
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +118 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/OrdersOption/index.tsx +54 -56
  20. package/src/components/PaymentOptions/index.tsx +335 -365
  21. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  22. package/src/components/ReviewDriver/index.tsx +1 -1
  23. package/src/components/ReviewOrder/index.tsx +2 -1
  24. package/src/components/ReviewProducts/index.tsx +11 -0
  25. package/src/components/SignupForm/index.tsx +143 -61
  26. package/src/components/SingleProductReview/index.tsx +8 -5
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  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 +16 -0
  94. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  95. package/themes/original/src/components/AddressList/index.tsx +1 -1
  96. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  97. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  98. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  99. package/themes/original/src/components/BusinessController/index.tsx +173 -108
  100. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  101. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  102. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  103. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  104. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  105. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  106. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  107. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  108. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  109. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  110. package/themes/original/src/components/BusinessProductsList/index.tsx +60 -77
  111. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  112. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -181
  113. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  114. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  115. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  116. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  117. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  118. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  119. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  120. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  121. package/themes/original/src/components/BusinessesListing/index.tsx +100 -484
  122. package/themes/original/src/components/Cart/index.tsx +81 -36
  123. package/themes/original/src/components/Cart/styles.tsx +4 -0
  124. package/themes/original/src/components/CartContent/index.tsx +22 -16
  125. package/themes/original/src/components/Checkout/index.tsx +106 -66
  126. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  127. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  128. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  129. package/themes/original/src/components/Favorite/index.tsx +1 -0
  130. package/themes/original/src/components/Favorite/styles.tsx +1 -0
  131. package/themes/original/src/components/FavoriteList/index.tsx +143 -94
  132. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  133. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  134. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  135. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  136. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  137. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  138. package/themes/original/src/components/LoginForm/index.tsx +79 -42
  139. package/themes/original/src/components/Messages/index.tsx +17 -17
  140. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  141. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  142. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  143. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  144. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  145. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  146. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  147. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  148. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  149. package/themes/original/src/components/MyOrders/index.tsx +177 -27
  150. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  151. package/themes/original/src/components/NavBar/index.tsx +11 -5
  152. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  153. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  154. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  155. package/themes/original/src/components/OrderDetails/index.tsx +125 -40
  156. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  157. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  158. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  159. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  160. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  161. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  162. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  163. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
  164. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  165. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  166. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  167. package/themes/original/src/components/OrdersOption/index.tsx +126 -37
  168. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  169. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  170. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  171. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  172. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  173. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  174. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  175. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  176. package/themes/original/src/components/ProductItemAccordion/index.tsx +40 -27
  177. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  178. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  179. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  180. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  181. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  182. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  183. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  184. package/themes/original/src/components/ReviewProducts/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 +10 -5
  188. package/themes/original/src/components/ServiceForm/index.tsx +608 -0
  189. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  190. package/themes/original/src/components/SignupForm/index.tsx +301 -158
  191. package/themes/original/src/components/SingleOrderCard/index.tsx +213 -177
  192. package/themes/original/src/components/SingleProductCard/index.tsx +198 -110
  193. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  194. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  195. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  196. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  197. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  198. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  199. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  200. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  201. package/themes/original/src/components/UserProfile/index.tsx +8 -1
  202. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  203. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  204. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  205. package/themes/original/src/components/Wallets/index.tsx +174 -162
  206. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  207. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  208. package/themes/original/src/components/shared/OButton.tsx +10 -3
  209. package/themes/original/src/components/shared/OInput.tsx +3 -2
  210. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  211. package/themes/original/src/types/index.tsx +160 -47
  212. package/themes/original/src/utils/index.tsx +77 -0
  213. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,56 +1,206 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { useLanguage } from 'ordering-components/native';
3
- import { View, StyleSheet, Platform, I18nManager } from 'react-native';
3
+ import { View, StyleSheet, RefreshControl, Platform } from 'react-native';
4
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
4
5
 
5
6
  import { OrdersOption } from '../OrdersOption'
6
- import { OText } from '../shared'
7
+ import { HeaderTitle, OButton, OText } from '../shared'
7
8
  import { ScrollView } from 'react-native-gesture-handler';
8
-
9
- const PIXELS_TO_SCROLL = 1000;
9
+ import { Tab } from './styles'
10
+ import { useTheme } from 'styled-components/native';
11
+ import { Container } from '../../layouts/Container';
10
12
 
11
13
  export const MyOrders = (props: any) => {
12
- const [, t] = useLanguage();
13
- const [loadMore, setLoadMore] = useState(false)
14
-
14
+ const {
15
+ navigation,
16
+ hideOrders,
17
+ businessesSearchList
18
+ } = props
19
+ const [, t] = useLanguage()
20
+ const theme = useTheme()
21
+ const [refreshing] = useState(false);
22
+ const [refreshOrders, setRefreshOrders] = useState(false)
23
+ const [isEmptyBusinesses, setIsEmptyBusinesses] = useState(false)
24
+ const [businessOrderIds, setBusinessOrderIds] = useState([])
15
25
  const [ordersLength, setOrdersLength] = useState({
16
26
  activeOrdersLength: 0,
17
27
  previousOrdersLength: 0,
18
28
  });
29
+ const [selectedOption, setSelectedOption] = useState(!hideOrders ? 'orders' : 'business')
30
+
31
+ const notOrderOptions = ['business', 'products']
32
+ const allEmpty = (ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) || ((isEmptyBusinesses || businessOrderIds?.length === 0) && hideOrders)
33
+ const MyOrdersMenu = [
34
+ { key: 'orders', value: t('ORDERS', 'Orders') },
35
+ { key: 'business', value: t('BUSINESS', 'Business') },
36
+ { key: 'products', value: t('PRODUCTS', 'Products') }
37
+ ]
38
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
39
+
40
+ const goToBack = () => navigation?.canGoBack() && navigation.goBack()
19
41
 
20
- const handleScroll = ({ nativeEvent }: any) => {
21
- const y = nativeEvent.contentOffset.y
22
- const height = nativeEvent.contentSize.height
42
+ const handleOnRefresh = () => {
43
+ setRefreshOrders(true);
44
+ }
23
45
 
24
- if (y + PIXELS_TO_SCROLL > height ) {
25
- setLoadMore(true)
46
+ const styles = StyleSheet.create({
47
+ container: {
48
+ paddingVertical: 5,
49
+ borderColor: theme.colors.clear,
50
+ backgroundColor: '#FFF'
51
+ },
52
+ featuredStyle: {
53
+ display: 'none',
54
+ },
55
+ tabStyle: {
56
+ marginTop: 10,
57
+ height: 4,
58
+ borderTopStartRadius: 4,
59
+ borderTopEndRadius: 4,
60
+ backgroundColor: theme.colors.textPrimary,
61
+ },
62
+ tabDeactived: {
63
+ marginTop: 10,
64
+ height: 4
26
65
  }
27
- }
66
+ });
28
67
 
29
68
  return (
30
- <ScrollView onScroll={(e: any) => handleScroll(e)}>
31
- <OText
32
- size={20}
33
- mBottom={15}
34
- style={{ marginTop: 25, paddingHorizontal: 40 }}>
35
- {t('MY_ORDERS', 'My Orders')}
36
- </OText>
37
- <View style={{ paddingLeft: 40, paddingRight: 40 }}>
69
+ <Container noPadding refreshControl={
70
+ <RefreshControl
71
+ refreshing={refreshing}
72
+ onRefresh={() => handleOnRefresh()}
73
+ />
74
+ }>
75
+ {isChewLayout && (
76
+ <View style={{
77
+ width: '100%',
78
+ display: 'flex',
79
+ flexDirection: 'row',
80
+ alignItems: 'center',
81
+ paddingHorizontal: 40
82
+ }}>
83
+ <OText
84
+ size={24}
85
+ style={{
86
+ marginTop: Platform.OS === 'android' ? 50 : 30,
87
+ paddingHorizontal: 20,
88
+ textTransform: 'capitalize'
89
+ }}
90
+ >
91
+ <OButton
92
+ imgLeftStyle={{ width: 18 }}
93
+ imgRightSrc={null}
94
+ style={{
95
+ borderWidth: 0,
96
+ width: 26,
97
+ height: 26,
98
+ backgroundColor: '#FFF',
99
+ borderColor: '#FFF',
100
+ shadowColor: '#FFF',
101
+ paddingLeft: 0,
102
+ paddingRight: 0,
103
+ }}
104
+ onClick={goToBack}
105
+ icon={AntDesignIcon}
106
+ iconProps={{
107
+ name: 'arrowleft',
108
+ size: 26
109
+ }}
110
+ />
111
+ {t('MY_ORDERS', 'My Orders')}
112
+ </OText>
113
+ </View>
114
+ )}
115
+ {!hideOrders && !isChewLayout && (
116
+ <HeaderTitle text={t('MY_ORDERS', 'My Orders')} />
117
+ )}
118
+ {!allEmpty && (
119
+ <ScrollView
120
+ horizontal
121
+ style={{ ...styles.container, borderBottomWidth: 1 }}
122
+ contentContainerStyle={{ paddingHorizontal: !!businessesSearchList ? 0 : 40 }}
123
+ showsHorizontalScrollIndicator={false}
124
+ scrollEventThrottle={16}
125
+ >
126
+ {MyOrdersMenu.filter(option => !hideOrders || option.key !== 'orders').map(option => (
127
+ <Tab
128
+ key={option.key}
129
+ onPress={() => setSelectedOption(option.key)}
130
+ style={
131
+ {
132
+ borderBottomColor:
133
+ selectedOption === option.key
134
+ ? theme.colors.textNormal
135
+ : theme.colors.border,
136
+ }
137
+ }
138
+ >
139
+ <OText>{option?.value}</OText>
140
+ </Tab>
141
+ ))}
142
+ </ScrollView>
143
+ )}
144
+ {selectedOption === 'orders' && (
145
+ <>
146
+ <View style={{ paddingLeft: 40, paddingRight: 40 }}>
147
+ <OrdersOption
148
+ {...props}
149
+ activeOrders
150
+ ordersLength={ordersLength}
151
+ setOrdersLength={setOrdersLength}
152
+ setRefreshOrders={setRefreshOrders}
153
+ refreshOrders={refreshOrders}
154
+ />
155
+ </View>
156
+ <View style={{ paddingLeft: 40, paddingRight: 40 }}>
157
+ <OrdersOption
158
+ {...props}
159
+ ordersLength={ordersLength}
160
+ setOrdersLength={setOrdersLength}
161
+ setRefreshOrders={setRefreshOrders}
162
+ refreshOrders={refreshOrders}
163
+ />
164
+ </View>
165
+ </>
166
+ )}
167
+ {selectedOption === 'business' && (
38
168
  <OrdersOption
39
169
  {...props}
170
+ isBusiness
171
+ titleContent={t('PREVIOUSLY_ORDERED', 'Previously ordered')}
172
+ hideOrders
173
+ horizontal
40
174
  activeOrders
175
+ pastOrders
176
+ preOrders
177
+ businessesSearchList={businessesSearchList}
178
+ setIsEmptyBusinesses={setIsEmptyBusinesses}
179
+ businessOrderIds={businessOrderIds}
180
+ setBusinessOrderIds={setBusinessOrderIds}
41
181
  ordersLength={ordersLength}
42
182
  setOrdersLength={setOrdersLength}
43
- loadMoreStatus={loadMore}
44
- setLoadMoreStatus={setLoadMore}
45
183
  />
46
- </View>
47
- <View style={{ paddingLeft: 40, paddingRight: 40 }}>
184
+ )}
185
+ {selectedOption === 'products' && (
48
186
  <OrdersOption
49
187
  {...props}
188
+ isProducts
189
+ titleContent={t('PREVIOUSLY_ORDERED', 'Previously ordered')}
190
+ hideOrders
191
+ horizontal
192
+ activeOrders
193
+ pastOrders
194
+ preOrders
195
+ businessesSearchList={businessesSearchList}
196
+ setIsEmptyBusinesses={setIsEmptyBusinesses}
197
+ businessOrderIds={businessOrderIds}
198
+ setBusinessOrderIds={setBusinessOrderIds}
50
199
  ordersLength={ordersLength}
51
200
  setOrdersLength={setOrdersLength}
52
201
  />
53
- </View>
54
- </ScrollView>
202
+ )}
203
+ </Container>
204
+
55
205
  )
56
206
  }
@@ -3,4 +3,11 @@ import styled, { css } from 'styled-components/native'
3
3
  export const Wrapper = styled.View`
4
4
  flex: 1;
5
5
  background-color: ${(props: any) => props.theme.colors.white};
6
- `
6
+ `
7
+
8
+ export const Tab = styled.TouchableOpacity`
9
+ padding-horizontal: 10px;
10
+ padding-vertical: 10px;
11
+ justify-content: center;
12
+ border-bottom-width: 1px;
13
+ `
@@ -2,6 +2,7 @@ import * as React from 'react'
2
2
  import styled, { useTheme } from 'styled-components/native'
3
3
  import { OButton, OIcon, OText } from '../shared'
4
4
  import { Platform, TextStyle, ViewStyle, I18nManager, TouchableOpacity } from 'react-native'
5
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
5
6
 
6
7
  const TitleWrapper = styled.View`
7
8
  flex-direction: column;
@@ -61,11 +62,16 @@ const NavBar = (props: Props) => {
61
62
  return (
62
63
  <Wrapper style={{ paddingTop: props.paddingTop, ...{ flexDirection: props.isVertical ? 'column' : 'row', alignItems: props.isVertical ? 'flex-start' : 'center' }, ...props.style }}>
63
64
  <OButton
64
- imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
65
- imgLeftStyle={{width: 18}}
65
+ imgLeftSrc={props.leftImg}
66
+ imgLeftStyle={{ width: 18 }}
66
67
  imgRightSrc={null}
67
68
  style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
68
69
  onClick={props?.onActionLeft}
70
+ icon={AntDesignIcon}
71
+ iconProps={{
72
+ name: 'arrowleft',
73
+ size: 26
74
+ }}
69
75
  />
70
76
  <TitleTopWrapper>
71
77
  {props.withIcon
@@ -126,9 +132,9 @@ NavBar.defaultProps = {
126
132
  textAlign: 'center'
127
133
  };
128
134
 
129
- const areEqual=(prevProps: { route?: any; }, nextProps: { route?: any; })=>{
130
- return prevProps.route === nextProps.route
131
- return true
135
+ const areEqual = (prevProps: { route?: any; }, nextProps: { route?: any; }) => {
136
+ return prevProps.route === nextProps.route
137
+ return true
132
138
  }
133
139
 
134
140
  export default React.memo(NavBar, areEqual);
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { useLanguage } from 'ordering-components/native'
2
+ import { useLanguage, useOrderingTheme } from 'ordering-components/native'
3
3
  import { Dimensions } from 'react-native'
4
4
  import RNRestart from 'react-native-restart'
5
5
  import { OText, OIcon, OButton } from '../shared'
@@ -16,7 +16,8 @@ export const NetworkError = (props: NoNetworkParams) => {
16
16
  } = props
17
17
  const theme = useTheme()
18
18
  const [, t] = useLanguage()
19
-
19
+ const [orderingTheme] = useOrderingTheme()
20
+ const urlimage = orderingTheme?.theme?.no_internet?.components?.image
20
21
  const noNetworkImage = image || theme.images.general.noNetwork
21
22
  const deviceWidth = Dimensions.get('screen').width
22
23
 
@@ -38,7 +39,8 @@ export const NetworkError = (props: NoNetworkParams) => {
38
39
  </OText>
39
40
  <ImageContainer>
40
41
  <OIcon
41
- src={noNetworkImage}
42
+ src={!urlimage && noNetworkImage}
43
+ url={urlimage}
42
44
  width={(deviceWidth - 80) * 0.9}
43
45
  height={(deviceWidth - 80) * 0.8}
44
46
  />
@@ -20,12 +20,13 @@ export const NotFoundSource = (props: NotFoundSourceParams) => {
20
20
  const theme = useTheme();
21
21
 
22
22
  const errorImage = image || theme.images.general.notFound
23
+ const isUrl = typeof errorImage === 'string' && errorImage.includes('http')
23
24
 
24
25
  return (
25
26
  <NotFound>
26
27
  {errorImage && (
27
28
  <NotFoundImage>
28
- <OIcon src={errorImage} width={260} height={220} />
29
+ <OIcon url={isUrl && errorImage} src={!isUrl && errorImage} width={260} height={220} />
29
30
  </NotFoundImage>
30
31
  )}
31
32
  {content && conditioned && !errorImage && <OText color={theme.colors.disabled} size={18} style={{ textAlign: 'center' }}>{content}</OText>}
@@ -0,0 +1,167 @@
1
+ import React from 'react'
2
+ import { useTheme } from 'styled-components/native'
3
+ import { ScrollView, StyleSheet, View } from 'react-native'
4
+ import { useLanguage, useUtils } from 'ordering-components/native'
5
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
6
+ import { OText, OButton } from '../shared'
7
+
8
+ export const OrderHistory = (props: any) => {
9
+ const {
10
+ order,
11
+ messages,
12
+ enableReview,
13
+ onClose,
14
+ handleTriggerReview
15
+ } = props
16
+
17
+ const [, t] = useLanguage()
18
+ const [{ parseDate }] = useUtils()
19
+ const theme = useTheme()
20
+
21
+ const styles = StyleSheet.create({
22
+ historyItem: {
23
+ display: 'flex',
24
+ alignItems: 'center',
25
+ flexDirection: 'row',
26
+ borderBottomWidth: 1,
27
+ borderColor: theme.colors.border
28
+ },
29
+ detailWrapper: {
30
+ marginLeft: 20,
31
+ paddingHorizontal: 13,
32
+ paddingVertical: 16
33
+ },
34
+ container: {
35
+ paddingHorizontal: 40,
36
+ paddingVertical: 15
37
+ }
38
+ });
39
+
40
+ const ORDER_STATUS: any = {
41
+ 0: 'ORDER_STATUS_PENDING',
42
+ 1: 'ORDERS_COMPLETED',
43
+ 2: 'ORDER_REJECTED',
44
+ 3: 'ORDER_STATUS_IN_BUSINESS',
45
+ 4: 'ORDER_READY',
46
+ 5: 'ORDER_REJECTED_RESTAURANT',
47
+ 6: 'ORDER_STATUS_CANCELLEDBYDRIVER',
48
+ 7: 'ORDER_STATUS_ACCEPTEDBYRESTAURANT',
49
+ 8: 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER',
50
+ 9: 'ORDER_PICKUP_COMPLETED_BY_DRIVER',
51
+ 10: 'ORDER_PICKUP_FAILED_BY_DRIVER',
52
+ 11: 'ORDER_DELIVERY_COMPLETED_BY_DRIVER',
53
+ 12: 'ORDER_DELIVERY_FAILED_BY_DRIVER',
54
+ 13: 'PREORDER',
55
+ 14: 'ORDER_NOT_READY',
56
+ 15: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
57
+ 16: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER',
58
+ 17: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
59
+ 18: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS',
60
+ 19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
61
+ 20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
62
+ 21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
63
+ 22: 'ORDER_LOOKING_FOR_DRIVER',
64
+ 23: 'ORDER_DRIVER_ON_WAY'
65
+ }
66
+
67
+ const getLogisticTagStatus = (status: any) => {
68
+ switch (status) {
69
+ case 0:
70
+ return t('PENDING', 'Pending')
71
+ case 1:
72
+ return t('IN_PROGRESS', 'In Progress')
73
+ case 2:
74
+ return t('IN_QUEUE', 'In Queue')
75
+ case 3:
76
+ return t('EXPIRED', 'Logistic expired')
77
+ case 4:
78
+ return t('RESOLVED', 'Resolved')
79
+ default:
80
+ return status
81
+ }
82
+ }
83
+
84
+ const handleReview = () => {
85
+ if (enableReview) handleTriggerReview()
86
+ else onClose()
87
+ }
88
+
89
+ return (
90
+ <ScrollView contentContainerStyle={styles.container}>
91
+ <OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
92
+ {t('DETAILS_OF_ORDER', 'Details of Order_NUMBER_').replace('_NUMBER_', ` # ${order?.id}`)}
93
+ </OText>
94
+ {!messages?.loading && order && (
95
+ <View style={styles.historyItem}>
96
+ <MaterialCommunityIcons
97
+ name="checkbox-marked-circle"
98
+ size={20}
99
+ color={theme.colors.primary}
100
+ />
101
+ <View style={styles.detailWrapper}>
102
+ <OText
103
+ size={14}
104
+ weight='bold'
105
+ numberOfLines={1}
106
+ ellipsizeMode='tail'
107
+ >
108
+ {t('ORDER_PLACED', 'Order placed')} {' '}
109
+ {t('VIA', 'Via')}{' '}
110
+ {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
111
+ </OText>
112
+ <OText size={12}>{parseDate(order?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
113
+ </View>
114
+ </View>
115
+ )}
116
+ {messages && messages?.messages.map((message: any, i: number) => message.type === 1 && (
117
+ <View
118
+ style={styles.historyItem}
119
+ key={i}
120
+ >
121
+ <MaterialCommunityIcons
122
+ name="checkbox-marked-circle"
123
+ size={20}
124
+ color={theme.colors.primary}
125
+ />
126
+ <View style={styles.detailWrapper}>
127
+ {message.change?.attribute !== 'driver_id' ? (
128
+ <OText
129
+ size={14}
130
+ weight='bold'
131
+ numberOfLines={1}
132
+ ellipsizeMode='tail'
133
+ >
134
+ {message.change?.attribute === 'logistic_status'
135
+ ? getLogisticTagStatus(parseInt(message.change.new, 10))
136
+ : t(ORDER_STATUS[parseInt(message.change.new, 10)])
137
+ }
138
+ </OText>
139
+ ) : (
140
+ <OText
141
+ size={14}
142
+ weight='bold'
143
+ numberOfLines={1}
144
+ ellipsizeMode='tail'
145
+ >
146
+ {message.change.new
147
+ ? (`${message.driver?.name} ${!!message.driver?.lastname ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')}`)
148
+ : t('DRIVER_UNASSIGNED', 'Driver unassigned')}
149
+ </OText>
150
+ )}
151
+ <OText size={12}>{parseDate(message?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
152
+ </View>
153
+ </View>
154
+ ))}
155
+ <OButton
156
+ text={enableReview ? t('REVIEW_ORDER', 'Review order') : t('CONTINUE', 'Continue')}
157
+ textStyle={{ fontSize: 14, color: theme.colors.white }}
158
+ imgRightSrc={theme.images.general.arrow_right}
159
+ imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
160
+ borderColor='transparent'
161
+ bgColor={theme.colors.primary}
162
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginBottom: 30, marginTop: 20 }}
163
+ onClick={() => handleReview()}
164
+ />
165
+ </ScrollView>
166
+ )
167
+ }