ordering-ui-react-native 0.16.24 → 0.16.25-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 (201) hide show
  1. package/package.json +7 -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 +33 -4
  9. package/src/components/BusinessInformation/styles.tsx +2 -2
  10. package/src/components/BusinessProductsList/index.tsx +10 -10
  11. package/src/components/BusinessesListing/index.tsx +1 -1
  12. package/src/components/Checkout/index.tsx +2 -1
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +118 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +2 -20
  19. package/src/components/OrdersOption/index.tsx +54 -56
  20. package/src/components/PaymentOptions/index.tsx +335 -365
  21. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  22. package/src/components/ReviewDriver/index.tsx +1 -1
  23. package/src/components/ReviewOrder/index.tsx +2 -1
  24. package/src/components/ReviewProducts/index.tsx +11 -0
  25. package/src/components/SignupForm/index.tsx +143 -61
  26. package/src/components/SingleProductReview/index.tsx +8 -5
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/VerifyPhone/styles.tsx +1 -2
  29. package/src/components/shared/OBottomPopup.tsx +6 -2
  30. package/src/index.tsx +2 -0
  31. package/src/pages/BusinessesListing.tsx +7 -6
  32. package/src/pages/OrderDetails.tsx +1 -1
  33. package/src/pages/ReviewDriver.tsx +2 -2
  34. package/src/pages/ReviewOrder.tsx +2 -2
  35. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  36. package/src/types/index.tsx +13 -9
  37. package/src/utils/index.tsx +0 -1
  38. package/themes/business/index.tsx +4 -0
  39. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  40. package/themes/business/src/components/Chat/index.tsx +42 -34
  41. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  42. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  43. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  44. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  45. package/themes/business/src/components/MapView/index.tsx +12 -1
  46. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  47. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  48. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  49. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  50. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  51. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  52. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  53. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  54. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  55. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  56. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  57. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  58. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  59. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  60. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  61. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  62. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  63. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  64. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  65. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  66. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  67. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  68. package/themes/business/src/components/shared/OModal.tsx +40 -37
  69. package/themes/business/src/types/index.tsx +15 -9
  70. package/themes/business/src/utils/index.tsx +10 -0
  71. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  72. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  73. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  74. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  75. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  76. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  77. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  78. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  79. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  80. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  81. package/themes/kiosk/src/types/index.d.ts +2 -0
  82. package/themes/original/index.tsx +12 -0
  83. package/themes/original/src/components/AddressForm/index.tsx +139 -135
  84. package/themes/original/src/components/AddressList/index.tsx +1 -1
  85. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  86. package/themes/original/src/components/BusinessBasicInformation/index.tsx +311 -161
  87. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  88. package/themes/original/src/components/BusinessController/index.tsx +190 -113
  89. package/themes/original/src/components/BusinessController/styles.tsx +0 -7
  90. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -4
  91. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  92. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  93. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  94. package/themes/original/src/components/BusinessListingSearch/index.tsx +101 -125
  95. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  96. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  97. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  98. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  99. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  100. package/themes/original/src/components/BusinessProductsListing/index.tsx +287 -175
  101. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -8
  102. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  103. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  104. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  105. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  106. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -10
  107. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  108. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  109. package/themes/original/src/components/BusinessesListing/index.tsx +105 -519
  110. package/themes/original/src/components/Cart/index.tsx +42 -10
  111. package/themes/original/src/components/Cart/styles.tsx +4 -0
  112. package/themes/original/src/components/CartContent/index.tsx +22 -16
  113. package/themes/original/src/components/Checkout/index.tsx +90 -53
  114. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  115. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  116. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  117. package/themes/original/src/components/Favorite/index.tsx +1 -0
  118. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  119. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  120. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  121. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  122. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  123. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  124. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  125. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  126. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  127. package/themes/original/src/components/LoginForm/index.tsx +82 -44
  128. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  129. package/themes/original/src/components/Messages/index.tsx +17 -17
  130. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  131. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  133. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  135. package/themes/original/src/components/MyOrders/index.tsx +70 -6
  136. package/themes/original/src/components/NavBar/index.tsx +15 -9
  137. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  138. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  139. package/themes/original/src/components/Notifications/index.tsx +148 -0
  140. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  141. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  142. package/themes/original/src/components/OrderDetails/index.tsx +190 -35
  143. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  144. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  145. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  146. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  147. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  149. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  150. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +100 -106
  151. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
  152. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  153. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  154. package/themes/original/src/components/PaymentOptions/index.tsx +42 -24
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  156. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  157. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  158. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  159. package/themes/original/src/components/ProductForm/index.tsx +710 -653
  160. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  162. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  163. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  164. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  165. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  166. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  167. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  168. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  169. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  170. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  171. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  172. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  173. package/themes/original/src/components/ServiceForm/index.tsx +631 -0
  174. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  175. package/themes/original/src/components/SignupForm/index.tsx +350 -206
  176. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  177. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  178. package/themes/original/src/components/SingleProductCard/index.tsx +207 -107
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +1 -10
  180. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  181. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  182. package/themes/original/src/components/StripeElementsForm/index.tsx +15 -7
  183. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  184. package/themes/original/src/components/UserDetails/index.tsx +31 -17
  185. package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
  186. package/themes/original/src/components/UserProfile/index.tsx +54 -29
  187. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  188. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  189. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  190. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  191. package/themes/original/src/components/Wallets/index.tsx +174 -162
  192. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  193. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  194. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  195. package/themes/original/src/components/shared/OButton.tsx +10 -3
  196. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  197. package/themes/original/src/components/shared/OInput.tsx +3 -2
  198. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  199. package/themes/original/src/types/index.tsx +122 -30
  200. package/themes/original/src/utils/index.tsx +77 -0
  201. 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,88 @@ 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 && 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, width: 50 }}
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
+ noMargin
105
+ />
106
+ {
107
+ items.length > 0 && (
108
+ <ListWrapper>
109
+ {
110
+ items && items.map((item: any, idx: number) =>
111
+ <OrderTypeWrapper activeOpacity={0.8} key={idx} disabled={orderState.loading} onPress={() => handleChangeOrderTypeCallback(item.value)}>
112
+ <BgImage source={theme.images.orderTypes[`type${item?.value || 1}`]} resizeMode={'cover'} style={{ opacity: item?.value == typeSelected || typeSelected === undefined ? 1 : 0.4 }}>
113
+ <MaskCont>
114
+ <OText size={12} lineHeight={18} color={theme.colors.white} weight={Platform.OS === 'android' ? 'bold' : '600'}>{item?.label}</OText>
115
+ <OText size={10} lineHeight={15} color={theme.colors.white}>{item?.description}</OText>
116
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
117
+ <OText size={10} lineHeight={15} color={theme.colors.white}>{t('START_MY_ORDER', 'Start my order')}</OText>
118
+ <AntDesignIcon name='arrowleft' size={26} color={theme.colors.white} style={{ transform: [{ rotate: '180deg' }], marginStart: 4 }} />
119
+ </View>
120
+ </MaskCont>
121
+ </BgImage>
122
+ </OrderTypeWrapper>
123
+ )
124
+ }
125
+ </ListWrapper>
126
+ )
127
+ }
128
+ </>
129
+ )}
130
+
82
131
  </Wrapper>
83
132
  )
84
133
  }
@@ -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
+ `;
@@ -1,5 +1,5 @@
1
- import React, { useEffect } from 'react'
2
- import { BusinessList as BusinessListController, useOrder } from 'ordering-components/native'
1
+ import React from 'react'
2
+ import { useOrder } from 'ordering-components/native'
3
3
  import { BusinessController } from '../../BusinessController'
4
4
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
5
 
@@ -7,32 +7,100 @@ import { ListWrapper } from './styles'
7
7
  import {
8
8
  View,
9
9
  StyleSheet,
10
- ScrollView
10
+ ScrollView,
11
+ Dimensions
11
12
  } from 'react-native';
12
13
  import { PreviousBusinessOrderedParams } from '../../../types';
13
14
 
14
- export const PreviousBusinessOrderedUI = (props : PreviousBusinessOrderedParams) => {
15
+ const BusinessControllerList = ({ businesses, onBusinessClick, navigation, orderState, handleCustomUpdate, 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
+ handleCustomUpdate={handleCustomUpdate}
35
+ style={style}
36
+ />
37
+ ))}
38
+ </>
39
+ )
40
+ }
41
+
42
+ const BusinessSkeletons = () => {
43
+ return (
44
+ <>
45
+ {[...Array(4).keys()].map((item, i) => (
46
+ <Placeholder
47
+ Animation={Fade}
48
+ key={i}
49
+ style={{ marginBottom: 20 }}>
50
+ <View style={{ width: '100%' }}>
51
+ <PlaceholderLine
52
+ height={200}
53
+ style={{ marginBottom: 20, borderRadius: 25 }}
54
+ />
55
+ <View style={{ paddingHorizontal: 10 }}>
56
+ <View
57
+ style={{
58
+ flexDirection: 'row',
59
+ justifyContent: 'space-between',
60
+ }}>
61
+ <PlaceholderLine
62
+ height={25}
63
+ width={40}
64
+ style={{ marginBottom: 10 }}
65
+ />
66
+ <PlaceholderLine
67
+ height={25}
68
+ width={20}
69
+ style={{ marginBottom: 10 }}
70
+ />
71
+ </View>
72
+ <PlaceholderLine
73
+ height={20}
74
+ width={30}
75
+ style={{ marginBottom: 10 }}
76
+ />
77
+ <PlaceholderLine
78
+ height={20}
79
+ width={80}
80
+ style={{ marginBottom: 10 }}
81
+ />
82
+ </View>
83
+ </View>
84
+ </Placeholder>
85
+ ))}
86
+ </>
87
+ )
88
+ }
89
+
90
+ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) => {
15
91
  const {
16
92
  navigation,
17
- businessesList,
18
- setBusinessLoading,
19
- businessId,
93
+ businesses,
20
94
  onNavigationRedirect,
21
95
  isBusinessesSearchList,
22
- businessLoading
96
+ handleUpdateBusinesses,
23
97
  } = props
24
98
 
25
99
  const [orderState] = useOrder()
100
+ const windowWidth = Dimensions.get('window').width;
26
101
  const onBusinessClick = (business: any) => {
27
- onNavigationRedirect('Business', { store: business.slug })
102
+ onNavigationRedirect('Business', { store: business.slug, logo: business.logo, header: business.header })
28
103
  }
29
- useEffect(() => {
30
- if (businessesList?.loading && businessesList?.businesses?.length === 0) {
31
- setBusinessLoading(true)
32
- } else {
33
- setBusinessLoading(false)
34
- }
35
- }, [businessesList?.loading])
36
104
 
37
105
  const styles = StyleSheet.create({
38
106
  container: {
@@ -40,95 +108,33 @@ export const PreviousBusinessOrderedUI = (props : PreviousBusinessOrderedParams)
40
108
  },
41
109
  });
42
110
 
43
- const BusinessControllerList = ({ style }: any) => {
44
- return (
45
- <>
46
- {businessesList.businesses?.filter((business: any) => businessId?.includes(business?.id))?.map((business: any, i: number) => (
47
- <BusinessController
48
- key={`${business.id}_` + i}
49
- business={business}
50
- isBusinessOpen={business.open}
51
- handleCustomClick={() => onBusinessClick(business)}
52
- orderType={orderState?.options?.type}
53
- navigation={navigation}
54
- businessHeader={business?.header}
55
- businessFeatured={business?.featured}
56
- businessLogo={business?.logo}
57
- businessReviews={business?.reviews}
58
- businessDeliveryPrice={business?.delivery_price}
59
- businessDeliveryTime={business?.delivery_time}
60
- businessPickupTime={business?.pickup_time}
61
- businessDistance={business?.distance}
62
- style={style}
63
- />
64
- ))}
65
- </>
66
- )
67
- }
68
-
69
- const BusinessSkeletons = () => {
70
- return (
71
- <>
72
- {[...Array(4).keys()].map((item, i) => (
73
- <Placeholder
74
- Animation={Fade}
75
- key={i}
76
- style={{ marginBottom: 20 }}>
77
- <View style={{ width: '100%' }}>
78
- <PlaceholderLine
79
- height={200}
80
- style={{ marginBottom: 20, borderRadius: 25 }}
81
- />
82
- <View style={{ paddingHorizontal: 10 }}>
83
- <View
84
- style={{
85
- flexDirection: 'row',
86
- justifyContent: 'space-between',
87
- }}>
88
- <PlaceholderLine
89
- height={25}
90
- width={40}
91
- style={{ marginBottom: 10 }}
92
- />
93
- <PlaceholderLine
94
- height={25}
95
- width={20}
96
- style={{ marginBottom: 10 }}
97
- />
98
- </View>
99
- <PlaceholderLine
100
- height={20}
101
- width={30}
102
- style={{ marginBottom: 10 }}
103
- />
104
- <PlaceholderLine
105
- height={20}
106
- width={80}
107
- style={{ marginBottom: 10 }}
108
- />
109
- </View>
110
- </View>
111
- </Placeholder>
112
- ))}
113
- </>
114
- )
115
- }
116
-
117
111
  return (
118
112
  <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
119
113
  {isBusinessesSearchList ? (
120
114
  <>
121
- {!businessLoading && (
115
+ {!businesses?.loading && (
122
116
  <BusinessControllerList
123
- style={{ width: 320, marginRight: 20 }}
117
+ style={{ width: windowWidth - 120, marginRight: 20 }}
118
+ onBusinessClick={onBusinessClick}
119
+ orderState={orderState}
120
+ navigation={navigation}
121
+ businesses={businesses}
122
+ handleCustomUpdate={handleUpdateBusinesses}
124
123
  />
125
124
  )}
126
125
  </>
127
126
  ) : (
128
127
  <ListWrapper>
129
- <BusinessControllerList />
130
- {businessesList.loading && (
128
+ {businesses?.loading ? (
131
129
  <BusinessSkeletons />
130
+ ) : (
131
+ <BusinessControllerList
132
+ onBusinessClick={onBusinessClick}
133
+ orderState={orderState}
134
+ navigation={navigation}
135
+ businesses={businesses}
136
+ handleCustomUpdate={handleUpdateBusinesses}
137
+ />
132
138
  )}
133
139
  </ListWrapper>
134
140
  )}
@@ -136,15 +142,3 @@ export const PreviousBusinessOrderedUI = (props : PreviousBusinessOrderedParams)
136
142
  </ScrollView>
137
143
  )
138
144
  }
139
-
140
- export const PreviousBusinessOrdered = (props) => {
141
- const previousBusinessOrderedController = {
142
- ...props,
143
- UIComponent: PreviousBusinessOrderedUI,
144
- paginationSettings: { initialPage: 1, pageSize: 50, controlType: 'infinity' }
145
- }
146
-
147
- return (
148
- <BusinessListController {...previousBusinessOrderedController} />
149
- )
150
- }
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { ScrollView, StyleSheet } from 'react-native'
2
+ import { ScrollView, StyleSheet, Dimensions } from 'react-native'
3
3
  import {
4
4
  ListWrapper
5
5
  } from './styles'
@@ -7,13 +7,16 @@ import {
7
7
  import { SingleProductCard } from '../../SingleProductCard'
8
8
  import { PreviousProductsOrderedParams } from '../../../types'
9
9
 
10
- export const PreviousProductsOrdered = (props : PreviousProductsOrderedParams) => {
10
+ export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) => {
11
11
  const {
12
12
  products,
13
13
  onProductClick,
14
+ handleUpdateProducts,
14
15
  isBusinessesSearchList
15
16
  } = props
16
17
 
18
+ const windowWidth = Dimensions.get('window').width;
19
+
17
20
  const styles = StyleSheet.create({
18
21
  container: {
19
22
  marginBottom: 0,
@@ -24,15 +27,17 @@ export const PreviousProductsOrdered = (props : PreviousProductsOrderedParams) =
24
27
  return (
25
28
  <>
26
29
  {products?.map((product: any) => (
27
- <SingleProductCard
28
- key={product?.id}
29
- isSoldOut={(product.inventoried && !product.quantity)}
30
- product={product}
31
- businessId={product?.business?.id}
32
- onProductClick={onProductClick}
33
- style={style}
34
- productAddedToCartLength={0}
35
- />
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
+ />
36
41
  ))}
37
42
  </>
38
43
  )
@@ -40,7 +45,7 @@ export const PreviousProductsOrdered = (props : PreviousProductsOrderedParams) =
40
45
  return (
41
46
  <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
42
47
  {isBusinessesSearchList ? (
43
- <ProductList style={{ width: 320, marginRight: 20 }} />
48
+ <ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
44
49
  ) : (
45
50
  <ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
46
51
  <ProductList />