ordering-ui-external 1.9.2 → 1.9.4

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 (97) hide show
  1. package/_bundles/0.ordering-ui.9ce64e14904d222c0020.js +1 -0
  2. package/_bundles/{1.ordering-ui.8e20ae6af39ad738a29e.js → 1.ordering-ui.9ce64e14904d222c0020.js} +1 -1
  3. package/_bundles/{2.ordering-ui.8e20ae6af39ad738a29e.js → 2.ordering-ui.9ce64e14904d222c0020.js} +1 -1
  4. package/_bundles/{4.ordering-ui.8e20ae6af39ad738a29e.js → 4.ordering-ui.9ce64e14904d222c0020.js} +1 -1
  5. package/_bundles/{5.ordering-ui.8e20ae6af39ad738a29e.js → 5.ordering-ui.9ce64e14904d222c0020.js} +1 -1
  6. package/_bundles/{6.ordering-ui.8e20ae6af39ad738a29e.js → 6.ordering-ui.9ce64e14904d222c0020.js} +1 -1
  7. package/_bundles/{7.ordering-ui.8e20ae6af39ad738a29e.js → 7.ordering-ui.9ce64e14904d222c0020.js} +2 -2
  8. package/_bundles/{7.ordering-ui.8e20ae6af39ad738a29e.js.LICENSE.txt → 7.ordering-ui.9ce64e14904d222c0020.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.8e20ae6af39ad738a29e.js → 8.ordering-ui.9ce64e14904d222c0020.js} +1 -1
  10. package/_bundles/{9.ordering-ui.8e20ae6af39ad738a29e.js → 9.ordering-ui.9ce64e14904d222c0020.js} +1 -1
  11. package/_bundles/ordering-ui.9ce64e14904d222c0020.js +2 -0
  12. package/_bundles/{ordering-ui.8e20ae6af39ad738a29e.js.LICENSE.txt → ordering-ui.9ce64e14904d222c0020.js.LICENSE.txt} +0 -0
  13. package/_modules/components/BusinessesListing/index.js +1 -3
  14. package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +26 -12
  15. package/_modules/components/VerticalOrdersLayout/styles.js +1 -1
  16. package/_modules/themes/five/index.js +7 -0
  17. package/_modules/themes/five/src/components/AddressList/index.js +3 -2
  18. package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +3 -2
  19. package/_modules/themes/five/src/components/BusinessListingSearch/index.js +14 -6
  20. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +8 -3
  21. package/_modules/themes/five/src/components/BusinessProductsList/index.js +50 -14
  22. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +9 -2
  23. package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +10 -6
  24. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +55 -186
  25. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +29 -40
  26. package/_modules/themes/five/src/components/Cart/index.js +56 -97
  27. package/_modules/themes/five/src/components/CartContent/index.js +50 -2
  28. package/_modules/themes/five/src/components/CartContent/styles.js +6 -4
  29. package/_modules/themes/five/src/components/Checkout/index.js +8 -2
  30. package/_modules/themes/five/src/components/Checkout/styles.js +10 -4
  31. package/_modules/themes/five/src/components/Header/index.js +26 -34
  32. package/_modules/themes/five/src/components/Header/styles.js +46 -35
  33. package/_modules/themes/five/src/components/HeaderOption/index.js +3 -2
  34. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +3 -2
  35. package/_modules/themes/five/src/components/MultiCheckout/index.js +22 -13
  36. package/_modules/themes/five/src/components/MultiCheckout/styles.js +11 -8
  37. package/_modules/themes/five/src/components/MultiOrdersDetails/index.js +9 -1
  38. package/_modules/themes/five/src/components/OrderContextUI/index.js +192 -0
  39. package/_modules/themes/five/src/components/OrderContextUI/styles.js +41 -0
  40. package/_modules/themes/five/src/components/OrderDetails/index.js +3 -0
  41. package/_modules/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/index.js +8 -2
  42. package/_modules/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/styles.js +8 -2
  43. package/_modules/themes/five/src/components/OrdersOption/index.js +2 -1
  44. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +17 -8
  45. package/_modules/themes/five/src/components/ProductItemAccordion/styles.js +27 -27
  46. package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +7 -2
  47. package/_modules/themes/five/src/components/ProductOptionSubOption/styles.js +17 -14
  48. package/_modules/themes/five/src/components/SingleOrderCard/index.js +16 -16
  49. package/_modules/themes/five/src/components/SingleOrderCard/styles.js +49 -41
  50. package/package.json +3 -2
  51. package/src/components/BusinessesListing/index.js +1 -3
  52. package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +25 -14
  53. package/src/components/VerticalOrdersLayout/styles.js +8 -0
  54. package/src/themes/five/index.js +2 -0
  55. package/src/themes/five/src/components/AddressList/index.js +3 -2
  56. package/src/themes/five/src/components/BusinessItemAccordion/index.js +2 -1
  57. package/src/themes/five/src/components/BusinessListingSearch/index.js +4 -0
  58. package/src/themes/five/src/components/BusinessProductsCategories/index.js +8 -3
  59. package/src/themes/five/src/components/BusinessProductsList/index.js +54 -18
  60. package/src/themes/five/src/components/BusinessProductsListing/index.js +14 -2
  61. package/src/themes/five/src/components/BusinessProductsListing/styles.js +18 -6
  62. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +219 -345
  63. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +2 -77
  64. package/src/themes/five/src/components/Cart/index.js +50 -57
  65. package/src/themes/five/src/components/CartContent/index.js +43 -3
  66. package/src/themes/five/src/components/CartContent/styles.js +6 -0
  67. package/src/themes/five/src/components/Checkout/index.js +16 -2
  68. package/src/themes/five/src/components/Checkout/styles.js +19 -6
  69. package/src/themes/five/src/components/Header/index.js +281 -277
  70. package/src/themes/five/src/components/Header/styles.js +20 -51
  71. package/src/themes/five/src/components/HeaderOption/index.js +3 -2
  72. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +2 -1
  73. package/src/themes/five/src/components/MultiCheckout/index.js +27 -13
  74. package/src/themes/five/src/components/MultiCheckout/styles.js +8 -13
  75. package/src/themes/five/src/components/MultiOrdersDetails/index.js +21 -13
  76. package/src/themes/five/src/components/OrderContextUI/index.js +133 -0
  77. package/src/themes/five/src/components/OrderContextUI/styles.js +86 -0
  78. package/src/themes/five/src/components/OrderDetails/index.js +4 -0
  79. package/src/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/index.js +5 -2
  80. package/src/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/styles.js +4 -0
  81. package/src/themes/five/src/components/OrdersOption/index.js +2 -1
  82. package/src/themes/five/src/components/ProductItemAccordion/index.js +58 -40
  83. package/src/themes/five/src/components/ProductItemAccordion/styles.js +4 -3
  84. package/src/themes/five/src/components/ProductOptionSubOption/index.js +8 -1
  85. package/src/themes/five/src/components/ProductOptionSubOption/styles.js +6 -0
  86. package/src/themes/five/src/components/SingleOrderCard/index.js +12 -13
  87. package/src/themes/five/src/components/SingleOrderCard/styles.js +26 -7
  88. package/template/app.js +179 -66
  89. package/template/components/ListenPageChanges/index.js +3 -2
  90. package/template/components/OrderingThemeUpdated/index.js +41 -0
  91. package/template/helmetdata.json +7 -0
  92. package/template/pages/MessagesList/index.js +2 -0
  93. package/template/pages/MultiCart/index.js +30 -0
  94. package/template/pages/MultiCheckout/index.js +86 -10
  95. package/template/pages/MultiOrdersDetails/index.js +9 -4
  96. package/_bundles/0.ordering-ui.8e20ae6af39ad738a29e.js +0 -1
  97. package/_bundles/ordering-ui.8e20ae6af39ad738a29e.js +0 -2
@@ -2,7 +2,6 @@ import React, { useEffect, useState, useCallback } from 'react'
2
2
  import { useTheme } from 'styled-components'
3
3
  import FiMap from '@meronex/icons/fi/FiMap'
4
4
  import FiFilter from '@meronex/icons/fi/FiFilter'
5
- import FaMapMarkerAlt from '@meronex/icons/fa/FaMapMarkerAlt'
6
5
  import {
7
6
  useOrder,
8
7
  useSession,
@@ -24,10 +23,6 @@ import {
24
23
  BusinessLogo,
25
24
  BusinessLogosContainer,
26
25
  BusinessBanner,
27
- BusinessFeatures,
28
- AddressMenu,
29
- FeatureItems,
30
- ItemInline,
31
26
  BusinessLogosWrapper
32
27
  } from './styles'
33
28
  import { useWindowSize } from '../../../../../../../hooks/useWindowSize'
@@ -36,8 +31,6 @@ import { NotFoundSource } from '../../../NotFoundSource'
36
31
 
37
32
  import { Modal } from '../../../Modal'
38
33
  import { Alert } from '../../../Confirm'
39
- import { AddressForm } from '../../../AddressForm'
40
- import { AddressList } from '../../../AddressList'
41
34
  import { SearchBar } from '../../../SearchBar'
42
35
 
43
36
  import { BusinessTypeFilter } from '../../../BusinessTypeFilter'
@@ -51,10 +44,10 @@ import { OrderProgress } from '../../../OrderProgress'
51
44
  import { PageBanner } from '../../../PageBanner'
52
45
 
53
46
  import Skeleton from 'react-loading-skeleton'
54
- import { MomentPopover } from '../../../../../../pwa/src/components/MomentPopover'
55
- import { OrderTypeSelectorHeader } from '../../../../../../../components/OrderTypeSelectorHeader'
56
47
  import { AutoScroll } from '../../../AutoScroll'
57
48
  import { CitiesControl } from '../../../CitiesControl'
49
+ import { OrderContextUI } from '../../../OrderContextUI'
50
+ import { OrdersSection } from './OrdersSection'
58
51
 
59
52
  const PIXELS_TO_SCROLL = 300
60
53
 
@@ -80,7 +73,6 @@ const BusinessesListingUI = (props) => {
80
73
 
81
74
  const [, t] = useLanguage()
82
75
  const [orderState, { changeCityFilter }] = useOrder()
83
- const [configState] = useConfig()
84
76
  const [{ auth }] = useSession()
85
77
  const [{ configs }] = useConfig()
86
78
  const windowSize = useWindowSize()
@@ -89,7 +81,6 @@ const BusinessesListingUI = (props) => {
89
81
  const [modals, setModals] = useState({ listOpen: false, formOpen: false, citiesOpen: false })
90
82
  const [alertState, setAlertState] = useState({ open: false, content: [] })
91
83
  const [activeMap, setActiveMap] = useState(false)
92
- const [openPopover, setOpenPopover] = useState({})
93
84
  const [mapErrors, setMapErrors] = useState('')
94
85
  const [isPreorder, setIsPreorder] = useState(false)
95
86
  const [preorderBusiness, setPreorderBusiness] = useState(null)
@@ -99,12 +90,13 @@ const BusinessesListingUI = (props) => {
99
90
  const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2) ?? true
100
91
  const hideSearch = theme?.business_listing_view?.components?.search?.hidden
101
92
  const hideFilter = theme?.business_listing_view?.components?.filter?.hidden || hideSearch
93
+ const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
94
+ const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
95
+ const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
102
96
  const hideSearchSection = hideCities && hideSearch && hideFilter
103
97
  const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
104
- const businessesIds = isCustomLayout &&
105
- businessesList.businesses &&
98
+ const businessesIds = businessesList.businesses &&
106
99
  businessesList.businesses?.map(business => business.id)
107
- const configTypes = configState?.configs?.order_types_allowed?.value.split('|').map(value => Number(value)) || []
108
100
  const isChew = orderingTheme?.theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
109
101
 
110
102
  const handleScroll = useCallback(() => {
@@ -128,28 +120,6 @@ const BusinessesListingUI = (props) => {
128
120
  }
129
121
  }
130
122
 
131
- const handleTogglePopover = (type) => {
132
- setOpenPopover({
133
- ...openPopover,
134
- [type]: !openPopover[type]
135
- })
136
- }
137
-
138
- const handleClosePopover = (type) => {
139
- setOpenPopover({
140
- ...openPopover,
141
- [type]: false
142
- })
143
- }
144
-
145
- const handleFindBusinesses = () => {
146
- if (!orderState?.options?.address?.location) {
147
- setAlertState({ open: true, content: [t('SELECT_AN_ADDRESS_TO_SEARCH', 'Select or add an address to search')] })
148
- return
149
- }
150
- setModals({ listOpen: false, formOpen: false })
151
- }
152
-
153
123
  const toggleMap = () => {
154
124
  setActiveMap(!activeMap)
155
125
  }
@@ -209,44 +179,6 @@ const BusinessesListingUI = (props) => {
209
179
  setFavoriteIds([...new Set(ids)])
210
180
  }, [businessesList?.businesses?.length])
211
181
 
212
- const OrdersSection = ({ titleContent }) => {
213
- return (
214
- <>
215
- {isCustomLayout && onRedirectPage && (
216
- <>
217
- <OrdersOption
218
- horizontal
219
- isBusinessesPage
220
- onRedirectPage={onRedirectPage}
221
- titleContent={t('CARTS', 'Carts')}
222
- businessesIds={businessesIds}
223
- customArray={
224
- getCustomArray(orderState.carts)?.filter(cart => cart.products.length > 0)
225
- }
226
- isCustomLayout
227
- isBusinessesLoading={businessesList.loading}
228
- isCustomerMode={isCustomerMode}
229
- franchiseId={props.franchiseId}
230
- />
231
- <OrdersOption
232
- horizontal
233
- asDashboard
234
- isBusinessesPage
235
- businessesIds={businessesIds}
236
- onRedirectPage={onRedirectPage}
237
- userCustomerId={userCustomer?.id}
238
- isCustomLayout
239
- titleContent={titleContent}
240
- isBusinessesLoading={businessesList.loading}
241
- isCustomerMode={isCustomerMode}
242
- franchiseId={props.franchiseId}
243
- />
244
- </>
245
- )}
246
- </>
247
- )
248
- }
249
-
250
182
  if (logosLayout) {
251
183
  return (
252
184
  <BusinessLogosWrapper>
@@ -275,293 +207,235 @@ const BusinessesListingUI = (props) => {
275
207
  }
276
208
 
277
209
  return (
278
- <>
279
- {props.beforeElements?.map((BeforeElement, i) => (
280
- <React.Fragment key={i}>
281
- {BeforeElement}
282
- </React.Fragment>))}
283
- {props.beforeComponents?.map((BeforeComponent, i) => (
284
- <BeforeComponent key={i} {...props} />))}
285
- <BusinessContainer>
286
- {(windowSize.width < 576 || (configs?.business_listing_hide_image?.value !== '1' && !isChew)) && (
287
- <BusinessBanner>
288
- {windowSize.width < 576 && (
289
- <BusinessFeatures>
290
- <AddressMenu
291
- onClick={() => handleClickAddress()}
292
- >
293
- <FaMapMarkerAlt />
294
- <span>{orderState.options?.address?.address || t('WHERE_DO_WE_DELIVERY', 'Where do we delivery?')}</span>
295
- </AddressMenu>
296
- <FeatureItems>
297
- <ItemInline>
298
- <OrderTypeSelectorHeader configTypes={configTypes} />
299
- </ItemInline>
300
- <ItemInline>
301
- <MomentPopover
302
- open={openPopover.moment}
303
- onClick={() => handleTogglePopover('moment')}
304
- onClose={() => handleClosePopover('moment')}
305
- isBanner
306
- />
307
- </ItemInline>
308
- </FeatureItems>
309
- </BusinessFeatures>
310
- )}
311
- {(configs?.business_listing_hide_image?.value !== '1' && !isChew) && (
312
- <BusinessHeroImg
313
- bgimage={theme.images?.general?.businessHero}
314
- height={theme?.business_listing_view?.components?.business_hero?.style?.height}
315
- />
316
- )}
317
- </BusinessBanner>
318
- )}
319
- {!!Object.values(orderState?.carts)?.length && (
320
- <OrderProgress
321
- isChew={isChew}
322
- franchiseId={props.franchiseId}
323
- userCustomerId={userCustomer?.id}
324
- asDashboard={isCustomerMode}
325
- isCustomerMode={isCustomerMode}
326
- />
327
- )}
328
- {(configs?.business_listing_hide_image?.value !== '1' && isChew) && (
329
- <BusinessHeroImg
330
- bgimage={theme.images?.general?.businessHero}
331
- height={theme?.business_listing_view?.components?.business_hero?.style?.height}
332
- />
333
- )}
334
- {isCustomerMode && (
335
- <OrdersSection titleContent={t('PREVIOUS_ORDERS', 'Previous orders')} />
336
- )}
337
- {!isCustomerMode && !hideSearchSection && (
338
- <>
339
- <WrapperSearch isCustomLayout={isCustomLayout} isCustomerMode={isCustomerMode}>
340
- {!hideSearch && windowSize.width <= 1200 && (
341
- <SearchBar
342
- lazyLoad
343
- search={searchValue}
344
- isCustomLayout={isCustomLayout}
345
- placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
346
- onSearch={handleChangeSearch}
347
- handleCustomEnter={() => onRedirectPage({ page: 'business_search' })}
348
- />
349
- )}
350
- {!hideCities && citiesState?.cities?.length > 0 && (
351
- <Button color='primary' onClick={handleOpenCities}>
352
- {citiesState?.cities?.find(city => city?.id === orderState?.options?.city_id)?.name || t('SELECT_A_CITY', 'Select a city')}
353
- </Button>
354
- )}
355
- {!hideFilter && configs?.advanced_business_search_enabled?.value === '1' && (
356
- <FiFilter onClick={() => onRedirectPage({ page: 'business_search' })} />
357
- )}
358
- {isCustomLayout && (
359
- <FiMap onClick={toggleMap} />
360
- )}
361
- </WrapperSearch>
362
- {activeMap && (
363
- <BusinessesMap
364
- businessList={businessesList.businesses}
365
- userLocation={orderState?.options?.address?.location}
366
- setErrors={setMapErrors}
367
- />
368
- )}
369
- </>
370
- )}
371
- {!isChew && hasHighRatedBusiness && !props.franchiseId && (
372
- <HightestRatedWrapper>
373
- <Divider />
374
- <HighestRated
375
- handleClickAddress={handleClickAddress}
376
- setHasHighRatedBusiness={setHasHighRatedBusiness}
377
- onBusinessClick={onBusinessClick}
378
- isCustomerMode={isCustomerMode}
379
- favoriteIds={favoriteIds}
380
- setFavoriteIds={setFavoriteIds}
210
+ <BusinessContainer>
211
+ {(windowSize.width < 576 || (configs?.business_listing_hide_image?.value !== '1' && !isChew)) && (
212
+ <BusinessBanner>
213
+ {windowSize.width < 576 && (
214
+ <OrderContextUI isBusinessList />
215
+ )}
216
+ {(configs?.business_listing_hide_image?.value !== '1' && !isChew) && !hideHero && (
217
+ <BusinessHeroImg
218
+ bgimage={theme.images?.general?.businessHero}
219
+ height={theme?.business_listing_view?.components?.business_hero?.style?.height}
381
220
  />
382
- <Divider />
383
- </HightestRatedWrapper>
384
- )}
385
-
386
- <PageBanner position='web_business_listing' />
387
-
388
- {(((configs && configs?.business_listing_categories !== false) || !isCustomLayout) && !isAllCategoriesHidden) && (
389
- <BusinessTypeFilter
390
- images={props.images}
391
- businessTypes={props.businessTypes}
392
- defaultBusinessType={props.defaultBusinessType}
393
- handleChangeBusinessType={handleChangeBusinessType}
394
- />
395
- )}
396
- {isCustomerMode && (
397
- <SearchContainer>
398
- {isCustomLayout && (
399
- <BusinessesTitle isCustomerMode={isCustomerMode}>
400
- {t('BUSINESSES', 'Businesses')}
401
- </BusinessesTitle>
402
- )}
403
- <WrapperSearch isCustomLayout={isCustomLayout} isCustomerMode={isCustomerMode}>
221
+ )}
222
+ </BusinessBanner>
223
+ )}
224
+ {!!Object.values(orderState?.carts)?.length && (
225
+ <OrderProgress
226
+ isChew={isChew}
227
+ franchiseId={props.franchiseId}
228
+ userCustomerId={userCustomer?.id}
229
+ asDashboard={isCustomerMode}
230
+ isCustomerMode={isCustomerMode}
231
+ />
232
+ )}
233
+ {(configs?.business_listing_hide_image?.value !== '1' && isChew) && (
234
+ <BusinessHeroImg
235
+ bgimage={theme.images?.general?.businessHero}
236
+ height={theme?.business_listing_view?.components?.business_hero?.style?.height}
237
+ />
238
+ )}
239
+ {isCustomerMode && !hidePreviousOrders && !businessesList.loading && (
240
+ <OrdersSection
241
+ titleContent={t('PREVIOUS_ORDERS', 'Previous orders')}
242
+ onRedirectPage={onRedirectPage}
243
+ businessesIds={businessesIds}
244
+ getCustomArray={getCustomArray}
245
+ businessesList={businessesList}
246
+ isCustomerMode={isCustomerMode}
247
+ userCustomer={userCustomer}
248
+ />
249
+ )}
250
+ {!isCustomerMode && !hideSearchSection && (
251
+ <>
252
+ <WrapperSearch isCustomLayout={isCustomLayout} isCustomerMode={isCustomerMode}>
253
+ {!hideSearch && windowSize.width <= 1200 && (
404
254
  <SearchBar
405
255
  lazyLoad
406
256
  search={searchValue}
407
257
  isCustomLayout={isCustomLayout}
408
258
  placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
409
259
  onSearch={handleChangeSearch}
260
+ handleCustomEnter={() => onRedirectPage({ page: 'business_search' })}
410
261
  />
411
- {configs?.advanced_business_search_enabled?.value === '1' && (
412
- <FiFilter onClick={() => onRedirectPage({ page: 'business_search' })} />
413
- )}
414
- {isCustomLayout && (
415
- <FiMap onClick={toggleMap} />
416
- )}
417
- </WrapperSearch>
418
- </SearchContainer>
419
- )}
420
- {isCustomerMode && activeMap && (
421
- <BusinessesMap
422
- businessList={businessesList.businesses}
423
- userLocation={orderState?.options?.address?.location}
424
- setErrors={setMapErrors}
262
+ )}
263
+ {!hideCities && citiesState?.cities?.length > 0 && (
264
+ <Button color='primary' onClick={handleOpenCities}>
265
+ {citiesState?.cities?.find(city => city?.id === orderState?.options?.city_id)?.name || t('SELECT_A_CITY', 'Select a city')}
266
+ </Button>
267
+ )}
268
+ {!hideFilter && configs?.advanced_business_search_enabled?.value === '1' && (
269
+ <FiFilter onClick={() => onRedirectPage({ page: 'business_search' })} />
270
+ )}
271
+ {isCustomLayout && (
272
+ <FiMap onClick={toggleMap} />
273
+ )}
274
+ </WrapperSearch>
275
+ {activeMap && (
276
+ <BusinessesMap
277
+ businessList={businessesList.businesses}
278
+ userLocation={orderState?.options?.address?.location}
279
+ setErrors={setMapErrors}
280
+ />
281
+ )}
282
+ </>
283
+ )}
284
+ {!isChew && hasHighRatedBusiness && !props.franchiseId && !hideHighestBusiness && (
285
+ <HightestRatedWrapper>
286
+ <Divider />
287
+ <HighestRated
288
+ handleClickAddress={handleClickAddress}
289
+ setHasHighRatedBusiness={setHasHighRatedBusiness}
290
+ onBusinessClick={onBusinessClick}
291
+ isCustomerMode={isCustomerMode}
292
+ favoriteIds={favoriteIds}
293
+ setFavoriteIds={setFavoriteIds}
294
+ disabledCities
425
295
  />
426
- )}
427
- {!isCustomerMode && (
428
- <OrdersSection />
429
- )}
430
- <>
431
- {((!isCustomLayout && isCustomerMode && businessesList?.businesses?.length > 0) || isChew) && (
432
- <BusinessesTitle>
296
+ <Divider />
297
+ </HightestRatedWrapper>
298
+ )}
299
+
300
+ <PageBanner position='web_business_listing' />
301
+
302
+ {(((configs && configs?.business_listing_categories !== false) || !isCustomLayout) && !isAllCategoriesHidden) && (
303
+ <BusinessTypeFilter
304
+ images={props.images}
305
+ businessTypes={props.businessTypes}
306
+ defaultBusinessType={props.defaultBusinessType}
307
+ handleChangeBusinessType={handleChangeBusinessType}
308
+ />
309
+ )}
310
+ {isCustomerMode && (
311
+ <SearchContainer>
312
+ {isCustomLayout && (
313
+ <BusinessesTitle isCustomerMode={isCustomerMode}>
433
314
  {t('BUSINESSES', 'Businesses')}
434
315
  </BusinessesTitle>
435
316
  )}
436
-
437
- <BusinessList>
438
- {
439
- !businessesList.loading && businessesList.businesses.length === 0 && (
440
- <NotFoundSource
441
- content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
442
- >
443
- <Button
444
- outline
445
- color='primary'
446
- onClick={() => handleClickAddress()}
447
- style={{ height: '44px' }}
448
- >
449
- {t('CHANGE_ADDRESS', 'Select other Address')}
450
- </Button>
451
- </NotFoundSource>
452
- )
453
- }
454
- {
455
- businessesList.businesses?.map((business) => (
456
- <BusinessController
457
- key={business.id}
458
- className='card'
459
- business={business}
460
- isBusinessOpen={business.open}
461
- handleCustomClick={handleBusinessClick}
462
- orderType={orderState?.options?.type}
463
- isCustomLayout={isCustomLayout}
464
- isCustomerMode={isCustomerMode}
465
- onPreorderBusiness={setPreorderBusiness}
466
- businessHeader={business?.header}
467
- businessFeatured={business?.featured}
468
- businessOffers={business?.offers}
469
- businessLogo={business?.logo}
470
- businessReviews={business?.reviews?.total}
471
- businessDeliveryPrice={business?.delivery_price}
472
- businessDeliveryTime={business?.delivery_time}
473
- businessPickupTime={business?.pickup_time}
474
- businessDistance={business?.distance}
475
- handleUpdateBusinessList={handleUpdateBusinessList}
476
- favoriteIds={favoriteIds}
477
- setFavoriteIds={setFavoriteIds}
478
- />
479
- ))
480
- }
481
- {businessesList.loading && (
482
- [...Array(paginationProps?.nextPageItems > 4 ? paginationProps.nextPageItems : 8).keys()].map(i => (
483
- <BusinessController
484
- key={i}
485
- className='card'
486
- business={{}}
487
- isSkeleton
488
- orderType={orderState?.options?.type}
489
- />
490
- ))
317
+ <WrapperSearch isCustomLayout={isCustomLayout} isCustomerMode={isCustomerMode}>
318
+ <SearchBar
319
+ lazyLoad
320
+ search={searchValue}
321
+ isCustomLayout={isCustomLayout}
322
+ placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
323
+ onSearch={handleChangeSearch}
324
+ />
325
+ {configs?.advanced_business_search_enabled?.value === '1' && (
326
+ <FiFilter onClick={() => onRedirectPage({ page: 'business_search' })} />
491
327
  )}
492
- </BusinessList>
493
- </>
494
- <Modal
495
- open={isPreorder}
496
- width='760px'
497
- onClose={() => handleClosePreorder()}
498
- >
499
- <BusinessPreorder
500
- business={preorderBusiness}
501
- handleClick={handleBusinessClick}
502
- showButton
503
- />
504
- </Modal>
505
-
506
- <Modal
507
- title={t('ADDRESS_FORM', 'Address Form')}
508
- open={modals.formOpen}
509
- onClose={() => setModals({ ...modals, formOpen: false })}
510
- >
511
- <AddressForm
512
- useValidationFileds
513
- address={orderState?.options?.address || {}}
514
- onClose={() => setModals({ ...modals, formOpen: false })}
515
- onCancel={() => setModals({ ...modals, formOpen: false })}
516
- onSaveAddress={() => setModals({ ...modals, formOpen: false })}
517
- />
518
- </Modal>
328
+ {isCustomLayout && (
329
+ <FiMap onClick={toggleMap} />
330
+ )}
331
+ </WrapperSearch>
332
+ </SearchContainer>
333
+ )}
334
+ {isCustomerMode && activeMap && (
335
+ <BusinessesMap
336
+ businessList={businessesList.businesses}
337
+ userLocation={orderState?.options?.address?.location}
338
+ setErrors={setMapErrors}
339
+ />
340
+ )}
341
+ <>
342
+ {((!isCustomLayout && isCustomerMode && businessesList?.businesses?.length > 0) || isChew) && (
343
+ <BusinessesTitle>
344
+ {t('BUSINESSES', 'Businesses')}
345
+ </BusinessesTitle>
346
+ )}
519
347
 
520
- <Modal
521
- title={t('ADDRESSES', 'Address List')}
522
- open={modals.listOpen}
523
- width='70%'
524
- onClose={() => setModals({ ...modals, listOpen: false })}
525
- >
526
- <AddressList
527
- isModal
528
- changeOrderAddressWithDefault
529
- userId={isNaN(userCustomer?.id) ? null : userCustomer?.id}
530
- onCancel={() => setModals({ ...modals, listOpen: false })}
531
- onAccept={() => handleFindBusinesses()}
532
- isCustomerMode={isCustomerMode}
533
- />
534
- </Modal>
535
- <Modal
536
- title={t('SELECT_A_STORE', 'Select a store')}
537
- open={modals.citiesOpen}
538
- width='70%'
348
+ <BusinessList>
349
+ {
350
+ !businessesList.loading && businessesList.businesses.length === 0 && businessesList?.fetched && (
351
+ <NotFoundSource
352
+ content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
353
+ >
354
+ <Button
355
+ outline
356
+ color='primary'
357
+ onClick={() => handleClickAddress()}
358
+ style={{ height: '44px' }}
359
+ >
360
+ {t('CHANGE_ADDRESS', 'Select other Address')}
361
+ </Button>
362
+ </NotFoundSource>
363
+ )
364
+ }
365
+ {
366
+ businessesList.businesses?.map((business) => (
367
+ <BusinessController
368
+ key={business.id}
369
+ className='card'
370
+ business={business}
371
+ isBusinessOpen={business.open}
372
+ handleCustomClick={handleBusinessClick}
373
+ orderType={orderState?.options?.type}
374
+ isCustomLayout={isCustomLayout}
375
+ isCustomerMode={isCustomerMode}
376
+ onPreorderBusiness={setPreorderBusiness}
377
+ businessHeader={business?.header}
378
+ businessFeatured={business?.featured}
379
+ businessOffers={business?.offers}
380
+ businessLogo={business?.logo}
381
+ businessReviews={business?.reviews?.total}
382
+ businessDeliveryPrice={business?.delivery_price}
383
+ businessDeliveryTime={business?.delivery_time}
384
+ businessPickupTime={business?.pickup_time}
385
+ businessDistance={business?.distance}
386
+ handleUpdateBusinessList={handleUpdateBusinessList}
387
+ favoriteIds={favoriteIds}
388
+ setFavoriteIds={setFavoriteIds}
389
+ />
390
+ ))
391
+ }
392
+ {(businessesList.loading || !businessesList?.fetched) && (
393
+ [...Array(paginationProps?.nextPageItems > 4 ? paginationProps.nextPageItems : 8).keys()].map(i => (
394
+ <BusinessController
395
+ key={i}
396
+ className='card'
397
+ business={{}}
398
+ isSkeleton
399
+ orderType={orderState?.options?.type}
400
+ />
401
+ ))
402
+ )}
403
+ </BusinessList>
404
+ </>
405
+ <Modal
406
+ open={isPreorder}
407
+ width='760px'
408
+ onClose={() => handleClosePreorder()}
409
+ >
410
+ <BusinessPreorder
411
+ business={preorderBusiness}
412
+ handleClick={handleBusinessClick}
413
+ showButton
414
+ />
415
+ </Modal>
416
+ <Modal
417
+ title={t('SELECT_A_STORE', 'Select a store')}
418
+ open={modals.citiesOpen}
419
+ width='70%'
420
+ onClose={() => setModals({ ...modals, citiesOpen: false })}
421
+ >
422
+ <CitiesControl
423
+ cities={citiesState?.cities}
424
+ handleChangeCity={handleChangeCity}
539
425
  onClose={() => setModals({ ...modals, citiesOpen: false })}
540
- >
541
- <CitiesControl
542
- cities={citiesState?.cities}
543
- handleChangeCity={handleChangeCity}
544
- onClose={() => setModals({ ...modals, citiesOpen: false })}
545
- />
546
- </Modal>
547
-
548
- <Alert
549
- title={!mapErrors ? t('SEARCH', 'Search') : t('BUSINESSES_MAP', 'Businesses Map')}
550
- content={alertState.content}
551
- acceptText={t('ACCEPT', 'Accept')}
552
- open={alertState.open}
553
- onClose={() => handleCloseAlerts()}
554
- onAccept={() => handleCloseAlerts()}
555
- closeOnBackdrop={false}
556
426
  />
557
- </BusinessContainer>
558
- {props.afterComponents?.map((AfterComponent, i) => (
559
- <AfterComponent key={i} {...props} />))}
560
- {props.afterElements?.map((AfterElement, i) => (
561
- <React.Fragment key={i}>
562
- {AfterElement}
563
- </React.Fragment>))}
564
- </>
427
+ </Modal>
428
+
429
+ <Alert
430
+ title={!mapErrors ? t('SEARCH', 'Search') : t('BUSINESSES_MAP', 'Businesses Map')}
431
+ content={alertState.content}
432
+ acceptText={t('ACCEPT', 'Accept')}
433
+ open={alertState.open}
434
+ onClose={() => handleCloseAlerts()}
435
+ onAccept={() => handleCloseAlerts()}
436
+ closeOnBackdrop={false}
437
+ />
438
+ </BusinessContainer>
565
439
  )
566
440
  }
567
441