ordering-ui-react-native 0.16.37 → 0.16.38-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 (202) hide show
  1. package/package.json +7 -5
  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/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/LoginForm/index.tsx +15 -0
  13. package/src/components/Messages/index.tsx +2 -2
  14. package/src/components/NotificationSetting/index.tsx +85 -0
  15. package/src/components/OrderDetails/index.tsx +2 -20
  16. package/src/components/OrdersOption/index.tsx +54 -56
  17. package/src/components/PaymentOptions/index.tsx +335 -365
  18. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  19. package/src/components/ReviewDriver/index.tsx +1 -1
  20. package/src/components/ReviewOrder/index.tsx +2 -1
  21. package/src/components/ReviewProducts/index.tsx +11 -0
  22. package/src/components/SignupForm/index.tsx +15 -0
  23. package/src/components/SingleProductReview/index.tsx +8 -5
  24. package/src/components/StripeElementsForm/index.tsx +25 -16
  25. package/src/components/VerifyPhone/styles.tsx +1 -2
  26. package/src/components/shared/OBottomPopup.tsx +6 -2
  27. package/src/index.tsx +2 -0
  28. package/src/pages/BusinessesListing.tsx +7 -6
  29. package/src/pages/OrderDetails.tsx +1 -1
  30. package/src/pages/ReviewDriver.tsx +2 -2
  31. package/src/pages/ReviewOrder.tsx +2 -2
  32. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  33. package/src/utils/index.tsx +2 -1
  34. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  35. package/themes/business/src/components/Chat/index.tsx +38 -30
  36. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  37. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  38. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  39. package/themes/business/src/components/MapView/index.tsx +12 -1
  40. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  41. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  42. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  43. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  44. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  45. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  46. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  47. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  48. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  49. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  50. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  51. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  52. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  53. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  54. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  55. package/themes/business/src/components/PreviousOrders/index.tsx +22 -24
  56. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  57. package/themes/business/src/components/ReviewCustomer/index.tsx +27 -13
  58. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  59. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  60. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  61. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  62. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  63. package/themes/business/src/types/index.tsx +15 -9
  64. package/themes/business/src/utils/index.tsx +10 -0
  65. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  66. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  67. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  68. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  69. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  70. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  71. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  72. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  73. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  74. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  75. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  76. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  77. package/themes/kiosk/src/types/index.d.ts +2 -0
  78. package/themes/original/index.tsx +4 -0
  79. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  80. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  81. package/themes/original/src/components/AddressList/index.tsx +1 -1
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +324 -162
  84. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  85. package/themes/original/src/components/BusinessController/index.tsx +216 -113
  86. package/themes/original/src/components/BusinessController/styles.tsx +1 -8
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  88. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +109 -139
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  94. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  96. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -104
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  99. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  100. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -25
  102. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -4
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +279 -104
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  105. package/themes/original/src/components/BusinessesListing/index.tsx +95 -7
  106. package/themes/original/src/components/Cart/index.tsx +54 -16
  107. package/themes/original/src/components/Cart/styles.tsx +4 -0
  108. package/themes/original/src/components/CartContent/index.tsx +22 -16
  109. package/themes/original/src/components/Checkout/index.tsx +110 -116
  110. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  111. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  112. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  113. package/themes/original/src/components/Favorite/index.tsx +1 -0
  114. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  118. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  119. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  120. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  121. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  122. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  123. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  124. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -73
  125. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  126. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  127. package/themes/original/src/components/Messages/index.tsx +17 -17
  128. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  129. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  130. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  131. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  132. package/themes/original/src/components/MyOrders/index.tsx +88 -22
  133. package/themes/original/src/components/NavBar/index.tsx +15 -9
  134. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  135. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  136. package/themes/original/src/components/Notifications/index.tsx +148 -0
  137. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  138. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  139. package/themes/original/src/components/OrderDetails/index.tsx +200 -37
  140. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  141. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  142. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  143. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  144. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  145. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  146. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  147. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  148. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +97 -106
  149. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  150. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  151. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  152. package/themes/original/src/components/PaymentOptions/index.tsx +41 -23
  153. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  154. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  155. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  156. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  157. package/themes/original/src/components/ProductForm/index.tsx +635 -664
  158. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  159. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  160. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  161. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  162. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  163. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  164. package/themes/original/src/components/ProfessionalProfile/index.tsx +26 -14
  165. package/themes/original/src/components/Promotions/index.tsx +232 -219
  166. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  167. package/themes/original/src/components/ReviewDriver/index.tsx +7 -7
  168. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  169. package/themes/original/src/components/ReviewProducts/index.tsx +2 -2
  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 +410 -258
  174. package/themes/original/src/components/SignupForm/index.tsx +184 -127
  175. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  176. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  177. package/themes/original/src/components/SingleProductCard/index.tsx +198 -112
  178. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  179. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  180. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +18 -7
  182. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  183. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  184. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  185. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  186. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  187. package/themes/original/src/components/UserProfileForm/index.tsx +10 -10
  188. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  189. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  190. package/themes/original/src/components/Wallets/index.tsx +176 -164
  191. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  192. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  193. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  194. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  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 +13 -3
  198. package/themes/original/src/layouts/Container.tsx +13 -9
  199. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  200. package/themes/original/src/types/index.tsx +82 -29
  201. package/themes/original/src/utils/index.tsx +121 -10
  202. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -11,6 +11,8 @@ import { StyleSheet } from 'react-native';
11
11
  import { useTheme } from 'styled-components/native';
12
12
  import { shape } from '../../utils'
13
13
  import { CategoryDescriptionMemoized } from './CategoryDescription';
14
+ import { OrderItAgain } from '../OrderItAgain'
15
+ import { SubcategoriesComponentMemoized } from './SubcategoriesComponent';
14
16
 
15
17
  const BusinessProductsListUI = (props: BusinessProductsListParams) => {
16
18
  const {
@@ -35,7 +37,9 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
35
37
  onClickCategory,
36
38
  lazyLoadProductsRecommended,
37
39
  handleUpdateProducts,
38
- isFiltMode
40
+ previouslyProducts,
41
+ isFiltMode,
42
+ navigation
39
43
  } = props;
40
44
 
41
45
  const [, t] = useLanguage();
@@ -67,51 +71,29 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
67
71
  }
68
72
  }
69
73
 
70
- const SubcategoriesComponent = ({ category }: any) => {
71
- const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
72
-
73
- return (
74
- <SubCategoriesContainer>
75
- <ContainerButton
76
- isSelected={allsubcategorySelected}
77
- >
78
- <OButton
79
- onClick={() => onClickSubcategory(null, category)}
80
- bgColor={allsubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
81
- text={`${t('ALL', 'All')} ${allsubcategorySelected ? 'X' : ''}`}
82
- style={bpStyles.categoryButtonStyle}
83
- textStyle={{ color: allsubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
84
- />
85
- </ContainerButton>
86
- {category?.subcategories?.map((subcategory: any) => {
87
- const isSubcategorySelected = subcategoriesSelected?.find((_subcategory: any) => _subcategory?.id === subcategory?.id)
88
- return (
89
- <ContainerButton
90
- key={subcategory?.id}
91
- isSelected={isSubcategorySelected}
92
- >
93
- <OButton
94
- onClick={() => onClickSubcategory(subcategory, category)}
95
- bgColor={isSubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
96
- text={`${subcategory?.name} ${isSubcategorySelected ? 'X' : ''}`}
97
- style={bpStyles.categoryButtonStyle}
98
- textStyle={{ color: isSubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
99
- />
100
- </ContainerButton>
101
- )
102
- }
103
- )}
104
- </SubCategoriesContainer>
105
- )
106
- }
107
-
108
74
  return (
109
75
  <ProductsContainer renderToHardwareTextureAndroid={categoryState.loading || isBusinessLoading}>
110
76
  <HeaderWrapper>
111
77
  {category?.subcategories?.length > 0 && (
112
- <SubcategoriesComponent category={category} />
78
+ <SubcategoriesComponentMemoized
79
+ category={category}
80
+ subcategoriesSelected={subcategoriesSelected}
81
+ onClickSubcategory={onClickSubcategory}
82
+ />
113
83
  )}
114
84
  </HeaderWrapper>
85
+ {previouslyProducts?.length > 0 && (
86
+ <OrderItAgain
87
+ onProductClick={onProductClick}
88
+ productList={previouslyProducts}
89
+ businessId={businessId}
90
+ categoryState={categoryState}
91
+ navigation={navigation}
92
+ handleUpdateProducts={handleUpdateProducts}
93
+ currentCart={currentCart}
94
+ searchValue={searchValue}
95
+ />
96
+ )}
115
97
  {category.id &&
116
98
  categoryState.products
117
99
  ?.filter((product: any) =>
@@ -122,12 +104,14 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
122
104
  <SingleProductCard
123
105
  key={'prod_' + product.id + `_${i}`}
124
106
  isSoldOut={product.inventoried && !product.quantity}
107
+ enableIntersection={!isFiltMode && categoryState.products?.length < 80}
125
108
  product={product}
126
109
  businessId={businessId}
127
110
  categoryState={categoryState}
128
111
  onProductClick={() => onProductClick(product)}
129
112
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
130
113
  handleUpdateProducts={handleUpdateProducts}
114
+ navigation={navigation}
131
115
  />
132
116
  ))
133
117
  }
@@ -148,11 +132,13 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
148
132
  key={'feat_' + product.id + `_${i}`}
149
133
  isSoldOut={product.inventoried && !product.quantity}
150
134
  product={product}
135
+ enableIntersection={!isFiltMode && categoryState.products?.length < 80}
151
136
  businessId={businessId}
152
137
  categoryState={categoryState}
153
138
  onProductClick={onProductClick}
154
139
  handleUpdateProducts={handleUpdateProducts}
155
140
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
141
+ navigation={navigation}
156
142
  />
157
143
  ),
158
144
  )}
@@ -233,18 +219,24 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
233
219
  </View>
234
220
  )}
235
221
  {category?.subcategories?.length > 0 && !isFiltMode && (
236
- <SubcategoriesComponent category={category} />
222
+ <SubcategoriesComponentMemoized
223
+ category={category}
224
+ subcategoriesSelected={subcategoriesSelected}
225
+ onClickSubcategory={onClickSubcategory}
226
+ />
237
227
  )}
238
228
  <>
239
229
  {products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
240
230
  <SingleProductCard
241
231
  key={`${product?.id}_${i}`}
232
+ enableIntersection={!isFiltMode && categoryState.products?.length < 80}
242
233
  isSoldOut={product.inventoried && !product.quantity}
243
234
  businessId={businessId}
244
235
  product={product}
245
236
  categoryState={categoryState}
246
237
  onProductClick={onProductClick}
247
238
  handleUpdateProducts={handleUpdateProducts}
239
+ navigation={navigation}
248
240
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
249
241
  />
250
242
  ))}
@@ -259,19 +251,24 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
259
251
  <>
260
252
  {[...Array(categoryState?.pagination?.nextPageItems).keys()].map(
261
253
  (item, i) => (
262
- <Placeholder key={i} style={{ padding: 5 }} Animation={Fade}>
263
- <View style={{ flexDirection: 'row' }}>
254
+ <View style={{ minHeight: 165, marginBottom: 28, padding: 12 }} key={i}>
255
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
256
+ <View style={{ flexDirection: 'row' }}>
257
+ <Placeholder style={{ paddingVertical: 10, flex: 1 }}>
258
+ <PlaceholderLine width={60} style={{ marginBottom: 15 }} />
259
+ <PlaceholderLine width={20} />
260
+ </Placeholder>
261
+ <PlaceholderLine
262
+ width={24}
263
+ height={70}
264
+ style={{ marginLeft: 10, marginBottom: 10 }}
265
+ />
266
+ </View>
264
267
  <PlaceholderLine
265
- width={24}
266
- height={70}
267
- style={{ marginRight: 10, marginBottom: 10 }}
268
+ height={52}
268
269
  />
269
- <Placeholder style={{ paddingVertical: 10 }}>
270
- <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
271
- <PlaceholderLine width={20} />
272
- </Placeholder>
273
- </View>
274
- </Placeholder>
270
+ </Placeholder>
271
+ </View>
275
272
  ),
276
273
  )}
277
274
  </>
@@ -18,15 +18,12 @@ export const RibbonBox = styled.View`
18
18
  background-color: ${(props: any) => props.theme.colors.primary};
19
19
  padding: 2px 8px;
20
20
  max-width: 180px;
21
-
22
21
  ${(props: any) => props.bgColor && css`
23
22
  background-color: ${props.bgColor};
24
23
  `}
25
-
26
24
  ${(props: any) => props.isRoundRect && css`
27
25
  border-radius: 7.6px;
28
26
  `}
29
-
30
27
  ${(props: any) => props.isCapsule && css`
31
28
  border-radius: 50px;
32
29
  `}
@@ -1,5 +1,7 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react'
2
2
  import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView } from 'react-native'
3
+ import { IOScrollView } from 'react-native-intersection-observer'
4
+ import { useSafeAreaInsets } from 'react-native-safe-area-context'
3
5
  import { useTheme } from 'styled-components/native';
4
6
  import {
5
7
  BusinessAndProductList,
@@ -11,6 +13,7 @@ import {
11
13
  useToast,
12
14
  useConfig
13
15
  } from 'ordering-components/native'
16
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
14
17
  import { OButton, OIcon, OModal, OText } from '../shared'
15
18
  import Alert from '../../providers/AlertProvider'
16
19
  import { BusinessBasicInformation } from '../BusinessBasicInformation'
@@ -19,21 +22,26 @@ import { BusinessProductsCategories } from '../BusinessProductsCategories'
19
22
  import { BusinessProductsList } from '../BusinessProductsList'
20
23
  import { BusinessProductsListingParams } from '../../types'
21
24
  import { _retrieveStoreData, _removeStoreData } from '../../providers/StoreUtil';
25
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
26
+ import { useIsFocused } from '@react-navigation/native';
27
+
22
28
  import {
23
29
  TopHeader,
24
30
  WrapSearchBar,
25
31
  WrapContent,
26
- BusinessProductsListingContainer,
27
32
  FiltProductsContainer,
28
33
  ContainerSafeAreaView,
29
34
  BackgroundGray,
30
- ProfessionalFilterWrapper
35
+ ProfessionalFilterWrapper,
36
+ NearBusiness,
37
+ TopActions
31
38
  } from './styles'
32
39
  import { FloatingButton } from '../FloatingButton'
33
40
  import { UpsellingRedirect } from './UpsellingRedirect'
34
41
  import Animated from 'react-native-reanimated'
35
42
  import { ProfessionalFilter } from '../ProfessionalFilter';
36
43
  import { ServiceForm } from '../ServiceForm';
44
+ import { BusinessesListing } from '../BusinessesListing/Layout/Original'
37
45
 
38
46
  const PIXELS_TO_SCROLL = 2000
39
47
 
@@ -58,9 +66,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
58
66
  getNextProducts,
59
67
  handleUpdateProducts,
60
68
  professionalSelected,
61
- handleChangeProfessionalSelected
69
+ handleChangeProfessionalSelected,
70
+ onBusinessClick
62
71
  } = props
63
72
 
73
+ const insets = useSafeAreaInsets()
64
74
  const theme = useTheme();
65
75
  const [, t] = useLanguage()
66
76
  const [{ auth }] = useSession()
@@ -68,10 +78,16 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
68
78
  const [{ parsePrice }] = useUtils()
69
79
  const [, { showToast }] = useToast()
70
80
  const [{ configs }] = useConfig()
81
+ const isFocused = useIsFocused();
71
82
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
83
+
84
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
85
+ const showLogo = !theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
86
+ const hideBusinessNearCity = theme?.business_view?.components?.near_business?.hidden ?? true
87
+
72
88
  const styles = StyleSheet.create({
73
89
  mainContainer: {
74
- flex: 1,
90
+ flex: 1
75
91
  },
76
92
  BackIcon: {
77
93
  paddingRight: 20,
@@ -93,7 +109,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
93
109
  padding: 15,
94
110
  justifyContent: 'center',
95
111
  shadowColor: theme.colors.clear,
96
- }
112
+ },
113
+ businessSkeleton: {
114
+ borderRadius: 8,
115
+ marginRight: 20,
116
+ width: 56,
117
+ height: 56
118
+ },
97
119
  })
98
120
 
99
121
  const { business, loading, error } = businessState
@@ -108,17 +130,21 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
108
130
  const [subcategoriesSelected, setSubcategoriesSelected] = useState([])
109
131
  const [openService, setOpenService] = useState(false)
110
132
  const [currentProduct, setCurrentProduct] = useState(null)
133
+ const [searchBarHeight, setSearchBarHeight] = useState(60)
111
134
 
112
135
  const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
136
+ const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
137
+
113
138
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
114
139
  const isOpenFiltProducts = isOpenSearchBar && !!searchValue
115
- const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
140
+ const filtProductsHeight = Platform.OS === 'ios' ? 0 : 100
116
141
  const onRedirect = (route: string, params?: any) => {
117
142
  navigation.navigate(route, params)
118
143
  }
119
144
 
120
145
  const onProductClick = (product: any) => {
121
- if (product?.type === 'service' && professionalSelected) {
146
+ const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0) || 0
147
+ if (product?.type === 'service' && business?.professionals?.length > 0) {
122
148
  setCurrentProduct(product)
123
149
  setOpenService(true)
124
150
  return
@@ -127,6 +153,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
127
153
  product: product,
128
154
  businessSlug: business.slug,
129
155
  businessId: business.id,
156
+ productAddedToCartLength
130
157
  })
131
158
  }
132
159
 
@@ -136,7 +163,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
136
163
  }
137
164
 
138
165
  const handleUpsellingPage = () => {
139
- if (isCheckoutMultiBusinessEnabled) {
166
+ if (isCheckoutMultiBusinessEnabled && openCarts.length > 1) {
140
167
  onRedirect('CheckoutNavigator', {
141
168
  screen: 'MultiCheckout'
142
169
  })
@@ -203,7 +230,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
203
230
  multiRemoveProducts && await multiRemoveProducts(unavailableProducts, _carts)
204
231
  return
205
232
  }
206
-
233
+
207
234
  if (alreadyRemoved === 'removed') {
208
235
  setAlertState({ open: true, content: [t('NOT_AVAILABLE_PRODUCT', 'This product is not available.')] })
209
236
  }
@@ -221,32 +248,41 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
221
248
  removeCartByReOrder()
222
249
  }, [currentCart])
223
250
 
251
+ useEffect(() => {
252
+ if (!isFocused) {
253
+ handleChangeSearch('')
254
+ setIsOpenSearchBar(false)
255
+ }
256
+ }, [isFocused])
257
+
258
+ const subtotalWithTaxes = currentCart?.taxes?.reduce((acc: any, item: any) => {
259
+ if (item?.type === 1)
260
+ return acc = acc + item?.summary?.tax
261
+ return acc = acc
262
+ }, currentCart?.subtotal)
263
+
224
264
  return (
225
265
  <>
226
- <ContainerSafeAreaView
227
- style={{ flex: 1 }}
228
- isOpenFiltProducts={isOpenFiltProducts}
229
- >
266
+ <View style={{ flex: 1 }}>
230
267
  <Animated.View style={{ position: 'relative' }}>
231
- <TopHeader isIos={Platform.OS === 'ios'}>
268
+ <TopHeader
269
+ style={{
270
+ marginTop: Platform.OS === 'ios' ? insets.top : 0
271
+ }}
272
+ onLayout={(event: any) => setSearchBarHeight(event.nativeEvent.layout.height)}
273
+ >
232
274
  {!isOpenSearchBar && (
233
275
  <>
234
- <View style={{ ...styles.headerItem, flex: 1 }}>
235
- <OButton
236
- imgLeftSrc={theme.images.general.arrow_left}
237
- imgRightSrc={null}
238
- style={styles.btnBackArrow}
239
- onClick={() => handleBackNavigation()}
240
- imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
241
- />
242
- </View>
276
+ <TopActions onPress={() => handleBackNavigation()}>
277
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
278
+ </TopActions>
243
279
  {!errorQuantityProducts && (
244
280
  <View style={{ ...styles.headerItem }}>
245
281
  <TouchableOpacity
246
282
  onPress={() => setIsOpenSearchBar(true)}
247
283
  style={styles.searchIcon}
248
284
  >
249
- <OIcon src={theme.images.general.search} color={theme.colors.textNormal} width={16} />
285
+ <OIcon src={theme.images.general.search} color={theme.colors.textNormal} width={20} />
250
286
  </TouchableOpacity>
251
287
  </View>
252
288
  )}
@@ -255,6 +291,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
255
291
  {isOpenSearchBar && (
256
292
  <WrapSearchBar>
257
293
  <SearchBar
294
+ autoFocus
258
295
  onSearch={handleChangeSearch}
259
296
  onCancel={() => handleCancel()}
260
297
  isCancelXButtonShow
@@ -265,57 +302,88 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
265
302
  </WrapSearchBar>
266
303
  )}
267
304
  </TopHeader>
305
+ {!hideBusinessNearCity && loading && (
306
+ <NearBusiness style={{ paddingBottom: 10 }}>
307
+ <Placeholder Animation={Fade}>
308
+ <View style={{ flexDirection: 'row' }}>
309
+ {[...Array(10).keys()].map(i => (
310
+ <View style={styles.businessSkeleton} key={i}>
311
+ <PlaceholderLine style={{ width: '100%', height: '100%' }} />
312
+ </View>
313
+ ))}
314
+ </View>
315
+ </Placeholder>
316
+ </NearBusiness>
317
+ )}
318
+ {!loading && !hideBusinessNearCity && businessState?.business?.city_id && (
319
+ <NearBusiness>
320
+ <BusinessesListing
321
+ logosLayout
322
+ propsToFetch={['id', 'logo', 'location', 'timezone', 'schedule', 'open', 'slug']}
323
+ cityId={businessState?.business?.city_id}
324
+ onBusinessClick={onBusinessClick}
325
+ actualSlug={businessState?.business?.slug}
326
+ />
327
+ </NearBusiness>
328
+ )}
268
329
  </Animated.View>
269
330
 
270
331
  {business?.categories?.length > 0 && isOpenFiltProducts && (
271
- <FiltProductsContainer
272
- isIos={Platform.OS === 'ios'}
273
- style={{
274
- height: Dimensions.get('window').height - filtProductsHeight
275
- }}
276
- >
277
- <View style={{ padding: 20, backgroundColor: theme.colors.white }}>
278
- <BusinessProductsList
279
- categories={[
280
- { id: null, name: t('ALL', 'All') },
281
- { id: 'featured', name: t('FEATURED', 'Featured') },
282
- ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
283
- ]}
284
- category={categorySelected}
285
- categoryState={categoryState}
286
- businessId={business.id}
287
- errors={errors}
288
- onProductClick={onProductClick}
289
- handleSearchRedirect={handleSearchRedirect}
290
- featured={featuredProducts}
291
- searchValue={searchValue}
292
- handleClearSearch={handleChangeSearch}
293
- errorQuantityProducts={errorQuantityProducts}
294
- handleCancelSearch={handleCancel}
295
- categoriesLayout={categoriesLayout}
296
- subcategoriesSelected={subcategoriesSelected}
297
- lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
298
- setCategoriesLayout={setCategoriesLayout}
299
- currentCart={currentCart}
300
- setSubcategoriesSelected={setSubcategoriesSelected}
301
- onClickCategory={handleChangeCategory}
302
- handleUpdateProducts={handleUpdateProducts}
303
- isFiltMode
304
- />
305
- </View>
306
- </FiltProductsContainer>
332
+ <FiltProductsContainer
333
+ style={{
334
+ height: Dimensions.get('window').height - filtProductsHeight,
335
+ top: Platform.OS === 'ios' ? searchBarHeight + insets.top : searchBarHeight
336
+ }}
337
+ contentContainerStyle={{ flexGrow: 1 }}
338
+ >
339
+ <View style={{ padding: 20, backgroundColor: theme.colors.white }}>
340
+ <BusinessProductsList
341
+ categories={[
342
+ { id: null, name: t('ALL', 'All') },
343
+ { id: 'featured', name: t('FEATURED', 'Featured') },
344
+ ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
345
+ ]}
346
+ category={categorySelected}
347
+ categoryState={categoryState}
348
+ businessId={business.id}
349
+ errors={errors}
350
+ onProductClick={onProductClick}
351
+ handleSearchRedirect={handleSearchRedirect}
352
+ featured={featuredProducts}
353
+ searchValue={searchValue}
354
+ handleClearSearch={handleChangeSearch}
355
+ errorQuantityProducts={errorQuantityProducts}
356
+ handleCancelSearch={handleCancel}
357
+ categoriesLayout={categoriesLayout}
358
+ subcategoriesSelected={subcategoriesSelected}
359
+ lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
360
+ setCategoriesLayout={setCategoriesLayout}
361
+ currentCart={currentCart}
362
+ setSubcategoriesSelected={setSubcategoriesSelected}
363
+ onClickCategory={handleChangeCategory}
364
+ handleUpdateProducts={handleUpdateProducts}
365
+ previouslyProducts={business?.previously_products}
366
+ navigation={navigation}
367
+ isFiltMode
368
+ />
369
+ </View>
370
+ </FiltProductsContainer>
307
371
  )}
308
372
  {isOpenFiltProducts && (
309
- <BackgroundGray />
373
+ <BackgroundGray isIos={Platform.OS === 'ios'} />
310
374
  )}
311
- <BusinessProductsListingContainer
312
- stickyHeaderIndices={[2]}
313
- style={styles.mainContainer}
375
+ <IOScrollView
376
+ stickyHeaderIndices={[business?.professionals?.length > 0 ? 3 : 2]}
377
+ style={{
378
+ ...styles.mainContainer,
379
+ marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
380
+ 50 : 0
381
+ }}
314
382
  ref={scrollViewRef}
315
- isActiveFloatingButtom={currentCart?.products?.length > 0 && categoryState.products.length !== 0}
316
383
  onScroll={handlePageScroll}
317
384
  onScrollBeginDrag={handleTouchDrag}
318
385
  scrollEventThrottle={16}
386
+ bounces={false}
319
387
  >
320
388
  <BusinessBasicInformation
321
389
  navigation={navigation}
@@ -341,27 +409,28 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
341
409
  />
342
410
  </ProfessionalFilterWrapper>
343
411
  )}
344
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
345
- {!loading && business?.id && (
346
- <>
347
- {!(business?.categories?.length === 0) && (
348
- <BusinessProductsCategories
349
- categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
350
- categorySelected={categorySelected}
351
- onClickCategory={handleChangeCategory}
352
- featured={featuredProducts}
353
- openBusinessInformation={openBusinessInformation}
354
- scrollViewRef={scrollViewRef}
355
- productListLayout={productListLayout}
356
- categoriesLayout={categoriesLayout}
357
- selectedCategoryId={selectedCategoryId}
358
- lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
359
- setSelectedCategoryId={setSelectedCategoryId}
360
- setCategoryClicked={setCategoryClicked}
361
-
362
- />
363
- )}
364
- </>
412
+ <View
413
+ style={{
414
+ height: 8,
415
+ backgroundColor: theme.colors.backgroundGray100,
416
+ marginTop: isChewLayout && showLogo ? 10 : 0
417
+ }}
418
+ />
419
+ {!loading && business?.id && !(business?.categories?.length === 0) && (
420
+ <BusinessProductsCategories
421
+ categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
422
+ categorySelected={categorySelected}
423
+ onClickCategory={handleChangeCategory}
424
+ featured={featuredProducts}
425
+ openBusinessInformation={openBusinessInformation}
426
+ scrollViewRef={scrollViewRef}
427
+ productListLayout={productListLayout}
428
+ categoriesLayout={categoriesLayout}
429
+ selectedCategoryId={selectedCategoryId}
430
+ lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
431
+ setSelectedCategoryId={setSelectedCategoryId}
432
+ setCategoryClicked={setCategoryClicked}
433
+ />
365
434
  )}
366
435
  {!loading && business?.id && (
367
436
  <>
@@ -393,6 +462,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
393
462
  setSubcategoriesSelected={setSubcategoriesSelected}
394
463
  onClickCategory={handleChangeCategory}
395
464
  handleUpdateProducts={handleUpdateProducts}
465
+ navigation={navigation}
466
+ previouslyProducts={business?.previously_products}
396
467
  />
397
468
  </WrapContent>
398
469
  </>
@@ -415,28 +486,31 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
415
486
  isBusinessLoading={loading}
416
487
  errorQuantityProducts={errorQuantityProducts}
417
488
  handleUpdateProducts={handleUpdateProducts}
489
+ navigation={navigation}
418
490
  />
419
491
  </WrapContent>
420
492
  </>
421
493
  )}
422
- </BusinessProductsListingContainer>
494
+ </IOScrollView>
423
495
  {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
424
- <FloatingButton
425
- btnText={
426
- openUpselling
427
- ? t('LOADING', 'Loading')
428
- : currentCart?.subtotal >= currentCart?.minimum
429
- ? t('VIEW_ORDER', 'View Order')
430
- : `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
431
- }
432
- isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
433
- btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
434
- btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
435
- btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
436
- btnRightValue={parsePrice(currentCart?.total)}
437
- disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
438
- handleClick={() => setOpenUpselling(true)}
439
- />
496
+ <View style={{ marginBottom: Platform.OS === 'ios' ? 20 : 0 }}>
497
+ <FloatingButton
498
+ btnText={
499
+ openUpselling
500
+ ? t('LOADING', 'Loading')
501
+ : subtotalWithTaxes >= currentCart?.minimum
502
+ ? t('VIEW_ORDER', 'View Order')
503
+ : `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
504
+ }
505
+ isSecondaryBtn={subtotalWithTaxes < currentCart?.minimum || openUpselling}
506
+ btnLeftValueShow={subtotalWithTaxes >= currentCart?.minimum && currentCart?.products?.length > 0}
507
+ btnRightValueShow={subtotalWithTaxes >= currentCart?.minimum && currentCart?.products?.length > 0}
508
+ btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
509
+ btnRightValue={parsePrice(currentCart?.total)}
510
+ disabled={subtotalWithTaxes < currentCart?.minimum || openUpselling}
511
+ handleClick={() => setOpenUpselling(true)}
512
+ />
513
+ </View>
440
514
  )}
441
515
  {openUpselling && (
442
516
  <UpsellingRedirect
@@ -460,7 +534,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
460
534
  onAccept={() => setAlertState({ open: false, content: [] })}
461
535
  onClose={() => setAlertState({ open: false, content: [] })}
462
536
  />
463
- </ContainerSafeAreaView>
537
+ </View>
464
538
  <OModal
465
539
  open={openService}
466
540
  onClose={() => setOpenService(false)}
@@ -485,6 +559,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
485
559
  export const BusinessProductsListing = (props: BusinessProductsListingParams) => {
486
560
  const businessProductslistingProps = {
487
561
  ...props,
562
+ isForceSearch: Platform.OS === 'ios',
488
563
  UIComponent: BusinessProductsListingUI
489
564
  }
490
565
  return (