ordering-ui-react-native 0.15.75 → 0.15.76-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 (221) 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 +6 -2
  14. package/src/components/LoginForm/index.tsx +120 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/NotificationSetting/index.tsx +85 -0
  17. package/src/components/OrderDetails/index.tsx +7 -21
  18. package/src/components/PaymentOptions/index.tsx +335 -365
  19. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  20. package/src/components/ReviewDriver/index.tsx +1 -1
  21. package/src/components/ReviewOrder/index.tsx +2 -1
  22. package/src/components/ReviewProducts/index.tsx +11 -0
  23. package/src/components/SignupForm/index.tsx +145 -61
  24. package/src/components/SingleProductCard/index.tsx +16 -4
  25. package/src/components/SingleProductReview/index.tsx +1 -1
  26. package/src/components/StripeElementsForm/index.tsx +25 -16
  27. package/src/components/StripeMethodForm/index.tsx +22 -24
  28. package/src/components/UpsellingProducts/index.tsx +1 -1
  29. package/src/components/UserProfileForm/index.tsx +63 -6
  30. package/src/components/UserProfileForm/styles.tsx +8 -0
  31. package/src/components/VerifyPhone/styles.tsx +1 -2
  32. package/src/components/shared/OBottomPopup.tsx +6 -2
  33. package/src/components/shared/OModal.tsx +1 -1
  34. package/src/hooks/useCountdownTimer.tsx +26 -0
  35. package/src/index.tsx +2 -0
  36. package/src/navigators/CheckoutNavigator.tsx +6 -0
  37. package/src/navigators/HomeNavigator.tsx +12 -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/pages/Sessions.tsx +22 -0
  45. package/src/theme.json +0 -1
  46. package/src/types/index.tsx +18 -11
  47. package/src/utils/index.tsx +68 -2
  48. package/themes/business/index.tsx +4 -0
  49. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  50. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  51. package/themes/business/src/components/Chat/index.tsx +51 -91
  52. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  53. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  54. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  55. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  56. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  57. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  58. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  59. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  60. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  61. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +9 -2
  62. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  63. package/themes/business/src/components/OrdersListManager/index.tsx +11 -4
  64. package/themes/business/src/components/OrdersOption/index.tsx +16 -4
  65. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  66. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  67. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  68. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  69. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  70. package/themes/business/src/components/shared/OModal.tsx +41 -38
  71. package/themes/business/src/types/index.tsx +14 -7
  72. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  73. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  74. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  75. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  76. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  77. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  78. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  79. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  80. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  81. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  82. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  83. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  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/NavBar/index.tsx +29 -20
  87. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  88. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  89. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  90. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  91. package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
  92. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  93. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  94. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  95. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  96. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  97. package/themes/kiosk/src/types/index.d.ts +1 -0
  98. package/themes/original/index.tsx +24 -0
  99. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  100. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  101. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  102. package/themes/original/src/components/AddressList/index.tsx +2 -2
  103. package/themes/original/src/components/AppleLogin/index.tsx +6 -8
  104. package/themes/original/src/components/BusinessBasicInformation/index.tsx +287 -150
  105. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  106. package/themes/original/src/components/BusinessController/index.tsx +201 -96
  107. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  108. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  109. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  110. package/themes/original/src/components/BusinessListingSearch/index.tsx +234 -64
  111. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  112. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  113. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  114. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  115. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  116. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  117. package/themes/original/src/components/BusinessProductsList/index.tsx +65 -73
  118. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  119. package/themes/original/src/components/BusinessProductsListing/index.tsx +313 -176
  120. package/themes/original/src/components/BusinessProductsListing/styles.tsx +11 -0
  121. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  122. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  123. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  124. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
  125. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  126. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +661 -0
  127. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  128. package/themes/original/src/components/BusinessesListing/index.tsx +104 -462
  129. package/themes/original/src/components/Cart/index.tsx +83 -39
  130. package/themes/original/src/components/Cart/styles.tsx +4 -0
  131. package/themes/original/src/components/Checkout/index.tsx +90 -40
  132. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  133. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  134. package/themes/original/src/components/Favorite/index.tsx +92 -0
  135. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  136. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  137. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  138. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  139. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  140. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  141. package/themes/original/src/components/Help/index.tsx +21 -4
  142. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  143. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  144. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  145. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  146. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  147. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  148. package/themes/original/src/components/Messages/index.tsx +1 -1
  149. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  150. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  151. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  152. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  153. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  154. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  155. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  156. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  157. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  158. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  159. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  160. package/themes/original/src/components/NavBar/index.tsx +4 -4
  161. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  162. package/themes/original/src/components/OrderDetails/index.tsx +148 -63
  163. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  164. package/themes/original/src/components/OrderItAgain/index.tsx +72 -0
  165. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  166. package/themes/original/src/components/OrderSummary/index.tsx +5 -5
  167. package/themes/original/src/components/OrderTypeSelector/index.tsx +77 -35
  168. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  169. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  170. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  171. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  172. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  173. package/themes/original/src/components/OrdersOption/index.tsx +139 -46
  174. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  175. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  176. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -22
  177. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  178. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  179. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  180. package/themes/original/src/components/ProductForm/index.tsx +712 -673
  181. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  182. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  183. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  184. package/themes/original/src/components/ProductOptionSubOption/index.tsx +13 -9
  185. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  186. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  187. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  188. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  189. package/themes/original/src/components/Promotions/index.tsx +151 -133
  190. package/themes/original/src/components/Promotions/styles.tsx +2 -1
  191. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  192. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  193. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  194. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  195. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  196. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  197. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  198. package/themes/original/src/components/Sessions/index.tsx +160 -0
  199. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  200. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  201. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  202. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  203. package/themes/original/src/components/SingleProductCard/index.tsx +220 -94
  204. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  205. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  206. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  207. package/themes/original/src/components/UpsellingProducts/index.tsx +2 -6
  208. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  209. package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
  210. package/themes/original/src/components/UserProfile/index.tsx +10 -1
  211. package/themes/original/src/components/UserProfileForm/index.tsx +14 -9
  212. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  213. package/themes/original/src/components/Wallets/index.tsx +2 -2
  214. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  215. package/themes/original/src/components/shared/OButton.tsx +2 -0
  216. package/themes/original/src/components/shared/OInput.tsx +3 -2
  217. package/themes/original/src/components/shared/OModal.tsx +4 -2
  218. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  219. package/themes/original/src/types/index.tsx +199 -36
  220. package/themes/original/src/utils/index.tsx +94 -1
  221. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,153 @@
1
+ import React, { useEffect } from 'react'
2
+ import { BusinessList as BusinessListController, 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
+ export const PreviousBusinessOrderedUI = (props: PreviousBusinessOrderedParams) => {
16
+ const {
17
+ navigation,
18
+ businessesList,
19
+ setBusinessLoading,
20
+ businessId,
21
+ onNavigationRedirect,
22
+ isBusinessesSearchList,
23
+ businessLoading
24
+ } = props
25
+
26
+ const [orderState] = useOrder()
27
+ const windowWidth = Dimensions.get('window').width;
28
+
29
+ const onBusinessClick = (business: any) => {
30
+ onNavigationRedirect('Business', { store: business.slug })
31
+ }
32
+ useEffect(() => {
33
+ if (businessesList?.loading && businessesList?.businesses?.length === 0) {
34
+ setBusinessLoading(true)
35
+ } else {
36
+ setBusinessLoading(false)
37
+ }
38
+ }, [businessesList?.loading])
39
+
40
+ const styles = StyleSheet.create({
41
+ container: {
42
+ marginBottom: 0,
43
+ },
44
+ });
45
+
46
+ const BusinessControllerList = ({ style }: any) => {
47
+ return (
48
+ <>
49
+ {businessesList.businesses?.filter((business: any) => businessId?.includes(business?.id))?.map((business: any, i: number) => (
50
+ <BusinessController
51
+ key={`${business.id}_` + i}
52
+ business={business}
53
+ isBusinessOpen={business.open}
54
+ handleCustomClick={() => onBusinessClick(business)}
55
+ orderType={orderState?.options?.type}
56
+ navigation={navigation}
57
+ businessHeader={business?.header}
58
+ businessFeatured={business?.featured}
59
+ businessLogo={business?.logo}
60
+ businessReviews={business?.reviews}
61
+ businessDeliveryPrice={business?.delivery_price}
62
+ businessDeliveryTime={business?.delivery_time}
63
+ businessPickupTime={business?.pickup_time}
64
+ businessDistance={business?.distance}
65
+ style={style}
66
+ />
67
+ ))}
68
+ </>
69
+ )
70
+ }
71
+
72
+ const BusinessSkeletons = () => {
73
+ return (
74
+ <>
75
+ {[...Array(4).keys()].map((item, i) => (
76
+ <Placeholder
77
+ Animation={Fade}
78
+ key={i}
79
+ style={{ marginBottom: 20 }}>
80
+ <View style={{ width: '100%' }}>
81
+ <PlaceholderLine
82
+ height={200}
83
+ style={{ marginBottom: 20, borderRadius: 25 }}
84
+ />
85
+ <View style={{ paddingHorizontal: 10 }}>
86
+ <View
87
+ style={{
88
+ flexDirection: 'row',
89
+ justifyContent: 'space-between',
90
+ }}>
91
+ <PlaceholderLine
92
+ height={25}
93
+ width={40}
94
+ style={{ marginBottom: 10 }}
95
+ />
96
+ <PlaceholderLine
97
+ height={25}
98
+ width={20}
99
+ style={{ marginBottom: 10 }}
100
+ />
101
+ </View>
102
+ <PlaceholderLine
103
+ height={20}
104
+ width={30}
105
+ style={{ marginBottom: 10 }}
106
+ />
107
+ <PlaceholderLine
108
+ height={20}
109
+ width={80}
110
+ style={{ marginBottom: 10 }}
111
+ />
112
+ </View>
113
+ </View>
114
+ </Placeholder>
115
+ ))}
116
+ </>
117
+ )
118
+ }
119
+
120
+ return (
121
+ <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
122
+ {isBusinessesSearchList ? (
123
+ <>
124
+ {!businessLoading && (
125
+ <BusinessControllerList
126
+ style={{ width: windowWidth - 120, marginRight: 20 }}
127
+ />
128
+ )}
129
+ </>
130
+ ) : (
131
+ <ListWrapper>
132
+ <BusinessControllerList />
133
+ {businessesList.loading && (
134
+ <BusinessSkeletons />
135
+ )}
136
+ </ListWrapper>
137
+ )}
138
+
139
+ </ScrollView>
140
+ )
141
+ }
142
+
143
+ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) => {
144
+ const previousBusinessOrderedController = {
145
+ ...props,
146
+ UIComponent: PreviousBusinessOrderedUI,
147
+ paginationSettings: { initialPage: 1, pageSize: 50, controlType: 'infinity' }
148
+ }
149
+
150
+ return (
151
+ <BusinessListController {...previousBusinessOrderedController} />
152
+ )
153
+ }
@@ -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,26 @@ 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,
39
50
  } = props
40
51
 
41
52
  const theme = useTheme();
42
53
 
43
54
  const [, t] = useLanguage()
44
- const [, { reorder }] = useOrder()
45
- const { showToast } = useToast()
55
+ const [{ carts }] = useOrder()
56
+ const [, { showToast }] = useToast()
46
57
  const { loading, error, orders: values } = orderList
58
+ const [businessLoading, setBusinessLoading] = useState(true)
47
59
 
48
60
  const imageFails = activeOrders
49
61
  ? theme.images.general.emptyActiveOrders
@@ -51,26 +63,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
51
63
 
52
64
  const orders = customArray || values || []
53
65
 
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
66
  const getOrderStatus = (s: string) => {
75
67
  const status = parseInt(s)
76
68
  const orderStatus = [
@@ -105,6 +97,48 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
105
97
  return objectStatus && objectStatus
106
98
  }
107
99
 
100
+ const onProductClick = (product: any) => {
101
+ if (product?.product_id && product?.category_id && product?.businessId &&
102
+ product?.business.slug && product?.business.header && product?.business.logo) {
103
+ onNavigationRedirect('ProductDetails', {
104
+ isRedirect: 'business',
105
+ businessId: product?.businessId,
106
+ categoryId: product?.category_id,
107
+ productId: product?.product_id,
108
+ business: {
109
+ store: product?.business.slug,
110
+ header: product?.business.header,
111
+ logo: product?.business.logo,
112
+ }
113
+ })
114
+ } else {
115
+ showToast(ToastType.Error, t('ERROR_FAILED_REDIRECT_IDS', 'Failed to redirect product for ids'))
116
+ }
117
+ }
118
+
119
+ useEffect(() => {
120
+ const _businessId = 'businessId:' + reorderState?.result?.business_id
121
+ if (reorderState?.error) {
122
+ if (reorderState?.result?.business_id) {
123
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
124
+ navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
125
+ }
126
+ }
127
+ if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
128
+ const cartProducts = carts?.[_businessId]?.products
129
+ const available = cartProducts.every((product: any) => product.valid === true)
130
+ const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
131
+
132
+ if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
133
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
134
+ } else {
135
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
136
+ cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
137
+ navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
138
+ }
139
+ }
140
+ }, [reorderState])
141
+
108
142
  useFocusEffect(
109
143
  React.useCallback(() => {
110
144
  loadOrders(false, false, false, true)
@@ -128,10 +162,10 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
128
162
  } else if (!preOrders) {
129
163
  setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
130
164
  }
131
- }, [orders, activeOrders])
165
+ }, [orders, activeOrders, preOrders])
132
166
 
133
167
  useEffect(() => {
134
- if(refreshOrders){
168
+ if (refreshOrders) {
135
169
  loadOrders(false, false, false, true)
136
170
  setRefreshOrders && setRefreshOrders(false)
137
171
  }
@@ -153,18 +187,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
153
187
 
154
188
  </NoOrdersWrapper>
155
189
  )}
156
- {(ordersLength.activeOrdersLength > 0 || ordersLength.previousOrdersLength > 0) && (
190
+ {(ordersLength?.activeOrdersLength > 0 || ordersLength?.previousOrdersLength > 0) && (
157
191
  <>
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) &&
192
+ {((titleContent && ((isBusiness && businessOrderIds?.length > 0) || isProducts)) || !titleContent) && (
193
+ <OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
194
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
195
+ {titleContent || (activeOrders
196
+ ? t('ACTIVE', 'Active')
197
+ : preOrders
198
+ ? t('PREORDERS', 'Preorders')
199
+ : t('PAST', 'Past'))}
200
+ </OText>
201
+ </OptionTitle>
202
+ )}
203
+
204
+ {!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
168
205
  !loading &&
169
206
  orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
170
207
  (
@@ -176,7 +213,51 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
176
213
  )}
177
214
  </>
178
215
  )}
179
- {loading && (
216
+ {isBusiness && !!businessesSearchList && businessLoading && businessOrderIds?.length > 0 && (
217
+ <ScrollView horizontal>
218
+ <BusinessControllerSkeletons />
219
+ </ScrollView>
220
+ )}
221
+ {isBusiness && businessOrderIds?.length > 0 && (
222
+ <PreviousBusinessOrdered
223
+ businessId={businessOrderIds}
224
+ businessLoading={businessLoading}
225
+ setBusinessLoading={setBusinessLoading}
226
+ onNavigationRedirect={onNavigationRedirect}
227
+ isLoadingOrders={loading}
228
+ isBusinessesSearchList={!!businessesSearchList}
229
+ />
230
+ )}
231
+
232
+ {isProducts && (
233
+ <PreviousProductsOrdered
234
+ products={products}
235
+ onProductClick={onProductClick}
236
+ isBusinessesSearchList={!!businessesSearchList}
237
+ />
238
+ )}
239
+ {(loading && isProducts) && (
240
+ <>
241
+ {[...Array(4).keys()].map(
242
+ (item, i) => (
243
+ <Placeholder key={i} style={{ padding: 5, paddingLeft: 40 }} Animation={Fade}>
244
+ <View style={{ flexDirection: 'row' }}>
245
+ <PlaceholderLine
246
+ width={24}
247
+ height={70}
248
+ style={{ marginRight: 10, marginBottom: 10 }}
249
+ />
250
+ <Placeholder style={{ paddingVertical: 10 }}>
251
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
252
+ <PlaceholderLine width={20} />
253
+ </Placeholder>
254
+ </View>
255
+ </Placeholder>
256
+ ),
257
+ )}
258
+ </>
259
+ )}
260
+ {loading && !hideOrders && (
180
261
  <>
181
262
  {!activeOrders ? (
182
263
  <Placeholder style={{ marginTop: 30 }} Animation={Fade}>
@@ -207,35 +288,38 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
207
288
  )}
208
289
  </>
209
290
  )}
210
- {!loading && !error && orders.length > 0 && (
291
+ {!loading && !error && orders.length > 0 && !hideOrders && (
211
292
  preOrders ? (
212
293
  <ActiveOrders
213
294
  orders={orders.filter((order: any) => orderStatus.includes(order.status))}
214
295
  pagination={pagination}
215
296
  loadMoreOrders={loadMoreOrders}
216
- reorderLoading={reorderLoading}
297
+ reorderLoading={reorderState?.loading}
217
298
  customArray={customArray}
218
299
  getOrderStatus={getOrderStatus}
219
300
  onNavigationRedirect={onNavigationRedirect}
301
+ handleUpdateOrderList={handleUpdateOrderList}
220
302
  />
221
303
  ) : activeOrders ? (
222
304
  <ActiveOrders
223
305
  orders={orders.filter((order: any) => orderStatus.includes(order.status))}
224
306
  pagination={pagination}
225
- reorderLoading={reorderLoading}
307
+ reorderLoading={reorderState?.loading}
226
308
  customArray={customArray}
227
309
  getOrderStatus={getOrderStatus}
228
310
  onNavigationRedirect={onNavigationRedirect}
311
+ handleUpdateOrderList={handleUpdateOrderList}
229
312
  />
230
313
  ) : (
231
314
  <PreviousOrders
232
- reorderLoading={reorderLoading}
315
+ reorderLoading={reorderState?.loading}
233
316
  orders={orders.filter((order: any) => orderStatus.includes(order.status)).sort((a: any, b: any) => a?.id < b?.id)}
234
317
  pagination={pagination}
235
318
  loadMoreOrders={loadMoreOrders}
236
319
  getOrderStatus={getOrderStatus}
237
320
  onNavigationRedirect={onNavigationRedirect}
238
321
  handleReorder={handleReorder}
322
+ handleUpdateOrderList={handleUpdateOrderList}
239
323
  />
240
324
  )
241
325
  )}
@@ -244,13 +328,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
244
328
  }
245
329
 
246
330
  export const OrdersOption = (props: OrdersOptionParams) => {
331
+ const getAllOrders = props.activeOrders && props.pastOrders && props.preOrders
332
+
247
333
  const MyOrdersProps = {
248
334
  ...props,
249
335
  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],
336
+ orderStatus: getAllOrders
337
+ ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
338
+ : props.preOrders ? [13] : props.activeOrders
339
+ ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
340
+ : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
253
341
  useDefualtSessionManager: true,
342
+ paginationSettings: {
343
+ initialPage: 1,
344
+ pageSize: getAllOrders ? 30 : 10,
345
+ controlType: 'infinity'
346
+ }
254
347
  }
255
348
 
256
349
  return <OrderList {...MyOrdersProps} />
@@ -1,7 +1,10 @@
1
- import styled from 'styled-components/native'
1
+ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const OptionTitle = styled.View`
4
4
  margin-top: 24px;
5
+ ${(props : any) => props.titleContent && css`
6
+ margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
7
+ `}
5
8
  `
6
9
 
7
10
  export const NoOrdersWrapper = styled.View`
@@ -23,8 +23,8 @@ export const PaymentOptionCash = (props: any) => {
23
23
  borderRadius: 7.6,
24
24
  marginTop: 10,
25
25
  width: '100%',
26
- height: 44,
27
- maxHeight: 44
26
+ height: 50,
27
+ maxHeight: 50
28
28
  },
29
29
  errorMsg: {
30
30
  marginTop: 10,
@@ -1,8 +1,8 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { Platform, StyleSheet, View } from 'react-native'
2
+ import { View } from 'react-native'
3
3
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
4
4
  import { useTheme } from 'styled-components/native'
5
- import CheckBox from '@react-native-community/checkbox';
5
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
6
6
  import {
7
7
  PaymentOptionWallet as PaymentOptionWalletController,
8
8
  useLanguage,
@@ -41,13 +41,6 @@ const PaymentOptionWalletUI = (props: any) => {
41
41
  const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
42
42
  const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
43
43
 
44
- const styles = StyleSheet.create({
45
- checkBoxStyle: {
46
- width: 25,
47
- height: 25,
48
- }
49
- });
50
-
51
44
  const [checkedState, setCheckedState] = useState(
52
45
  new Array(walletsState.result?.length).fill(false)
53
46
  );
@@ -104,19 +97,19 @@ const PaymentOptionWalletUI = (props: any) => {
104
97
  disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
105
98
  >
106
99
  <SectionLeft>
107
- <CheckBox
108
- value={checkedState[idx]}
109
- disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
110
- boxType={'square'}
111
- tintColors={{
112
- true: theme.colors.primary,
113
- false: theme.colors.disabled
114
- }}
115
- tintColor={theme.colors.disabled}
116
- onCheckColor={theme.colors.primary}
117
- onTintColor={theme.colors.primary}
118
- style={Platform.OS === 'ios' && styles.checkBoxStyle}
119
- />
100
+ {checkedState[idx] ? (
101
+ <MaterialCommunityIcons
102
+ name="checkbox-marked"
103
+ size={25}
104
+ color={theme.colors.primary}
105
+ />
106
+ ) : (
107
+ <MaterialCommunityIcons
108
+ name="checkbox-blank-outline"
109
+ size={25}
110
+ color={theme.colors.disabled}
111
+ />
112
+ )}
120
113
  <View style={{ alignItems: 'baseline', marginLeft: 5 }}>
121
114
  <View>
122
115
  <OText