ordering-ui-react-native 0.15.86 → 0.15.87-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 (239) 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 +25 -3
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +120 -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/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 +145 -61
  25. package/src/components/SingleProductCard/index.tsx +16 -4
  26. package/src/components/SingleProductReview/index.tsx +1 -1
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/StripeMethodForm/index.tsx +22 -24
  29. package/src/components/UpsellingProducts/index.tsx +1 -1
  30. package/src/components/UserProfileForm/index.tsx +63 -6
  31. package/src/components/UserProfileForm/styles.tsx +8 -0
  32. package/src/components/VerifyPhone/styles.tsx +1 -2
  33. package/src/components/shared/OBottomPopup.tsx +6 -2
  34. package/src/components/shared/OModal.tsx +1 -1
  35. package/src/index.tsx +2 -0
  36. package/src/navigators/CheckoutNavigator.tsx +6 -0
  37. package/src/navigators/HomeNavigator.tsx +6 -0
  38. package/src/pages/BusinessesListing.tsx +7 -6
  39. package/src/pages/MultiCheckout.tsx +31 -0
  40. package/src/pages/MultiOrdersDetails.tsx +27 -0
  41. package/src/pages/OrderDetails.tsx +1 -1
  42. package/src/pages/ReviewDriver.tsx +2 -2
  43. package/src/pages/ReviewOrder.tsx +2 -2
  44. package/src/theme.json +0 -1
  45. package/src/types/index.tsx +18 -11
  46. package/src/utils/index.tsx +28 -29
  47. package/themes/business/index.tsx +4 -0
  48. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +100 -60
  49. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  50. package/themes/business/src/components/Chat/index.tsx +52 -92
  51. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  52. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  53. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  54. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  55. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  56. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  57. package/themes/business/src/components/MapView/index.tsx +1 -1
  58. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  59. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  60. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  61. package/themes/business/src/components/OrderDetails/Delivery.tsx +17 -7
  62. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +26 -18
  63. package/themes/business/src/components/OrdersListManager/index.tsx +11 -4
  64. package/themes/business/src/components/OrdersOption/index.tsx +66 -20
  65. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  66. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  67. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  68. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  69. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  70. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  71. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  72. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  73. package/themes/business/src/components/PreviousMessages/index.tsx +1 -0
  74. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  75. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  76. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  77. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  78. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  79. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  80. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  81. package/themes/business/src/components/shared/OModal.tsx +41 -38
  82. package/themes/business/src/types/index.tsx +15 -7
  83. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  84. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  85. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  86. package/themes/kiosk/src/components/BusinessMenu/index.tsx +25 -26
  87. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  88. package/themes/kiosk/src/components/Cart/index.tsx +10 -11
  89. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  90. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  91. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  92. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  93. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  94. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  95. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  96. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  97. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  98. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  99. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  100. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  101. package/themes/kiosk/src/components/PaymentOptions/index.tsx +55 -53
  102. package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
  103. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  104. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  105. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  106. package/themes/kiosk/src/types/index.d.ts +1 -0
  107. package/themes/original/index.tsx +22 -0
  108. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  109. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  110. package/themes/original/src/components/AddressForm/index.tsx +26 -33
  111. package/themes/original/src/components/AddressList/index.tsx +2 -2
  112. package/themes/original/src/components/AppleLogin/index.tsx +6 -8
  113. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  114. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  115. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  116. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  117. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -8
  118. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  119. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  120. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  121. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  122. package/themes/original/src/components/BusinessListingSearch/index.tsx +217 -127
  123. package/themes/original/src/components/BusinessListingSearch/styles.tsx +29 -11
  124. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  125. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  126. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  127. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  128. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  129. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  130. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  131. package/themes/original/src/components/BusinessProductsListing/index.tsx +296 -178
  132. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  133. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  134. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  135. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  136. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  137. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  138. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  139. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  140. package/themes/original/src/components/BusinessesListing/index.tsx +104 -462
  141. package/themes/original/src/components/Cart/index.tsx +83 -38
  142. package/themes/original/src/components/Cart/styles.tsx +4 -0
  143. package/themes/original/src/components/CartContent/index.tsx +3 -3
  144. package/themes/original/src/components/Checkout/index.tsx +128 -67
  145. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  146. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  147. package/themes/original/src/components/Favorite/index.tsx +92 -0
  148. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  149. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  150. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  151. package/themes/original/src/components/ForgotPasswordForm/index.tsx +13 -4
  152. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  153. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  154. package/themes/original/src/components/Help/index.tsx +21 -4
  155. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  156. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  157. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  158. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  159. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  160. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -3
  161. package/themes/original/src/components/LoginForm/index.tsx +52 -13
  162. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  163. package/themes/original/src/components/Messages/index.tsx +17 -17
  164. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  165. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  166. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  167. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  168. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  169. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  170. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  171. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  172. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  173. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  174. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  175. package/themes/original/src/components/NavBar/index.tsx +11 -5
  176. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  177. package/themes/original/src/components/OrderDetails/index.tsx +153 -77
  178. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  179. package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
  180. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  181. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  182. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  183. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  184. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  185. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  186. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  187. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  188. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  189. package/themes/original/src/components/OrdersOption/index.tsx +138 -46
  190. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  191. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  192. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -22
  193. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  194. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  195. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  196. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  197. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  198. package/themes/original/src/components/ProductForm/index.tsx +737 -682
  199. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  200. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  201. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  202. package/themes/original/src/components/ProductOptionSubOption/index.tsx +13 -9
  203. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  204. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  205. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  206. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  207. package/themes/original/src/components/Promotions/index.tsx +22 -6
  208. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  209. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  210. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  211. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  212. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  213. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  214. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  215. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  216. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  217. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  218. package/themes/original/src/components/SingleProductCard/index.tsx +197 -95
  219. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  220. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  221. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  222. package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
  223. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  224. package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
  225. package/themes/original/src/components/UserProfile/index.tsx +5 -1
  226. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  227. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  228. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  229. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  230. package/themes/original/src/components/Wallets/index.tsx +177 -163
  231. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  232. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  233. package/themes/original/src/components/shared/OButton.tsx +10 -3
  234. package/themes/original/src/components/shared/OInput.tsx +3 -2
  235. package/themes/original/src/components/shared/OModal.tsx +4 -2
  236. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  237. package/themes/original/src/types/index.tsx +199 -48
  238. package/themes/original/src/utils/index.tsx +77 -0
  239. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import {
3
3
  OrderTypeControl,
4
4
  useLanguage,
@@ -6,28 +6,32 @@ import {
6
6
  } from 'ordering-components/native'
7
7
  import { useTheme } from 'styled-components/native';
8
8
  import { Platform, View } from 'react-native'
9
- import { BgImage, ListWrapper, MaskCont, OrderTypeWrapper, Wrapper } from './styles'
9
+ import { BgImage, ListWrapper, MaskCont, OrderTypeWrapper, OTab, OTabs, TabBtn, Wrapper } from './styles'
10
10
  import { OrderTypeSelectParams } from '../../types'
11
11
  import { OIcon, OText } from '../shared'
12
12
  import NavBar from '../NavBar';
13
13
  import { ORDER_TYPES } from '../../config/constants';
14
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
14
15
 
15
16
  const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
16
17
  const {
17
18
  navigation,
18
19
  handleChangeOrderType,
20
+ handleChangeType,
19
21
  typeSelected,
20
22
  defaultValue,
21
23
  configTypes,
22
24
  orderTypes,
23
- setOrderTypeValue
25
+ setOrderTypeValue,
26
+ isChewLayout,
27
+ chewOrderTypes
24
28
  } = props
25
29
 
26
30
  const theme = useTheme();
27
31
  const [orderState] = useOrder();
28
32
  const [, t] = useLanguage();
29
33
  const _orderTypes = orderTypes.filter((type: any) => configTypes?.includes(type.value));
30
-
34
+
31
35
  const items = _orderTypes.map((type) => {
32
36
  return {
33
37
  value: type.value,
@@ -42,43 +46,87 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
42
46
  if (!orderState.loading) {
43
47
  setOrderTypeValue && setOrderTypeValue(orderType)
44
48
  handleChangeOrderType(orderType)
45
- goToBack();
49
+ if (!isChewLayout) {
50
+ goToBack();
51
+ }
46
52
  }
47
53
  }
48
54
 
55
+ useEffect(() => {
56
+ handleChangeType(typeSelected)
57
+ }, [typeSelected])
58
+
49
59
  return (
50
60
  <Wrapper>
51
- <NavBar
52
- onActionLeft={() => goToBack()}
53
- btnStyle={{ paddingLeft: 0 }}
54
- paddingTop={0}
55
- style={{ paddingBottom: 0 }}
56
- title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
57
- titleAlign={'center'}
58
- titleStyle={{ fontSize: 14 }}
59
- />
60
- {
61
- items.length > 0 && (
62
- <ListWrapper>
63
- {
64
- items && items.map((item: any, idx: number) =>
65
- <OrderTypeWrapper activeOpacity={0.8} key={idx} disabled={orderState.loading} onPress={() => handleChangeOrderTypeCallback(item.value)}>
66
- <BgImage source={theme.images.orderTypes[`type${item?.value || 1}`]} resizeMode={'cover'} style={{opacity: item?.value == typeSelected || typeSelected === undefined ? 1 : 0.4}}>
67
- <MaskCont>
68
- <OText size={12} lineHeight={18} color={theme.colors.white} weight={Platform.OS === 'android' ? 'bold' : '600'}>{item?.label}</OText>
69
- <OText size={10} lineHeight={15} color={theme.colors.white}>{item?.description}</OText>
70
- <View style={{flexDirection: 'row', alignItems: 'center'}}>
71
- <OText size={10} lineHeight={15} color={theme.colors.white}>{t('START_MY_ORDER', 'Start my order')}</OText>
72
- <OIcon src={theme.images.general.arrow_left} width={16} color={theme.colors.white} style={{transform: [{ rotate: '180deg' }], marginStart: 4}} />
73
- </View>
74
- </MaskCont>
75
- </BgImage>
76
- </OrderTypeWrapper>
77
- )
78
- }
79
- </ListWrapper>
80
- )
81
- }
61
+ {isChewLayout ? (
62
+ <View>
63
+ <OTabs
64
+ horizontal
65
+ showsHorizontalScrollIndicator={false}
66
+ >
67
+ {chewOrderTypes?.map((type: any) => (
68
+ <TabBtn
69
+ key={type.value}
70
+ onPress={() => handleChangeOrderTypeCallback(type.value)}
71
+ >
72
+ <OTab
73
+ style={{
74
+ borderBottomColor:
75
+ type.value === typeSelected
76
+ ? theme.colors.textNormal
77
+ : theme.colors.border,
78
+ }}>
79
+ <OText
80
+ size={14}
81
+ color={
82
+ type.value === typeSelected
83
+ ? theme.colors.textNormal
84
+ : theme.colors.disabled
85
+ }
86
+ weight={type.value === typeSelected ? 'bold' : 'normal'}>
87
+ {type.name}
88
+ </OText>
89
+ </OTab>
90
+ </TabBtn>
91
+ ))}
92
+ </OTabs>
93
+ </View>
94
+ ) : (
95
+ <>
96
+ <NavBar
97
+ onActionLeft={() => goToBack()}
98
+ btnStyle={{ paddingLeft: 0 }}
99
+ paddingTop={0}
100
+ style={{ paddingBottom: 0 }}
101
+ title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
102
+ titleAlign={'center'}
103
+ titleStyle={{ fontSize: 14 }}
104
+ />
105
+ {
106
+ items.length > 0 && (
107
+ <ListWrapper>
108
+ {
109
+ items && items.map((item: any, idx: number) =>
110
+ <OrderTypeWrapper activeOpacity={0.8} key={idx} disabled={orderState.loading} onPress={() => handleChangeOrderTypeCallback(item.value)}>
111
+ <BgImage source={theme.images.orderTypes[`type${item?.value || 1}`]} resizeMode={'cover'} style={{ opacity: item?.value == typeSelected || typeSelected === undefined ? 1 : 0.4 }}>
112
+ <MaskCont>
113
+ <OText size={12} lineHeight={18} color={theme.colors.white} weight={Platform.OS === 'android' ? 'bold' : '600'}>{item?.label}</OText>
114
+ <OText size={10} lineHeight={15} color={theme.colors.white}>{item?.description}</OText>
115
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
116
+ <OText size={10} lineHeight={15} color={theme.colors.white}>{t('START_MY_ORDER', 'Start my order')}</OText>
117
+ <AntDesignIcon name='arrowleft' size={26} color={theme.colors.white} style={{ transform: [{ rotate: '180deg' }], marginStart: 4 }} />
118
+ </View>
119
+ </MaskCont>
120
+ </BgImage>
121
+ </OrderTypeWrapper>
122
+ )
123
+ }
124
+ </ListWrapper>
125
+ )
126
+ }
127
+ </>
128
+ )}
129
+
82
130
  </Wrapper>
83
131
  )
84
132
  }
@@ -24,4 +24,22 @@ export const MaskCont = styled.View`
24
24
  padding: 16px 39px;
25
25
  background-color: #0000004D;
26
26
  height: 100%;
27
- `;
27
+ `;
28
+
29
+ export const OTabs = styled.View`
30
+ flex-direction: row;
31
+ width: 100%;
32
+ margin-bottom: -1px;
33
+ justify-content: space-between;
34
+ `;
35
+
36
+ export const OTab = styled.View`
37
+ padding-bottom: 10px;
38
+ border-bottom-width: 1px;
39
+ padding-horizontal: 10px;
40
+ `;
41
+
42
+ export const TabBtn = styled.TouchableOpacity`
43
+ min-height: 30px;
44
+ height: 30px;
45
+ `;
@@ -0,0 +1,140 @@
1
+ import React from 'react'
2
+ import { useOrder } from 'ordering-components/native'
3
+ import { BusinessController } from '../../BusinessController'
4
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
+
6
+ import { ListWrapper } from './styles'
7
+ import {
8
+ View,
9
+ StyleSheet,
10
+ ScrollView,
11
+ Dimensions
12
+ } from 'react-native';
13
+ import { PreviousBusinessOrderedParams } from '../../../types';
14
+
15
+ const BusinessControllerList = ({ businesses, onBusinessClick, navigation, orderState, style }: any) => {
16
+ return (
17
+ <>
18
+ {businesses?.result?.map((business: any, i: number) => (
19
+ <BusinessController
20
+ key={`${business.id}_` + i}
21
+ business={business}
22
+ isBusinessOpen={business.open}
23
+ handleCustomClick={() => onBusinessClick(business)}
24
+ orderType={orderState?.options?.type}
25
+ navigation={navigation}
26
+ businessHeader={business?.header}
27
+ businessFeatured={business?.featured}
28
+ businessLogo={business?.logo}
29
+ businessReviews={business?.reviews}
30
+ businessDeliveryPrice={business?.delivery_price}
31
+ businessDeliveryTime={business?.delivery_time}
32
+ businessPickupTime={business?.pickup_time}
33
+ businessDistance={business?.distance}
34
+ style={style}
35
+ />
36
+ ))}
37
+ </>
38
+ )
39
+ }
40
+
41
+ const BusinessSkeletons = () => {
42
+ return (
43
+ <>
44
+ {[...Array(4).keys()].map((item, i) => (
45
+ <Placeholder
46
+ Animation={Fade}
47
+ key={i}
48
+ style={{ marginBottom: 20 }}>
49
+ <View style={{ width: '100%' }}>
50
+ <PlaceholderLine
51
+ height={200}
52
+ style={{ marginBottom: 20, borderRadius: 25 }}
53
+ />
54
+ <View style={{ paddingHorizontal: 10 }}>
55
+ <View
56
+ style={{
57
+ flexDirection: 'row',
58
+ justifyContent: 'space-between',
59
+ }}>
60
+ <PlaceholderLine
61
+ height={25}
62
+ width={40}
63
+ style={{ marginBottom: 10 }}
64
+ />
65
+ <PlaceholderLine
66
+ height={25}
67
+ width={20}
68
+ style={{ marginBottom: 10 }}
69
+ />
70
+ </View>
71
+ <PlaceholderLine
72
+ height={20}
73
+ width={30}
74
+ style={{ marginBottom: 10 }}
75
+ />
76
+ <PlaceholderLine
77
+ height={20}
78
+ width={80}
79
+ style={{ marginBottom: 10 }}
80
+ />
81
+ </View>
82
+ </View>
83
+ </Placeholder>
84
+ ))}
85
+ </>
86
+ )
87
+ }
88
+
89
+ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) => {
90
+ const {
91
+ navigation,
92
+ businesses,
93
+ onNavigationRedirect,
94
+ isBusinessesSearchList,
95
+ } = props
96
+
97
+ const [orderState] = useOrder()
98
+ const windowWidth = Dimensions.get('window').width;
99
+ const onBusinessClick = (business: any) => {
100
+ onNavigationRedirect('Business', { store: business.slug, logo: business.logo, header: business.header })
101
+ }
102
+
103
+ const styles = StyleSheet.create({
104
+ container: {
105
+ marginBottom: 0,
106
+ },
107
+ });
108
+
109
+ return (
110
+ <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
111
+ {isBusinessesSearchList ? (
112
+ <>
113
+ {!businesses?.loading && (
114
+ <BusinessControllerList
115
+ style={{ width: windowWidth - 120, marginRight: 20 }}
116
+ onBusinessClick={onBusinessClick}
117
+ orderState={orderState}
118
+ navigation={navigation}
119
+ businesses={businesses}
120
+ />
121
+ )}
122
+ </>
123
+ ) : (
124
+ <ListWrapper>
125
+ {businesses?.loading ? (
126
+ <BusinessSkeletons />
127
+ ) : (
128
+ <BusinessControllerList
129
+ onBusinessClick={onBusinessClick}
130
+ orderState={orderState}
131
+ navigation={navigation}
132
+ businesses={businesses}
133
+ />
134
+ )}
135
+ </ListWrapper>
136
+ )}
137
+
138
+ </ScrollView>
139
+ )
140
+ }
@@ -0,0 +1,6 @@
1
+ import styled, { css } from 'styled-components/native'
2
+
3
+ export const ListWrapper = styled.View`
4
+ background-color: ${(props: any) => props.theme.colors.backgroundLight};
5
+ padding-horizontal: ${(props : any) => props.isBusinessesSearchList ? '0' : '40px'};
6
+ `;
@@ -0,0 +1,53 @@
1
+ import React from 'react'
2
+ import { ScrollView, StyleSheet, Dimensions } from 'react-native'
3
+ import {
4
+ ListWrapper
5
+ } from './styles'
6
+
7
+ import { SingleProductCard } from '../../SingleProductCard'
8
+ import { PreviousProductsOrderedParams } from '../../../types'
9
+
10
+ export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) => {
11
+ const {
12
+ products,
13
+ onProductClick,
14
+ isBusinessesSearchList
15
+ } = props
16
+
17
+ const windowWidth = Dimensions.get('window').width;
18
+
19
+ const styles = StyleSheet.create({
20
+ container: {
21
+ marginBottom: 0,
22
+ },
23
+ });
24
+
25
+ const ProductList = ({ style }: any) => {
26
+ return (
27
+ <>
28
+ {products?.map((product: any) => (
29
+ <SingleProductCard
30
+ key={product?.id}
31
+ isSoldOut={(product.inventoried && !product.quantity)}
32
+ product={product}
33
+ businessId={product?.business?.id}
34
+ onProductClick={onProductClick}
35
+ style={style}
36
+ productAddedToCartLength={0}
37
+ />
38
+ ))}
39
+ </>
40
+ )
41
+ }
42
+ return (
43
+ <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
44
+ {isBusinessesSearchList ? (
45
+ <ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
46
+ ) : (
47
+ <ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
48
+ <ProductList />
49
+ </ListWrapper>
50
+ )}
51
+ </ScrollView>
52
+ )
53
+ }
@@ -0,0 +1,6 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const ListWrapper = styled.View`
4
+ background-color: ${(props: any) => props.theme.colors.backgroundLight};
5
+ padding-horizontal: ${(props : any) => props.isBusinessesSearchList ? '0' : '40px'};
6
+ `;
@@ -6,10 +6,11 @@ import { OText, OButton } from '../shared'
6
6
  import { NotFoundSource } from '../NotFoundSource'
7
7
  import { ActiveOrders } from '../ActiveOrders'
8
8
  import { PreviousOrders } from '../PreviousOrders'
9
-
9
+ import { PreviousBusinessOrdered } from './PreviousBusinessOrdered'
10
+ import { PreviousProductsOrdered } from './PreviousProductsOrdered'
10
11
  import { OptionTitle, NoOrdersWrapper } from './styles'
11
12
  import { OrdersOptionParams } from '../../types'
12
-
13
+ import { _setStoreData } from '../../providers/StoreUtil';
13
14
  import {
14
15
  Placeholder,
15
16
  PlaceholderLine,
@@ -35,15 +36,28 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
35
36
  setOrdersLength,
36
37
  ordersLength,
37
38
  refreshOrders,
38
- setRefreshOrders
39
+ setRefreshOrders,
40
+ reorderState,
41
+ handleReorder,
42
+ handleUpdateOrderList,
43
+ isBusiness,
44
+ isProducts,
45
+ businessOrderIds,
46
+ products,
47
+ businessesSearchList,
48
+ hideOrders,
49
+ BusinessControllerSkeletons,
50
+ businesses,
51
+ businessPaginationProps
39
52
  } = props
40
53
 
41
54
  const theme = useTheme();
42
55
 
43
56
  const [, t] = useLanguage()
44
- const [, { reorder }] = useOrder()
45
- const { showToast } = useToast()
57
+ const [{ carts }] = useOrder()
58
+ const [, { showToast }] = useToast()
46
59
  const { loading, error, orders: values } = orderList
60
+ const [businessLoading, setBusinessLoading] = useState(true)
47
61
 
48
62
  const imageFails = activeOrders
49
63
  ? theme.images.general.emptyActiveOrders
@@ -51,26 +65,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
51
65
 
52
66
  const orders = customArray || values || []
53
67
 
54
- const [reorderLoading, setReorderLoading] = useState(false)
55
-
56
-
57
- const handleReorder = async (orderId: number) => {
58
- setReorderLoading(true)
59
- try {
60
- const { error, result } = await reorder(orderId)
61
- if (!error) {
62
- onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: result.uuid })
63
- setReorderLoading(false)
64
- return
65
- }
66
- setReorderLoading(false)
67
-
68
- } catch (err: any) {
69
- showToast(ToastType.Error, t('ERROR', err.message))
70
- setReorderLoading(false)
71
- }
72
- }
73
-
74
68
  const getOrderStatus = (s: string) => {
75
69
  const status = parseInt(s)
76
70
  const orderStatus = [
@@ -105,6 +99,48 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
105
99
  return objectStatus && objectStatus
106
100
  }
107
101
 
102
+ const onProductClick = (product: any) => {
103
+ if (product?.product_id && product?.category_id && product?.businessId &&
104
+ product?.business.slug && product?.business.header && product?.business.logo) {
105
+ onNavigationRedirect('ProductDetails', {
106
+ isRedirect: 'business',
107
+ businessId: product?.businessId,
108
+ categoryId: product?.category_id,
109
+ productId: product?.product_id,
110
+ business: {
111
+ store: product?.business.slug,
112
+ header: product?.business.header,
113
+ logo: product?.business.logo,
114
+ }
115
+ })
116
+ } else {
117
+ showToast(ToastType.Error, t('ERROR_FAILED_REDIRECT_IDS', 'Failed to redirect product for ids'))
118
+ }
119
+ }
120
+
121
+ useEffect(() => {
122
+ const _businessId = 'businessId:' + reorderState?.result?.business_id
123
+ if (reorderState?.error) {
124
+ if (reorderState?.result?.business_id) {
125
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
126
+ navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
127
+ }
128
+ }
129
+ if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
130
+ const cartProducts = carts?.[_businessId]?.products
131
+ const available = cartProducts.every((product: any) => product.valid === true)
132
+ const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
133
+
134
+ if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
135
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
136
+ } else {
137
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
138
+ cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
139
+ navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
140
+ }
141
+ }
142
+ }, [reorderState])
143
+
108
144
  useFocusEffect(
109
145
  React.useCallback(() => {
110
146
  loadOrders(false, false, false, true)
@@ -128,10 +164,10 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
128
164
  } else if (!preOrders) {
129
165
  setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
130
166
  }
131
- }, [orders, activeOrders])
167
+ }, [orders, activeOrders, preOrders])
132
168
 
133
169
  useEffect(() => {
134
- if(refreshOrders){
170
+ if (refreshOrders) {
135
171
  loadOrders(false, false, false, true)
136
172
  setRefreshOrders && setRefreshOrders(false)
137
173
  }
@@ -153,18 +189,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
153
189
 
154
190
  </NoOrdersWrapper>
155
191
  )}
156
- {(ordersLength.activeOrdersLength > 0 || ordersLength.previousOrdersLength > 0) && (
192
+ {(ordersLength?.activeOrdersLength > 0 || ordersLength?.previousOrdersLength > 0) && (
157
193
  <>
158
- <OptionTitle>
159
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
160
- {titleContent || (activeOrders
161
- ? t('ACTIVE', 'Active')
162
- : preOrders
163
- ? t('PREORDERS', 'Preorders')
164
- : t('PAST', 'Past'))}
165
- </OText>
166
- </OptionTitle>
167
- {!(ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0) &&
194
+ {((titleContent && ((isBusiness && businessOrderIds?.length > 0) || isProducts)) || !titleContent) && (
195
+ <OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
196
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
197
+ {titleContent || (activeOrders
198
+ ? t('ACTIVE', 'Active')
199
+ : preOrders
200
+ ? t('PREORDERS', 'Preorders')
201
+ : t('PAST', 'Past'))}
202
+ </OText>
203
+ </OptionTitle>
204
+ )}
205
+
206
+ {!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
168
207
  !loading &&
169
208
  orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
170
209
  (
@@ -176,7 +215,48 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
176
215
  )}
177
216
  </>
178
217
  )}
179
- {loading && (
218
+ {isBusiness && !!businessesSearchList && businesses?.loading && (
219
+ <ScrollView horizontal>
220
+ <BusinessControllerSkeletons paginationProps={businessPaginationProps} />
221
+ </ScrollView>
222
+ )}
223
+ {isBusiness && (
224
+ <PreviousBusinessOrdered
225
+ onNavigationRedirect={onNavigationRedirect}
226
+ isBusinessesSearchList={!!businessesSearchList}
227
+ businesses={businesses}
228
+ />
229
+ )}
230
+
231
+ {isProducts && !loading && (
232
+ <PreviousProductsOrdered
233
+ products={products}
234
+ onProductClick={onProductClick}
235
+ isBusinessesSearchList={!!businessesSearchList}
236
+ />
237
+ )}
238
+ {(loading && isProducts) && (
239
+ <>
240
+ {[...Array(!!businessesSearchList ? 1 : 4).keys()].map(
241
+ (item, i) => (
242
+ <Placeholder key={i} style={{ padding: 5, paddingLeft: !!businessesSearchList ? 0 : 40, marginBottom: !!businessesSearchList ? 38 : 0 }} Animation={Fade}>
243
+ <View style={{ flexDirection: 'row' }}>
244
+ <PlaceholderLine
245
+ width={24}
246
+ height={70}
247
+ style={{ marginRight: 10, marginBottom: 10 }}
248
+ />
249
+ <Placeholder style={{ paddingVertical: 10 }}>
250
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
251
+ <PlaceholderLine width={20} />
252
+ </Placeholder>
253
+ </View>
254
+ </Placeholder>
255
+ ),
256
+ )}
257
+ </>
258
+ )}
259
+ {loading && !hideOrders && (
180
260
  <>
181
261
  {!activeOrders ? (
182
262
  <Placeholder style={{ marginTop: 30 }} Animation={Fade}>
@@ -207,35 +287,38 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
207
287
  )}
208
288
  </>
209
289
  )}
210
- {!loading && !error && orders.length > 0 && (
290
+ {!loading && !error && orders.length > 0 && !hideOrders && (
211
291
  preOrders ? (
212
292
  <ActiveOrders
213
293
  orders={orders.filter((order: any) => orderStatus.includes(order.status))}
214
294
  pagination={pagination}
215
295
  loadMoreOrders={loadMoreOrders}
216
- reorderLoading={reorderLoading}
296
+ reorderLoading={reorderState?.loading}
217
297
  customArray={customArray}
218
298
  getOrderStatus={getOrderStatus}
219
299
  onNavigationRedirect={onNavigationRedirect}
300
+ handleUpdateOrderList={handleUpdateOrderList}
220
301
  />
221
302
  ) : activeOrders ? (
222
303
  <ActiveOrders
223
304
  orders={orders.filter((order: any) => orderStatus.includes(order.status))}
224
305
  pagination={pagination}
225
- reorderLoading={reorderLoading}
306
+ reorderLoading={reorderState?.loading}
226
307
  customArray={customArray}
227
308
  getOrderStatus={getOrderStatus}
228
309
  onNavigationRedirect={onNavigationRedirect}
310
+ handleUpdateOrderList={handleUpdateOrderList}
229
311
  />
230
312
  ) : (
231
313
  <PreviousOrders
232
- reorderLoading={reorderLoading}
314
+ reorderLoading={reorderState?.loading}
233
315
  orders={orders.filter((order: any) => orderStatus.includes(order.status)).sort((a: any, b: any) => a?.id < b?.id)}
234
316
  pagination={pagination}
235
317
  loadMoreOrders={loadMoreOrders}
236
318
  getOrderStatus={getOrderStatus}
237
319
  onNavigationRedirect={onNavigationRedirect}
238
320
  handleReorder={handleReorder}
321
+ handleUpdateOrderList={handleUpdateOrderList}
239
322
  />
240
323
  )
241
324
  )}
@@ -244,13 +327,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
244
327
  }
245
328
 
246
329
  export const OrdersOption = (props: OrdersOptionParams) => {
330
+ const getAllOrders = props.activeOrders && props.pastOrders && props.preOrders
331
+
247
332
  const MyOrdersProps = {
248
333
  ...props,
249
334
  UIComponent: OrdersOptionUI,
250
- orderStatus: props.preOrders ? [13] : props.activeOrders
251
- ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
252
- : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
335
+ orderStatus: getAllOrders
336
+ ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
337
+ : props.preOrders ? [13] : props.activeOrders
338
+ ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
339
+ : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
253
340
  useDefualtSessionManager: true,
341
+ paginationSettings: {
342
+ initialPage: 1,
343
+ pageSize: getAllOrders ? 30 : 10,
344
+ controlType: 'infinity'
345
+ }
254
346
  }
255
347
 
256
348
  return <OrderList {...MyOrdersProps} />