ordering-ui-react-native 0.16.4 → 0.16.5-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 (223) hide show
  1. package/package.json +8 -4
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +10 -8
  8. package/src/components/BusinessInformation/index.tsx +22 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/DriverTips/index.tsx +11 -6
  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/StripeMethodForm/index.tsx +1 -2
  29. package/src/components/VerifyPhone/styles.tsx +1 -2
  30. package/src/components/shared/OBottomPopup.tsx +6 -2
  31. package/src/index.tsx +2 -0
  32. package/src/navigators/CheckoutNavigator.tsx +6 -0
  33. package/src/navigators/HomeNavigator.tsx +6 -0
  34. package/src/pages/BusinessesListing.tsx +7 -6
  35. package/src/pages/MultiCheckout.tsx +31 -0
  36. package/src/pages/MultiOrdersDetails.tsx +27 -0
  37. package/src/pages/OrderDetails.tsx +1 -1
  38. package/src/pages/ReviewDriver.tsx +2 -2
  39. package/src/pages/ReviewOrder.tsx +2 -2
  40. package/src/theme.json +0 -1
  41. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  42. package/src/types/index.tsx +13 -9
  43. package/src/utils/index.tsx +0 -1
  44. package/themes/business/index.tsx +4 -0
  45. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  46. package/themes/business/src/components/Chat/index.tsx +42 -34
  47. package/themes/business/src/components/DriverMap/index.tsx +13 -10
  48. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  49. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  50. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  51. package/themes/business/src/components/MapView/index.tsx +1 -1
  52. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  53. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  54. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  55. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -18
  56. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  57. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  58. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  59. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  61. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  62. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  63. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  64. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  65. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  66. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  67. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  68. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  69. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  70. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  71. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  72. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  73. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  74. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  75. package/themes/business/src/components/shared/OModal.tsx +40 -37
  76. package/themes/business/src/types/index.tsx +14 -9
  77. package/themes/business/src/utils/index.tsx +10 -0
  78. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  79. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  80. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  81. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  82. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  83. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  84. package/themes/kiosk/src/components/Checkout/index.tsx +18 -3
  85. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  86. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  87. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  88. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  89. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  90. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  91. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  92. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  93. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  94. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  95. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  96. package/themes/kiosk/src/types/index.d.ts +2 -0
  97. package/themes/original/index.tsx +22 -0
  98. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  99. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  100. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  101. package/themes/original/src/components/AddressList/index.tsx +1 -1
  102. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  103. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  104. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  105. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  106. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  107. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  108. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  109. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  110. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  111. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  112. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  113. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  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 +66 -73
  118. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  119. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -178
  120. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -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 +561 -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 +673 -0
  127. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  128. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  129. package/themes/original/src/components/Cart/index.tsx +81 -36
  130. package/themes/original/src/components/Cart/styles.tsx +4 -0
  131. package/themes/original/src/components/CartContent/index.tsx +22 -16
  132. package/themes/original/src/components/Checkout/index.tsx +107 -67
  133. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  134. package/themes/original/src/components/DriverTips/index.tsx +11 -6
  135. package/themes/original/src/components/Favorite/index.tsx +92 -0
  136. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  137. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  138. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  139. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  140. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  141. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  142. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  143. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  144. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  145. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  146. package/themes/original/src/components/LoginForm/index.tsx +83 -42
  147. package/themes/original/src/components/Messages/index.tsx +17 -17
  148. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  149. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  150. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  151. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  152. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  153. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  154. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  155. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  156. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  157. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  158. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  159. package/themes/original/src/components/NavBar/index.tsx +11 -5
  160. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  161. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  162. package/themes/original/src/components/OrderDetails/index.tsx +125 -40
  163. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  164. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  165. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  166. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  167. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  168. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  169. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  170. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  171. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  172. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  173. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  174. package/themes/original/src/components/OrdersOption/index.tsx +128 -37
  175. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  176. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -23
  177. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  178. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  179. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  180. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  181. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  182. package/themes/original/src/components/ProductForm/index.tsx +697 -649
  183. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  184. package/themes/original/src/components/ProductItemAccordion/index.tsx +37 -24
  185. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  186. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  187. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  188. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  189. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  190. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  191. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  192. package/themes/original/src/components/ReviewProducts/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 +608 -0
  197. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  198. package/themes/original/src/components/SignupForm/index.tsx +305 -158
  199. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  200. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  201. package/themes/original/src/components/SingleProductCard/index.tsx +215 -95
  202. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  203. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  204. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  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 +14 -4
  208. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  209. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  210. package/themes/original/src/components/UserProfile/index.tsx +4 -0
  211. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  212. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  213. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  214. package/themes/original/src/components/Wallets/index.tsx +176 -162
  215. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  216. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  217. package/themes/original/src/components/shared/OButton.tsx +10 -3
  218. package/themes/original/src/components/shared/OInput.tsx +3 -2
  219. package/themes/original/src/components/shared/OModal.tsx +3 -1
  220. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  221. package/themes/original/src/types/index.tsx +197 -46
  222. package/themes/original/src/utils/index.tsx +77 -0
  223. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -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,56 @@
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
+ handleUpdateProducts,
15
+ isBusinessesSearchList
16
+ } = props
17
+
18
+ const windowWidth = Dimensions.get('window').width;
19
+
20
+ const styles = StyleSheet.create({
21
+ container: {
22
+ marginBottom: 0,
23
+ },
24
+ });
25
+
26
+ const ProductList = ({ style }: any) => {
27
+ return (
28
+ <>
29
+ {products?.map((product: any) => (
30
+ <SingleProductCard
31
+ key={product?.id}
32
+ isProductId
33
+ isSoldOut={(product.inventoried && !product.quantity)}
34
+ product={product}
35
+ businessId={product?.business?.id}
36
+ onProductClick={onProductClick}
37
+ style={style}
38
+ productAddedToCartLength={0}
39
+ handleUpdateProducts={handleUpdateProducts}
40
+ />
41
+ ))}
42
+ </>
43
+ )
44
+ }
45
+ return (
46
+ <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
47
+ {isBusinessesSearchList ? (
48
+ <ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
49
+ ) : (
50
+ <ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
51
+ <ProductList />
52
+ </ListWrapper>
53
+ )}
54
+ </ScrollView>
55
+ )
56
+ }
@@ -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,7 +6,8 @@ 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';
@@ -37,15 +38,27 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
37
38
  refreshOrders,
38
39
  setRefreshOrders,
39
40
  reorderState,
40
- handleReorder
41
+ handleReorder,
42
+ handleUpdateOrderList,
43
+ isBusiness,
44
+ isProducts,
45
+ businessOrderIds,
46
+ products,
47
+ businessesSearchList,
48
+ hideOrders,
49
+ BusinessControllerSkeletons,
50
+ businesses,
51
+ businessPaginationProps,
52
+ handleUpdateProducts
41
53
  } = props
42
54
 
43
55
  const theme = useTheme();
44
56
 
45
57
  const [, t] = useLanguage()
46
58
  const [{ carts }] = useOrder()
47
- const { showToast } = useToast()
59
+ const [, { showToast }] = useToast()
48
60
  const { loading, error, orders: values } = orderList
61
+ const [businessLoading, setBusinessLoading] = useState(true)
49
62
 
50
63
  const imageFails = activeOrders
51
64
  ? theme.images.general.emptyActiveOrders
@@ -87,32 +100,53 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
87
100
  return objectStatus && objectStatus
88
101
  }
89
102
 
103
+ const onProductClick = (product: any) => {
104
+ if (product?.product_id && product?.category_id && product?.businessId &&
105
+ product?.business.slug && product?.business.header && product?.business.logo) {
106
+ onNavigationRedirect('ProductDetails', {
107
+ isRedirect: 'business',
108
+ businessId: product?.businessId,
109
+ categoryId: product?.category_id,
110
+ productId: product?.product_id,
111
+ business: {
112
+ store: product?.business.slug,
113
+ header: product?.business.header,
114
+ logo: product?.business.logo,
115
+ }
116
+ })
117
+ } else {
118
+ showToast(ToastType.Error, t('ERROR_FAILED_REDIRECT_IDS', 'Failed to redirect product for ids'))
119
+ }
120
+ }
121
+
90
122
  useEffect(() => {
91
123
  const _businessId = 'businessId:' + reorderState?.result?.business_id
92
124
  if (reorderState?.error) {
93
- if (reorderState?.result?.business_id) {
94
- _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
95
- navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
96
- }
125
+ if (reorderState?.result?.business_id) {
126
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
127
+ navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
128
+ }
97
129
  }
98
130
  if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
99
- const cartProducts = carts?.[_businessId]?.products
100
- const available = cartProducts.every((product: any) => product.valid === true)
101
- const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
131
+ const cartProducts = carts?.[_businessId]?.products
132
+ const available = cartProducts.every((product: any) => product.valid === true)
133
+ const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
102
134
 
103
- if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
104
- onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
105
- } else {
106
- _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
107
- cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
108
- navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
109
- }
135
+ if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
136
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
137
+ } else {
138
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
139
+ cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
140
+ navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
141
+ }
110
142
  }
111
- }, [reorderState])
143
+ }, [reorderState])
112
144
 
113
145
  useFocusEffect(
114
146
  React.useCallback(() => {
115
- loadOrders(false, false, false, true)
147
+ if (!businessesSearchList) {
148
+ loadOrders(false, false, false, true)
149
+ }
116
150
  }, [navigation])
117
151
  )
118
152
 
@@ -133,10 +167,10 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
133
167
  } else if (!preOrders) {
134
168
  setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
135
169
  }
136
- }, [orders, activeOrders])
170
+ }, [orders, activeOrders, preOrders])
137
171
 
138
172
  useEffect(() => {
139
- if(refreshOrders){
173
+ if (refreshOrders) {
140
174
  loadOrders(false, false, false, true)
141
175
  setRefreshOrders && setRefreshOrders(false)
142
176
  }
@@ -158,18 +192,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
158
192
 
159
193
  </NoOrdersWrapper>
160
194
  )}
161
- {(ordersLength.activeOrdersLength > 0 || ordersLength.previousOrdersLength > 0) && (
195
+ {(ordersLength?.activeOrdersLength > 0 || ordersLength?.previousOrdersLength > 0) && (
162
196
  <>
163
- <OptionTitle>
164
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
165
- {titleContent || (activeOrders
166
- ? t('ACTIVE', 'Active')
167
- : preOrders
168
- ? t('PREORDERS', 'Preorders')
169
- : t('PAST', 'Past'))}
170
- </OText>
171
- </OptionTitle>
172
- {!(ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0) &&
197
+ {((titleContent && ((isBusiness && businessOrderIds?.length > 0) || isProducts)) || !titleContent) && (
198
+ <OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
199
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
200
+ {titleContent || (activeOrders
201
+ ? t('ACTIVE', 'Active')
202
+ : preOrders
203
+ ? t('PREORDERS', 'Preorders')
204
+ : t('PAST', 'Past'))}
205
+ </OText>
206
+ </OptionTitle>
207
+ )}
208
+
209
+ {!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
173
210
  !loading &&
174
211
  orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
175
212
  (
@@ -181,7 +218,49 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
181
218
  )}
182
219
  </>
183
220
  )}
184
- {loading && (
221
+ {isBusiness && !!businessesSearchList && businesses?.loading && (
222
+ <ScrollView horizontal>
223
+ <BusinessControllerSkeletons paginationProps={businessPaginationProps} />
224
+ </ScrollView>
225
+ )}
226
+ {isBusiness && (
227
+ <PreviousBusinessOrdered
228
+ onNavigationRedirect={onNavigationRedirect}
229
+ isBusinessesSearchList={!!businessesSearchList}
230
+ businesses={businesses}
231
+ />
232
+ )}
233
+
234
+ {isProducts && !loading && (
235
+ <PreviousProductsOrdered
236
+ products={products}
237
+ onProductClick={onProductClick}
238
+ handleUpdateProducts={handleUpdateProducts}
239
+ isBusinessesSearchList={!!businessesSearchList}
240
+ />
241
+ )}
242
+ {(loading && isProducts) && (
243
+ <>
244
+ {[...Array(!!businessesSearchList ? 1 : 4).keys()].map(
245
+ (item, i) => (
246
+ <Placeholder key={i} style={{ padding: 5, paddingLeft: !!businessesSearchList ? 0 : 40, marginBottom: !!businessesSearchList ? 38 : 0 }} Animation={Fade}>
247
+ <View style={{ flexDirection: 'row' }}>
248
+ <PlaceholderLine
249
+ width={24}
250
+ height={70}
251
+ style={{ marginRight: 10, marginBottom: 10 }}
252
+ />
253
+ <Placeholder style={{ paddingVertical: 10 }}>
254
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
255
+ <PlaceholderLine width={20} />
256
+ </Placeholder>
257
+ </View>
258
+ </Placeholder>
259
+ ),
260
+ )}
261
+ </>
262
+ )}
263
+ {loading && !hideOrders && (
185
264
  <>
186
265
  {!activeOrders ? (
187
266
  <Placeholder style={{ marginTop: 30 }} Animation={Fade}>
@@ -212,7 +291,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
212
291
  )}
213
292
  </>
214
293
  )}
215
- {!loading && !error && orders.length > 0 && (
294
+ {!loading && !error && orders.length > 0 && !hideOrders && (
216
295
  preOrders ? (
217
296
  <ActiveOrders
218
297
  orders={orders.filter((order: any) => orderStatus.includes(order.status))}
@@ -222,6 +301,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
222
301
  customArray={customArray}
223
302
  getOrderStatus={getOrderStatus}
224
303
  onNavigationRedirect={onNavigationRedirect}
304
+ handleUpdateOrderList={handleUpdateOrderList}
225
305
  />
226
306
  ) : activeOrders ? (
227
307
  <ActiveOrders
@@ -231,6 +311,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
231
311
  customArray={customArray}
232
312
  getOrderStatus={getOrderStatus}
233
313
  onNavigationRedirect={onNavigationRedirect}
314
+ handleUpdateOrderList={handleUpdateOrderList}
234
315
  />
235
316
  ) : (
236
317
  <PreviousOrders
@@ -241,6 +322,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
241
322
  getOrderStatus={getOrderStatus}
242
323
  onNavigationRedirect={onNavigationRedirect}
243
324
  handleReorder={handleReorder}
325
+ handleUpdateOrderList={handleUpdateOrderList}
244
326
  />
245
327
  )
246
328
  )}
@@ -249,13 +331,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
249
331
  }
250
332
 
251
333
  export const OrdersOption = (props: OrdersOptionParams) => {
334
+ const getAllOrders = props.activeOrders && props.pastOrders && props.preOrders
335
+
252
336
  const MyOrdersProps = {
253
337
  ...props,
254
338
  UIComponent: OrdersOptionUI,
255
- orderStatus: props.preOrders ? [13] : props.activeOrders
256
- ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
257
- : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
339
+ orderStatus: getAllOrders
340
+ ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
341
+ : props.preOrders ? [13] : props.activeOrders
342
+ ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
343
+ : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
258
344
  useDefualtSessionManager: true,
345
+ paginationSettings: {
346
+ initialPage: 1,
347
+ pageSize: getAllOrders ? 30 : 10,
348
+ controlType: 'infinity'
349
+ }
259
350
  }
260
351
 
261
352
  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`
@@ -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,20 +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
- onChange={() => handleOnChange(idx, wallet)}
116
- tintColor={theme.colors.disabled}
117
- onCheckColor={theme.colors.primary}
118
- onTintColor={theme.colors.primary}
119
- style={Platform.OS === 'ios' && styles.checkBoxStyle}
120
- />
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
+ )}
121
113
  <View style={{ alignItems: 'baseline', marginLeft: 5 }}>
122
114
  <View>
123
115
  <OText